Use universal themese scaled according to DPI_MUL
* Resolution-specific themes are still supported
This commit is contained in:
@@ -17,6 +17,8 @@ LOCAL_SRC_FILES:= \
|
||||
pong.c \
|
||||
progressdots.c \
|
||||
multirom_ui_themes.c \
|
||||
themes/multirom_ui_landscape.c \
|
||||
themes/multirom_ui_portrait.c \
|
||||
fstab.c
|
||||
|
||||
ifeq ($(ARCH_ARM_HAVE_NEON),true)
|
||||
@@ -52,14 +54,17 @@ LOCAL_SRC_FILES += input_$(MR_INPUT_TYPE).c
|
||||
|
||||
ifeq ($(DEVICE_RESOLUTION),)
|
||||
$(info DEVICE_RESOLUTION was not specified)
|
||||
else ifneq ($(wildcard $(multirom_local_path)/themes/multirom_ui_$(DEVICE_RESOLUTION).c),)
|
||||
LOCAL_SRC_FILES += themes/multirom_ui_$(DEVICE_RESOLUTION).c
|
||||
LOCAL_CFLAGS += -DMULTIROM_THEME_$(DEVICE_RESOLUTION)
|
||||
endif
|
||||
LOCAL_SRC_FILES += themes/multirom_ui_$(DEVICE_RESOLUTION).c
|
||||
LOCAL_CFLAGS += -DMULTIROM_THEME_$(DEVICE_RESOLUTION)
|
||||
|
||||
ifneq ($(LANDSCAPE_RESOLUTION),)
|
||||
ifneq ($(wildcard $(multirom_local_path)/themes/multirom_ui_$(LANDSCAPE_RESOLUTION).c),)
|
||||
LOCAL_SRC_FILES += themes/multirom_ui_$(LANDSCAPE_RESOLUTION).c
|
||||
LOCAL_CFLAGS += -DMULTIROM_THEME_$(LANDSCAPE_RESOLUTION)
|
||||
endif
|
||||
endif
|
||||
ifneq ($(TW_DEFAULT_ROTATION),)
|
||||
MULTIROM_DEFAULT_ROTATION := $(TW_DEFAULT_ROTATION)
|
||||
endif
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "multirom.h"
|
||||
#include "util.h"
|
||||
#include "log.h"
|
||||
|
||||
multirom_themes_info *multirom_ui_init_themes(void)
|
||||
{
|
||||
@@ -31,18 +32,9 @@ multirom_themes_info *multirom_ui_init_themes(void)
|
||||
extern struct multirom_theme theme_info_ ## RES; \
|
||||
list_add(&theme_info_ ## RES, &i->themes);
|
||||
|
||||
#ifdef MULTIROM_THEME_800x1280
|
||||
ADD_THEME(800x1280);
|
||||
#endif
|
||||
#ifdef MULTIROM_THEME_1280x800
|
||||
ADD_THEME(1280x800);
|
||||
#endif
|
||||
#ifdef MULTIROM_THEME_1200x1920
|
||||
ADD_THEME(1200x1920);
|
||||
#endif
|
||||
#ifdef MULTIROM_THEME_1920x1200
|
||||
ADD_THEME(1920x1200);
|
||||
#endif
|
||||
// universal themes which scale according to DPI_MUL
|
||||
ADD_THEME(landscape);
|
||||
ADD_THEME(portrait);
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -58,10 +50,21 @@ multirom_theme *multirom_ui_select_theme(multirom_themes_info *i, int w, int h)
|
||||
if(i->themes == NULL)
|
||||
return NULL;
|
||||
|
||||
multirom_theme *universal = NULL;
|
||||
const int uni_type = (w > h) ? TH_LANDSCAPE : TH_PORTRAIT;
|
||||
|
||||
multirom_theme **itr;
|
||||
for(itr = i->themes; *itr; ++itr)
|
||||
{
|
||||
if((*itr)->width == w && (*itr)->height == h)
|
||||
return *itr;
|
||||
|
||||
return NULL;
|
||||
if((*itr)->width == uni_type)
|
||||
universal = *itr;
|
||||
}
|
||||
|
||||
if(universal)
|
||||
INFO("Using universal theme (%d)\n", uni_type);
|
||||
|
||||
return universal;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
#include "progressdots.h"
|
||||
#include "listview.h"
|
||||
|
||||
// universal themes has these as width and height,
|
||||
// instead of real resolution
|
||||
#define TH_PORTRAIT (-1)
|
||||
#define TH_LANDSCAPE (-2)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
listview *list;
|
||||
@@ -52,8 +57,8 @@ typedef struct
|
||||
|
||||
struct multirom_theme
|
||||
{
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
int16_t width;
|
||||
int16_t height;
|
||||
|
||||
void (*destroy)(multirom_theme_data *t);
|
||||
void (*init_header)(multirom_theme_data *t);
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
/*
|
||||
* This file is part of MultiROM.
|
||||
*
|
||||
* MultiROM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MultiROM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "multirom.h"
|
||||
#include "framebuffer.h"
|
||||
#include "util.h"
|
||||
#include "button.h"
|
||||
#include "version.h"
|
||||
|
||||
#define HEADER_WIDTH 300
|
||||
#define TAB_BTN_HEIGHT 75
|
||||
|
||||
#define ROMS_FOOTER_H 90
|
||||
#define ROMS_HEADER_H 60
|
||||
|
||||
#define BOOTBTN_W 300
|
||||
#define BOOTBTN_H 80
|
||||
|
||||
#define REFRESHBTN_W 400
|
||||
#define REFRESHBTN_H 60
|
||||
|
||||
#define MISCBTN_W 530
|
||||
#define MISCBTN_H 100
|
||||
|
||||
#define CLRBTN_W 50
|
||||
#define CLRBTN_B 10
|
||||
#define CLRBTN_TOTAL (CLRBTN_W+CLRBTN_B)
|
||||
#define CLRBTN_Y 700
|
||||
|
||||
static void destroy(multirom_theme_data *t)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void init_header(multirom_theme_data *t)
|
||||
{
|
||||
button **tab_btns = t->tab_btns;
|
||||
fb_text **tab_texts = t->tab_texts;
|
||||
|
||||
int i, text_x, text_y;
|
||||
int y = TAB_BTN_HEIGHT;
|
||||
|
||||
static const char *str[] = { "Internal", "USB", "Misc", "MultiROM" };
|
||||
|
||||
text_x = center_x(0, HEADER_WIDTH, SIZE_EXTRA, str[3]);
|
||||
fb_add_text(text_x, 5, WHITE, SIZE_EXTRA, str[3]);
|
||||
|
||||
for(i = 0; i < TAB_COUNT; ++i)
|
||||
{
|
||||
text_x = center_x(0, HEADER_WIDTH, SIZE_NORMAL, str[i]);
|
||||
text_y = center_y(y, TAB_BTN_HEIGHT, SIZE_NORMAL);
|
||||
tab_texts[i] = fb_add_text(text_x, text_y, WHITE, SIZE_NORMAL, str[i]);
|
||||
|
||||
fb_add_rect(0, y, HEADER_WIDTH, 2, WHITE);
|
||||
|
||||
tab_btns[i] = malloc(sizeof(button));
|
||||
memset(tab_btns[i], 0, sizeof(button));
|
||||
tab_btns[i]->y = y;
|
||||
tab_btns[i]->w = HEADER_WIDTH;
|
||||
tab_btns[i]->h = TAB_BTN_HEIGHT;
|
||||
tab_btns[i]->action = i;
|
||||
tab_btns[i]->clicked = &multirom_ui_switch;
|
||||
button_init_ui(tab_btns[i], NULL, 0);
|
||||
|
||||
y += TAB_BTN_HEIGHT;
|
||||
}
|
||||
fb_add_rect(0, y, HEADER_WIDTH, 2, WHITE);
|
||||
|
||||
fb_add_rect(HEADER_WIDTH-2, 0, 2, fb_height, WHITE);
|
||||
}
|
||||
|
||||
static void header_select(multirom_theme_data *t, int tab)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < TAB_COUNT; ++i)
|
||||
t->tab_texts[i]->color = (i == tab) ? BLACK : WHITE;
|
||||
|
||||
if(!t->selected_tab_rect)
|
||||
t->selected_tab_rect = fb_add_rect(0, 0, HEADER_WIDTH, TAB_BTN_HEIGHT, WHITE);
|
||||
|
||||
t->selected_tab_rect->head.y = TAB_BTN_HEIGHT + (TAB_BTN_HEIGHT * tab);
|
||||
}
|
||||
|
||||
static void tab_rom_init(multirom_theme_data *t, tab_data_roms *d, int tab_type)
|
||||
{
|
||||
int base_y = fb_height-ROMS_FOOTER_H;
|
||||
|
||||
d->rom_name = fb_add_text(HEADER_WIDTH, center_y(base_y, ROMS_FOOTER_H, SIZE_NORMAL),
|
||||
WHITE, SIZE_NORMAL, "");
|
||||
|
||||
d->list->x = HEADER_WIDTH;
|
||||
d->list->y = ROMS_HEADER_H;
|
||||
d->list->w = fb_width-HEADER_WIDTH;
|
||||
d->list->h = fb_height - d->list->y - ROMS_FOOTER_H-20;
|
||||
|
||||
// header
|
||||
int y = center_y(0, ROMS_HEADER_H, SIZE_BIG);
|
||||
d->title_text = fb_add_text(HEADER_WIDTH, y, CLR_PRIMARY, SIZE_BIG, "");
|
||||
list_add(d->title_text, &d->ui_elements);
|
||||
|
||||
// footer
|
||||
fb_rect *sep = fb_add_rect(HEADER_WIDTH+2, fb_height-ROMS_FOOTER_H, fb_width-HEADER_WIDTH-2, 2, CLR_PRIMARY);
|
||||
list_add(sep, &d->ui_elements);
|
||||
|
||||
// boot btn
|
||||
d->boot_btn->x = fb_width - BOOTBTN_W - 5;
|
||||
d->boot_btn->y = base_y + (ROMS_FOOTER_H-BOOTBTN_H)/2;
|
||||
d->boot_btn->w = BOOTBTN_W;
|
||||
d->boot_btn->h = BOOTBTN_H;
|
||||
}
|
||||
|
||||
static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_scheme)
|
||||
{
|
||||
int x = HEADER_WIDTH + ((fb_width - HEADER_WIDTH)/2 - MISCBTN_W/2);
|
||||
int y = 10;
|
||||
|
||||
button *b = mzalloc(sizeof(button));
|
||||
b->x = x;
|
||||
b->y = y;
|
||||
b->w = MISCBTN_W;
|
||||
b->h = MISCBTN_H;
|
||||
b->clicked = &multirom_ui_tab_misc_copy_log;
|
||||
button_init_ui(b, "Copy log to /sdcard", SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+50;
|
||||
|
||||
static const char *texts[] =
|
||||
{
|
||||
"Reboot", // 0
|
||||
"Reboot to recovery", // 1
|
||||
"Reboot to bootloader", // 2
|
||||
"Shutdown", // 3
|
||||
NULL
|
||||
};
|
||||
|
||||
static const int exit_codes[] = {
|
||||
UI_EXIT_REBOOT, UI_EXIT_REBOOT_RECOVERY,
|
||||
UI_EXIT_REBOOT_BOOTLOADER, UI_EXIT_SHUTDOWN
|
||||
};
|
||||
|
||||
int i;
|
||||
for(i = 0; texts[i]; ++i)
|
||||
{
|
||||
b = mzalloc(sizeof(button));
|
||||
b->x = x;
|
||||
b->y = y;
|
||||
b->w = MISCBTN_W;
|
||||
b->h = MISCBTN_H;
|
||||
b->action = exit_codes[i];
|
||||
b->clicked = &multirom_ui_reboot_btn;
|
||||
button_init_ui(b, texts[i], SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+20;
|
||||
if(i == 2)
|
||||
y += 30;
|
||||
}
|
||||
|
||||
fb_text *text = fb_add_text(HEADER_WIDTH+5, fb_height-16, WHITE, SIZE_SMALL, "MultiROM v%d"VERSION_DEV_FIX" with trampoline v%d.",
|
||||
VERSION_MULTIROM, multirom_get_trampoline_ver());
|
||||
list_add(text, &d->ui_elements);
|
||||
|
||||
char bat_text[16];
|
||||
sprintf(bat_text, "Battery: %d%%", multirom_get_battery());
|
||||
text = fb_add_text_long(fb_width-strlen(bat_text)*8, fb_height-16, WHITE, SIZE_SMALL, bat_text);
|
||||
list_add(text, &d->ui_elements);
|
||||
|
||||
x = HEADER_WIDTH + ((fb_width - HEADER_WIDTH)/2 - (CLRS_MAX*CLRBTN_TOTAL)/2);
|
||||
uint32_t p, s;
|
||||
fb_rect *r;
|
||||
for(i = 0; i < CLRS_MAX; ++i)
|
||||
{
|
||||
multirom_ui_setup_colors(i, &p, &s);
|
||||
|
||||
if(i == color_scheme)
|
||||
{
|
||||
r = fb_add_rect(x, CLRBTN_Y, CLRBTN_TOTAL, CLRBTN_TOTAL, WHITE);
|
||||
list_add(r, &d->ui_elements);
|
||||
}
|
||||
|
||||
r = fb_add_rect(x+CLRBTN_B/2, CLRBTN_Y+CLRBTN_B/2, CLRBTN_W, CLRBTN_W, p);
|
||||
list_add(r, &d->ui_elements);
|
||||
|
||||
b = mzalloc(sizeof(button));
|
||||
b->x = x;
|
||||
b->y = CLRBTN_Y;
|
||||
b->w = CLRBTN_TOTAL;
|
||||
b->h = CLRBTN_TOTAL;
|
||||
b->action = i;
|
||||
b->clicked = &multirom_ui_tab_misc_change_clr;
|
||||
button_init_ui(b, NULL, 0);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
x += CLRBTN_TOTAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int get_tab_width(multirom_theme_data *t)
|
||||
{
|
||||
return fb_width - HEADER_WIDTH;
|
||||
}
|
||||
|
||||
static int get_tab_height(multirom_theme_data *t)
|
||||
{
|
||||
return fb_height;
|
||||
}
|
||||
|
||||
static void center_rom_name(tab_data_roms *d, const char *name)
|
||||
{
|
||||
d->rom_name->head.x = center_x(HEADER_WIDTH, fb_width-BOOTBTN_W-HEADER_WIDTH-20, SIZE_NORMAL, name);
|
||||
}
|
||||
|
||||
const struct multirom_theme theme_info_1280x800 = {
|
||||
.width = 1280,
|
||||
.height = 800,
|
||||
|
||||
.destroy = &destroy,
|
||||
.init_header = &init_header,
|
||||
.header_select = &header_select,
|
||||
.tab_rom_init = &tab_rom_init,
|
||||
.tab_misc_init = &tab_misc_init,
|
||||
.get_tab_width = &get_tab_width,
|
||||
.get_tab_height = &get_tab_height,
|
||||
.center_rom_name = ¢er_rom_name
|
||||
};
|
||||
@@ -1,249 +0,0 @@
|
||||
/*
|
||||
* This file is part of MultiROM.
|
||||
*
|
||||
* MultiROM is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* MultiROM is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with MultiROM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "multirom_ui.h"
|
||||
#include "multirom_ui_themes.h"
|
||||
#include "multirom.h"
|
||||
#include "framebuffer.h"
|
||||
#include "util.h"
|
||||
#include "button.h"
|
||||
#include "version.h"
|
||||
|
||||
#define HEADER_HEIGHT 75
|
||||
#define TAB_BTN_WIDTH 165
|
||||
|
||||
#define ROMS_FOOTER_H 130
|
||||
#define ROMS_HEADER_H 90
|
||||
|
||||
#define BOOTBTN_W 300
|
||||
#define BOOTBTN_H 80
|
||||
|
||||
#define REFRESHBTN_W 400
|
||||
#define REFRESHBTN_H 60
|
||||
|
||||
#define MISCBTN_W 530
|
||||
#define MISCBTN_H 100
|
||||
|
||||
#define CLRBTN_W 50
|
||||
#define CLRBTN_B 10
|
||||
#define CLRBTN_TOTAL (CLRBTN_W+CLRBTN_B)
|
||||
#define CLRBTN_Y 1150
|
||||
|
||||
static button *pong_btn = NULL;
|
||||
|
||||
static void destroy(multirom_theme_data *t)
|
||||
{
|
||||
button_destroy(pong_btn);
|
||||
pong_btn = NULL;
|
||||
}
|
||||
|
||||
static void init_header(multirom_theme_data *t)
|
||||
{
|
||||
button **tab_btns = t->tab_btns;
|
||||
fb_text **tab_texts = t->tab_texts;
|
||||
|
||||
int i, text_x, text_y;
|
||||
int x = fb_width - (TAB_BTN_WIDTH*TAB_COUNT);
|
||||
|
||||
static const char *str[] = { "Internal", "USB", "Misc", "MultiROM" };
|
||||
|
||||
text_x = center_x(0, x, SIZE_EXTRA, str[3]);
|
||||
fb_add_text(text_x, 5, WHITE, SIZE_EXTRA, str[3]);
|
||||
|
||||
pong_btn = mzalloc(sizeof(button));
|
||||
pong_btn->w = x;
|
||||
pong_btn->h = HEADER_HEIGHT;
|
||||
pong_btn->clicked = &multirom_ui_start_pong;
|
||||
button_init_ui(pong_btn, NULL, 0);
|
||||
|
||||
for(i = 0; i < TAB_COUNT; ++i)
|
||||
{
|
||||
text_x = center_x(x, TAB_BTN_WIDTH, SIZE_NORMAL, str[i]);
|
||||
text_y = center_y(0, HEADER_HEIGHT, SIZE_NORMAL);
|
||||
tab_texts[i] = fb_add_text(text_x, text_y, WHITE, SIZE_NORMAL, str[i]);
|
||||
|
||||
fb_add_rect(x, 0, 2, HEADER_HEIGHT, WHITE);
|
||||
|
||||
tab_btns[i] = malloc(sizeof(button));
|
||||
memset(tab_btns[i], 0, sizeof(button));
|
||||
tab_btns[i]->x = x;
|
||||
tab_btns[i]->w = TAB_BTN_WIDTH;
|
||||
tab_btns[i]->h = HEADER_HEIGHT;
|
||||
tab_btns[i]->action = i;
|
||||
tab_btns[i]->clicked = &multirom_ui_switch;
|
||||
button_init_ui(tab_btns[i], NULL, 0);
|
||||
|
||||
x += TAB_BTN_WIDTH;
|
||||
}
|
||||
|
||||
fb_add_rect(0, HEADER_HEIGHT, fb_width, 2, WHITE);
|
||||
}
|
||||
|
||||
static void header_select(multirom_theme_data *t, int tab)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < TAB_COUNT; ++i)
|
||||
t->tab_texts[i]->color = (i == tab) ? BLACK : WHITE;
|
||||
|
||||
if(!t->selected_tab_rect)
|
||||
t->selected_tab_rect = fb_add_rect(0, 0, TAB_BTN_WIDTH, HEADER_HEIGHT, WHITE);
|
||||
|
||||
t->selected_tab_rect->head.x = fb_width - (TAB_BTN_WIDTH * (TAB_COUNT - tab));
|
||||
}
|
||||
|
||||
static void tab_rom_init(multirom_theme_data *t, tab_data_roms *d, int tab_type)
|
||||
{
|
||||
int base_y = fb_height-ROMS_FOOTER_H;
|
||||
|
||||
d->rom_name = fb_add_text(0, center_y(base_y, ROMS_FOOTER_H, SIZE_NORMAL),
|
||||
WHITE, SIZE_NORMAL, "");
|
||||
|
||||
d->list->y = HEADER_HEIGHT+ROMS_HEADER_H;
|
||||
d->list->w = fb_width;
|
||||
d->list->h = fb_height - d->list->y - ROMS_FOOTER_H-20;
|
||||
|
||||
// header
|
||||
int y = center_y(HEADER_HEIGHT, ROMS_HEADER_H, SIZE_BIG);
|
||||
d->title_text = fb_add_text(0, y, CLR_PRIMARY, SIZE_BIG, "");
|
||||
list_add(d->title_text, &d->ui_elements);
|
||||
|
||||
// footer
|
||||
fb_rect *sep = fb_add_rect(0, fb_height-ROMS_FOOTER_H, fb_width, 2, CLR_PRIMARY);
|
||||
list_add(sep, &d->ui_elements);
|
||||
|
||||
// boot btn
|
||||
d->boot_btn->x = fb_width - BOOTBTN_W - 20;
|
||||
d->boot_btn->y = base_y + (ROMS_FOOTER_H-BOOTBTN_H)/2;
|
||||
d->boot_btn->w = BOOTBTN_W;
|
||||
d->boot_btn->h = BOOTBTN_H;
|
||||
}
|
||||
|
||||
static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_scheme)
|
||||
{
|
||||
int x = fb_width/2 - MISCBTN_W/2;
|
||||
int y = 270;
|
||||
|
||||
button *b = mzalloc(sizeof(button));
|
||||
b->x = x;
|
||||
b->y = y;
|
||||
b->w = MISCBTN_W;
|
||||
b->h = MISCBTN_H;
|
||||
b->clicked = &multirom_ui_tab_misc_copy_log;
|
||||
button_init_ui(b, "Copy log to /sdcard", SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+70;
|
||||
|
||||
static const char *texts[] =
|
||||
{
|
||||
"Reboot", // 0
|
||||
"Reboot to recovery", // 1
|
||||
"Reboot to bootloader", // 2
|
||||
"Shutdown", // 3
|
||||
NULL
|
||||
};
|
||||
|
||||
static const int exit_codes[] = {
|
||||
UI_EXIT_REBOOT, UI_EXIT_REBOOT_RECOVERY,
|
||||
UI_EXIT_REBOOT_BOOTLOADER, UI_EXIT_SHUTDOWN
|
||||
};
|
||||
|
||||
int i;
|
||||
for(i = 0; texts[i]; ++i)
|
||||
{
|
||||
b = mzalloc(sizeof(button));
|
||||
b->x = x;
|
||||
b->y = y;
|
||||
b->w = MISCBTN_W;
|
||||
b->h = MISCBTN_H;
|
||||
b->action = exit_codes[i];
|
||||
b->clicked = &multirom_ui_reboot_btn;
|
||||
button_init_ui(b, texts[i], SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+20;
|
||||
if(i == 2)
|
||||
y += 50;
|
||||
}
|
||||
|
||||
fb_text *text = fb_add_text(0, fb_height-16, WHITE, SIZE_SMALL, "MultiROM v%d"VERSION_DEV_FIX" with trampoline v%d.",
|
||||
VERSION_MULTIROM, multirom_get_trampoline_ver());
|
||||
list_add(text, &d->ui_elements);
|
||||
|
||||
char bat_text[16];
|
||||
sprintf(bat_text, "Battery: %d%%", multirom_get_battery());
|
||||
text = fb_add_text_long(fb_width-strlen(bat_text)*8, fb_height-16, WHITE, SIZE_SMALL, bat_text);
|
||||
list_add(text, &d->ui_elements);
|
||||
|
||||
x = fb_width/2 - (CLRS_MAX*CLRBTN_TOTAL)/2;
|
||||
uint32_t p, s;
|
||||
fb_rect *r;
|
||||
for(i = 0; i < CLRS_MAX; ++i)
|
||||
{
|
||||
multirom_ui_setup_colors(i, &p, &s);
|
||||
|
||||
if(i == color_scheme)
|
||||
{
|
||||
r = fb_add_rect(x, CLRBTN_Y, CLRBTN_TOTAL, CLRBTN_TOTAL, WHITE);
|
||||
list_add(r, &d->ui_elements);
|
||||
}
|
||||
|
||||
r = fb_add_rect(x+CLRBTN_B/2, CLRBTN_Y+CLRBTN_B/2, CLRBTN_W, CLRBTN_W, p);
|
||||
list_add(r, &d->ui_elements);
|
||||
|
||||
b = mzalloc(sizeof(button));
|
||||
b->x = x;
|
||||
b->y = CLRBTN_Y;
|
||||
b->w = CLRBTN_TOTAL;
|
||||
b->h = CLRBTN_TOTAL;
|
||||
b->action = i;
|
||||
b->clicked = &multirom_ui_tab_misc_change_clr;
|
||||
button_init_ui(b, NULL, 0);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
x += CLRBTN_TOTAL;
|
||||
}
|
||||
}
|
||||
|
||||
static int get_tab_width(multirom_theme_data *t)
|
||||
{
|
||||
return fb_width;
|
||||
}
|
||||
|
||||
static int get_tab_height(multirom_theme_data *t)
|
||||
{
|
||||
return fb_height - HEADER_HEIGHT;
|
||||
}
|
||||
|
||||
static void center_rom_name(tab_data_roms *d, const char *name)
|
||||
{
|
||||
d->rom_name->head.x = center_x(0, fb_width-BOOTBTN_W-20, SIZE_NORMAL, name);
|
||||
}
|
||||
|
||||
const struct multirom_theme theme_info_800x1280 = {
|
||||
.width = 800,
|
||||
.height = 1280,
|
||||
|
||||
.destroy = &destroy,
|
||||
.init_header = &init_header,
|
||||
.header_select = &header_select,
|
||||
.tab_rom_init = &tab_rom_init,
|
||||
.tab_misc_init = &tab_misc_init,
|
||||
.get_tab_width = &get_tab_width,
|
||||
.get_tab_height = &get_tab_height,
|
||||
.center_rom_name = ¢er_rom_name
|
||||
};
|
||||
@@ -23,25 +23,25 @@
|
||||
#include "button.h"
|
||||
#include "version.h"
|
||||
|
||||
#define HEADER_WIDTH 450
|
||||
#define TAB_BTN_HEIGHT 110
|
||||
#define HEADER_WIDTH (300*DPI_MUL)
|
||||
#define TAB_BTN_HEIGHT (75*DPI_MUL)
|
||||
|
||||
#define ROMS_FOOTER_H 120
|
||||
#define ROMS_HEADER_H 90
|
||||
#define ROMS_FOOTER_H (90*DPI_MUL)
|
||||
#define ROMS_HEADER_H (60*DPI_MUL)
|
||||
|
||||
#define BOOTBTN_W 380
|
||||
#define BOOTBTN_H 105
|
||||
#define BOOTBTN_W (300*DPI_MUL)
|
||||
#define BOOTBTN_H (80*DPI_MUL)
|
||||
|
||||
#define REFRESHBTN_W 400
|
||||
#define REFRESHBTN_H 60
|
||||
#define REFRESHBTN_W (400*DPI_MUL)
|
||||
#define REFRESHBTN_H (60*DPI_MUL)
|
||||
|
||||
#define MISCBTN_W 730
|
||||
#define MISCBTN_H 150
|
||||
#define MISCBTN_W (530*DPI_MUL)
|
||||
#define MISCBTN_H (100*DPI_MUL)
|
||||
|
||||
#define CLRBTN_W 80
|
||||
#define CLRBTN_B 20
|
||||
#define CLRBTN_W (50*DPI_MUL)
|
||||
#define CLRBTN_B (10*DPI_MUL)
|
||||
#define CLRBTN_TOTAL (CLRBTN_W+CLRBTN_B)
|
||||
#define CLRBTN_Y 1000
|
||||
#define CLRBTN_Y (700*DPI_MUL)
|
||||
|
||||
static void destroy(multirom_theme_data *t)
|
||||
{
|
||||
@@ -139,9 +139,9 @@ static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_sc
|
||||
button_init_ui(b, "Copy log to /sdcard", SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+50;
|
||||
y += MISCBTN_H+50*DPI_MUL;
|
||||
|
||||
static const char *texts[] =
|
||||
static const char *texts[] =
|
||||
{
|
||||
"Reboot", // 0
|
||||
"Reboot to recovery", // 1
|
||||
@@ -168,9 +168,9 @@ static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_sc
|
||||
button_init_ui(b, texts[i], SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+20;
|
||||
y += MISCBTN_H+20*DPI_MUL;
|
||||
if(i == 2)
|
||||
y += 30;
|
||||
y += 30*DPI_MUL;
|
||||
}
|
||||
|
||||
fb_text *text = fb_add_text(HEADER_WIDTH+5, fb_height-16*SIZE_SMALL, WHITE, SIZE_SMALL, "MultiROM v%d"VERSION_DEV_FIX" with trampoline v%d.",
|
||||
@@ -227,9 +227,9 @@ static void center_rom_name(tab_data_roms *d, const char *name)
|
||||
d->rom_name->head.x = center_x(HEADER_WIDTH, fb_width-BOOTBTN_W-HEADER_WIDTH-20, SIZE_NORMAL, name);
|
||||
}
|
||||
|
||||
const struct multirom_theme theme_info_1920x1200 = {
|
||||
.width = 1920,
|
||||
.height = 1200,
|
||||
const struct multirom_theme theme_info_landscape = {
|
||||
.width = TH_LANDSCAPE,
|
||||
.height = TH_LANDSCAPE,
|
||||
|
||||
.destroy = &destroy,
|
||||
.init_header = &init_header,
|
||||
@@ -23,25 +23,25 @@
|
||||
#include "button.h"
|
||||
#include "version.h"
|
||||
|
||||
#define HEADER_HEIGHT 110
|
||||
#define TAB_BTN_WIDTH 250
|
||||
#define HEADER_HEIGHT (75*DPI_MUL)
|
||||
#define TAB_BTN_WIDTH (165*DPI_MUL)
|
||||
|
||||
#define ROMS_FOOTER_H 165
|
||||
#define ROMS_HEADER_H 120
|
||||
#define ROMS_FOOTER_H (130*DPI_MUL)
|
||||
#define ROMS_HEADER_H (90*DPI_MUL)
|
||||
|
||||
#define BOOTBTN_W 380
|
||||
#define BOOTBTN_H 105
|
||||
#define BOOTBTN_W (300*DPI_MUL)
|
||||
#define BOOTBTN_H (80*DPI_MUL)
|
||||
|
||||
#define REFRESHBTN_W 400
|
||||
#define REFRESHBTN_H 60
|
||||
#define REFRESHBTN_W (400*DPI_MUL)
|
||||
#define REFRESHBTN_H (60*DPI_MUL)
|
||||
|
||||
#define MISCBTN_W 730
|
||||
#define MISCBTN_H 150
|
||||
#define MISCBTN_W (530*DPI_MUL)
|
||||
#define MISCBTN_H (100*DPI_MUL)
|
||||
|
||||
#define CLRBTN_W 80
|
||||
#define CLRBTN_B 20
|
||||
#define CLRBTN_W (50*DPI_MUL)
|
||||
#define CLRBTN_B (10*DPI_MUL)
|
||||
#define CLRBTN_TOTAL (CLRBTN_W+CLRBTN_B)
|
||||
#define CLRBTN_Y 1500
|
||||
#define CLRBTN_Y (1150*DPI_MUL)
|
||||
|
||||
static button *pong_btn = NULL;
|
||||
|
||||
@@ -74,7 +74,7 @@ static void init_header(multirom_theme_data *t)
|
||||
{
|
||||
text_x = center_x(x, TAB_BTN_WIDTH, SIZE_NORMAL, str[i]);
|
||||
text_y = center_y(0, HEADER_HEIGHT, SIZE_NORMAL);
|
||||
tab_texts[i] = fb_add_text(text_x, text_y, WHITE, 3, str[i]);
|
||||
tab_texts[i] = fb_add_text(text_x, text_y, WHITE, SIZE_NORMAL, str[i]);
|
||||
|
||||
fb_add_rect(x, 0, 2, HEADER_HEIGHT, WHITE);
|
||||
|
||||
@@ -135,7 +135,7 @@ static void tab_rom_init(multirom_theme_data *t, tab_data_roms *d, int tab_type)
|
||||
static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_scheme)
|
||||
{
|
||||
int x = fb_width/2 - MISCBTN_W/2;
|
||||
int y = 320;
|
||||
int y = 270*DPI_MUL;
|
||||
|
||||
button *b = mzalloc(sizeof(button));
|
||||
b->x = x;
|
||||
@@ -146,9 +146,9 @@ static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_sc
|
||||
button_init_ui(b, "Copy log to /sdcard", SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+70;
|
||||
y += MISCBTN_H+70*DPI_MUL;
|
||||
|
||||
static const char *texts[] =
|
||||
static const char *texts[] =
|
||||
{
|
||||
"Reboot", // 0
|
||||
"Reboot to recovery", // 1
|
||||
@@ -175,9 +175,9 @@ static void tab_misc_init(multirom_theme_data *t, tab_data_misc *d, int color_sc
|
||||
button_init_ui(b, texts[i], SIZE_BIG);
|
||||
list_add(b, &d->buttons);
|
||||
|
||||
y += MISCBTN_H+40;
|
||||
y += MISCBTN_H+20*DPI_MUL;
|
||||
if(i == 2)
|
||||
y += 80;
|
||||
y += 50*DPI_MUL;
|
||||
}
|
||||
|
||||
fb_text *text = fb_add_text(0, fb_height-16*SIZE_SMALL, WHITE, SIZE_SMALL, "MultiROM v%d"VERSION_DEV_FIX" with trampoline v%d.",
|
||||
@@ -234,9 +234,9 @@ static void center_rom_name(tab_data_roms *d, const char *name)
|
||||
d->rom_name->head.x = center_x(0, fb_width-BOOTBTN_W-20, SIZE_NORMAL, name);
|
||||
}
|
||||
|
||||
const struct multirom_theme theme_info_1200x1920 = {
|
||||
.width = 1200,
|
||||
.height = 1920,
|
||||
const struct multirom_theme theme_info_portrait = {
|
||||
.width = TH_PORTRAIT,
|
||||
.height = TH_PORTRAIT,
|
||||
|
||||
.destroy = &destroy,
|
||||
.init_header = &init_header,
|
||||
Reference in New Issue
Block a user