|
|
@@ -94,80 +94,6 @@ struct Station stations[] = {
|
|
|
{107.5, "Amor 107.5"},
|
|
|
};
|
|
|
|
|
|
-// Function prototypes for forward declarations
|
|
|
-void elements_button_top_left(Canvas* canvas, const char* str);
|
|
|
-void elements_button_top_right(Canvas* canvas, const char* str);
|
|
|
-//lib can only do bottom left/right
|
|
|
-void elements_button_top_left(Canvas* canvas, const char* str) {
|
|
|
- const uint8_t button_height = 10; // Define the height of the button
|
|
|
- const uint8_t vertical_offset = 2; // Define the vertical offset of the text
|
|
|
- const uint8_t horizontal_offset = 2; // Define the horizontal offset of the text
|
|
|
- const uint8_t string_width = canvas_string_width(canvas, str);
|
|
|
- const Icon* icon = &I_ButtonUp;
|
|
|
- const uint8_t icon_h_offset = 2;
|
|
|
- const uint8_t icon_width_with_offset = icon->width + icon_h_offset;
|
|
|
- const uint8_t icon_v_offset = icon->height + vertical_offset;
|
|
|
- const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset;
|
|
|
-
|
|
|
- const uint8_t x = 0;
|
|
|
- const uint8_t y = 0 + button_height;
|
|
|
-
|
|
|
- canvas_draw_box(canvas, x, y - button_height, button_width, button_height); // Draw the button
|
|
|
- canvas_draw_line(
|
|
|
- canvas,
|
|
|
- x + button_width + 0,
|
|
|
- y - button_height,
|
|
|
- x + button_width + 0,
|
|
|
- y - 1); // Draw the button border
|
|
|
- canvas_draw_line(
|
|
|
- canvas,
|
|
|
- x + button_width + 1,
|
|
|
- y - button_height,
|
|
|
- x + button_width + 1,
|
|
|
- y - 2); // Draw the button border
|
|
|
- canvas_draw_line(
|
|
|
- canvas,
|
|
|
- x + button_width + 2,
|
|
|
- y - button_height,
|
|
|
- x + button_width + 2,
|
|
|
- y - 3); // Draw the button border
|
|
|
-
|
|
|
- canvas_invert_color(canvas); // Invert the color of the text and icon
|
|
|
- canvas_draw_str(
|
|
|
- canvas,
|
|
|
- x + horizontal_offset + icon_width_with_offset,
|
|
|
- y - vertical_offset,
|
|
|
- str); // Draw the text
|
|
|
- canvas_draw_icon(canvas, x - horizontal_offset - icon->width, y - icon_v_offset, &I_ButtonUp);
|
|
|
- canvas_invert_color(canvas); // Invert the color of the text and icon
|
|
|
-}
|
|
|
-
|
|
|
-void elements_button_top_right(Canvas* canvas, const char* str) {
|
|
|
- const uint8_t button_height = 10;
|
|
|
- const uint8_t vertical_offset = 2;
|
|
|
- const uint8_t horizontal_offset = 2;
|
|
|
- const uint8_t string_width = canvas_string_width(canvas, str);
|
|
|
- const Icon* icon = &I_ButtonUp;
|
|
|
- const uint8_t icon_h_offset = 2;
|
|
|
- const uint8_t icon_width_with_offset = icon->width + icon_h_offset;
|
|
|
- const uint8_t icon_v_offset = icon->height + vertical_offset;
|
|
|
- const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset;
|
|
|
-
|
|
|
- const uint8_t x = canvas_width(canvas);
|
|
|
- const uint8_t y = 0 + button_height;
|
|
|
-
|
|
|
- canvas_draw_box(canvas, x - button_width, y - button_height, button_width, button_height);
|
|
|
- canvas_draw_line(canvas, x - button_width - 1, y - button_height, x - button_width - 1, y - 1);
|
|
|
- canvas_draw_line(canvas, x - button_width - 2, y - button_height, x - button_width - 2, y - 2);
|
|
|
- canvas_draw_line(canvas, x - button_width - 3, y - button_height, x - button_width - 3, y - 3);
|
|
|
-
|
|
|
- canvas_invert_color(canvas);
|
|
|
- canvas_draw_str(canvas, x - button_width + horizontal_offset, y - vertical_offset, str);
|
|
|
- canvas_draw_icon_ex(
|
|
|
- canvas, x + horizontal_offset, y - icon_v_offset, &I_ButtonUp, IconRotation180);
|
|
|
- canvas_invert_color(canvas);
|
|
|
-}
|
|
|
-
|
|
|
// Enumerations for submenu and view indices
|
|
|
typedef enum {
|
|
|
MyAppSubmenuIndexConfigure,
|
|
|
@@ -311,13 +237,13 @@ void my_app_view_draw_callback(Canvas* canvas, void* model) {
|
|
|
|
|
|
// Draw strings on the canvas
|
|
|
canvas_set_font(canvas, FontPrimary);
|
|
|
- canvas_draw_str(canvas, 33, 10, "FM Radio");
|
|
|
- canvas_draw_icon(canvas, 83, 0, &I_RadioSmall);
|
|
|
+ canvas_draw_str(canvas, 35, 10, "FM Radio");
|
|
|
+ canvas_draw_icon(canvas, 84, 0, &I_radio);
|
|
|
|
|
|
// Draw button prompts
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
- elements_button_top_left(canvas, "Pre");
|
|
|
- elements_button_top_right(canvas, "Pre");
|
|
|
+ elements_button_up(canvas, "Pre");
|
|
|
+ elements_button_down(canvas, "Pre");
|
|
|
elements_button_left(canvas, "Scan-");
|
|
|
elements_button_center(canvas, "Mute");
|
|
|
elements_button_right(canvas, "Scan+");
|
|
|
@@ -377,7 +303,6 @@ MyApp* my_app_alloc() {
|
|
|
Gui* gui = furi_record_open(RECORD_GUI);
|
|
|
// Initialize the view dispatcher
|
|
|
app->view_dispatcher = view_dispatcher_alloc();
|
|
|
- view_dispatcher_enable_queue(app->view_dispatcher);
|
|
|
view_dispatcher_attach_to_gui(app->view_dispatcher, gui, ViewDispatcherTypeFullscreen);
|
|
|
|
|
|
// Initialize the submenu
|