mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-10 05:59:08 -07:00
commit new compact menu style
This commit is contained in:
@@ -22,6 +22,7 @@ const char* const menu_style_names[MenuStyleCount] = {
|
||||
"Vertical",
|
||||
"C64",
|
||||
"Eurocorp",
|
||||
"Compact",
|
||||
};
|
||||
static void xtreme_app_scene_interface_mainmenu_menu_style_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
|
||||
@@ -362,6 +362,48 @@ static void menu_draw_callback(Canvas* canvas, void* _model) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MenuStyleCompact: {
|
||||
FuriString* memstr = furi_string_alloc();
|
||||
|
||||
size_t index;
|
||||
size_t y_off, x_off;
|
||||
|
||||
canvas_set_font(canvas, FontKeyboard);
|
||||
|
||||
for(size_t i = 0; i < 2; i++) {
|
||||
for(size_t j = 0; j < 7; j++) { // Change 5 to 6 to accommodate the extra row
|
||||
index = i * 7 + j + (position - (position % 14)); // Change 10 to 12
|
||||
if(index >= items_count) continue;
|
||||
y_off = (9 * j) - 4; // Adjust the y offset
|
||||
x_off = 64 * i;
|
||||
bool selected = index == position;
|
||||
size_t scroll_counter = menu_scroll_counter(model, selected);
|
||||
if(selected) {
|
||||
canvas_draw_box(canvas, x_off, y_off + 4, 64, 9);
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
}
|
||||
item = MenuItemArray_get(model->items, index);
|
||||
menu_short_name(item, name);
|
||||
|
||||
FuriString* item_str = furi_string_alloc();
|
||||
|
||||
furi_string_printf(item_str, "%s", furi_string_get_cstr(name));
|
||||
|
||||
elements_scrollable_text_line(
|
||||
canvas, x_off + 2, y_off + 12, 64, item_str, scroll_counter, false);
|
||||
|
||||
furi_string_free(item_str);
|
||||
|
||||
if(selected) {
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
furi_string_free(memstr);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -612,6 +654,13 @@ static void menu_process_up(Menu* menu) {
|
||||
position = count - 1;
|
||||
}
|
||||
break;
|
||||
case MenuStyleCompact:
|
||||
if(position > 0) {
|
||||
position--;
|
||||
} else {
|
||||
position = count - 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -660,6 +709,13 @@ static void menu_process_down(Menu* menu) {
|
||||
position = 0;
|
||||
}
|
||||
break;
|
||||
case MenuStyleCompact:
|
||||
if(position < count - 1) {
|
||||
position++;
|
||||
} else {
|
||||
position = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -712,6 +768,14 @@ static void menu_process_left(Menu* menu) {
|
||||
} else if((position % 10) >= 5) {
|
||||
position = position - 5;
|
||||
}
|
||||
break;
|
||||
case MenuStyleCompact:
|
||||
if((position % 16) < 8) {
|
||||
position = position + 7;
|
||||
} else if((position % 16) >= 8) {
|
||||
position = position - 7;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -769,6 +833,14 @@ static void menu_process_right(Menu* menu) {
|
||||
} else if((position % 10) >= 5 && position < count) {
|
||||
position = position - 5;
|
||||
}
|
||||
break;
|
||||
case MenuStyleCompact:
|
||||
if(position >= (count - count) && (position % 16) < 8) {
|
||||
position = position + 7;
|
||||
} else if((position % 16) >= 8 && position < count) {
|
||||
position = position - 7;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -793,4 +865,4 @@ static void menu_process_ok(Menu* menu) {
|
||||
if(item && item->callback) {
|
||||
item->callback(item->callback_context, item->index);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user