From 3ecfd41ed5af6756e3a046da9672c5e63edbd6c6 Mon Sep 17 00:00:00 2001 From: Luc <8822552+luc-github@users.noreply.github.com> Date: Sun, 28 Apr 2024 12:35:10 +0800 Subject: [PATCH] POC refactoring on style and screen code for Splash screen on Marlin target --- CMakeLists.txt | 4 +- cmake/dev_tools.cmake | 2 +- .../display/3dprinter/marlin/esp3d_styles.cpp | 63 +++++++------------ main/display/3dprinter/marlin/esp3d_styles.h | 32 +++++++++- .../display/3dprinter/marlin/esp3d_tft_ui.cpp | 4 +- .../marlin/res_320_240/esp3d_styles_res.h | 2 - .../res_320_240/esp3d_styles_splash_screen.h | 24 +++++++ .../res_480_272/esp3d_styles_splash_screen.h | 24 +++++++ .../res_480_320/esp3d_styles_splash_screen.h | 24 +++++++ .../marlin/res_800_480/esp3d_styles_res.h | 5 +- .../res_800_480/esp3d_styles_splash_screen.h | 24 +++++++ .../marlin/screens/auto_leveling_screen.cpp | 4 +- .../3dprinter/marlin/screens/fan_screen.cpp | 16 ++--- .../marlin/screens/filament_screen.cpp | 16 ++--- .../marlin/screens/informations_screen.cpp | 4 +- .../marlin/screens/leveling_screen.cpp | 6 +- .../3dprinter/marlin/screens/main_screen.cpp | 24 +++---- .../marlin/screens/manual_leveling_screen.cpp | 6 +- .../3dprinter/marlin/screens/menu_screen.cpp | 10 +-- .../marlin/screens/positions_screen.cpp | 18 +++--- .../marlin/screens/settings_screen.cpp | 2 +- .../3dprinter/marlin/screens/speed_screen.cpp | 14 ++--- .../marlin/screens/temperatures_screen.cpp | 22 +++---- .../3dprinter/repetier/esp3d_styles.cpp | 42 ++++++------- .../display/3dprinter/repetier/esp3d_styles.h | 6 +- .../3dprinter/repetier/esp3d_tft_ui.cpp | 2 +- .../repetier/screens/auto_leveling_screen.cpp | 4 +- .../3dprinter/repetier/screens/fan_screen.cpp | 16 ++--- .../repetier/screens/filament_screen.cpp | 16 ++--- .../repetier/screens/informations_screen.cpp | 4 +- .../repetier/screens/leveling_screen.cpp | 6 +- .../repetier/screens/main_screen.cpp | 18 +++--- .../screens/manual_leveling_screen.cpp | 6 +- .../repetier/screens/menu_screen.cpp | 10 +-- .../repetier/screens/positions_screen.cpp | 18 +++--- .../repetier/screens/settings_screen.cpp | 2 +- .../repetier/screens/speed_screen.cpp | 14 ++--- .../repetier/screens/temperatures_screen.cpp | 22 +++---- .../3dprinter/smoothieware/esp3d_styles.cpp | 42 ++++++------- .../3dprinter/smoothieware/esp3d_styles.h | 6 +- .../3dprinter/smoothieware/esp3d_tft_ui.cpp | 2 +- .../screens/auto_leveling_screen.cpp | 4 +- .../smoothieware/screens/fan_screen.cpp | 16 ++--- .../smoothieware/screens/filament_screen.cpp | 16 ++--- .../screens/informations_screen.cpp | 4 +- .../smoothieware/screens/leveling_screen.cpp | 6 +- .../smoothieware/screens/main_screen.cpp | 18 +++--- .../screens/manual_leveling_screen.cpp | 6 +- .../smoothieware/screens/menu_screen.cpp | 10 +-- .../smoothieware/screens/positions_screen.cpp | 18 +++--- .../smoothieware/screens/settings_screen.cpp | 2 +- .../smoothieware/screens/speed_screen.cpp | 14 ++--- .../screens/temperatures_screen.cpp | 22 +++---- main/display/cnc/grbl/esp3d_styles.cpp | 42 ++++++------- main/display/cnc/grbl/esp3d_styles.h | 6 +- main/display/cnc/grbl/esp3d_tft_ui.cpp | 2 +- .../cnc/grbl/screens/informations_screen.cpp | 4 +- main/display/cnc/grbl/screens/main_screen.cpp | 18 +++--- main/display/cnc/grbl/screens/menu_screen.cpp | 10 +-- .../cnc/grbl/screens/settings_screen.cpp | 2 +- .../components/choice_editor_component.cpp | 4 +- .../components/main_container_component.cpp | 2 +- .../components/message_box_component.cpp | 2 +- main/display/components/spinner_component.cpp | 6 +- .../components/status_bar_component.cpp | 2 +- .../components/symbol_button_component.cpp | 2 +- .../components/wifi_status_component.cpp | 2 +- main/display/screens/ap_screen.cpp | 6 +- main/display/screens/empty_screen.cpp | 2 +- main/display/screens/files_screen.cpp | 4 +- main/display/screens/splash_screen.cpp | 49 ++++++++++----- main/display/screens/splash_screen.h | 2 +- main/display/screens/sta_screen.cpp | 6 +- main/display/screens/status_screen.cpp | 8 +-- main/display/screens/wifi_screen.cpp | 6 +- 75 files changed, 513 insertions(+), 396 deletions(-) create mode 100644 main/display/3dprinter/marlin/res_320_240/esp3d_styles_splash_screen.h create mode 100644 main/display/3dprinter/marlin/res_480_272/esp3d_styles_splash_screen.h create mode 100644 main/display/3dprinter/marlin/res_480_320/esp3d_styles_splash_screen.h create mode 100644 main/display/3dprinter/marlin/res_800_480/esp3d_styles_splash_screen.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 73fbe2db..af5f0530 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,10 +39,10 @@ OPTION(HARDWARE_MOD_EXT_PSRAM "Hardware Mod: External PSRAM" OFF) # ####################################### # Select one targeted firmware # ####################################### -OPTION(TARGET_FW_MARLIN "Marlin firmware" OFF) +OPTION(TARGET_FW_MARLIN "Marlin firmware" ON) OPTION(TARGET_FW_REPETIER "Repetier firmware" OFF) OPTION(TARGET_FW_SMOOTHIEWARE "Smoothieware firmware" OFF) -OPTION(TARGET_FW_GRBL "GRBL firmware" ON) +OPTION(TARGET_FW_GRBL "GRBL firmware" OFF) # ####################################### diff --git a/cmake/dev_tools.cmake b/cmake/dev_tools.cmake index 2ee51015..cd8603c4 100644 --- a/cmake/dev_tools.cmake +++ b/cmake/dev_tools.cmake @@ -8,7 +8,7 @@ add_compile_options(-DESP3D_TFT_LOG=0) add_compile_options(-DDISABLE_COLOR_LOG=0) #Use the Snapshot API of LVGL to dump screens to the SD card -add_compile_options(-DLV_USE_SNAPSHOT=0) +add_compile_options(-DLV_USE_SNAPSHOT=1) # ESP3D-TFT specific bechmark # Enabled = 1 diff --git a/main/display/3dprinter/marlin/esp3d_styles.cpp b/main/display/3dprinter/marlin/esp3d_styles.cpp index f86fcfe2..7bc4ae6a 100644 --- a/main/display/3dprinter/marlin/esp3d_styles.cpp +++ b/main/display/3dprinter/marlin/esp3d_styles.cpp @@ -21,27 +21,7 @@ #include "esp3d_styles.h" #include "esp3d_log.h" - -#define CURRENT_MAIN_BG_COLOR lv_color_hex(0x000000) - -#define CURRENT_BG_LABEL_TEXT_COLOR lv_color_hex(0xFFFFFF) - -#define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) -#define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) - -#define CURRENT_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) - -#define CURRENT_BUTTON_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_COLOR_PALETTE_DARKEN 2 - -#define CURRENT_BUTTON_BORDER_COLOR \ - lv_color_hex(0xFFFFFF) // lv_palette_main(LV_PALETTE_GREY) -#define CURRENT_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) -#define CURRENT_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN -#define CURRENT_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY -#define CURRENT_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) -#define CURRENT_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) - +namespace ESP3DStyle { // Create styles for main background lv_style_t style_main_bg; lv_style_t style_bg_label; @@ -82,45 +62,45 @@ lv_style_t style_text_container; lv_style_t style_spinner_screen; lv_style_t style_spinner_text; -bool init_styles() { +bool init() { /* Spinner screen */ lv_style_init(&style_spinner_screen); lv_style_set_text_opa(&style_spinner_screen, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_screen, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_spinner_screen, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_bg_opa(&style_spinner_screen, LV_OPA_50); /* Spinner text */ lv_style_init(&style_spinner_text); lv_style_set_text_opa(&style_spinner_text, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_text, CURRENT_BG_LABEL_TEXT_COLOR); + lv_style_set_text_color(&style_spinner_text, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); /* Main background */ lv_style_init(&style_main_bg); lv_style_set_text_opa(&style_main_bg, LV_OPA_COVER); - lv_style_set_text_color(&style_main_bg, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_main_bg, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_COLOR); /* Label on main background */ lv_style_init(&style_bg_label); lv_style_set_text_opa(&style_bg_label, LV_OPA_COVER); - lv_style_set_text_color(&style_bg_label, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_bg_label, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_COLOR); /* read only value on main background */ lv_style_init(&style_read_only_value); lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); - lv_style_set_text_color(&style_read_only_value, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_value, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -137,7 +117,7 @@ bool init_styles() { lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, CURRENT_BUTTON_PRESSED_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_setting, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -541,17 +521,17 @@ bool init_styles() { */ lv_style_init(&style_simple_container_default); lv_style_set_bg_opa(&style_simple_container_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_simple_container_default, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_simple_container_default, ESP3D_SCREEN_BACKGROUND_COLOR); // Text Container lv_style_init(&style_text_container); lv_style_set_bg_opa(&style_text_container, LV_OPA_COVER); - lv_style_set_bg_color(&style_text_container, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_text_container, ESP3D_SCREEN_BACKGROUND_COLOR); return true; } -bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { +bool apply(lv_obj_t* obj, ESP3DStyleType type) { if (type != ESP3DStyleType::main_bg && type != ESP3DStyleType::status_list && type != ESP3DStyleType::buttons_msgbox && type != ESP3DStyleType::message_box && @@ -625,8 +605,8 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { break; case ESP3DStyleType::message_box: lv_obj_set_width(obj, LV_PCT(80)); - apply_style(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); - apply_style(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); + ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); + ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); break; @@ -651,7 +631,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { LV_PART_MAIN); break; case ESP3DStyleType::list_container: - apply_style(obj, ESP3DStyleType::col_container); + ESP3DStyle::apply(obj, ESP3DStyleType::col_container); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); @@ -675,7 +655,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::simple_container: lv_obj_add_style(obj, &style_simple_container_default, LV_STATE_DEFAULT); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - apply_outline_pad(obj); + ESP3DStyle::add_pad(obj); break; case ESP3DStyleType::status_list: lv_obj_add_style(obj, &style_status_list_default, LV_STATE_DEFAULT); @@ -688,11 +668,12 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { return true; } -bool apply_outline_pad(lv_obj_t* obj) { +bool add_pad(lv_obj_t* obj) { lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_bottom(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); return true; -} \ No newline at end of file +} +} // namespace ESP3DStyle \ No newline at end of file diff --git a/main/display/3dprinter/marlin/esp3d_styles.h b/main/display/3dprinter/marlin/esp3d_styles.h index 4c4a4f2b..ced70744 100644 --- a/main/display/3dprinter/marlin/esp3d_styles.h +++ b/main/display/3dprinter/marlin/esp3d_styles.h @@ -25,6 +25,7 @@ #include "esp3d_styles_res.h" #include "lvgl.h" +//Styles for common controls enum class ESP3DStyleType : uint8_t { default_style = 0, main_bg, @@ -48,6 +49,31 @@ enum class ESP3DStyleType : uint8_t { text_container, }; -extern bool init_styles(); -extern bool apply_style(lv_obj_t* obj, ESP3DStyleType type); -extern bool apply_outline_pad(lv_obj_t* obj); +//Name space for styles +namespace ESP3DStyle { + bool init(); + bool apply(lv_obj_t* obj, ESP3DStyleType type); + bool add_pad(lv_obj_t* obj); +}; // namespace ESP3DStyle + +//Colors definition +//Screen colors +#define ESP3D_SCREEN_BACKGROUND_COLOR lv_color_hex(0x000000) +#define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) + + +#define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) +#define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) +#define CURRENT_STATUS_BAR_BORDER_COLOR lv_palette_main(LV_PALETTE_GREY) + +#define CURRENT_BUTTON_COLOR_PALETTE LV_PALETTE_GREY +#define CURRENT_BUTTON_COLOR_PALETTE_DARKEN 2 + +#define CURRENT_BUTTON_BORDER_COLOR \ + lv_color_hex(0xFFFFFF) // lv_palette_main(LV_PALETTE_GREY) +#define CURRENT_BUTTON_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define CURRENT_BUTTON_OUTLINE_COLOR_PALETTE LV_PALETTE_GREEN +#define CURRENT_BUTTON_PRESSED_COLOR_PALETTE LV_PALETTE_GREY +#define CURRENT_BUTTON_PRESSED_TEXT_COLOR lv_color_hex(0x00FF00) +#define CURRENT_BUTTON_PRESSED_BORDER_COLOR lv_color_hex(0x00FF00) + diff --git a/main/display/3dprinter/marlin/esp3d_tft_ui.cpp b/main/display/3dprinter/marlin/esp3d_tft_ui.cpp index 4224ecd2..334924bd 100644 --- a/main/display/3dprinter/marlin/esp3d_tft_ui.cpp +++ b/main/display/3dprinter/marlin/esp3d_tft_ui.cpp @@ -25,6 +25,6 @@ **********************/ void create_application(void) { - init_styles(); - splashScreen::boot_screen(); + ESP3DStyle::init(); + splashScreen::enter(); } diff --git a/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h b/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h index b55f6ce1..be39cd82 100644 --- a/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h +++ b/main/display/3dprinter/marlin/res_320_240/esp3d_styles_res.h @@ -63,5 +63,3 @@ #define CURRENT_SCROLL_BAR_WIDTH 10 #define CURRENT_SCROLL_BAR_RADIUS 5 -#define FW_LOGO_X 1 -#define FW_LOGO_Y -1 diff --git a/main/display/3dprinter/marlin/res_320_240/esp3d_styles_splash_screen.h b/main/display/3dprinter/marlin/res_320_240/esp3d_styles_splash_screen.h new file mode 100644 index 00000000..3dcbd99a --- /dev/null +++ b/main/display/3dprinter/marlin/res_320_240/esp3d_styles_splash_screen.h @@ -0,0 +1,24 @@ +/* + esp3d_styles_splash_screen.h - ESP3D screens styles definition + + Copyright (c) 2022 Luc Lebosse. All rights reserved. + + This code is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This code 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#define FW_LOGO_X 1 +#define FW_LOGO_Y -1 \ No newline at end of file diff --git a/main/display/3dprinter/marlin/res_480_272/esp3d_styles_splash_screen.h b/main/display/3dprinter/marlin/res_480_272/esp3d_styles_splash_screen.h new file mode 100644 index 00000000..0572f128 --- /dev/null +++ b/main/display/3dprinter/marlin/res_480_272/esp3d_styles_splash_screen.h @@ -0,0 +1,24 @@ +/* + esp3d_styles_splash_screen.h - ESP3D screens styles definition + + Copyright (c) 2022 Luc Lebosse. All rights reserved. + + This code is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This code 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#define FW_LOGO_X 10 +#define FW_LOGO_Y -1 \ No newline at end of file diff --git a/main/display/3dprinter/marlin/res_480_320/esp3d_styles_splash_screen.h b/main/display/3dprinter/marlin/res_480_320/esp3d_styles_splash_screen.h new file mode 100644 index 00000000..84076b52 --- /dev/null +++ b/main/display/3dprinter/marlin/res_480_320/esp3d_styles_splash_screen.h @@ -0,0 +1,24 @@ +/* + esp3d_styles_splash_screen.h - ESP3D screens styles definition + + Copyright (c) 2022 Luc Lebosse. All rights reserved. + + This code is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This code 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#define FW_LOGO_X 10 +#define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h b/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h index 6c0f54ba..4139bed0 100644 --- a/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h +++ b/main/display/3dprinter/marlin/res_800_480/esp3d_styles_res.h @@ -60,7 +60,4 @@ #define LIST_LINE_BUTTON_WIDTH 80 #define CURRENT_SCROLL_BAR_WIDTH 10 -#define CURRENT_SCROLL_BAR_RADIUS 5 - -#define FW_LOGO_X 10 -#define FW_LOGO_Y -10 \ No newline at end of file +#define CURRENT_SCROLL_BAR_RADIUS 5 \ No newline at end of file diff --git a/main/display/3dprinter/marlin/res_800_480/esp3d_styles_splash_screen.h b/main/display/3dprinter/marlin/res_800_480/esp3d_styles_splash_screen.h new file mode 100644 index 00000000..84076b52 --- /dev/null +++ b/main/display/3dprinter/marlin/res_800_480/esp3d_styles_splash_screen.h @@ -0,0 +1,24 @@ +/* + esp3d_styles_splash_screen.h - ESP3D screens styles definition + + Copyright (c) 2022 Luc Lebosse. All rights reserved. + + This code is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This code 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#define FW_LOGO_X 10 +#define FW_LOGO_Y -10 \ No newline at end of file diff --git a/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp b/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp index 283748a1..9eba2990 100644 --- a/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp +++ b/main/display/3dprinter/marlin/screens/auto_leveling_screen.cpp @@ -259,7 +259,7 @@ void auto_leveling_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); homing_done = false; @@ -288,7 +288,7 @@ void auto_leveling_screen() { LV_EVENT_CLICKED, NULL); label_status = lv_label_create(ui_new_screen); - apply_style(label_status, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_status, ESP3DStyleType::bg_label); lv_label_set_text(label_status, ""); lv_obj_align_to(label_status, auto_leveling_screen_table, LV_ALIGN_OUT_BOTTOM_LEFT, 0, CURRENT_BUTTON_PRESSED_OUTLINE); diff --git a/main/display/3dprinter/marlin/screens/fan_screen.cpp b/main/display/3dprinter/marlin/screens/fan_screen.cpp index d31ad5e4..320c925f 100644 --- a/main/display/3dprinter/marlin/screens/fan_screen.cpp +++ b/main/display/3dprinter/marlin/screens/fan_screen.cpp @@ -89,7 +89,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_fan_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -305,7 +305,7 @@ void fan_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -315,7 +315,7 @@ void fan_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, fan_steps_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(fan_steps_buttons_map) / sizeof(fan_steps_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -329,7 +329,7 @@ void fan_screen() { // Current Fan label label_current_fan = lv_label_create(ui_new_screen); lv_label_set_text(label_current_fan, fan_buttons_map[fan_buttons_map_id]); - apply_style(label_current_fan, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_fan, ESP3DStyleType::bg_label); lv_obj_align(label_current_fan, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_fan); @@ -340,7 +340,7 @@ void fan_screen() { label_current_fan_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_fan_value, current_fan_value_init.c_str()); - apply_style(label_current_fan_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_fan_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_fan_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_fan_value, label_current_fan, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -349,7 +349,7 @@ void fan_screen() { // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, "%"); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_fan_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -373,14 +373,14 @@ void fan_screen() { // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FAN); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, fan_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, fan_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/marlin/screens/filament_screen.cpp b/main/display/3dprinter/marlin/screens/filament_screen.cpp index afb9bf24..5e277be1 100644 --- a/main/display/3dprinter/marlin/screens/filament_screen.cpp +++ b/main/display/3dprinter/marlin/screens/filament_screen.cpp @@ -91,7 +91,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_filament_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -289,7 +289,7 @@ void filament_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -299,7 +299,7 @@ void filament_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, filament_distance_steps_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(filament_distance_steps_buttons_map) / sizeof(filament_distance_steps_buttons_map[0])) - 1; @@ -312,7 +312,7 @@ void filament_screen() { // Text area label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FILAMENT); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_update_layout(label_ta); int32_t label_width = lv_obj_get_width(label_ta); int32_t label_height = lv_obj_get_height(label_ta); @@ -355,7 +355,7 @@ void filament_screen() { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, filament_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -363,7 +363,7 @@ void filament_screen() { label_current_temperature_filament = lv_label_create(ui_new_screen); lv_label_set_text(label_current_temperature_filament, filament_buttons_map[filament_buttons_map_id]); - apply_style(label_current_temperature_filament, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_temperature_filament, ESP3DStyleType::bg_label); lv_obj_align_to(label_current_temperature_filament, label_unit2, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE * 3, 0); @@ -379,7 +379,7 @@ void filament_screen() { label_current_temperature_filament_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_temperature_filament_value, current_temperature_filament_value_init.c_str()); - apply_style(label_current_temperature_filament_value, + ESP3DStyle::apply(label_current_temperature_filament_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_filament_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_filament_value, @@ -390,7 +390,7 @@ void filament_screen() { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_filament_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/marlin/screens/informations_screen.cpp b/main/display/3dprinter/marlin/screens/informations_screen.cpp index ef81b951..5b58aa87 100644 --- a/main/display/3dprinter/marlin/screens/informations_screen.cpp +++ b/main/display/3dprinter/marlin/screens/informations_screen.cpp @@ -94,7 +94,7 @@ void informations_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -104,7 +104,7 @@ void informations_screen() { lv_obj_set_style_flex_flow(ui_new_screen, LV_FLEX_FLOW_ROW, LV_FLEX_ALIGN_SPACE_EVENLY); lv_obj_t *ui_info_list_ctl = lv_list_create(ui_new_screen); - apply_style(ui_info_list_ctl, ESP3DStyleType::status_list); + ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, diff --git a/main/display/3dprinter/marlin/screens/leveling_screen.cpp b/main/display/3dprinter/marlin/screens/leveling_screen.cpp index f21f2d3c..8c36e052 100644 --- a/main/display/3dprinter/marlin/screens/leveling_screen.cpp +++ b/main/display/3dprinter/marlin/screens/leveling_screen.cpp @@ -116,7 +116,7 @@ void leveling_screen(bool autoleveling) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -127,9 +127,9 @@ void leveling_screen(bool autoleveling) { ui_new_screen, btnback, ESP3DStyleType::col_container); lv_obj_t *ui_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_buttons_container); + ESP3DStyle::add_pad(ui_buttons_container); lv_obj_clear_flag(ui_buttons_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_t *btn = nullptr; diff --git a/main/display/3dprinter/marlin/screens/main_screen.cpp b/main/display/3dprinter/marlin/screens/main_screen.cpp index aee22fb6..f16ea93f 100644 --- a/main/display/3dprinter/marlin/screens/main_screen.cpp +++ b/main/display/3dprinter/marlin/screens/main_screen.cpp @@ -22,14 +22,15 @@ #include -#include "screens/empty_screen.h" #include "esp3d_hal.h" #include "esp3d_log.h" #include "esp3d_string.h" #include "esp3d_styles.h" #include "esp3d_tft_ui.h" +#include "screens/empty_screen.h" #include "screens/fan_screen.h" + #if ESP3D_SD_CARD_FEATURE #include "screens/files_screen.h" #endif // ESP3D_SD_CARD_FEATURE @@ -38,14 +39,15 @@ #include "components/status_bar_component.h" #include "components/symbol_button_component.h" #include "esp3d_json_settings.h" -#include "screens/filament_screen.h" #include "gcode_host/esp3d_gcode_host_service.h" +#include "screens/filament_screen.h" #include "screens/menu_screen.h" #include "screens/positions_screen.h" #include "screens/speed_screen.h" #include "screens/temperatures_screen.h" #include "translations/esp3d_translation_service.h" + /********************** * STATIC PROTOTYPES **********************/ @@ -655,7 +657,7 @@ void main_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_main_screen); - apply_style(ui_main_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_main_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *ui_status_bar_container = statusBar::status_bar(ui_main_screen); @@ -663,7 +665,7 @@ void main_screen() { // create container for main screen buttons lv_obj_t *ui_container_main_screen = lv_obj_create(ui_main_screen); - apply_style(ui_container_main_screen, ESP3DStyleType::col_container); + ESP3DStyle::apply(ui_container_main_screen, ESP3DStyleType::col_container); lv_obj_clear_flag(ui_container_main_screen, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_size(ui_container_main_screen, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(ui_status_bar_container)); @@ -672,23 +674,23 @@ void main_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Middle container lv_obj_t *ui_middle_container = lv_btn_create(ui_container_main_screen); - apply_style(ui_middle_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_middle_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_middle_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_middle_container); + ESP3DStyle::add_pad(ui_middle_container); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); //********************************** @@ -721,7 +723,7 @@ void main_screen() { // Create button and label for middle container main_label_progression_area = lv_label_create(ui_middle_container); - apply_style(main_label_progression_area, ESP3DStyleType::status_bar); + ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, diff --git a/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp b/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp index ca9d4e50..fbf5e613 100644 --- a/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp +++ b/main/display/3dprinter/marlin/screens/manual_leveling_screen.cpp @@ -368,7 +368,7 @@ void manual_leveling_screen(bool autoleveling) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // Button back @@ -380,7 +380,7 @@ void manual_leveling_screen(bool autoleveling) { // Manual leveling button matrix btnm_leveling_position = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm_leveling_position, leveling_position_buttons_map); - apply_style(btnm_leveling_position, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_leveling_position, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_leveling_position); lv_obj_set_pos(btnm_leveling_position, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); @@ -427,7 +427,7 @@ void manual_leveling_screen(bool autoleveling) { // Status container status_container = lv_obj_create(ui_new_screen); - apply_style(status_container, ESP3DStyleType::text_container); + ESP3DStyle::apply(status_container, ESP3DStyleType::text_container); lv_obj_set_size(status_container, (LV_HOR_RES / 2) - (3 * CURRENT_BUTTON_PRESSED_OUTLINE), LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 4) - diff --git a/main/display/3dprinter/marlin/screens/menu_screen.cpp b/main/display/3dprinter/marlin/screens/menu_screen.cpp index 88d4f2c2..85383e6e 100644 --- a/main/display/3dprinter/marlin/screens/menu_screen.cpp +++ b/main/display/3dprinter/marlin/screens/menu_screen.cpp @@ -231,7 +231,7 @@ void menu_screen() { lv_obj_t *ui_new_screen = lv_obj_create(NULL); lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -242,16 +242,16 @@ void menu_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); //********************************** diff --git a/main/display/3dprinter/marlin/screens/positions_screen.cpp b/main/display/3dprinter/marlin/screens/positions_screen.cpp index faa9d564..44b60999 100644 --- a/main/display/3dprinter/marlin/screens/positions_screen.cpp +++ b/main/display/3dprinter/marlin/screens/positions_screen.cpp @@ -308,7 +308,7 @@ void positions_screen(uint8_t target_id) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // back button @@ -319,7 +319,7 @@ void positions_screen(uint8_t target_id) { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, positions_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(positions_buttons_map) / sizeof(positions_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -333,7 +333,7 @@ void positions_screen(uint8_t target_id) { // Target selector button matrix lv_obj_t *btnm_target = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm_target, axis_buttons_map); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); size_t i2 = (sizeof(axis_buttons_map) / sizeof(axis_buttons_map[0])) - 1; lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i2, MATRIX_BUTTON_HEIGHT); lv_btnmatrix_set_btn_ctrl(btnm_target, axis_buttons_map_id, @@ -353,7 +353,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_current_position, axis_buttons_map[axis_buttons_map_id]); // need to change // according axis - apply_style(label_current_position, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_position, ESP3DStyleType::bg_label); lv_obj_align(label_current_position, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_position); @@ -383,7 +383,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_current_position_value, current_position_value_init.c_str()); - apply_style(label_current_position_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_position_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_position_value, LV_HOR_RES / 5); lv_obj_align_to(label_current_position_value, label_current_position, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -392,7 +392,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_position_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -429,7 +429,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_target, LV_SYMBOL_JOG); // need to change according // axis - apply_style(label_target, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, position_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -437,7 +437,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, position_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -459,7 +459,7 @@ void positions_screen(uint8_t target_id) { // absolute /relative mode button lv_obj_t *btn_mode = lv_btn_create(ui_new_screen); - apply_style(btn_mode, ESP3DStyleType::button); + ESP3DStyle::apply(btn_mode, ESP3DStyleType::button); lv_obj_t *label = lv_label_create(btn_mode); lv_label_set_recolor(label, true); updateModeLabel(absolute_position, label); diff --git a/main/display/3dprinter/marlin/screens/settings_screen.cpp b/main/display/3dprinter/marlin/screens/settings_screen.cpp index 002672dd..7601a4ac 100644 --- a/main/display/3dprinter/marlin/screens/settings_screen.cpp +++ b/main/display/3dprinter/marlin/screens/settings_screen.cpp @@ -615,7 +615,7 @@ void settings_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); diff --git a/main/display/3dprinter/marlin/screens/speed_screen.cpp b/main/display/3dprinter/marlin/screens/speed_screen.cpp index 0f865dd3..4f8c496b 100644 --- a/main/display/3dprinter/marlin/screens/speed_screen.cpp +++ b/main/display/3dprinter/marlin/screens/speed_screen.cpp @@ -162,7 +162,7 @@ void speed_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -172,7 +172,7 @@ void speed_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, speed_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(speed_buttons_map) / sizeof(speed_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, @@ -185,7 +185,7 @@ void speed_screen() { // Current Speed label lv_obj_t *label_current_speed = lv_label_create(ui_new_screen); lv_label_set_text(label_current_speed, LV_SYMBOL_SPEED); - apply_style(label_current_speed, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_speed, ESP3DStyleType::bg_label); lv_obj_align(label_current_speed, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_speed); @@ -197,7 +197,7 @@ void speed_screen() { label_current_speed_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_speed_value, current_speed_value_init.c_str()); - apply_style(label_current_speed_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_speed_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_speed_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_speed_value, label_current_speed, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -206,7 +206,7 @@ void speed_screen() { // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, "%"); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_speed_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -232,14 +232,14 @@ void speed_screen() { // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_SPEED); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, speed_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, speed_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/marlin/screens/temperatures_screen.cpp b/main/display/3dprinter/marlin/screens/temperatures_screen.cpp index fe56cae1..fb9dbaa6 100644 --- a/main/display/3dprinter/marlin/screens/temperatures_screen.cpp +++ b/main/display/3dprinter/marlin/screens/temperatures_screen.cpp @@ -129,7 +129,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_heater_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -442,7 +442,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // back button @@ -453,7 +453,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, temperatures_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(temperatures_buttons_map) / sizeof(temperatures_buttons_map[0])) - 1; @@ -484,7 +484,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_current_temperature, heater_buttons_map[heater_buttons_map_id]); // need to change according // heater - apply_style(label_current_temperature, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_temperature, ESP3DStyleType::bg_label); lv_obj_align(label_current_temperature, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_temperature); @@ -523,7 +523,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { } lv_label_set_text(label_current_temperature_value, current_temperature_value_init.c_str()); - apply_style(label_current_temperature_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_temperature_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_value, label_current_temperature, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -532,7 +532,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -573,7 +573,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_label_set_text(label_target, LV_SYMBOL_HEAT_EXTRUDER); // need to change according // heater - apply_style(label_target, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, temperatures_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -581,7 +581,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -628,7 +628,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_label_set_text(label_target_temperature_value, temperatures_value_init.c_str()); - apply_style(label_target_temperature_value, + ESP3DStyle::apply(label_target_temperature_value, ESP3DStyleType::read_only_setting); lv_obj_set_width(label_target_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_target_temperature_value, btn_down, @@ -639,7 +639,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_target_temperature_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -650,7 +650,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_target_temperature, heater_buttons_map[heater_buttons_map_id]); // need to change according // heater - apply_style(label_target_temperature, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target_temperature, ESP3DStyleType::bg_label); lv_obj_align_to(label_target_temperature, label_target_temperature_value, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, diff --git a/main/display/3dprinter/repetier/esp3d_styles.cpp b/main/display/3dprinter/repetier/esp3d_styles.cpp index f86fcfe2..36c2e232 100644 --- a/main/display/3dprinter/repetier/esp3d_styles.cpp +++ b/main/display/3dprinter/repetier/esp3d_styles.cpp @@ -22,9 +22,9 @@ #include "esp3d_log.h" -#define CURRENT_MAIN_BG_COLOR lv_color_hex(0x000000) +#define ESP3D_SCREEN_BACKGROUND_COLOR lv_color_hex(0x000000) -#define CURRENT_BG_LABEL_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) #define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) #define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) @@ -82,45 +82,45 @@ lv_style_t style_text_container; lv_style_t style_spinner_screen; lv_style_t style_spinner_text; -bool init_styles() { +bool ESP3DStyle::init() { /* Spinner screen */ lv_style_init(&style_spinner_screen); lv_style_set_text_opa(&style_spinner_screen, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_screen, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_spinner_screen, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_bg_opa(&style_spinner_screen, LV_OPA_50); /* Spinner text */ lv_style_init(&style_spinner_text); lv_style_set_text_opa(&style_spinner_text, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_text, CURRENT_BG_LABEL_TEXT_COLOR); + lv_style_set_text_color(&style_spinner_text, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); /* Main background */ lv_style_init(&style_main_bg); lv_style_set_text_opa(&style_main_bg, LV_OPA_COVER); - lv_style_set_text_color(&style_main_bg, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_main_bg, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_COLOR); /* Label on main background */ lv_style_init(&style_bg_label); lv_style_set_text_opa(&style_bg_label, LV_OPA_COVER); - lv_style_set_text_color(&style_bg_label, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_bg_label, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_COLOR); /* read only value on main background */ lv_style_init(&style_read_only_value); lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); - lv_style_set_text_color(&style_read_only_value, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_value, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -137,7 +137,7 @@ bool init_styles() { lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, CURRENT_BUTTON_PRESSED_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_setting, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -541,17 +541,17 @@ bool init_styles() { */ lv_style_init(&style_simple_container_default); lv_style_set_bg_opa(&style_simple_container_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_simple_container_default, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_simple_container_default, ESP3D_SCREEN_BACKGROUND_COLOR); // Text Container lv_style_init(&style_text_container); lv_style_set_bg_opa(&style_text_container, LV_OPA_COVER); - lv_style_set_bg_color(&style_text_container, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_text_container, ESP3D_SCREEN_BACKGROUND_COLOR); return true; } -bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { +bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { if (type != ESP3DStyleType::main_bg && type != ESP3DStyleType::status_list && type != ESP3DStyleType::buttons_msgbox && type != ESP3DStyleType::message_box && @@ -625,8 +625,8 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { break; case ESP3DStyleType::message_box: lv_obj_set_width(obj, LV_PCT(80)); - apply_style(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); - apply_style(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); + ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); + ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); break; @@ -651,7 +651,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { LV_PART_MAIN); break; case ESP3DStyleType::list_container: - apply_style(obj, ESP3DStyleType::col_container); + ESP3DStyle::apply(obj, ESP3DStyleType::col_container); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); @@ -675,7 +675,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::simple_container: lv_obj_add_style(obj, &style_simple_container_default, LV_STATE_DEFAULT); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - apply_outline_pad(obj); + ESP3DStyle::add_pad(obj); break; case ESP3DStyleType::status_list: lv_obj_add_style(obj, &style_status_list_default, LV_STATE_DEFAULT); @@ -688,7 +688,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { return true; } -bool apply_outline_pad(lv_obj_t* obj) { +bool ESP3DStyle::add_pad(lv_obj_t* obj) { lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); diff --git a/main/display/3dprinter/repetier/esp3d_styles.h b/main/display/3dprinter/repetier/esp3d_styles.h index 4c4a4f2b..70ef6146 100644 --- a/main/display/3dprinter/repetier/esp3d_styles.h +++ b/main/display/3dprinter/repetier/esp3d_styles.h @@ -48,6 +48,6 @@ enum class ESP3DStyleType : uint8_t { text_container, }; -extern bool init_styles(); -extern bool apply_style(lv_obj_t* obj, ESP3DStyleType type); -extern bool apply_outline_pad(lv_obj_t* obj); +extern bool ESP3DStyle::init(); +extern bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type); +extern bool ESP3DStyle::add_pad(lv_obj_t* obj); diff --git a/main/display/3dprinter/repetier/esp3d_tft_ui.cpp b/main/display/3dprinter/repetier/esp3d_tft_ui.cpp index 4224ecd2..ab696daf 100644 --- a/main/display/3dprinter/repetier/esp3d_tft_ui.cpp +++ b/main/display/3dprinter/repetier/esp3d_tft_ui.cpp @@ -25,6 +25,6 @@ **********************/ void create_application(void) { - init_styles(); + ESP3DStyle::init(); splashScreen::boot_screen(); } diff --git a/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp b/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp index 283748a1..9eba2990 100644 --- a/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp +++ b/main/display/3dprinter/repetier/screens/auto_leveling_screen.cpp @@ -259,7 +259,7 @@ void auto_leveling_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); homing_done = false; @@ -288,7 +288,7 @@ void auto_leveling_screen() { LV_EVENT_CLICKED, NULL); label_status = lv_label_create(ui_new_screen); - apply_style(label_status, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_status, ESP3DStyleType::bg_label); lv_label_set_text(label_status, ""); lv_obj_align_to(label_status, auto_leveling_screen_table, LV_ALIGN_OUT_BOTTOM_LEFT, 0, CURRENT_BUTTON_PRESSED_OUTLINE); diff --git a/main/display/3dprinter/repetier/screens/fan_screen.cpp b/main/display/3dprinter/repetier/screens/fan_screen.cpp index d31ad5e4..320c925f 100644 --- a/main/display/3dprinter/repetier/screens/fan_screen.cpp +++ b/main/display/3dprinter/repetier/screens/fan_screen.cpp @@ -89,7 +89,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_fan_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -305,7 +305,7 @@ void fan_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -315,7 +315,7 @@ void fan_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, fan_steps_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(fan_steps_buttons_map) / sizeof(fan_steps_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -329,7 +329,7 @@ void fan_screen() { // Current Fan label label_current_fan = lv_label_create(ui_new_screen); lv_label_set_text(label_current_fan, fan_buttons_map[fan_buttons_map_id]); - apply_style(label_current_fan, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_fan, ESP3DStyleType::bg_label); lv_obj_align(label_current_fan, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_fan); @@ -340,7 +340,7 @@ void fan_screen() { label_current_fan_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_fan_value, current_fan_value_init.c_str()); - apply_style(label_current_fan_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_fan_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_fan_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_fan_value, label_current_fan, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -349,7 +349,7 @@ void fan_screen() { // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, "%"); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_fan_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -373,14 +373,14 @@ void fan_screen() { // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FAN); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, fan_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, fan_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/repetier/screens/filament_screen.cpp b/main/display/3dprinter/repetier/screens/filament_screen.cpp index afb9bf24..5e277be1 100644 --- a/main/display/3dprinter/repetier/screens/filament_screen.cpp +++ b/main/display/3dprinter/repetier/screens/filament_screen.cpp @@ -91,7 +91,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_filament_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -289,7 +289,7 @@ void filament_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -299,7 +299,7 @@ void filament_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, filament_distance_steps_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(filament_distance_steps_buttons_map) / sizeof(filament_distance_steps_buttons_map[0])) - 1; @@ -312,7 +312,7 @@ void filament_screen() { // Text area label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FILAMENT); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_update_layout(label_ta); int32_t label_width = lv_obj_get_width(label_ta); int32_t label_height = lv_obj_get_height(label_ta); @@ -355,7 +355,7 @@ void filament_screen() { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, filament_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -363,7 +363,7 @@ void filament_screen() { label_current_temperature_filament = lv_label_create(ui_new_screen); lv_label_set_text(label_current_temperature_filament, filament_buttons_map[filament_buttons_map_id]); - apply_style(label_current_temperature_filament, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_temperature_filament, ESP3DStyleType::bg_label); lv_obj_align_to(label_current_temperature_filament, label_unit2, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE * 3, 0); @@ -379,7 +379,7 @@ void filament_screen() { label_current_temperature_filament_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_temperature_filament_value, current_temperature_filament_value_init.c_str()); - apply_style(label_current_temperature_filament_value, + ESP3DStyle::apply(label_current_temperature_filament_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_filament_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_filament_value, @@ -390,7 +390,7 @@ void filament_screen() { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_filament_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/repetier/screens/informations_screen.cpp b/main/display/3dprinter/repetier/screens/informations_screen.cpp index dd5fd229..dbf0d3de 100644 --- a/main/display/3dprinter/repetier/screens/informations_screen.cpp +++ b/main/display/3dprinter/repetier/screens/informations_screen.cpp @@ -94,7 +94,7 @@ void informations_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -104,7 +104,7 @@ void informations_screen() { lv_obj_set_style_flex_flow(ui_new_screen, LV_FLEX_FLOW_ROW, LV_FLEX_ALIGN_SPACE_EVENLY); lv_obj_t *ui_info_list_ctl = lv_list_create(ui_new_screen); - apply_style(ui_info_list_ctl, ESP3DStyleType::status_list); + ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, diff --git a/main/display/3dprinter/repetier/screens/leveling_screen.cpp b/main/display/3dprinter/repetier/screens/leveling_screen.cpp index f21f2d3c..8c36e052 100644 --- a/main/display/3dprinter/repetier/screens/leveling_screen.cpp +++ b/main/display/3dprinter/repetier/screens/leveling_screen.cpp @@ -116,7 +116,7 @@ void leveling_screen(bool autoleveling) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -127,9 +127,9 @@ void leveling_screen(bool autoleveling) { ui_new_screen, btnback, ESP3DStyleType::col_container); lv_obj_t *ui_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_buttons_container); + ESP3DStyle::add_pad(ui_buttons_container); lv_obj_clear_flag(ui_buttons_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_t *btn = nullptr; diff --git a/main/display/3dprinter/repetier/screens/main_screen.cpp b/main/display/3dprinter/repetier/screens/main_screen.cpp index aee22fb6..34d68a48 100644 --- a/main/display/3dprinter/repetier/screens/main_screen.cpp +++ b/main/display/3dprinter/repetier/screens/main_screen.cpp @@ -655,7 +655,7 @@ void main_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_main_screen); - apply_style(ui_main_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_main_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *ui_status_bar_container = statusBar::status_bar(ui_main_screen); @@ -663,7 +663,7 @@ void main_screen() { // create container for main screen buttons lv_obj_t *ui_container_main_screen = lv_obj_create(ui_main_screen); - apply_style(ui_container_main_screen, ESP3DStyleType::col_container); + ESP3DStyle::apply(ui_container_main_screen, ESP3DStyleType::col_container); lv_obj_clear_flag(ui_container_main_screen, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_size(ui_container_main_screen, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(ui_status_bar_container)); @@ -672,23 +672,23 @@ void main_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Middle container lv_obj_t *ui_middle_container = lv_btn_create(ui_container_main_screen); - apply_style(ui_middle_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_middle_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_middle_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_middle_container); + ESP3DStyle::add_pad(ui_middle_container); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); //********************************** @@ -721,7 +721,7 @@ void main_screen() { // Create button and label for middle container main_label_progression_area = lv_label_create(ui_middle_container); - apply_style(main_label_progression_area, ESP3DStyleType::status_bar); + ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, diff --git a/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp b/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp index ca9d4e50..fbf5e613 100644 --- a/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp +++ b/main/display/3dprinter/repetier/screens/manual_leveling_screen.cpp @@ -368,7 +368,7 @@ void manual_leveling_screen(bool autoleveling) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // Button back @@ -380,7 +380,7 @@ void manual_leveling_screen(bool autoleveling) { // Manual leveling button matrix btnm_leveling_position = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm_leveling_position, leveling_position_buttons_map); - apply_style(btnm_leveling_position, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_leveling_position, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_leveling_position); lv_obj_set_pos(btnm_leveling_position, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); @@ -427,7 +427,7 @@ void manual_leveling_screen(bool autoleveling) { // Status container status_container = lv_obj_create(ui_new_screen); - apply_style(status_container, ESP3DStyleType::text_container); + ESP3DStyle::apply(status_container, ESP3DStyleType::text_container); lv_obj_set_size(status_container, (LV_HOR_RES / 2) - (3 * CURRENT_BUTTON_PRESSED_OUTLINE), LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 4) - diff --git a/main/display/3dprinter/repetier/screens/menu_screen.cpp b/main/display/3dprinter/repetier/screens/menu_screen.cpp index 88d4f2c2..85383e6e 100644 --- a/main/display/3dprinter/repetier/screens/menu_screen.cpp +++ b/main/display/3dprinter/repetier/screens/menu_screen.cpp @@ -231,7 +231,7 @@ void menu_screen() { lv_obj_t *ui_new_screen = lv_obj_create(NULL); lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -242,16 +242,16 @@ void menu_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); //********************************** diff --git a/main/display/3dprinter/repetier/screens/positions_screen.cpp b/main/display/3dprinter/repetier/screens/positions_screen.cpp index faa9d564..44b60999 100644 --- a/main/display/3dprinter/repetier/screens/positions_screen.cpp +++ b/main/display/3dprinter/repetier/screens/positions_screen.cpp @@ -308,7 +308,7 @@ void positions_screen(uint8_t target_id) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // back button @@ -319,7 +319,7 @@ void positions_screen(uint8_t target_id) { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, positions_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(positions_buttons_map) / sizeof(positions_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -333,7 +333,7 @@ void positions_screen(uint8_t target_id) { // Target selector button matrix lv_obj_t *btnm_target = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm_target, axis_buttons_map); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); size_t i2 = (sizeof(axis_buttons_map) / sizeof(axis_buttons_map[0])) - 1; lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i2, MATRIX_BUTTON_HEIGHT); lv_btnmatrix_set_btn_ctrl(btnm_target, axis_buttons_map_id, @@ -353,7 +353,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_current_position, axis_buttons_map[axis_buttons_map_id]); // need to change // according axis - apply_style(label_current_position, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_position, ESP3DStyleType::bg_label); lv_obj_align(label_current_position, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_position); @@ -383,7 +383,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_current_position_value, current_position_value_init.c_str()); - apply_style(label_current_position_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_position_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_position_value, LV_HOR_RES / 5); lv_obj_align_to(label_current_position_value, label_current_position, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -392,7 +392,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_position_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -429,7 +429,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_target, LV_SYMBOL_JOG); // need to change according // axis - apply_style(label_target, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, position_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -437,7 +437,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, position_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -459,7 +459,7 @@ void positions_screen(uint8_t target_id) { // absolute /relative mode button lv_obj_t *btn_mode = lv_btn_create(ui_new_screen); - apply_style(btn_mode, ESP3DStyleType::button); + ESP3DStyle::apply(btn_mode, ESP3DStyleType::button); lv_obj_t *label = lv_label_create(btn_mode); lv_label_set_recolor(label, true); updateModeLabel(absolute_position, label); diff --git a/main/display/3dprinter/repetier/screens/settings_screen.cpp b/main/display/3dprinter/repetier/screens/settings_screen.cpp index 002672dd..7601a4ac 100644 --- a/main/display/3dprinter/repetier/screens/settings_screen.cpp +++ b/main/display/3dprinter/repetier/screens/settings_screen.cpp @@ -615,7 +615,7 @@ void settings_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); diff --git a/main/display/3dprinter/repetier/screens/speed_screen.cpp b/main/display/3dprinter/repetier/screens/speed_screen.cpp index 0f865dd3..4f8c496b 100644 --- a/main/display/3dprinter/repetier/screens/speed_screen.cpp +++ b/main/display/3dprinter/repetier/screens/speed_screen.cpp @@ -162,7 +162,7 @@ void speed_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -172,7 +172,7 @@ void speed_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, speed_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(speed_buttons_map) / sizeof(speed_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, @@ -185,7 +185,7 @@ void speed_screen() { // Current Speed label lv_obj_t *label_current_speed = lv_label_create(ui_new_screen); lv_label_set_text(label_current_speed, LV_SYMBOL_SPEED); - apply_style(label_current_speed, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_speed, ESP3DStyleType::bg_label); lv_obj_align(label_current_speed, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_speed); @@ -197,7 +197,7 @@ void speed_screen() { label_current_speed_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_speed_value, current_speed_value_init.c_str()); - apply_style(label_current_speed_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_speed_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_speed_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_speed_value, label_current_speed, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -206,7 +206,7 @@ void speed_screen() { // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, "%"); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_speed_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -232,14 +232,14 @@ void speed_screen() { // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_SPEED); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, speed_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, speed_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/repetier/screens/temperatures_screen.cpp b/main/display/3dprinter/repetier/screens/temperatures_screen.cpp index fe56cae1..fb9dbaa6 100644 --- a/main/display/3dprinter/repetier/screens/temperatures_screen.cpp +++ b/main/display/3dprinter/repetier/screens/temperatures_screen.cpp @@ -129,7 +129,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_heater_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -442,7 +442,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // back button @@ -453,7 +453,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, temperatures_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(temperatures_buttons_map) / sizeof(temperatures_buttons_map[0])) - 1; @@ -484,7 +484,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_current_temperature, heater_buttons_map[heater_buttons_map_id]); // need to change according // heater - apply_style(label_current_temperature, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_temperature, ESP3DStyleType::bg_label); lv_obj_align(label_current_temperature, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_temperature); @@ -523,7 +523,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { } lv_label_set_text(label_current_temperature_value, current_temperature_value_init.c_str()); - apply_style(label_current_temperature_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_temperature_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_value, label_current_temperature, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -532,7 +532,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -573,7 +573,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_label_set_text(label_target, LV_SYMBOL_HEAT_EXTRUDER); // need to change according // heater - apply_style(label_target, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, temperatures_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -581,7 +581,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -628,7 +628,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_label_set_text(label_target_temperature_value, temperatures_value_init.c_str()); - apply_style(label_target_temperature_value, + ESP3DStyle::apply(label_target_temperature_value, ESP3DStyleType::read_only_setting); lv_obj_set_width(label_target_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_target_temperature_value, btn_down, @@ -639,7 +639,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_target_temperature_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -650,7 +650,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_target_temperature, heater_buttons_map[heater_buttons_map_id]); // need to change according // heater - apply_style(label_target_temperature, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target_temperature, ESP3DStyleType::bg_label); lv_obj_align_to(label_target_temperature, label_target_temperature_value, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, diff --git a/main/display/3dprinter/smoothieware/esp3d_styles.cpp b/main/display/3dprinter/smoothieware/esp3d_styles.cpp index f86fcfe2..36c2e232 100644 --- a/main/display/3dprinter/smoothieware/esp3d_styles.cpp +++ b/main/display/3dprinter/smoothieware/esp3d_styles.cpp @@ -22,9 +22,9 @@ #include "esp3d_log.h" -#define CURRENT_MAIN_BG_COLOR lv_color_hex(0x000000) +#define ESP3D_SCREEN_BACKGROUND_COLOR lv_color_hex(0x000000) -#define CURRENT_BG_LABEL_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) #define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) #define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) @@ -82,45 +82,45 @@ lv_style_t style_text_container; lv_style_t style_spinner_screen; lv_style_t style_spinner_text; -bool init_styles() { +bool ESP3DStyle::init() { /* Spinner screen */ lv_style_init(&style_spinner_screen); lv_style_set_text_opa(&style_spinner_screen, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_screen, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_spinner_screen, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_bg_opa(&style_spinner_screen, LV_OPA_50); /* Spinner text */ lv_style_init(&style_spinner_text); lv_style_set_text_opa(&style_spinner_text, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_text, CURRENT_BG_LABEL_TEXT_COLOR); + lv_style_set_text_color(&style_spinner_text, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); /* Main background */ lv_style_init(&style_main_bg); lv_style_set_text_opa(&style_main_bg, LV_OPA_COVER); - lv_style_set_text_color(&style_main_bg, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_main_bg, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_COLOR); /* Label on main background */ lv_style_init(&style_bg_label); lv_style_set_text_opa(&style_bg_label, LV_OPA_COVER); - lv_style_set_text_color(&style_bg_label, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_bg_label, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_COLOR); /* read only value on main background */ lv_style_init(&style_read_only_value); lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); - lv_style_set_text_color(&style_read_only_value, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_value, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -137,7 +137,7 @@ bool init_styles() { lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, CURRENT_BUTTON_PRESSED_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_setting, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -541,17 +541,17 @@ bool init_styles() { */ lv_style_init(&style_simple_container_default); lv_style_set_bg_opa(&style_simple_container_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_simple_container_default, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_simple_container_default, ESP3D_SCREEN_BACKGROUND_COLOR); // Text Container lv_style_init(&style_text_container); lv_style_set_bg_opa(&style_text_container, LV_OPA_COVER); - lv_style_set_bg_color(&style_text_container, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_text_container, ESP3D_SCREEN_BACKGROUND_COLOR); return true; } -bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { +bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { if (type != ESP3DStyleType::main_bg && type != ESP3DStyleType::status_list && type != ESP3DStyleType::buttons_msgbox && type != ESP3DStyleType::message_box && @@ -625,8 +625,8 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { break; case ESP3DStyleType::message_box: lv_obj_set_width(obj, LV_PCT(80)); - apply_style(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); - apply_style(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); + ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); + ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); break; @@ -651,7 +651,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { LV_PART_MAIN); break; case ESP3DStyleType::list_container: - apply_style(obj, ESP3DStyleType::col_container); + ESP3DStyle::apply(obj, ESP3DStyleType::col_container); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); @@ -675,7 +675,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::simple_container: lv_obj_add_style(obj, &style_simple_container_default, LV_STATE_DEFAULT); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - apply_outline_pad(obj); + ESP3DStyle::add_pad(obj); break; case ESP3DStyleType::status_list: lv_obj_add_style(obj, &style_status_list_default, LV_STATE_DEFAULT); @@ -688,7 +688,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { return true; } -bool apply_outline_pad(lv_obj_t* obj) { +bool ESP3DStyle::add_pad(lv_obj_t* obj) { lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); diff --git a/main/display/3dprinter/smoothieware/esp3d_styles.h b/main/display/3dprinter/smoothieware/esp3d_styles.h index 4c4a4f2b..70ef6146 100644 --- a/main/display/3dprinter/smoothieware/esp3d_styles.h +++ b/main/display/3dprinter/smoothieware/esp3d_styles.h @@ -48,6 +48,6 @@ enum class ESP3DStyleType : uint8_t { text_container, }; -extern bool init_styles(); -extern bool apply_style(lv_obj_t* obj, ESP3DStyleType type); -extern bool apply_outline_pad(lv_obj_t* obj); +extern bool ESP3DStyle::init(); +extern bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type); +extern bool ESP3DStyle::add_pad(lv_obj_t* obj); diff --git a/main/display/3dprinter/smoothieware/esp3d_tft_ui.cpp b/main/display/3dprinter/smoothieware/esp3d_tft_ui.cpp index 4224ecd2..ab696daf 100644 --- a/main/display/3dprinter/smoothieware/esp3d_tft_ui.cpp +++ b/main/display/3dprinter/smoothieware/esp3d_tft_ui.cpp @@ -25,6 +25,6 @@ **********************/ void create_application(void) { - init_styles(); + ESP3DStyle::init(); splashScreen::boot_screen(); } diff --git a/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp b/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp index 283748a1..9eba2990 100644 --- a/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/auto_leveling_screen.cpp @@ -259,7 +259,7 @@ void auto_leveling_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); homing_done = false; @@ -288,7 +288,7 @@ void auto_leveling_screen() { LV_EVENT_CLICKED, NULL); label_status = lv_label_create(ui_new_screen); - apply_style(label_status, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_status, ESP3DStyleType::bg_label); lv_label_set_text(label_status, ""); lv_obj_align_to(label_status, auto_leveling_screen_table, LV_ALIGN_OUT_BOTTOM_LEFT, 0, CURRENT_BUTTON_PRESSED_OUTLINE); diff --git a/main/display/3dprinter/smoothieware/screens/fan_screen.cpp b/main/display/3dprinter/smoothieware/screens/fan_screen.cpp index d31ad5e4..320c925f 100644 --- a/main/display/3dprinter/smoothieware/screens/fan_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/fan_screen.cpp @@ -89,7 +89,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_fan_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -305,7 +305,7 @@ void fan_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -315,7 +315,7 @@ void fan_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, fan_steps_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(fan_steps_buttons_map) / sizeof(fan_steps_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -329,7 +329,7 @@ void fan_screen() { // Current Fan label label_current_fan = lv_label_create(ui_new_screen); lv_label_set_text(label_current_fan, fan_buttons_map[fan_buttons_map_id]); - apply_style(label_current_fan, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_fan, ESP3DStyleType::bg_label); lv_obj_align(label_current_fan, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_fan); @@ -340,7 +340,7 @@ void fan_screen() { label_current_fan_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_fan_value, current_fan_value_init.c_str()); - apply_style(label_current_fan_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_fan_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_fan_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_fan_value, label_current_fan, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -349,7 +349,7 @@ void fan_screen() { // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, "%"); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_fan_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -373,14 +373,14 @@ void fan_screen() { // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FAN); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, fan_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, fan_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/smoothieware/screens/filament_screen.cpp b/main/display/3dprinter/smoothieware/screens/filament_screen.cpp index afb9bf24..5e277be1 100644 --- a/main/display/3dprinter/smoothieware/screens/filament_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/filament_screen.cpp @@ -91,7 +91,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_filament_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -289,7 +289,7 @@ void filament_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -299,7 +299,7 @@ void filament_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, filament_distance_steps_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(filament_distance_steps_buttons_map) / sizeof(filament_distance_steps_buttons_map[0])) - 1; @@ -312,7 +312,7 @@ void filament_screen() { // Text area label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_FILAMENT); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_update_layout(label_ta); int32_t label_width = lv_obj_get_width(label_ta); int32_t label_height = lv_obj_get_height(label_ta); @@ -355,7 +355,7 @@ void filament_screen() { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, filament_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -363,7 +363,7 @@ void filament_screen() { label_current_temperature_filament = lv_label_create(ui_new_screen); lv_label_set_text(label_current_temperature_filament, filament_buttons_map[filament_buttons_map_id]); - apply_style(label_current_temperature_filament, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_temperature_filament, ESP3DStyleType::bg_label); lv_obj_align_to(label_current_temperature_filament, label_unit2, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE * 3, 0); @@ -379,7 +379,7 @@ void filament_screen() { label_current_temperature_filament_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_temperature_filament_value, current_temperature_filament_value_init.c_str()); - apply_style(label_current_temperature_filament_value, + ESP3DStyle::apply(label_current_temperature_filament_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_filament_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_filament_value, @@ -390,7 +390,7 @@ void filament_screen() { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_filament_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/smoothieware/screens/informations_screen.cpp b/main/display/3dprinter/smoothieware/screens/informations_screen.cpp index b80874ea..096d8f4c 100644 --- a/main/display/3dprinter/smoothieware/screens/informations_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/informations_screen.cpp @@ -94,7 +94,7 @@ void informations_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -104,7 +104,7 @@ void informations_screen() { lv_obj_set_style_flex_flow(ui_new_screen, LV_FLEX_FLOW_ROW, LV_FLEX_ALIGN_SPACE_EVENLY); lv_obj_t *ui_info_list_ctl = lv_list_create(ui_new_screen); - apply_style(ui_info_list_ctl, ESP3DStyleType::status_list); + ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, diff --git a/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp b/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp index f21f2d3c..8c36e052 100644 --- a/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/leveling_screen.cpp @@ -116,7 +116,7 @@ void leveling_screen(bool autoleveling) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -127,9 +127,9 @@ void leveling_screen(bool autoleveling) { ui_new_screen, btnback, ESP3DStyleType::col_container); lv_obj_t *ui_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_buttons_container); + ESP3DStyle::add_pad(ui_buttons_container); lv_obj_clear_flag(ui_buttons_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_t *btn = nullptr; diff --git a/main/display/3dprinter/smoothieware/screens/main_screen.cpp b/main/display/3dprinter/smoothieware/screens/main_screen.cpp index aee22fb6..34d68a48 100644 --- a/main/display/3dprinter/smoothieware/screens/main_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/main_screen.cpp @@ -655,7 +655,7 @@ void main_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_main_screen); - apply_style(ui_main_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_main_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *ui_status_bar_container = statusBar::status_bar(ui_main_screen); @@ -663,7 +663,7 @@ void main_screen() { // create container for main screen buttons lv_obj_t *ui_container_main_screen = lv_obj_create(ui_main_screen); - apply_style(ui_container_main_screen, ESP3DStyleType::col_container); + ESP3DStyle::apply(ui_container_main_screen, ESP3DStyleType::col_container); lv_obj_clear_flag(ui_container_main_screen, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_size(ui_container_main_screen, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(ui_status_bar_container)); @@ -672,23 +672,23 @@ void main_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Middle container lv_obj_t *ui_middle_container = lv_btn_create(ui_container_main_screen); - apply_style(ui_middle_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_middle_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_middle_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_middle_container); + ESP3DStyle::add_pad(ui_middle_container); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); //********************************** @@ -721,7 +721,7 @@ void main_screen() { // Create button and label for middle container main_label_progression_area = lv_label_create(ui_middle_container); - apply_style(main_label_progression_area, ESP3DStyleType::status_bar); + ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, diff --git a/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp b/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp index ca9d4e50..fbf5e613 100644 --- a/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/manual_leveling_screen.cpp @@ -368,7 +368,7 @@ void manual_leveling_screen(bool autoleveling) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // Button back @@ -380,7 +380,7 @@ void manual_leveling_screen(bool autoleveling) { // Manual leveling button matrix btnm_leveling_position = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm_leveling_position, leveling_position_buttons_map); - apply_style(btnm_leveling_position, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_leveling_position, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_leveling_position); lv_obj_set_pos(btnm_leveling_position, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); @@ -427,7 +427,7 @@ void manual_leveling_screen(bool autoleveling) { // Status container status_container = lv_obj_create(ui_new_screen); - apply_style(status_container, ESP3DStyleType::text_container); + ESP3DStyle::apply(status_container, ESP3DStyleType::text_container); lv_obj_set_size(status_container, (LV_HOR_RES / 2) - (3 * CURRENT_BUTTON_PRESSED_OUTLINE), LV_VER_RES - (CURRENT_BUTTON_PRESSED_OUTLINE * 4) - diff --git a/main/display/3dprinter/smoothieware/screens/menu_screen.cpp b/main/display/3dprinter/smoothieware/screens/menu_screen.cpp index 88d4f2c2..85383e6e 100644 --- a/main/display/3dprinter/smoothieware/screens/menu_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/menu_screen.cpp @@ -231,7 +231,7 @@ void menu_screen() { lv_obj_t *ui_new_screen = lv_obj_create(NULL); lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -242,16 +242,16 @@ void menu_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); //********************************** diff --git a/main/display/3dprinter/smoothieware/screens/positions_screen.cpp b/main/display/3dprinter/smoothieware/screens/positions_screen.cpp index faa9d564..44b60999 100644 --- a/main/display/3dprinter/smoothieware/screens/positions_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/positions_screen.cpp @@ -308,7 +308,7 @@ void positions_screen(uint8_t target_id) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // back button @@ -319,7 +319,7 @@ void positions_screen(uint8_t target_id) { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, positions_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(positions_buttons_map) / sizeof(positions_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -333,7 +333,7 @@ void positions_screen(uint8_t target_id) { // Target selector button matrix lv_obj_t *btnm_target = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm_target, axis_buttons_map); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); size_t i2 = (sizeof(axis_buttons_map) / sizeof(axis_buttons_map[0])) - 1; lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i2, MATRIX_BUTTON_HEIGHT); lv_btnmatrix_set_btn_ctrl(btnm_target, axis_buttons_map_id, @@ -353,7 +353,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_current_position, axis_buttons_map[axis_buttons_map_id]); // need to change // according axis - apply_style(label_current_position, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_position, ESP3DStyleType::bg_label); lv_obj_align(label_current_position, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_position); @@ -383,7 +383,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_current_position_value, current_position_value_init.c_str()); - apply_style(label_current_position_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_position_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_position_value, LV_HOR_RES / 5); lv_obj_align_to(label_current_position_value, label_current_position, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -392,7 +392,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_position_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -429,7 +429,7 @@ void positions_screen(uint8_t target_id) { lv_label_set_text(label_target, LV_SYMBOL_JOG); // need to change according // axis - apply_style(label_target, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, position_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -437,7 +437,7 @@ void positions_screen(uint8_t target_id) { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::millimeters)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, position_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -459,7 +459,7 @@ void positions_screen(uint8_t target_id) { // absolute /relative mode button lv_obj_t *btn_mode = lv_btn_create(ui_new_screen); - apply_style(btn_mode, ESP3DStyleType::button); + ESP3DStyle::apply(btn_mode, ESP3DStyleType::button); lv_obj_t *label = lv_label_create(btn_mode); lv_label_set_recolor(label, true); updateModeLabel(absolute_position, label); diff --git a/main/display/3dprinter/smoothieware/screens/settings_screen.cpp b/main/display/3dprinter/smoothieware/screens/settings_screen.cpp index 002672dd..7601a4ac 100644 --- a/main/display/3dprinter/smoothieware/screens/settings_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/settings_screen.cpp @@ -615,7 +615,7 @@ void settings_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); diff --git a/main/display/3dprinter/smoothieware/screens/speed_screen.cpp b/main/display/3dprinter/smoothieware/screens/speed_screen.cpp index 0f865dd3..4f8c496b 100644 --- a/main/display/3dprinter/smoothieware/screens/speed_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/speed_screen.cpp @@ -162,7 +162,7 @@ void speed_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -172,7 +172,7 @@ void speed_screen() { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, speed_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(speed_buttons_map) / sizeof(speed_buttons_map[0])) - 1; lv_obj_set_size(btnm, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); lv_obj_align(btnm, LV_ALIGN_TOP_RIGHT, -CURRENT_BUTTON_PRESSED_OUTLINE, @@ -185,7 +185,7 @@ void speed_screen() { // Current Speed label lv_obj_t *label_current_speed = lv_label_create(ui_new_screen); lv_label_set_text(label_current_speed, LV_SYMBOL_SPEED); - apply_style(label_current_speed, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_speed, ESP3DStyleType::bg_label); lv_obj_align(label_current_speed, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_speed); @@ -197,7 +197,7 @@ void speed_screen() { label_current_speed_value = lv_label_create(ui_new_screen); lv_label_set_text(label_current_speed_value, current_speed_value_init.c_str()); - apply_style(label_current_speed_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_speed_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_speed_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_speed_value, label_current_speed, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -206,7 +206,7 @@ void speed_screen() { // unit lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, "%"); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_speed_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -232,14 +232,14 @@ void speed_screen() { // label lv_obj_t *label_ta = lv_label_create(ui_new_screen); lv_label_set_text(label_ta, LV_SYMBOL_SPEED); - apply_style(label_ta, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ta, ESP3DStyleType::bg_label); lv_obj_align_to(label_ta, speed_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); // unit lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, "%"); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, speed_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); diff --git a/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp b/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp index fe56cae1..fb9dbaa6 100644 --- a/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp +++ b/main/display/3dprinter/smoothieware/screens/temperatures_screen.cpp @@ -129,7 +129,7 @@ bool updateBtnMatrix() { // if yes update // then apply style lv_btnmatrix_set_map(btnm_target, get_heater_buttons_map()); - apply_style(btnm_target, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm_target, ESP3DStyleType::buttons_matrix); lv_obj_update_layout(btnm_target); size_t i = get_map_size(); lv_obj_set_size(btnm_target, MATRIX_BUTTON_WIDTH * i, MATRIX_BUTTON_HEIGHT); @@ -442,7 +442,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // back button @@ -453,7 +453,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { // Steps in button matrix lv_obj_t *btnm = lv_btnmatrix_create(ui_new_screen); lv_btnmatrix_set_map(btnm, temperatures_buttons_map); - apply_style(btnm, ESP3DStyleType::buttons_matrix); + ESP3DStyle::apply(btnm, ESP3DStyleType::buttons_matrix); size_t i = (sizeof(temperatures_buttons_map) / sizeof(temperatures_buttons_map[0])) - 1; @@ -484,7 +484,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_current_temperature, heater_buttons_map[heater_buttons_map_id]); // need to change according // heater - apply_style(label_current_temperature, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_current_temperature, ESP3DStyleType::bg_label); lv_obj_align(label_current_temperature, LV_ALIGN_TOP_LEFT, CURRENT_BUTTON_PRESSED_OUTLINE, CURRENT_BUTTON_PRESSED_OUTLINE); lv_obj_update_layout(label_current_temperature); @@ -523,7 +523,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { } lv_label_set_text(label_current_temperature_value, current_temperature_value_init.c_str()); - apply_style(label_current_temperature_value, ESP3DStyleType::read_only_value); + ESP3DStyle::apply(label_current_temperature_value, ESP3DStyleType::read_only_value); lv_obj_set_width(label_current_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_current_temperature_value, label_current_temperature, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, @@ -532,7 +532,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_current_temperature_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -573,7 +573,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_label_set_text(label_target, LV_SYMBOL_HEAT_EXTRUDER); // need to change according // heater - apply_style(label_target, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target, ESP3DStyleType::bg_label); lv_obj_align_to(label_target, temperatures_ta, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -581,7 +581,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_obj_t *label_unit2 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit2, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit2, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit2, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit2, temperatures_ta, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -628,7 +628,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { lv_label_set_text(label_target_temperature_value, temperatures_value_init.c_str()); - apply_style(label_target_temperature_value, + ESP3DStyle::apply(label_target_temperature_value, ESP3DStyleType::read_only_setting); lv_obj_set_width(label_target_temperature_value, LV_HOR_RES / 6); lv_obj_align_to(label_target_temperature_value, btn_down, @@ -639,7 +639,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_unit1 = lv_label_create(ui_new_screen); lv_label_set_text(label_unit1, esp3dTranslationService.translate(ESP3DLabel::celsius)); - apply_style(label_unit1, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_unit1, ESP3DStyleType::bg_label); lv_obj_align_to(label_unit1, label_target_temperature_value, LV_ALIGN_OUT_RIGHT_MID, CURRENT_BUTTON_PRESSED_OUTLINE / 2, 0); @@ -650,7 +650,7 @@ void temperatures_screen(uint8_t target, ESP3DScreenType screenreturn) { label_target_temperature, heater_buttons_map[heater_buttons_map_id]); // need to change according // heater - apply_style(label_target_temperature, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_target_temperature, ESP3DStyleType::bg_label); lv_obj_align_to(label_target_temperature, label_target_temperature_value, LV_ALIGN_OUT_LEFT_MID, -CURRENT_BUTTON_PRESSED_OUTLINE / 2, diff --git a/main/display/cnc/grbl/esp3d_styles.cpp b/main/display/cnc/grbl/esp3d_styles.cpp index f86fcfe2..36c2e232 100644 --- a/main/display/cnc/grbl/esp3d_styles.cpp +++ b/main/display/cnc/grbl/esp3d_styles.cpp @@ -22,9 +22,9 @@ #include "esp3d_log.h" -#define CURRENT_MAIN_BG_COLOR lv_color_hex(0x000000) +#define ESP3D_SCREEN_BACKGROUND_COLOR lv_color_hex(0x000000) -#define CURRENT_BG_LABEL_TEXT_COLOR lv_color_hex(0xFFFFFF) +#define ESP3D_SCREEN_BACKGROUND_TEXT_COLOR lv_color_hex(0xFFFFFF) #define CURRENT_STATUS_BAR_TEXT_COLOR lv_color_hex(0x000000) #define CURRENT_STATUS_BAR_BG_COLOR lv_color_hex(0xFFFFFF) @@ -82,45 +82,45 @@ lv_style_t style_text_container; lv_style_t style_spinner_screen; lv_style_t style_spinner_text; -bool init_styles() { +bool ESP3DStyle::init() { /* Spinner screen */ lv_style_init(&style_spinner_screen); lv_style_set_text_opa(&style_spinner_screen, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_screen, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_spinner_screen, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_spinner_screen, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_bg_opa(&style_spinner_screen, LV_OPA_50); /* Spinner text */ lv_style_init(&style_spinner_text); lv_style_set_text_opa(&style_spinner_text, LV_OPA_COVER); - lv_style_set_text_color(&style_spinner_text, CURRENT_BG_LABEL_TEXT_COLOR); + lv_style_set_text_color(&style_spinner_text, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); /* Main background */ lv_style_init(&style_main_bg); lv_style_set_text_opa(&style_main_bg, LV_OPA_COVER); - lv_style_set_text_color(&style_main_bg, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_main_bg, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_main_bg, ESP3D_SCREEN_BACKGROUND_COLOR); /* Label on main background */ lv_style_init(&style_bg_label); lv_style_set_text_opa(&style_bg_label, LV_OPA_COVER); - lv_style_set_text_color(&style_bg_label, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_bg_label, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_bg_label, ESP3D_SCREEN_BACKGROUND_COLOR); /* read only value on main background */ lv_style_init(&style_read_only_value); lv_style_set_text_opa(&style_read_only_value, LV_OPA_COVER); - lv_style_set_text_color(&style_read_only_value, CURRENT_BG_LABEL_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_value, CURRENT_MAIN_BG_COLOR); + lv_style_set_text_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_TEXT_COLOR); + lv_style_set_bg_color(&style_read_only_value, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_value, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_value, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -137,7 +137,7 @@ bool init_styles() { lv_style_set_text_opa(&style_read_only_setting, LV_OPA_COVER); lv_style_set_text_color(&style_read_only_setting, CURRENT_BUTTON_PRESSED_TEXT_COLOR); - lv_style_set_bg_color(&style_read_only_setting, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_read_only_setting, ESP3D_SCREEN_BACKGROUND_COLOR); lv_style_set_radius(&style_read_only_setting, CURRENT_STATUS_BAR_RADIUS); lv_style_set_border_width(&style_read_only_setting, CURRENT_STATUS_BAR_BORDER_VALUE); @@ -541,17 +541,17 @@ bool init_styles() { */ lv_style_init(&style_simple_container_default); lv_style_set_bg_opa(&style_simple_container_default, LV_OPA_COVER); - lv_style_set_bg_color(&style_simple_container_default, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_simple_container_default, ESP3D_SCREEN_BACKGROUND_COLOR); // Text Container lv_style_init(&style_text_container); lv_style_set_bg_opa(&style_text_container, LV_OPA_COVER); - lv_style_set_bg_color(&style_text_container, CURRENT_MAIN_BG_COLOR); + lv_style_set_bg_color(&style_text_container, ESP3D_SCREEN_BACKGROUND_COLOR); return true; } -bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { +bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type) { if (type != ESP3DStyleType::main_bg && type != ESP3DStyleType::status_list && type != ESP3DStyleType::buttons_msgbox && type != ESP3DStyleType::message_box && @@ -625,8 +625,8 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { break; case ESP3DStyleType::message_box: lv_obj_set_width(obj, LV_PCT(80)); - apply_style(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); - apply_style(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); + ESP3DStyle::apply(lv_msgbox_get_close_btn(obj), ESP3DStyleType::button); + ESP3DStyle::apply(lv_msgbox_get_btns(obj), ESP3DStyleType::buttons_msgbox); lv_obj_set_height(lv_msgbox_get_btns(obj), SYMBOL_BUTTON_HEIGHT); lv_obj_set_width(lv_msgbox_get_btns(obj), MSGBOX_BUTTON_WIDTH); break; @@ -651,7 +651,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { LV_PART_MAIN); break; case ESP3DStyleType::list_container: - apply_style(obj, ESP3DStyleType::col_container); + ESP3DStyle::apply(obj, ESP3DStyleType::col_container); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLL_ELASTIC); lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_scrollbar_mode(obj, LV_SCROLLBAR_MODE_AUTO); @@ -675,7 +675,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { case ESP3DStyleType::simple_container: lv_obj_add_style(obj, &style_simple_container_default, LV_STATE_DEFAULT); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - apply_outline_pad(obj); + ESP3DStyle::add_pad(obj); break; case ESP3DStyleType::status_list: lv_obj_add_style(obj, &style_status_list_default, LV_STATE_DEFAULT); @@ -688,7 +688,7 @@ bool apply_style(lv_obj_t* obj, ESP3DStyleType type) { return true; } -bool apply_outline_pad(lv_obj_t* obj) { +bool ESP3DStyle::add_pad(lv_obj_t* obj) { lv_obj_set_style_pad_left(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_right(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); lv_obj_set_style_pad_top(obj, CURRENT_BUTTON_PRESSED_OUTLINE, LV_PART_MAIN); diff --git a/main/display/cnc/grbl/esp3d_styles.h b/main/display/cnc/grbl/esp3d_styles.h index 4c4a4f2b..70ef6146 100644 --- a/main/display/cnc/grbl/esp3d_styles.h +++ b/main/display/cnc/grbl/esp3d_styles.h @@ -48,6 +48,6 @@ enum class ESP3DStyleType : uint8_t { text_container, }; -extern bool init_styles(); -extern bool apply_style(lv_obj_t* obj, ESP3DStyleType type); -extern bool apply_outline_pad(lv_obj_t* obj); +extern bool ESP3DStyle::init(); +extern bool ESP3DStyle::apply(lv_obj_t* obj, ESP3DStyleType type); +extern bool ESP3DStyle::add_pad(lv_obj_t* obj); diff --git a/main/display/cnc/grbl/esp3d_tft_ui.cpp b/main/display/cnc/grbl/esp3d_tft_ui.cpp index 4224ecd2..ab696daf 100644 --- a/main/display/cnc/grbl/esp3d_tft_ui.cpp +++ b/main/display/cnc/grbl/esp3d_tft_ui.cpp @@ -25,6 +25,6 @@ **********************/ void create_application(void) { - init_styles(); + ESP3DStyle::init(); splashScreen::boot_screen(); } diff --git a/main/display/cnc/grbl/screens/informations_screen.cpp b/main/display/cnc/grbl/screens/informations_screen.cpp index 50d743b6..a6e0e54f 100644 --- a/main/display/cnc/grbl/screens/informations_screen.cpp +++ b/main/display/cnc/grbl/screens/informations_screen.cpp @@ -94,7 +94,7 @@ void informations_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -104,7 +104,7 @@ void informations_screen() { lv_obj_set_style_flex_flow(ui_new_screen, LV_FLEX_FLOW_ROW, LV_FLEX_ALIGN_SPACE_EVENLY); lv_obj_t *ui_info_list_ctl = lv_list_create(ui_new_screen); - apply_style(ui_info_list_ctl, ESP3DStyleType::status_list); + ESP3DStyle::apply(ui_info_list_ctl, ESP3DStyleType::status_list); lv_obj_update_layout(ui_new_screen); lv_obj_set_pos(ui_info_list_ctl, CURRENT_BUTTON_PRESSED_OUTLINE, diff --git a/main/display/cnc/grbl/screens/main_screen.cpp b/main/display/cnc/grbl/screens/main_screen.cpp index 18471bff..fb5da9e4 100644 --- a/main/display/cnc/grbl/screens/main_screen.cpp +++ b/main/display/cnc/grbl/screens/main_screen.cpp @@ -382,7 +382,7 @@ void main_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_main_screen); - apply_style(ui_main_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_main_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *ui_status_bar_container = statusBar::status_bar(ui_main_screen); @@ -390,7 +390,7 @@ void main_screen() { // create container for main screen buttons lv_obj_t *ui_container_main_screen = lv_obj_create(ui_main_screen); - apply_style(ui_container_main_screen, ESP3DStyleType::col_container); + ESP3DStyle::apply(ui_container_main_screen, ESP3DStyleType::col_container); lv_obj_clear_flag(ui_container_main_screen, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_size(ui_container_main_screen, LV_HOR_RES, LV_VER_RES - lv_obj_get_height(ui_status_bar_container)); @@ -399,23 +399,23 @@ void main_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Middle container lv_obj_t *ui_middle_container = lv_btn_create(ui_container_main_screen); - apply_style(ui_middle_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_middle_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_middle_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_middle_container); + ESP3DStyle::add_pad(ui_middle_container); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_container_main_screen); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Create button and label for positions @@ -427,7 +427,7 @@ void main_screen() { // Create button and label for middle container main_label_progression_area = lv_label_create(ui_middle_container); - apply_style(main_label_progression_area, ESP3DStyleType::status_bar); + ESP3DStyle::apply(main_label_progression_area, ESP3DStyleType::status_bar); lv_obj_center(main_label_progression_area); lv_obj_set_size(main_label_progression_area, CURRENT_STATUS_AREA_WIDTH, diff --git a/main/display/cnc/grbl/screens/menu_screen.cpp b/main/display/cnc/grbl/screens/menu_screen.cpp index 618cb959..6e689afb 100644 --- a/main/display/cnc/grbl/screens/menu_screen.cpp +++ b/main/display/cnc/grbl/screens/menu_screen.cpp @@ -151,7 +151,7 @@ void menu_screen() { lv_obj_t *ui_new_screen = lv_obj_create(NULL); lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -162,16 +162,16 @@ void menu_screen() { // Add buttons top container to main container lv_obj_t *ui_top_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_top_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_top_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_top_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_top_buttons_container); + ESP3DStyle::add_pad(ui_top_buttons_container); lv_obj_clear_flag(ui_top_buttons_container, LV_OBJ_FLAG_SCROLLABLE); // Add buttons bottom container to main container lv_obj_t *ui_bottom_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_bottom_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_bottom_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_bottom_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_bottom_buttons_container); + ESP3DStyle::add_pad(ui_bottom_buttons_container); lv_obj_clear_flag(ui_bottom_buttons_container, LV_OBJ_FLAG_SCROLLABLE); //********************************** diff --git a/main/display/cnc/grbl/screens/settings_screen.cpp b/main/display/cnc/grbl/screens/settings_screen.cpp index 7682a510..4224c8ec 100644 --- a/main/display/cnc/grbl/screens/settings_screen.cpp +++ b/main/display/cnc/grbl/screens/settings_screen.cpp @@ -570,7 +570,7 @@ void settings_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); diff --git a/main/display/components/choice_editor_component.cpp b/main/display/components/choice_editor_component.cpp index 4d9220f9..df72b9da 100644 --- a/main/display/components/choice_editor_component.cpp +++ b/main/display/components/choice_editor_component.cpp @@ -122,7 +122,7 @@ lv_obj_t *create_choice_editor(lv_obj_t *container, const char *text, lv_obj_t *choice_container = lv_obj_create(main_container); size_t heigth = y_bottom - y_top - 2 * CURRENT_BUTTON_PRESSED_OUTLINE; - apply_style(choice_container, ESP3DStyleType::list_container); + ESP3DStyle::apply(choice_container, ESP3DStyleType::list_container); lv_obj_align_to(choice_container, editor_title, LV_ALIGN_OUT_BOTTOM_MID, 0, CURRENT_BUTTON_PRESSED_OUTLINE); @@ -142,7 +142,7 @@ lv_obj_t *create_choice_editor(lv_obj_t *container, const char *text, if (!found) active_pos += lv_obj_get_height(obj) + CURRENT_BUTTON_PRESSED_OUTLINE; lv_obj_add_flag(obj, LV_OBJ_FLAG_EVENT_BUBBLE); - apply_style(obj, ESP3DStyleType::radio_button); + ESP3DStyle::apply(obj, ESP3DStyleType::radio_button); index++; } diff --git a/main/display/components/main_container_component.cpp b/main/display/components/main_container_component.cpp index 83ed506d..45585b30 100644 --- a/main/display/components/main_container_component.cpp +++ b/main/display/components/main_container_component.cpp @@ -30,7 +30,7 @@ namespace mainContainer { lv_obj_t *create_main_container(lv_obj_t *parent, lv_obj_t *button_back, ESP3DStyleType style) { lv_obj_t *ui_container = lv_obj_create(parent); - if (ESP3DStyleType::default_style != style) apply_style(ui_container, style); + if (ESP3DStyleType::default_style != style) ESP3DStyle::apply(ui_container, style); lv_obj_clear_flag(ui_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_update_layout(button_back); lv_obj_set_size(ui_container, LV_HOR_RES, diff --git a/main/display/components/message_box_component.cpp b/main/display/components/message_box_component.cpp index bf97d030..47cbfd09 100644 --- a/main/display/components/message_box_component.cpp +++ b/main/display/components/message_box_component.cpp @@ -64,7 +64,7 @@ lv_obj_t *messageBoxMain(lv_obj_t *container, MsgBoxType type, lv_obj_t *mbox = lv_msgbox_create(NULL, title.c_str(), content, (const char **)btns, true); - apply_style(mbox, ESP3DStyleType::message_box); + ESP3DStyle::apply(mbox, ESP3DStyleType::message_box); lv_obj_center(mbox); return mbox; } diff --git a/main/display/components/spinner_component.cpp b/main/display/components/spinner_component.cpp index 15b4ca38..37f9b325 100644 --- a/main/display/components/spinner_component.cpp +++ b/main/display/components/spinner_component.cpp @@ -58,7 +58,7 @@ void show_spinner(const char* msg, lv_obj_t* backtbn) { esp3d_log("Spinner index is %d", spinner_index); screen_displaying_spinner = lv_scr_act(); spinnerObj = lv_obj_create(screen_displaying_spinner); - apply_style(spinnerObj, ESP3DStyleType::spinner_screen); + ESP3DStyle::apply(spinnerObj, ESP3DStyleType::spinner_screen); lv_obj_move_foreground(spinnerObj); lv_obj_set_size(spinnerObj, LV_HOR_RES, LV_VER_RES); lv_obj_set_pos(spinnerObj, 0, 0); @@ -68,14 +68,14 @@ void show_spinner(const char* msg, lv_obj_t* backtbn) { std::string text = esp3dTranslationService.translate(ESP3DLabel::please_wait); lv_obj_t* lbl = lv_label_create(spinnerObj); - apply_style(lbl, ESP3DStyleType::spinner_text); + ESP3DStyle::apply(lbl, ESP3DStyleType::spinner_text); lv_label_set_text(lbl, text.c_str()); lv_obj_align_to(lbl, spinner, LV_ALIGN_OUT_BOTTOM_MID, 0, CURRENT_BUTTON_PRESSED_OUTLINE); lblextra = NULL; if (msg != nullptr) { lblextra = lv_label_create(spinnerObj); - apply_style(lblextra, ESP3DStyleType::spinner_text); + ESP3DStyle::apply(lblextra, ESP3DStyleType::spinner_text); lv_label_set_text(lblextra, msg); lv_obj_align_to(lblextra, lbl, LV_ALIGN_OUT_BOTTOM_MID, 0, CURRENT_BUTTON_PRESSED_OUTLINE); diff --git a/main/display/components/status_bar_component.cpp b/main/display/components/status_bar_component.cpp index a90e0e6f..88a5f924 100644 --- a/main/display/components/status_bar_component.cpp +++ b/main/display/components/status_bar_component.cpp @@ -66,7 +66,7 @@ lv_obj_t *status_bar(lv_obj_t *screen) { lv_obj_t *status_bar_container = lv_obj_create(screen); status_bar_label = lv_label_create(status_bar_container); - apply_style(status_bar_label, ESP3DStyleType::status_bar); + ESP3DStyle::apply(status_bar_label, ESP3DStyleType::status_bar); if (status_bar_desc == nullptr) { esp3d_log_e("status_bar: description is null cancel"); diff --git a/main/display/components/symbol_button_component.cpp b/main/display/components/symbol_button_component.cpp index 8c7e1799..d35a0b73 100644 --- a/main/display/components/symbol_button_component.cpp +++ b/main/display/components/symbol_button_component.cpp @@ -34,7 +34,7 @@ lv_obj_t *create_symbol_button(lv_obj_t *container, const char *text, int width, int height, bool center, bool slash, int rotation) { lv_obj_t *btn = lv_btn_create(container); - apply_style(btn, ESP3DStyleType::button); + ESP3DStyle::apply(btn, ESP3DStyleType::button); if (width != -1) lv_obj_set_width(btn, width); if (height != -1) lv_obj_set_height(btn, height); lv_obj_t *label = lv_label_create(btn); diff --git a/main/display/components/wifi_status_component.cpp b/main/display/components/wifi_status_component.cpp index b0771a37..7b34ce5d 100644 --- a/main/display/components/wifi_status_component.cpp +++ b/main/display/components/wifi_status_component.cpp @@ -79,7 +79,7 @@ void wifi_display_mode() { lv_obj_t *wifi_status(lv_obj_t *parent, lv_obj_t *btnback) { lv_obj_update_layout(btnback); lv_obj_t *status_container = lv_obj_create(parent); - apply_style(status_container, ESP3DStyleType::default_style); + ESP3DStyle::apply(status_container, ESP3DStyleType::default_style); lv_obj_clear_flag(status_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_size(status_container, LV_HOR_RES - (lv_obj_get_width(btnback) + diff --git a/main/display/screens/ap_screen.cpp b/main/display/screens/ap_screen.cpp index 7e6961df..ee3af655 100644 --- a/main/display/screens/ap_screen.cpp +++ b/main/display/screens/ap_screen.cpp @@ -255,7 +255,7 @@ void ap_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); lv_obj_add_event_cb(btnback, event_button_ap_back_handler, LV_EVENT_CLICKED, @@ -264,7 +264,7 @@ void ap_screen() { // SSID lv_obj_t *label_ssid = lv_label_create(ui_new_screen); lv_label_set_text(label_ssid, LV_SYMBOL_ACCESS_POINT); - apply_style(label_ssid, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ssid, ESP3DStyleType::bg_label); lv_obj_update_layout(label_ssid); int width_label = lv_obj_get_width(label_ssid); esp3d_log("width_label %d", lv_obj_get_width(label_ssid)); @@ -293,7 +293,7 @@ void ap_screen() { // Password lv_obj_t *label_pwd = lv_label_create(ui_new_screen); lv_label_set_text(label_pwd, LV_SYMBOL_UNLOCK); - apply_style(label_pwd, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_pwd, ESP3DStyleType::bg_label); ap_ta_password = lv_textarea_create(ui_new_screen); lv_textarea_set_password_mode(ap_ta_password, false); diff --git a/main/display/screens/empty_screen.cpp b/main/display/screens/empty_screen.cpp index b297b1e8..dddcac1c 100644 --- a/main/display/screens/empty_screen.cpp +++ b/main/display/screens/empty_screen.cpp @@ -44,7 +44,7 @@ void empty_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_add_event_cb(ui_new_screen, event_button_handler, LV_EVENT_CLICKED, diff --git a/main/display/screens/files_screen.cpp b/main/display/screens/files_screen.cpp index 8cb8220e..ca6b0bb9 100644 --- a/main/display/screens/files_screen.cpp +++ b/main/display/screens/files_screen.cpp @@ -269,7 +269,7 @@ void files_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // button back @@ -290,7 +290,7 @@ void files_screen() { lv_obj_t *labelpath = lv_label_create(ui_new_screen); lv_label_set_text(labelpath, files_path.c_str()); lv_label_set_long_mode(labelpath, LV_LABEL_LONG_SCROLL_CIRCULAR); - apply_style(labelpath, ESP3DStyleType::bg_label); + ESP3DStyle::apply(labelpath, ESP3DStyleType::bg_label); lv_obj_set_pos(labelpath, CURRENT_STATUS_BAR_V_PAD, CURRENT_STATUS_BAR_V_PAD); lv_obj_set_width(labelpath, LV_HOR_RES - (2 * CURRENT_STATUS_BAR_V_PAD)); lv_obj_set_style_pad_left(labelpath, CURRENT_BUTTON_PRESSED_OUTLINE, diff --git a/main/display/screens/splash_screen.cpp b/main/display/screens/splash_screen.cpp index d3b37497..000ff78e 100644 --- a/main/display/screens/splash_screen.cpp +++ b/main/display/screens/splash_screen.cpp @@ -24,56 +24,73 @@ #include "esp3d_log.h" #include "esp3d_styles.h" + #include "esp3d_tft_ui.h" #include "esp3d_version.h" #include "screens/main_screen.h" +#include "esp3d_styles_splash_screen.h" +// Images are stored in the flash memory +// the logo is an rle image extern "C" lv_img_dsc_t *get_splash_logo(); extern "C" void release_splash_logo(lv_img_dsc_t *splash_logo); +// no rle image but normal one for the target logo LV_IMG_DECLARE(target_fw_logo); -/********************** - * STATIC PROTOTYPES - **********************/ +// namespace for the splash screen namespace splashScreen { +// Static variables lv_timer_t *boot_timer = NULL; lv_img_dsc_t *splash_logo = NULL; -void splash_screen(); +// Static functions +void display(); +// Callback for the timer to to display screen void splash_in_timer_cb(lv_timer_t *timer) { // If timer is not null, delete it to avoid multiple call if (boot_timer) { lv_timer_del(boot_timer); boot_timer = NULL; } - // Call splash screen - splash_screen(); + // Call display function + display(); } -void main_screen_timer_cb(lv_timer_t *timer) { +// leave function to delete timer and release image +void leave() { // If timer is not null, delete it to avoid multiple call if (boot_timer) { lv_timer_del(boot_timer); boot_timer = NULL; } + // If splash_logo is not null, release it if (splash_logo != NULL) { release_splash_logo(splash_logo); + splash_logo = NULL; } +} + +// Callback for the timer to leave and switch to main screen +void main_screen_timer_cb(lv_timer_t *timer) { + // Call leave function + leave(); // Call main screen mainScreen::main_screen(); } -void boot_screen() { - apply_style(lv_scr_act(), ESP3DStyleType::main_bg); +// Enter function to set style and create timer +void enter() { + ESP3DStyle::apply(lv_scr_act(), ESP3DStyleType::main_bg); boot_timer = lv_timer_create(splash_in_timer_cb, 10, NULL); } -void splash_screen() { +// Display function to show splash screen +void display() { esp3dTftui.set_current_screen(ESP3DScreenType::none); // Get active screen lv_obj_t *ui_Screen = lv_scr_act(); - + // get splash logo splash_logo = get_splash_logo(); if (splash_logo != NULL) { // Create logo object @@ -84,16 +101,16 @@ void splash_screen() { lv_obj_center(logo); } - //Marlin Logo - lv_obj_t *logo_marlin = lv_img_create(ui_Screen); - lv_img_set_src(logo_marlin, &target_fw_logo); - lv_obj_align(logo_marlin, LV_ALIGN_BOTTOM_LEFT, FW_LOGO_X, FW_LOGO_Y); + // Set target Logo + lv_obj_t *logo_target = lv_img_create(ui_Screen); + lv_img_set_src(logo_target, &target_fw_logo); + lv_obj_align(logo_target, LV_ALIGN_BOTTOM_LEFT, FW_LOGO_X, FW_LOGO_Y); // Create version text object lv_obj_t *label = lv_label_create(ui_Screen); // Set version text lv_label_set_text(label, "V" ESP3D_TFT_VERSION); - apply_style(label, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label, ESP3DStyleType::bg_label); lv_obj_align(label, LV_ALIGN_BOTTOM_RIGHT, -10, -10); // Set timer to switch to main screen diff --git a/main/display/screens/splash_screen.h b/main/display/screens/splash_screen.h index 6011fa4f..46bf7862 100644 --- a/main/display/screens/splash_screen.h +++ b/main/display/screens/splash_screen.h @@ -20,5 +20,5 @@ #pragma once namespace splashScreen { -extern void boot_screen(); + void enter(); } // namespace splashScreen diff --git a/main/display/screens/sta_screen.cpp b/main/display/screens/sta_screen.cpp index 2107cf9a..468d5f44 100644 --- a/main/display/screens/sta_screen.cpp +++ b/main/display/screens/sta_screen.cpp @@ -458,7 +458,7 @@ void sta_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); lv_obj_t *btnback = backButton::create_back_button(ui_new_screen); @@ -469,7 +469,7 @@ void sta_screen() { // SSID lv_obj_t *label_ssid = lv_label_create(ui_new_screen); lv_label_set_text(label_ssid, LV_SYMBOL_ACCESS_POINT); - apply_style(label_ssid, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_ssid, ESP3DStyleType::bg_label); lv_obj_update_layout(label_ssid); int width_label = lv_obj_get_width(label_ssid); esp3d_log("width_label %d", lv_obj_get_width(label_ssid)); @@ -498,7 +498,7 @@ void sta_screen() { // Password lv_obj_t *label_pwd = lv_label_create(ui_new_screen); lv_label_set_text(label_pwd, LV_SYMBOL_UNLOCK); - apply_style(label_pwd, ESP3DStyleType::bg_label); + ESP3DStyle::apply(label_pwd, ESP3DStyleType::bg_label); sta_ta_password = lv_textarea_create(ui_new_screen); lv_textarea_set_password_mode(sta_ta_password, false); diff --git a/main/display/screens/status_screen.cpp b/main/display/screens/status_screen.cpp index 88601f7f..015d135d 100644 --- a/main/display/screens/status_screen.cpp +++ b/main/display/screens/status_screen.cpp @@ -89,19 +89,19 @@ void status_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_status_screen); // Apply background color - apply_style(ui_status_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_status_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); // Create screen container lv_obj_t *ui_status_screen_container = lv_obj_create(ui_status_screen); - apply_style(ui_status_screen_container, ESP3DStyleType::col_container); + ESP3DStyle::apply(ui_status_screen_container, ESP3DStyleType::col_container); lv_obj_set_size(ui_status_screen_container, LV_HOR_RES, LV_VER_RES); lv_obj_clear_flag(ui_status_screen_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_style_pad_top(ui_status_screen_container, 0, LV_PART_MAIN); lv_obj_set_style_pad_bottom(ui_status_screen_container, 0, LV_PART_MAIN); lv_obj_t *ui_status_list_ctl = lv_list_create(ui_status_screen_container); - apply_style(ui_status_list_ctl, ESP3DStyleType::status_list); + ESP3DStyle::apply(ui_status_list_ctl, ESP3DStyleType::status_list); lv_obj_set_align(ui_status_list_ctl, LV_ALIGN_TOP_MID); esp3d_log("status_list size is %d", ui_status_screen_list.size()); for (auto &line : ui_status_screen_list) { @@ -109,7 +109,7 @@ void status_screen() { } lv_obj_t *btn_back = lv_btn_create(ui_status_screen_container); - apply_style(btn_back, ESP3DStyleType::embedded_button); + ESP3DStyle::apply(btn_back, ESP3DStyleType::embedded_button); lv_obj_set_width(btn_back, LV_HOR_RES); lv_obj_t *label_btn_back = lv_label_create(btn_back); lv_label_set_text(label_btn_back, LV_SYMBOL_UP); diff --git a/main/display/screens/wifi_screen.cpp b/main/display/screens/wifi_screen.cpp index 7e05930e..c6c003eb 100644 --- a/main/display/screens/wifi_screen.cpp +++ b/main/display/screens/wifi_screen.cpp @@ -205,7 +205,7 @@ void wifi_screen() { // Display new screen and delete old one lv_obj_t *ui_current_screen = lv_scr_act(); lv_scr_load(ui_new_screen); - apply_style(ui_new_screen, ESP3DStyleType::main_bg); + ESP3DStyle::apply(ui_new_screen, ESP3DStyleType::main_bg); lv_obj_del(ui_current_screen); btnback = backButton::create_back_button(ui_new_screen); @@ -216,9 +216,9 @@ void wifi_screen() { ui_new_screen, btnback, ESP3DStyleType::col_container); lv_obj_t *ui_buttons_container = lv_obj_create(ui_main_container); - apply_style(ui_buttons_container, ESP3DStyleType::row_container); + ESP3DStyle::apply(ui_buttons_container, ESP3DStyleType::row_container); lv_obj_set_size(ui_buttons_container, LV_HOR_RES, LV_SIZE_CONTENT); - apply_outline_pad(ui_buttons_container); + ESP3DStyle::add_pad(ui_buttons_container); lv_obj_clear_flag(ui_buttons_container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_t *btn = nullptr;