mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
More statubar settings
This commit is contained in:
@@ -60,7 +60,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
/* for support black theme - paint white area and
|
||||
* draw icon with transparent white color
|
||||
*/
|
||||
if(xtreme_settings->status_bar) {
|
||||
if(xtreme_settings->bar_background) {
|
||||
canvas_set_color(gui->canvas, ColorWhite);
|
||||
canvas_draw_box(gui->canvas, 1, 1, 9, 7);
|
||||
canvas_draw_box(gui->canvas, 7, 3, 58, 6);
|
||||
@@ -74,72 +74,76 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
}
|
||||
canvas_set_bitmap_mode(gui->canvas, 0);
|
||||
|
||||
uint8_t x;
|
||||
|
||||
// Right side
|
||||
uint8_t x = GUI_DISPLAY_WIDTH - 1;
|
||||
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarRight]);
|
||||
while(!ViewPortArray_end_p(it) && right_used < GUI_STATUS_BAR_WIDTH) {
|
||||
ViewPort* view_port = *ViewPortArray_ref(it);
|
||||
if(view_port_is_enabled(view_port)) {
|
||||
width = view_port_get_width(view_port);
|
||||
if(!width) width = 8;
|
||||
// Recalculate next position
|
||||
right_used += (width + 2);
|
||||
x -= (width + 2);
|
||||
// Prepare work area background
|
||||
canvas_frame_set(
|
||||
gui->canvas,
|
||||
x - 1,
|
||||
GUI_STATUS_BAR_Y + 1,
|
||||
width + 2,
|
||||
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||
// Hide battery background
|
||||
if(xtreme_settings->status_bar && xtreme_settings->battery_icon != BatteryIconOff) {
|
||||
canvas_set_color(gui->canvas, ColorWhite);
|
||||
canvas_draw_box(
|
||||
gui->canvas, -1, 0, canvas_width(gui->canvas) + 1, canvas_height(gui->canvas));
|
||||
if(xtreme_settings->battery_icon != BatteryIconOff) {
|
||||
x = GUI_DISPLAY_WIDTH - 1;
|
||||
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarRight]);
|
||||
while(!ViewPortArray_end_p(it) && right_used < GUI_STATUS_BAR_WIDTH) {
|
||||
ViewPort* view_port = *ViewPortArray_ref(it);
|
||||
if(view_port_is_enabled(view_port)) {
|
||||
width = view_port_get_width(view_port);
|
||||
if(!width) width = 8;
|
||||
// Recalculate next position
|
||||
right_used += (width + 2);
|
||||
x -= (width + 2);
|
||||
// Prepare work area background
|
||||
canvas_frame_set(
|
||||
gui->canvas,
|
||||
x - 1,
|
||||
GUI_STATUS_BAR_Y + 1,
|
||||
width + 2,
|
||||
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||
// Hide battery background
|
||||
if(xtreme_settings->bar_borders) {
|
||||
canvas_set_color(gui->canvas, ColorWhite);
|
||||
canvas_draw_box(
|
||||
gui->canvas, -1, 0, canvas_width(gui->canvas) + 1, canvas_height(gui->canvas));
|
||||
}
|
||||
canvas_set_color(gui->canvas, ColorBlack);
|
||||
// ViewPort draw
|
||||
canvas_frame_set(
|
||||
gui->canvas,
|
||||
x - xtreme_settings->bar_borders,
|
||||
GUI_STATUS_BAR_Y + 2,
|
||||
width,
|
||||
GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||
view_port_draw(view_port, gui->canvas);
|
||||
}
|
||||
canvas_set_color(gui->canvas, ColorBlack);
|
||||
// ViewPort draw
|
||||
ViewPortArray_next(it);
|
||||
}
|
||||
// Draw frame around icons on the right
|
||||
if(right_used) {
|
||||
canvas_frame_set(
|
||||
gui->canvas,
|
||||
x - xtreme_settings->status_bar,
|
||||
GUI_STATUS_BAR_Y + 2,
|
||||
width,
|
||||
GUI_STATUS_BAR_WORKAREA_HEIGHT);
|
||||
view_port_draw(view_port, gui->canvas);
|
||||
}
|
||||
ViewPortArray_next(it);
|
||||
}
|
||||
// Draw frame around icons on the right
|
||||
if(right_used) {
|
||||
canvas_frame_set(
|
||||
gui->canvas,
|
||||
GUI_DISPLAY_WIDTH - 4 - right_used,
|
||||
GUI_STATUS_BAR_Y,
|
||||
right_used + 4,
|
||||
GUI_STATUS_BAR_HEIGHT);
|
||||
// Disable battery border
|
||||
if(xtreme_settings->status_bar && xtreme_settings->battery_icon != BatteryIconOff) {
|
||||
canvas_set_color(gui->canvas, ColorBlack);
|
||||
canvas_draw_rframe(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
1,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
1,
|
||||
canvas_height(gui->canvas) - 2,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
GUI_DISPLAY_WIDTH - 4 - right_used,
|
||||
GUI_STATUS_BAR_Y,
|
||||
right_used + 4,
|
||||
GUI_STATUS_BAR_HEIGHT);
|
||||
// Disable battery border
|
||||
if(xtreme_settings->bar_borders) {
|
||||
canvas_set_color(gui->canvas, ColorBlack);
|
||||
canvas_draw_rframe(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
1,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
1,
|
||||
canvas_height(gui->canvas) - 2,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Left side
|
||||
if(xtreme_settings->status_bar) {
|
||||
if(xtreme_settings->status_icons) {
|
||||
x = 2;
|
||||
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarLeft]);
|
||||
while(!ViewPortArray_end_p(it) && (right_used + left_used) < GUI_STATUS_BAR_WIDTH) {
|
||||
@@ -154,9 +158,11 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
GUI_STATUS_BAR_Y + 1,
|
||||
width + 2,
|
||||
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||
canvas_set_color(gui->canvas, ColorWhite);
|
||||
canvas_draw_box(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||
if(xtreme_settings->bar_borders) {
|
||||
canvas_set_color(gui->canvas, ColorWhite);
|
||||
canvas_draw_box(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||
}
|
||||
canvas_set_color(gui->canvas, ColorBlack);
|
||||
// ViewPort draw
|
||||
canvas_frame_set(
|
||||
@@ -178,9 +184,11 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
GUI_STATUS_BAR_Y + 1,
|
||||
width + 2,
|
||||
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
|
||||
canvas_set_color(gui->canvas, ColorWhite);
|
||||
canvas_draw_box(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||
if(xtreme_settings->bar_borders) {
|
||||
canvas_set_color(gui->canvas, ColorWhite);
|
||||
canvas_draw_box(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas));
|
||||
}
|
||||
canvas_set_color(gui->canvas, ColorBlack);
|
||||
// Draw Icon
|
||||
canvas_frame_set(
|
||||
@@ -193,20 +201,22 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
|
||||
// Draw frame around icons on the left
|
||||
if(left_used) {
|
||||
canvas_frame_set(gui->canvas, 0, 0, left_used + 3, GUI_STATUS_BAR_HEIGHT);
|
||||
canvas_draw_rframe(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
1,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
1,
|
||||
canvas_height(gui->canvas) - 2,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
if(xtreme_settings->bar_borders) {
|
||||
canvas_draw_rframe(
|
||||
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
1,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
canvas_draw_line(
|
||||
gui->canvas,
|
||||
1,
|
||||
canvas_height(gui->canvas) - 2,
|
||||
canvas_width(gui->canvas) - 2,
|
||||
canvas_height(gui->canvas) - 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ typedef struct {
|
||||
bool unlock_anims;
|
||||
BatteryIcon battery_icon;
|
||||
bool status_icons;
|
||||
bool status_bar_frames;
|
||||
bool status_bar_back;
|
||||
bool bar_borders;
|
||||
bool bar_background;
|
||||
bool sort_ignore_dirs;
|
||||
bool bad_bt;
|
||||
} XtremeSettings;
|
||||
|
||||
@@ -70,11 +70,27 @@ static void xtreme_app_scene_main_battery_icon_changed(VariableItem* item) {
|
||||
app->settings_changed = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_main_status_bar_changed(VariableItem* item) {
|
||||
static void xtreme_app_scene_main_status_icons_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->status_bar = value;
|
||||
XTREME_SETTINGS()->status_icons = value;
|
||||
app->settings_changed = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_main_bar_borders_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->bar_borders = value;
|
||||
app->settings_changed = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_main_bar_background_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->bar_background = value;
|
||||
app->settings_changed = true;
|
||||
}
|
||||
|
||||
@@ -216,9 +232,19 @@ void xtreme_app_scene_main_on_enter(void* context) {
|
||||
variable_item_set_current_value_text(item, battery_icon_names[value_index]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Status Bar", 2, xtreme_app_scene_main_status_bar_changed, app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->status_bar);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->status_bar ? "ON" : "OFF");
|
||||
var_item_list, "Status Icons", 2, xtreme_app_scene_main_status_icons_changed, app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->status_icons);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->status_icons ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Bar Borders", 2, xtreme_app_scene_main_bar_borders_changed, app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->bar_borders);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->bar_borders ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Bar Background", 2, xtreme_app_scene_main_bar_background_changed, app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->bar_background);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->bar_background ? "ON" : "OFF");
|
||||
|
||||
|
||||
variable_item_list_add(var_item_list, " = Protocols =", 0, NULL, app);
|
||||
|
||||
Reference in New Issue
Block a user