feat(color): start of UI for 3.0 (#5685)
This commit is contained in:
@@ -151,7 +151,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
|
||||
#if defined(GVARS)
|
||||
case ITEM_MODEL_FLIGHT_MODE_GVARS_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_GLOBAL_VARS);
|
||||
lcdDrawTextAlignedLeft(y, TR_MENU_GLOBAL_VARS);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -60,8 +60,8 @@ void onModelSelectMenu(const char * result)
|
||||
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
|
||||
const char* ext = nullptr;
|
||||
const char* path = nullptr;
|
||||
ext = STR_YAML_EXT;
|
||||
path = STR_BACKUP_PATH;
|
||||
ext = YAML_EXT;
|
||||
path = BACKUP_PATH;
|
||||
if (sdListFiles(path, ext, MENU_LINE_LENGTH-1, nullptr))
|
||||
POPUP_MENU_START(onModelSelectMenu);
|
||||
else
|
||||
|
||||
@@ -51,8 +51,8 @@ void onModelSelectMenu(const char * result)
|
||||
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
|
||||
const char* ext = nullptr;
|
||||
const char* path = nullptr;
|
||||
ext = STR_YAML_EXT;
|
||||
path = STR_BACKUP_PATH;
|
||||
ext = YAML_EXT;
|
||||
path = BACKUP_PATH;
|
||||
if (sdListFiles(path, ext, MENU_LINE_LENGTH-1, nullptr))
|
||||
POPUP_MENU_START(onModelSelectMenu);
|
||||
else
|
||||
|
||||
@@ -14,6 +14,7 @@ include_directories(
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/radio
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/module
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/mainview
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/setup_menus
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/themes
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/controls
|
||||
)
|
||||
@@ -33,6 +34,9 @@ file(GLOB LIBUI_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd
|
||||
file(GLOB MAINVIEW_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/mainview/*.cpp)
|
||||
|
||||
file(GLOB MENUS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/setup_menus/*.cpp)
|
||||
|
||||
file(GLOB CONTROLS_SRC RELATIVE ${RADIO_SRC_DIR}/gui/colorlcd
|
||||
${RADIO_SRC_DIR}/gui/colorlcd/controls/*.cpp)
|
||||
|
||||
@@ -43,6 +47,7 @@ set(GUI_SRC
|
||||
${LAYOUTS_SRC}
|
||||
${WIDGETS_SRC}
|
||||
${MAINVIEW_SRC}
|
||||
${MENUS_SRC}
|
||||
${CONTROLS_SRC}
|
||||
bitmaps.cpp
|
||||
colors.cpp
|
||||
@@ -54,7 +59,6 @@ set(GUI_SRC
|
||||
model/curveedit.cpp
|
||||
model/input_edit_adv.cpp
|
||||
model/input_edit.cpp
|
||||
model/menu_model.cpp
|
||||
model/mixer_edit_adv.cpp
|
||||
model/mixer_edit.cpp
|
||||
model/model_curves.cpp
|
||||
@@ -85,7 +89,6 @@ set(GUI_SRC
|
||||
radio/hw_inputs.cpp
|
||||
radio/hw_intmodule.cpp
|
||||
radio/hw_serial.cpp
|
||||
radio/menu_radio.cpp
|
||||
radio/preview_window.cpp
|
||||
radio/radio_calibration.cpp
|
||||
radio/radio_diaganas.cpp
|
||||
|
||||
@@ -129,18 +129,6 @@ static const uint8_t mask_menu_model_select[] = {
|
||||
static const uint8_t mask_monitor[] = {
|
||||
#include "mask_monitor.lbm"
|
||||
};
|
||||
static const uint8_t mask_monitor_channels1[] = {
|
||||
#include "mask_monitor_channels1.lbm"
|
||||
};
|
||||
static const uint8_t mask_monitor_channels2[] = {
|
||||
#include "mask_monitor_channels2.lbm"
|
||||
};
|
||||
static const uint8_t mask_monitor_channels3[] = {
|
||||
#include "mask_monitor_channels3.lbm"
|
||||
};
|
||||
static const uint8_t mask_monitor_channels4[] = {
|
||||
#include "mask_monitor_channels4.lbm"
|
||||
};
|
||||
static const uint8_t mask_monitor_logsw[] = {
|
||||
#include "mask_monitor_logsw.lbm"
|
||||
};
|
||||
@@ -180,9 +168,6 @@ static const uint8_t mask_stats_analogs[] = {
|
||||
static const uint8_t mask_stats_debug[] = {
|
||||
#include "mask_stats_debug.lbm"
|
||||
};
|
||||
static const uint8_t mask_stats_throttle_graph[] = {
|
||||
#include "mask_stats_throttle_graph.lbm"
|
||||
};
|
||||
static const uint8_t mask_stats_timers[] = {
|
||||
#include "mask_stats_timers.lbm"
|
||||
};
|
||||
@@ -250,6 +235,9 @@ static const uint8_t mask_shutdown[] = {
|
||||
const uint8_t mask_topleft_bg[] = {
|
||||
#include "mask_topleft.lbm"
|
||||
};
|
||||
const uint8_t mask_topright_bg[] = {
|
||||
#include "mask_topright.lbm"
|
||||
};
|
||||
|
||||
const uint8_t mask_currentmenu_bg[] = {
|
||||
#include "mask_currentmenu_bg.lbm"
|
||||
@@ -367,6 +355,27 @@ static const uint8_t mask_trim_shadow[] = {
|
||||
#include "mask_trim_shadow.lbm"
|
||||
};
|
||||
|
||||
static const uint8_t mask_tools_apps[] = {
|
||||
#include "mask_tools_apps.lbm"
|
||||
};
|
||||
static const uint8_t mask_tools_reset[] = {
|
||||
#include "mask_tools_reset.lbm"
|
||||
};
|
||||
|
||||
static const uint8_t mask_btn_close[] = {
|
||||
#include "mask_btn_close.lbm"
|
||||
};
|
||||
static const uint8_t mask_btn_next[] = {
|
||||
#include "mask_btn_next.lbm"
|
||||
};
|
||||
static const uint8_t mask_btn_prev[] = {
|
||||
#include "mask_btn_prev.lbm"
|
||||
};
|
||||
|
||||
static const uint8_t mask_top_logo[] = {
|
||||
#include "mask_top_logo.lbm"
|
||||
};
|
||||
|
||||
struct _BuiltinIcon {
|
||||
const uint8_t* lz4_compressed_bitmap;
|
||||
};
|
||||
@@ -419,15 +428,10 @@ static const _BuiltinIcon _builtinIcons[EDGETX_ICONS_COUNT] = {
|
||||
BI(ICON_THEME_VIEW10, mask_theme_view10),
|
||||
BI(ICON_THEME_ADD_VIEW, mask_theme_add_view),
|
||||
BI(ICON_STATS, mask_menu_stats),
|
||||
BI(ICON_STATS_THROTTLE_GRAPH, mask_stats_throttle_graph),
|
||||
BI(ICON_STATS_TIMERS, mask_stats_timers),
|
||||
BI(ICON_STATS_ANALOGS, mask_stats_analogs),
|
||||
BI(ICON_STATS_DEBUG, mask_stats_debug),
|
||||
BI(ICON_MONITOR, mask_monitor),
|
||||
BI(ICON_MONITOR_CHANNELS1, mask_monitor_channels1),
|
||||
BI(ICON_MONITOR_CHANNELS2, mask_monitor_channels2),
|
||||
BI(ICON_MONITOR_CHANNELS3, mask_monitor_channels3),
|
||||
BI(ICON_MONITOR_CHANNELS4, mask_monitor_channels4),
|
||||
BI(ICON_MONITOR_LOGICAL_SWITCHES, mask_monitor_logsw),
|
||||
|
||||
BI(ICON_CHAN_MONITOR_LOCKED, mask_chan_locked),
|
||||
@@ -440,6 +444,7 @@ static const _BuiltinIcon _builtinIcons[EDGETX_ICONS_COUNT] = {
|
||||
BI(ICON_SHUTDOWN, mask_shutdown),
|
||||
|
||||
BI(ICON_TOPLEFT_BG, mask_topleft_bg),
|
||||
BI(ICON_TOPRIGHT_BG, mask_topright_bg),
|
||||
BI(ICON_CURRENTMENU_BG, mask_currentmenu_bg),
|
||||
BI(ICON_CURRENTMENU_SHADOW, mask_currentmenu_shadow),
|
||||
BI(ICON_CURRENTMENU_DOT, mask_currentmenu_dot),
|
||||
@@ -488,6 +493,14 @@ static const _BuiltinIcon _builtinIcons[EDGETX_ICONS_COUNT] = {
|
||||
|
||||
BI(ICON_TRIM, mask_trim),
|
||||
BI(ICON_TRIM_SHADOW, mask_trim_shadow),
|
||||
|
||||
BI(ICON_TOOLS_APPS, mask_tools_apps),
|
||||
BI(ICON_TOOLS_RESET, mask_tools_reset),
|
||||
|
||||
BI(ICON_BTN_CLOSE, mask_btn_close),
|
||||
BI(ICON_BTN_NEXT, mask_btn_next),
|
||||
BI(ICON_BTN_PREV, mask_btn_prev),
|
||||
BI(ICON_TOP_LOGO, mask_top_logo),
|
||||
};
|
||||
|
||||
static MaskBitmap* _builtinIconsDecompressed[EDGETX_ICONS_COUNT] = {0};
|
||||
|
||||
@@ -65,15 +65,10 @@ enum EdgeTxIcon {
|
||||
ICON_THEME_VIEW10,
|
||||
ICON_THEME_ADD_VIEW,
|
||||
ICON_STATS,
|
||||
ICON_STATS_THROTTLE_GRAPH,
|
||||
ICON_STATS_TIMERS,
|
||||
ICON_STATS_ANALOGS,
|
||||
ICON_STATS_DEBUG,
|
||||
ICON_MONITOR,
|
||||
ICON_MONITOR_CHANNELS1,
|
||||
ICON_MONITOR_CHANNELS2,
|
||||
ICON_MONITOR_CHANNELS3,
|
||||
ICON_MONITOR_CHANNELS4,
|
||||
ICON_MONITOR_LOGICAL_SWITCHES,
|
||||
|
||||
ICON_CHAN_MONITOR_LOCKED,
|
||||
@@ -86,6 +81,7 @@ enum EdgeTxIcon {
|
||||
ICON_SHUTDOWN,
|
||||
|
||||
ICON_TOPLEFT_BG,
|
||||
ICON_TOPRIGHT_BG,
|
||||
ICON_CURRENTMENU_BG,
|
||||
ICON_CURRENTMENU_SHADOW,
|
||||
ICON_CURRENTMENU_DOT,
|
||||
@@ -136,6 +132,15 @@ enum EdgeTxIcon {
|
||||
ICON_TRIM,
|
||||
ICON_TRIM_SHADOW,
|
||||
|
||||
ICON_TOOLS_APPS,
|
||||
ICON_TOOLS_RESET,
|
||||
|
||||
ICON_BTN_CLOSE,
|
||||
ICON_BTN_NEXT,
|
||||
ICON_BTN_PREV,
|
||||
|
||||
ICON_TOP_LOGO,
|
||||
|
||||
EDGETX_ICONS_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include "libopenui_defines.h"
|
||||
#include "edgetx_types.h"
|
||||
|
||||
// TODO common code, not in target
|
||||
enum LcdColorIndex {
|
||||
|
||||
@@ -86,7 +86,8 @@ bool ButtonBase::onLongPress()
|
||||
{
|
||||
if (longPressHandler) {
|
||||
check(longPressHandler());
|
||||
lv_obj_clear_state(lvobj, LV_STATE_PRESSED);
|
||||
if (!deleted())
|
||||
lv_obj_clear_state(lvobj, LV_STATE_PRESSED);
|
||||
lv_indev_wait_release(lv_indev_get_act());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ LV_STYLE_CONST_SINGLE_INIT(EdgeTxStyles::bg_opacity_20, LV_STYLE_BG_OPA,
|
||||
LV_STYLE_CONST_SINGLE_INIT(EdgeTxStyles::bg_opacity_50, LV_STYLE_BG_OPA,
|
||||
LV_OPA_50);
|
||||
LV_STYLE_CONST_SINGLE_INIT(EdgeTxStyles::bg_opacity_75, LV_STYLE_BG_OPA, 187);
|
||||
LV_STYLE_CONST_SINGLE_INIT(EdgeTxStyles::bg_opacity_90, LV_STYLE_BG_OPA, 230);
|
||||
LV_STYLE_CONST_SINGLE_INIT(EdgeTxStyles::bg_opacity_cover, LV_STYLE_BG_OPA,
|
||||
LV_OPA_COVER);
|
||||
LV_STYLE_CONST_SINGLE_INIT(EdgeTxStyles::fg_opacity_transparent, LV_STYLE_OPA,
|
||||
@@ -215,6 +216,23 @@ const lv_style_const_prop_t disabled_props[] = {
|
||||
};
|
||||
LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::disabled, disabled_props);
|
||||
|
||||
static lv_color_t darkgrey_filter_cb(const lv_color_filter_dsc_t* f,
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
LV_UNUSED(f);
|
||||
return lv_color_mix(lv_palette_darken(LV_PALETTE_GREY, 2), color, opa);
|
||||
}
|
||||
|
||||
const lv_color_filter_dsc_t darkgrey_filter = {.filter_cb = darkgrey_filter_cb,
|
||||
.user_data = 0};
|
||||
|
||||
const lv_style_const_prop_t qm_disabled_props[] = {
|
||||
LV_STYLE_CONST_COLOR_FILTER_DSC(&darkgrey_filter),
|
||||
LV_STYLE_CONST_COLOR_FILTER_OPA(LV_OPA_90),
|
||||
LV_STYLE_PROP_INV,
|
||||
};
|
||||
LV_STYLE_CONST_MULTI_INIT(EdgeTxStyles::qmdisabled, qm_disabled_props);
|
||||
|
||||
/**********************
|
||||
* Variable Styles
|
||||
**********************/
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#if LANDSCAPE
|
||||
#if LCD_W == 320
|
||||
#define LAYOUT_SCALE(x) (((x) * 4 + 3) / 5)
|
||||
#define LAYOUT_SCALE(x) (((x) * 8 + 5) / 10)
|
||||
#elif LCD_W == 800
|
||||
#define LAYOUT_SCALE(x) (((x) * 3 + 1) / 2)
|
||||
#endif
|
||||
@@ -243,12 +243,14 @@ class EdgeTxStyles
|
||||
static const lv_style_t bg_opacity_20;
|
||||
static const lv_style_t bg_opacity_50;
|
||||
static const lv_style_t bg_opacity_75;
|
||||
static const lv_style_t bg_opacity_90;
|
||||
static const lv_style_t bg_opacity_cover;
|
||||
static const lv_style_t fg_opacity_transparent;
|
||||
static const lv_style_t fg_opacity_cover;
|
||||
static const lv_style_t rounded;
|
||||
static const lv_style_t circle;
|
||||
static const lv_style_t disabled;
|
||||
static const lv_style_t qmdisabled;
|
||||
static const lv_style_t pressed;
|
||||
static const lv_style_t scrollbar;
|
||||
static const lv_style_t border;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "etx_lv_theme.h"
|
||||
#include "window.h"
|
||||
|
||||
class FlexGridLayout
|
||||
|
||||
@@ -58,6 +58,7 @@ void Layer::pop(Window* w)
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stack.empty()) {
|
||||
@@ -83,3 +84,13 @@ Window* Layer::getFirstOpaque()
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Window* Layer::walk(std::function<bool(Window* w)> check)
|
||||
{
|
||||
for (auto layer = stack.crbegin(); layer != stack.crend(); layer++) {
|
||||
if (layer->window && check(layer->window))
|
||||
return layer->window;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -36,4 +36,5 @@ class Layer
|
||||
|
||||
static Window* back();
|
||||
static Window* getFirstOpaque();
|
||||
static Window* walk(std::function<bool(Window* w)> check);
|
||||
};
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "debug.h"
|
||||
#include "hal.h"
|
||||
#include "edgetx_types.h"
|
||||
#include "colors.h"
|
||||
#include "keys.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "button.h"
|
||||
#include "edgetx_types.h"
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ListLineButton : public ButtonBase
|
||||
{
|
||||
@@ -113,10 +113,10 @@ class InputMixGroupBase : public Window
|
||||
std::list<InputMixButtonBase*> lines;
|
||||
};
|
||||
|
||||
class InputMixPageBase : public PageTab
|
||||
class InputMixPageBase : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
InputMixPageBase(const char* title, EdgeTxIcon icon) : PageTab(title, icon) {}
|
||||
InputMixPageBase(PageDef& pageDef) : PageGroupItem(pageDef) {}
|
||||
|
||||
protected:
|
||||
std::list<InputMixButtonBase*> lines;
|
||||
|
||||
@@ -85,7 +85,10 @@ void MainWindow::shutdown()
|
||||
LayoutFactory::deleteCustomScreens();
|
||||
|
||||
// clear layer stack first
|
||||
for (Window* w = Layer::back(); w; w = Layer::back()) w->deleteLater();
|
||||
for (Window* w = Layer::back(); w; w = Layer::back()) {
|
||||
Layer::pop(w);
|
||||
w->deleteLater();
|
||||
}
|
||||
|
||||
children.clear();
|
||||
clear();
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "etx_lv_theme.h"
|
||||
#include "view_main.h"
|
||||
#include "keyboard_base.h"
|
||||
#include "quick_menu.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
PageHeader::PageHeader(Window* parent, EdgeTxIcon icon) :
|
||||
Window(parent, {0, 0, LCD_W, EdgeTxStyles::MENU_HEADER_HEIGHT})
|
||||
@@ -75,6 +77,14 @@ Page::Page(EdgeTxIcon icon, PaddingSize padding, bool pauseRefresh) :
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
header = new PageHeader(this, icon);
|
||||
|
||||
new HeaderBackIcon(header);
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
addCustomButton(0, 0, [=]() { openMenu(); });
|
||||
addCustomButton(LCD_W - EdgeTxStyles::MENU_HEADER_HEIGHT, 0, [=]() { onCancel(); });
|
||||
#endif
|
||||
|
||||
body = new Window(this,
|
||||
{0, EdgeTxStyles::MENU_HEADER_HEIGHT, LCD_W, LCD_H - EdgeTxStyles::MENU_HEADER_HEIGHT});
|
||||
body->setWindowFlag(NO_FOCUS);
|
||||
@@ -88,10 +98,6 @@ Page::Page(EdgeTxIcon icon, PaddingSize padding, bool pauseRefresh) :
|
||||
Layer::push(this);
|
||||
|
||||
body->padAll(padding);
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
addBackButton();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Page::deleteLater(bool detach, bool trash)
|
||||
@@ -102,7 +108,36 @@ void Page::deleteLater(bool detach, bool trash)
|
||||
Window::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
void Page::onCancel() { deleteLater(); }
|
||||
void Page::openMenu()
|
||||
{
|
||||
PageGroup* p = nullptr;
|
||||
QuickMenu::SubMenu subMenu = QuickMenu::NONE;
|
||||
Window* w = Layer::walk([=](Window *w) mutable -> bool {
|
||||
return w->isPageGroup();
|
||||
});
|
||||
if (w) {
|
||||
p = (PageGroup*)w;
|
||||
subMenu = p->getCurrentTab()->subMenu();
|
||||
}
|
||||
quickMenu = QuickMenu::openQuickMenu([=]() { quickMenu = nullptr; },
|
||||
[=](bool close) {
|
||||
onCancel();
|
||||
if (p) {
|
||||
while (!Layer::back()->isPageGroup()) {
|
||||
Layer::back()->deleteLater();
|
||||
}
|
||||
if (close)
|
||||
Layer::back()->onCancel();
|
||||
}
|
||||
}, p, subMenu);
|
||||
}
|
||||
|
||||
void Page::onCancel()
|
||||
{
|
||||
if (quickMenu) quickMenu->closeMenu();
|
||||
quickMenu = nullptr;
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void Page::onClicked() { Keyboard::hide(false); }
|
||||
|
||||
@@ -118,7 +153,64 @@ void Page::enableRefresh()
|
||||
lv_obj_refresh_style(lvobj, LV_PART_ANY, LV_STYLE_PROP_ANY);
|
||||
}
|
||||
|
||||
NavWindow* Page::navWindow()
|
||||
{
|
||||
auto p = Layer::back();
|
||||
if (p->isNavWindow()) return (NavWindow*)p;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void Page::onPressSYS()
|
||||
{
|
||||
if (!quickMenu) openMenu();
|
||||
}
|
||||
|
||||
void Page::onLongPressSYS()
|
||||
{
|
||||
auto p = navWindow();
|
||||
if (p) {
|
||||
onCancel();
|
||||
p->onLongPressSYS();
|
||||
}
|
||||
}
|
||||
|
||||
void Page::onPressMDL()
|
||||
{
|
||||
auto p = navWindow();
|
||||
if (p) {
|
||||
onCancel();
|
||||
p->onPressMDL();
|
||||
}
|
||||
}
|
||||
|
||||
void Page::onLongPressMDL()
|
||||
{
|
||||
auto p = navWindow();
|
||||
if (p) {
|
||||
onCancel();
|
||||
p->onLongPressMDL();
|
||||
}
|
||||
}
|
||||
|
||||
void Page::onPressTELE()
|
||||
{
|
||||
auto p = navWindow();
|
||||
if (p) {
|
||||
onCancel();
|
||||
p->onPressTELE();
|
||||
}
|
||||
}
|
||||
|
||||
void Page::onLongPressTELE()
|
||||
{
|
||||
auto p = navWindow();
|
||||
if (p) {
|
||||
onCancel();
|
||||
p->onLongPressTELE();
|
||||
}
|
||||
}
|
||||
|
||||
void Page::onLongPressRTN() { onCancel(); }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,11 +21,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bitmaps.h"
|
||||
#include "button.h"
|
||||
#include "static.h"
|
||||
|
||||
class Page;
|
||||
class QuickMenu;
|
||||
|
||||
class PageHeader : public Window
|
||||
{
|
||||
@@ -60,14 +58,25 @@ class Page : public NavWindow
|
||||
|
||||
void enableRefresh();
|
||||
|
||||
void openMenu();
|
||||
|
||||
protected:
|
||||
PageHeader* header = nullptr;
|
||||
Window* body = nullptr;
|
||||
QuickMenu* quickMenu = nullptr;
|
||||
|
||||
void checkEvents() override;
|
||||
bool bubbleEvents() override { return false; }
|
||||
|
||||
NavWindow* navWindow();
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onPressSYS() override;
|
||||
void onLongPressSYS() override;
|
||||
void onPressMDL() override;
|
||||
void onLongPressMDL() override;
|
||||
void onPressTELE() override;
|
||||
void onLongPressTELE() override;
|
||||
void onLongPressRTN() override;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1,370 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "tabsgroup.h"
|
||||
|
||||
#include "theme_manager.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "view_main.h"
|
||||
#include "topbar_impl.h"
|
||||
#include "keyboard_base.h"
|
||||
|
||||
#if defined(DEBUG)
|
||||
static uint32_t dsms, dems, end_ms, start_ms;
|
||||
static bool timepg = false;
|
||||
|
||||
static void on_draw_begin(lv_event_t* e)
|
||||
{
|
||||
if (timepg) {
|
||||
dsms = lv_tick_get();
|
||||
}
|
||||
}
|
||||
static void on_draw_end(lv_event_t* e)
|
||||
{
|
||||
timepg = false;
|
||||
dems = lv_tick_get();
|
||||
TRACE("tab time: build %ld layout %ld draw %ld total %ld",
|
||||
end_ms - start_ms, dsms - end_ms, dems - dsms, dems - start_ms);
|
||||
}
|
||||
#endif
|
||||
|
||||
class SelectedTabIcon : public StaticIcon
|
||||
{
|
||||
public:
|
||||
SelectedTabIcon(Window* parent) :
|
||||
StaticIcon(parent, 0, 0, ICON_CURRENTMENU_SHADOW, COLOR_THEME_PRIMARY1_INDEX)
|
||||
{
|
||||
new StaticIcon(this, 0, 0, ICON_CURRENTMENU_BG, COLOR_THEME_FOCUS_INDEX);
|
||||
new StaticIcon(this, SEL_DOT_X, SEL_DOT_Y, ICON_CURRENTMENU_DOT, COLOR_THEME_PRIMARY2_INDEX);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "SelectedTabIcon"; }
|
||||
#endif
|
||||
|
||||
static LAYOUT_VAL_SCALED(SEL_DOT_X, 10)
|
||||
static LAYOUT_VAL_SCALED(SEL_DOT_Y, 39)
|
||||
};
|
||||
|
||||
class TabsGroupButton : public ButtonBase
|
||||
{
|
||||
public:
|
||||
TabsGroupButton(Window* parent, const rect_t& rect, PageTab* page, int idx) :
|
||||
ButtonBase(parent, rect, nullptr, window_create), pageTab(page), index(idx)
|
||||
{
|
||||
lastIcon = pageTab->getIcon();
|
||||
icon = new StaticIcon(this, 2, ICON_Y, lastIcon, COLOR_THEME_PRIMARY2_INDEX);
|
||||
|
||||
show(isVisible());
|
||||
}
|
||||
|
||||
~TabsGroupButton()
|
||||
{
|
||||
delete pageTab;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override
|
||||
{
|
||||
return "TabsGroupButton(" + std::to_string(lastIcon) + ")";
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isVisible() const { return pageTab->isVisible(); }
|
||||
|
||||
PageTab* page() const { return pageTab; }
|
||||
int getIndex() const { return index; }
|
||||
void setIndex(int idx)
|
||||
{
|
||||
index = idx;
|
||||
pageTab->update(index);
|
||||
}
|
||||
|
||||
static LAYOUT_VAL_SCALED(ICON_Y, 7)
|
||||
|
||||
protected:
|
||||
PageTab* pageTab;
|
||||
EdgeTxIcon lastIcon;
|
||||
StaticIcon* icon = nullptr;
|
||||
int index;
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
show(isVisible());
|
||||
if (lastIcon != pageTab->getIcon()) {
|
||||
lastIcon = pageTab->getIcon();
|
||||
icon->setIcon(lastIcon);
|
||||
}
|
||||
ButtonBase::checkEvents();
|
||||
}
|
||||
};
|
||||
|
||||
class TabsGroupHeader : public Window
|
||||
{
|
||||
public:
|
||||
TabsGroupHeader(TabsGroup* menu, EdgeTxIcon icon) :
|
||||
Window(menu, {0, 0, LCD_W, TabsGroup::MENU_BODY_TOP}),
|
||||
menu(menu)
|
||||
{
|
||||
setWindowFlag(NO_FOCUS | OPAQUE);
|
||||
|
||||
etx_solid_bg(lvobj, COLOR_THEME_SECONDARY1_INDEX);
|
||||
|
||||
new HeaderIcon(this, icon);
|
||||
|
||||
auto sep = lv_obj_create(lvobj);
|
||||
etx_solid_bg(sep);
|
||||
lv_obj_set_pos(sep, 0, EdgeTxStyles::MENU_HEADER_HEIGHT);
|
||||
lv_obj_set_size(sep, LCD_W, TabsGroup::MENU_TITLE_TOP - EdgeTxStyles::MENU_HEADER_HEIGHT);
|
||||
|
||||
titleLabel = lv_label_create(lvobj);
|
||||
etx_txt_color(titleLabel, COLOR_THEME_PRIMARY2_INDEX);
|
||||
lv_obj_set_style_pad_left(titleLabel, PAD_MEDIUM, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_top(titleLabel, 1, LV_PART_MAIN);
|
||||
lv_obj_set_pos(titleLabel, 0, TabsGroup::MENU_TITLE_TOP);
|
||||
lv_obj_set_size(titleLabel, LCD_W, TabsGroup::MENU_TITLE_HEIGHT);
|
||||
setTitle("");
|
||||
|
||||
carousel = new Window(this,
|
||||
{MENU_HEADER_BUTTONS_LEFT, 0,
|
||||
LCD_W - HDR_DATE_FULL_WIDTH - MENU_HEADER_BUTTONS_LEFT, EdgeTxStyles::MENU_HEADER_HEIGHT + 10});
|
||||
carousel->padAll(PAD_ZERO);
|
||||
carousel->setWindowFlag(NO_FOCUS);
|
||||
|
||||
selectedIcon = new SelectedTabIcon(carousel);
|
||||
|
||||
new HeaderDateTime(this, LCD_W - DATE_XO, PAD_MEDIUM);
|
||||
}
|
||||
|
||||
void setTitle(const char* title) { lv_label_set_text(titleLabel, title); }
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "TabsGroupHeader"; }
|
||||
#endif
|
||||
|
||||
void setCurrentIndex(uint8_t index)
|
||||
{
|
||||
if (index < buttons.size()) {
|
||||
buttons[currentIndex]->check(false);
|
||||
currentIndex = index;
|
||||
buttons[currentIndex]->check(true);
|
||||
coord_t x = getX(currentIndex);
|
||||
selectedIcon->setPos(x, 0);
|
||||
coord_t sx = lv_obj_get_scroll_x(carousel->getLvObj());
|
||||
if (x + MENU_HEADER_BUTTON_WIDTH - sx > carousel->width()) {
|
||||
lv_obj_scroll_to(carousel->getLvObj(), x + MENU_HEADER_BUTTON_WIDTH - carousel->width(), 0, LV_ANIM_OFF);
|
||||
} else if (x < sx) {
|
||||
lv_obj_scroll_to(carousel->getLvObj(), x, 0, LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void chgTab(int dir)
|
||||
{
|
||||
int idx = currentIndex;
|
||||
do {
|
||||
idx += dir;
|
||||
if (idx < 0) idx = buttons.size() - 1;
|
||||
if (idx >= (int)buttons.size()) idx = 0;
|
||||
} while (!buttons[idx]->isVisible());
|
||||
menu->setCurrentTab(idx);
|
||||
}
|
||||
|
||||
void nextTab() { chgTab(1); }
|
||||
void prevTab() { chgTab(-1); }
|
||||
|
||||
void addTab(PageTab* page)
|
||||
{
|
||||
uint8_t idx = buttons.size();
|
||||
TabsGroupButton* btn = new TabsGroupButton(
|
||||
carousel, {getX(idx), 0, MENU_HEADER_BUTTON_WIDTH + 3, TabsGroup::MENU_TITLE_TOP + 5}, page, idx);
|
||||
btn->setPressHandler([=]() {
|
||||
menu->setCurrentTab(btn->getIndex());
|
||||
return true;
|
||||
});
|
||||
btn->show(btn->isVisible());
|
||||
buttons.emplace_back(btn);
|
||||
}
|
||||
|
||||
void removeTab(unsigned index)
|
||||
{
|
||||
auto btn = buttons[index];
|
||||
buttons.erase(buttons.begin() + index);
|
||||
btn->deleteLater();
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
void updateLayout()
|
||||
{
|
||||
for (uint8_t i = 0; i < buttons.size(); i += 1) {
|
||||
buttons[i]->setIndex(i);
|
||||
buttons[i]->setPos(getX(i), 0);
|
||||
}
|
||||
}
|
||||
|
||||
PageTab* pageTab(uint8_t idx) const { return buttons[idx]->page(); }
|
||||
bool isCurrent(uint8_t idx) const { return currentIndex == idx; }
|
||||
uint8_t tabCount() const { return buttons.size(); }
|
||||
|
||||
static LAYOUT_VAL_SCALED(DATE_XO, 48)
|
||||
static LAYOUT_VAL_SCALED(MENU_HEADER_BUTTON_WIDTH, 33)
|
||||
static LAYOUT_VAL_SCALED(HDR_DATE_FULL_WIDTH, 51)
|
||||
|
||||
protected:
|
||||
uint8_t currentIndex = 0;
|
||||
TabsGroup* menu;
|
||||
lv_obj_t* titleLabel = nullptr;
|
||||
SelectedTabIcon* selectedIcon = nullptr;
|
||||
Window* carousel = nullptr;
|
||||
std::vector<TabsGroupButton*> buttons;
|
||||
|
||||
coord_t getX(uint8_t idx)
|
||||
{
|
||||
coord_t x = 0;
|
||||
for (uint8_t i = 0; i < idx; i += 1)
|
||||
if (buttons[i]->isVisible())
|
||||
x += MENU_HEADER_BUTTON_WIDTH;
|
||||
return x;
|
||||
}
|
||||
|
||||
void checkEvents() override
|
||||
{
|
||||
updateLayout();
|
||||
Window::checkEvents();
|
||||
}
|
||||
};
|
||||
|
||||
TabsGroup::TabsGroup(EdgeTxIcon icon) :
|
||||
NavWindow(MainWindow::instance(), {0, 0, LCD_W, LCD_H})
|
||||
{
|
||||
etx_solid_bg(lvobj);
|
||||
|
||||
header = new TabsGroupHeader(this, icon);
|
||||
|
||||
body = new Window(this, {0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT});
|
||||
body->setWindowFlag(NO_FOCUS);
|
||||
lv_obj_set_style_max_height(body->getLvObj(), MENU_BODY_HEIGHT, LV_PART_MAIN);
|
||||
etx_scrollbar(body->getLvObj());
|
||||
|
||||
Layer::back()->hide();
|
||||
Layer::push(this);
|
||||
|
||||
#if defined(DEBUG)
|
||||
lv_obj_add_event_cb(lvobj, on_draw_begin, LV_EVENT_COVER_CHECK, nullptr);
|
||||
lv_obj_add_event_cb(lvobj, on_draw_end, LV_EVENT_DRAW_POST_END, nullptr);
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
addBackButton();
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t TabsGroup::tabCount() const { return header->tabCount(); }
|
||||
|
||||
void TabsGroup::setCurrentTab(unsigned index)
|
||||
{
|
||||
if (deleted()) return;
|
||||
|
||||
header->setCurrentIndex(index);
|
||||
|
||||
PageTab* tab = header->pageTab(index);
|
||||
|
||||
if (tab != currentTab && !deleted()) {
|
||||
header->setTitle(tab->getTitle().c_str());
|
||||
|
||||
lv_obj_enable_style_refresh(false);
|
||||
|
||||
body->clear();
|
||||
if (currentTab)
|
||||
currentTab->cleanup();
|
||||
currentTab = tab;
|
||||
|
||||
#if defined(DEBUG)
|
||||
start_ms = lv_tick_get();
|
||||
timepg = true;
|
||||
#endif
|
||||
|
||||
static lv_style_prop_t remStyles[] = {
|
||||
LV_STYLE_FLEX_FLOW, LV_STYLE_LAYOUT, LV_STYLE_PAD_ROW,
|
||||
LV_STYLE_PAD_COLUMN, LV_STYLE_PAD_LEFT, LV_STYLE_PAD_RIGHT,
|
||||
LV_STYLE_PAD_TOP, LV_STYLE_PAD_BOTTOM};
|
||||
for (uint8_t i = 0; i < DIM(remStyles); i += 1)
|
||||
lv_obj_remove_local_style_prop(body->getLvObj(), remStyles[i],
|
||||
LV_PART_MAIN);
|
||||
|
||||
body->padAll(tab->getPadding());
|
||||
|
||||
tab->build(body);
|
||||
|
||||
lv_obj_enable_style_refresh(true);
|
||||
lv_obj_refresh_style(body->getLvObj(), LV_PART_ANY, LV_STYLE_PROP_ANY);
|
||||
|
||||
#if defined(DEBUG)
|
||||
end_ms = lv_tick_get();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void TabsGroup::deleteLater(bool detach, bool trash)
|
||||
{
|
||||
if (_deleted) return;
|
||||
|
||||
Layer::pop(this);
|
||||
Layer::back()->show();
|
||||
|
||||
Window::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
void TabsGroup::addTab(PageTab* page)
|
||||
{
|
||||
header->addTab(page);
|
||||
if (!currentTab) {
|
||||
setCurrentTab(0);
|
||||
}
|
||||
}
|
||||
|
||||
void TabsGroup::removeTab(unsigned index)
|
||||
{
|
||||
if (header->isCurrent(index))
|
||||
setCurrentTab(max<unsigned>(0, index - 1));
|
||||
header->removeTab(index);
|
||||
}
|
||||
|
||||
void TabsGroup::checkEvents()
|
||||
{
|
||||
Window::checkEvents();
|
||||
if (currentTab) {
|
||||
currentTab->checkEvents();
|
||||
}
|
||||
ViewMain::instance()->runBackground();
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void TabsGroup::onPressPGUP() { header->prevTab(); }
|
||||
void TabsGroup::onPressPGDN() { header->nextTab(); }
|
||||
void TabsGroup::onLongPressPGUP() { header->prevTab(); }
|
||||
void TabsGroup::onLongPressPGDN() { header->nextTab(); }
|
||||
void TabsGroup::onLongPressRTN() { onCancel(); }
|
||||
#endif
|
||||
|
||||
void TabsGroup::onClicked() { Keyboard::hide(false); }
|
||||
|
||||
void TabsGroup::onCancel() { deleteLater(); }
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bitmaps.h"
|
||||
#include "button.h"
|
||||
|
||||
class TabsGroup;
|
||||
class TabsGroupHeader;
|
||||
|
||||
class PageTab
|
||||
{
|
||||
public:
|
||||
PageTab(PaddingSize padding = PAD_SMALL) : padding(padding) {}
|
||||
|
||||
PageTab(std::string title, EdgeTxIcon icon,
|
||||
PaddingSize padding = PAD_SMALL) :
|
||||
title(std::move(title)), icon(icon), padding(padding)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~PageTab() = default;
|
||||
|
||||
virtual bool isVisible() const { return true; }
|
||||
|
||||
virtual void build(Window* window) = 0;
|
||||
|
||||
virtual void checkEvents() {}
|
||||
|
||||
void setTitle(std::string value) { title = std::move(value); }
|
||||
std::string getTitle() const { return title; }
|
||||
|
||||
void setIcon(EdgeTxIcon icon) { this->icon = icon; }
|
||||
EdgeTxIcon getIcon() const { return icon; }
|
||||
|
||||
PaddingSize getPadding() const { return padding; }
|
||||
|
||||
virtual void update(uint8_t index) {}
|
||||
virtual void cleanup() {}
|
||||
|
||||
protected:
|
||||
std::string title;
|
||||
EdgeTxIcon icon;
|
||||
PaddingSize padding;
|
||||
};
|
||||
|
||||
class TabsGroup : public NavWindow
|
||||
{
|
||||
public:
|
||||
explicit TabsGroup(EdgeTxIcon icon);
|
||||
|
||||
void deleteLater(bool detach = true, bool trash = true) override;
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "TabsGroup"; }
|
||||
#endif
|
||||
|
||||
uint8_t tabCount() const;
|
||||
|
||||
void addTab(PageTab* page);
|
||||
|
||||
void removeTab(unsigned index);
|
||||
|
||||
void setCurrentTab(unsigned index);
|
||||
|
||||
void checkEvents() override;
|
||||
|
||||
void onClicked() override;
|
||||
void onCancel() override;
|
||||
|
||||
static LAYOUT_VAL_SCALED(MENU_TITLE_TOP, 48)
|
||||
static constexpr coord_t MENU_TITLE_HEIGHT = EdgeTxStyles::STD_FONT_HEIGHT;
|
||||
static constexpr coord_t MENU_BODY_TOP = MENU_TITLE_TOP + MENU_TITLE_HEIGHT;
|
||||
static constexpr coord_t MENU_BODY_HEIGHT = LCD_H - MENU_BODY_TOP;
|
||||
|
||||
protected:
|
||||
TabsGroupHeader* header = nullptr;
|
||||
Window* body = nullptr;
|
||||
PageTab* currentTab = nullptr;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onPressPGUP() override;
|
||||
void onPressPGDN() override;
|
||||
void onLongPressPGUP() override;
|
||||
void onLongPressPGDN() override;
|
||||
void onLongPressRTN() override;
|
||||
#endif
|
||||
};
|
||||
@@ -378,9 +378,10 @@ void Window::setFlexLayout(lv_flex_flow_t flow, lv_coord_t padding,
|
||||
coord_t width, coord_t height)
|
||||
{
|
||||
lv_obj_set_flex_flow(lvobj, flow);
|
||||
if (_LV_FLEX_COLUMN & flow) {
|
||||
if ((_LV_FLEX_COLUMN & flow) || (_LV_FLEX_WRAP & flow)) {
|
||||
lv_obj_set_style_pad_row(lvobj, padding, LV_PART_MAIN);
|
||||
} else {
|
||||
}
|
||||
if (!(_LV_FLEX_COLUMN & flow) || (_LV_FLEX_WRAP & flow)) {
|
||||
lv_obj_set_style_pad_column(lvobj, padding, LV_PART_MAIN);
|
||||
}
|
||||
lv_obj_set_width(lvobj, width);
|
||||
@@ -427,6 +428,17 @@ void Window::addBackButton()
|
||||
},
|
||||
window_create);
|
||||
}
|
||||
|
||||
void Window::addCustomButton(coord_t x, coord_t y, std::function<void()> action)
|
||||
{
|
||||
new ButtonBase(
|
||||
this, {x, y, EdgeTxStyles::MENU_HEADER_HEIGHT, EdgeTxStyles::MENU_HEADER_HEIGHT},
|
||||
[=]() -> uint8_t {
|
||||
action();
|
||||
return 0;
|
||||
},
|
||||
window_create);
|
||||
}
|
||||
#endif
|
||||
|
||||
void NavWindow::onEvent(event_t event)
|
||||
@@ -490,6 +502,26 @@ NavWindow::NavWindow(Window *parent, const rect_t &rect,
|
||||
setWindowFlag(OPAQUE);
|
||||
}
|
||||
|
||||
class SetupTextButton : public TextButton
|
||||
{
|
||||
public:
|
||||
SetupTextButton(Window* parent, const rect_t& rect, PageButtonDef& entry) :
|
||||
TextButton(parent, rect, entry.title)
|
||||
{
|
||||
setPressHandler([=] {
|
||||
entry.createPage();
|
||||
return 0;
|
||||
});
|
||||
setCheckHandler([=]() {
|
||||
if (entry.isActive) check(entry.isActive());
|
||||
if (entry.enabled) show(entry.enabled());
|
||||
});
|
||||
setWrap();
|
||||
}
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
SetupButtonGroup::SetupButtonGroup(Window* parent, const rect_t& rect, const char* title, int cols,
|
||||
PaddingSize padding, PageDefs pages, coord_t btnHeight) :
|
||||
Window(parent, rect)
|
||||
@@ -523,19 +555,7 @@ SetupButtonGroup::SetupButtonGroup(Window* parent, const rect_t& rect, const cha
|
||||
x = xo + (n % cols) * xw;
|
||||
y = yo + (n / cols) * (btnHeight + PAD_MEDIUM);
|
||||
|
||||
// TODO: sort out all caps title strings VS quick menu strings
|
||||
std::string title(entry.title);
|
||||
for (std::string::iterator it = title.begin(); it != title.end(); ++it) {
|
||||
if (*it == '\n')
|
||||
*it = ' ';
|
||||
}
|
||||
|
||||
auto btn = new TextButton(this, rect_t{x, y, buttonWidth, btnHeight}, title, [&, entry]() {
|
||||
entry.createPage();
|
||||
return 0;
|
||||
});
|
||||
btn->setWrap();
|
||||
if (entry.isActive) btn->setCheckHandler([=]() { btn->check(entry.isActive()); });
|
||||
new SetupTextButton(this, {x, y, buttonWidth, btnHeight}, entry);
|
||||
n += 1;
|
||||
remaining -= 1;
|
||||
}
|
||||
|
||||
@@ -166,12 +166,15 @@ class Window
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
void addBackButton();
|
||||
void addCustomButton(coord_t x, coord_t y, std::function<void()> action);
|
||||
#endif
|
||||
|
||||
inline lv_obj_t *getLvObj() { return lvobj; }
|
||||
|
||||
virtual bool isTopBar() { return false; }
|
||||
virtual bool isWidgetsContainer() { return false; }
|
||||
virtual bool isNavWindow() { return false; }
|
||||
virtual bool isPageGroup() { return false; }
|
||||
|
||||
virtual bool isBubblePopup() { return false; }
|
||||
|
||||
@@ -229,7 +232,8 @@ class NavWindow : public Window
|
||||
NavWindow(Window *parent, const rect_t &rect,
|
||||
LvglCreate objConstruct = nullptr);
|
||||
|
||||
protected:
|
||||
bool isNavWindow() override { return true; }
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
virtual void onPressSYS() {}
|
||||
virtual void onLongPressSYS() {}
|
||||
@@ -243,6 +247,8 @@ class NavWindow : public Window
|
||||
virtual void onLongPressPGDN() {}
|
||||
virtual void onLongPressRTN() {}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual bool bubbleEvents() { return true; }
|
||||
void onEvent(event_t event) override;
|
||||
};
|
||||
@@ -251,9 +257,13 @@ struct PageButtonDef {
|
||||
const char* title;
|
||||
std::function<void()> createPage;
|
||||
std::function<bool()> isActive;
|
||||
std::function<bool()> enabled;
|
||||
|
||||
PageButtonDef(const char* title, std::function<void()> createPage, std::function<bool()> isActive = nullptr) :
|
||||
title(title), createPage(std::move(createPage)), isActive(std::move(isActive))
|
||||
PageButtonDef(const char* title,
|
||||
std::function<void()> createPage,
|
||||
std::function<bool()> isActive = nullptr,
|
||||
std::function<bool()> enabled = nullptr) :
|
||||
title(title), createPage(std::move(createPage)), isActive(std::move(isActive)), enabled(std::move(enabled))
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "menu_screen.h"
|
||||
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "model_select.h"
|
||||
#include "edgetx.h"
|
||||
#include "screen_setup.h"
|
||||
#include "storage/storage.h"
|
||||
#include "view_channels.h"
|
||||
#include "view_main.h"
|
||||
|
||||
ScreenMenu::ScreenMenu(int8_t tabIdx) : TabsGroup(ICON_THEME)
|
||||
{
|
||||
addTab(new ScreenUserInterfacePage(this));
|
||||
|
||||
for (int index = 0; index < MAX_CUSTOM_SCREENS; index++) {
|
||||
if (customScreens[index]) {
|
||||
addTab(new ScreenSetupPage(this, index));
|
||||
} else {
|
||||
addTab(new ScreenAddPage(this, tabCount()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set the active tab to the currently shown screen on the MainView
|
||||
auto viewMain = ViewMain::instance();
|
||||
auto tab = viewMain->getCurrentMainView() + 1;
|
||||
|
||||
if (tabIdx >= 0) {
|
||||
tab = tabIdx;
|
||||
}
|
||||
|
||||
setCurrentTab(tab);
|
||||
|
||||
setCloseHandler([] {
|
||||
ViewMain::instance()->updateTopbarVisibility();
|
||||
storageDirty(EE_MODEL);
|
||||
});
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void ScreenMenu::onPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
new RadioMenu();
|
||||
}
|
||||
void ScreenMenu::onLongPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
// Radio setup
|
||||
(new RadioMenu())->setCurrentTab(2);
|
||||
}
|
||||
void ScreenMenu::onPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
new ModelMenu();
|
||||
}
|
||||
void ScreenMenu::onLongPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
new ModelLabelsWindow();
|
||||
}
|
||||
void ScreenMenu::onLongPressTELE()
|
||||
{
|
||||
onCancel();
|
||||
new ChannelsViewMenu();
|
||||
}
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
|
||||
class ScreenMenu : public TabsGroup
|
||||
{
|
||||
public:
|
||||
ScreenMenu(int8_t tabIdx = -1);
|
||||
|
||||
protected:
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onPressSYS() override;
|
||||
void onLongPressSYS() override;
|
||||
void onPressMDL() override;
|
||||
void onLongPressMDL() override;
|
||||
void onLongPressTELE() override;
|
||||
#endif
|
||||
};
|
||||
@@ -35,6 +35,8 @@
|
||||
#define BUTTON_HEIGHT 30
|
||||
#define BUTTON_WIDTH 75
|
||||
|
||||
extern PageDef screensMenuItems[];
|
||||
|
||||
class LayoutChoice : public Button
|
||||
{
|
||||
public:
|
||||
@@ -100,76 +102,6 @@ class LayoutChoice : public Button
|
||||
}
|
||||
};
|
||||
|
||||
ScreenAddPage::ScreenAddPage(ScreenMenu* menu, uint8_t pageIndex) :
|
||||
PageTab(STR_ADD_MAIN_VIEW, ICON_THEME_ADD_VIEW),
|
||||
menu(menu),
|
||||
pageIndex(pageIndex)
|
||||
{
|
||||
}
|
||||
|
||||
void ScreenAddPage::update(uint8_t index)
|
||||
{
|
||||
pageIndex = index;
|
||||
}
|
||||
|
||||
void ScreenAddPage::build(Window* window)
|
||||
{
|
||||
new TextButton(window,
|
||||
rect_t{LCD_W / 2 - ADD_TXT_W / 2, window->height() / 2 - EdgeTxStyles::UI_ELEMENT_HEIGHT, ADD_TXT_W, EdgeTxStyles::UI_ELEMENT_HEIGHT},
|
||||
STR_ADD_MAIN_VIEW, [this]() -> uint8_t {
|
||||
// First page is "User interface", subtract it
|
||||
auto newIdx = pageIndex - 1;
|
||||
TRACE("ScreenAddPage: add screen: newIdx = %d", newIdx);
|
||||
|
||||
auto& screen = customScreens[newIdx];
|
||||
auto& screenData = g_model.screenData[newIdx];
|
||||
|
||||
TRACE("ScreenAddPage: add screen: screen = %p", screen);
|
||||
|
||||
const LayoutFactory* factory = defaultLayout;
|
||||
if (factory) {
|
||||
TRACE("ScreenAddPage: add screen: factory = %p", factory);
|
||||
|
||||
auto viewMain = ViewMain::instance();
|
||||
screen = factory->create(viewMain, &screenData.layoutData);
|
||||
viewMain->addMainView(screen, newIdx);
|
||||
|
||||
strncpy(screenData.LayoutId, factory->getId(),
|
||||
sizeof(screenData.LayoutId));
|
||||
TRACE("ScreenAddPage: add screen: LayoutId = %s",
|
||||
screenData.LayoutId);
|
||||
|
||||
auto tab = new ScreenSetupPage(menu, newIdx);
|
||||
std::string title(STR_MAIN_VIEW_X);
|
||||
if (newIdx >= 9) {
|
||||
title[title.size() - 2] = '1';
|
||||
title.back() = (newIdx - 9) + '0';
|
||||
} else {
|
||||
title[title.size() - 2] = newIdx + '1';
|
||||
title.back() = ' ';
|
||||
}
|
||||
tab->setTitle(title);
|
||||
tab->setIcon((EdgeTxIcon)(ICON_THEME_VIEW1 + newIdx));
|
||||
|
||||
// remove current tab first
|
||||
menu->setCurrentTab(0);
|
||||
menu->removeTab(pageIndex);
|
||||
|
||||
// add the new one
|
||||
menu->addTab(tab);
|
||||
|
||||
if (menu->tabCount() <= MAX_CUSTOM_SCREENS) {
|
||||
menu->addTab(new ScreenAddPage(menu, menu->tabCount()));
|
||||
}
|
||||
|
||||
menu->setCurrentTab(pageIndex);
|
||||
} else {
|
||||
TRACE("Add main view: factory is NULL");
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
#if LANDSCAPE
|
||||
static const lv_coord_t line_col_dsc[] = {LV_GRID_FR(2), LV_GRID_FR(1),
|
||||
LV_GRID_FR(2), LV_GRID_TEMPLATE_LAST};
|
||||
@@ -180,27 +112,15 @@ static const lv_coord_t line_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
static const lv_coord_t line_row_dsc[] = {LV_GRID_CONTENT,
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
ScreenSetupPage::ScreenSetupPage(ScreenMenu* menu, unsigned index) :
|
||||
PageTab(),
|
||||
menu(menu)
|
||||
ScreenSetupPage::ScreenSetupPage(unsigned index, PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
update(index + 1);
|
||||
update(index + FIRST_SCREEN_OFFSET);
|
||||
}
|
||||
|
||||
void ScreenSetupPage::update(uint8_t index)
|
||||
{
|
||||
customScreenIndex = index - 1;
|
||||
|
||||
std::string title(STR_MAIN_VIEW_X);
|
||||
if (customScreenIndex >= 9) {
|
||||
title[title.size() - 2] = '1';
|
||||
title.back() = (customScreenIndex - 9) + '0';
|
||||
} else {
|
||||
title[title.size() - 2] = customScreenIndex + '1';
|
||||
title.back() = ' ';
|
||||
}
|
||||
setTitle(title);
|
||||
setIcon((EdgeTxIcon)(ICON_THEME_VIEW1 + customScreenIndex));
|
||||
customScreenIndex = index - FIRST_SCREEN_OFFSET;
|
||||
}
|
||||
|
||||
void ScreenSetupPage::build(Window* window)
|
||||
@@ -213,8 +133,7 @@ void ScreenSetupPage::build(Window* window)
|
||||
auto line = window->newLine(grid);
|
||||
auto label = new StaticText(line, rect_t{}, STR_LAYOUT);
|
||||
|
||||
lv_obj_set_style_grid_cell_y_align(label->getLvObj(), LV_GRID_ALIGN_CENTER,
|
||||
0);
|
||||
lv_obj_set_style_grid_cell_y_align(label->getLvObj(), LV_GRID_ALIGN_CENTER, 0);
|
||||
|
||||
// Dynamic options window...
|
||||
LayoutChoice::LayoutFactoryGetter getFactory =
|
||||
@@ -267,7 +186,7 @@ void ScreenSetupPage::build(Window* window)
|
||||
#endif
|
||||
btn = new TextButton(line, rect_t{}, STR_SETUP_WIDGETS,
|
||||
[=]() -> uint8_t {
|
||||
menu->deleteLater();
|
||||
window->getParent()->deleteLater();
|
||||
new SetupWidgetsPage(customScreenIndex);
|
||||
return 0;
|
||||
});
|
||||
@@ -293,9 +212,10 @@ void ScreenSetupPage::build(Window* window)
|
||||
// ... and reload
|
||||
LayoutFactory::loadCustomScreens();
|
||||
|
||||
// Let's try to stay on the same page
|
||||
menu->removeTab(customScreenIndex + 1);
|
||||
menu->setCurrentTab(customScreenIndex);
|
||||
// Rest to first screen so user knows something has happened
|
||||
PageGroup* menu = (PageGroup*)window->getParent();
|
||||
menu->setCurrentTab(FIRST_SCREEN_OFFSET);
|
||||
|
||||
return 0;
|
||||
});
|
||||
auto obj = btn->getLvObj();
|
||||
|
||||
@@ -22,36 +22,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "datastructs.h"
|
||||
#include "menu_screen.h"
|
||||
#include "screen_user_interface.h"
|
||||
#include "radio_theme.h"
|
||||
|
||||
class ScreenAddPage : public PageTab
|
||||
class ScreenSetupPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ScreenAddPage(ScreenMenu* menu, uint8_t pageIndex);
|
||||
|
||||
void build(Window* window) override;
|
||||
|
||||
void update(uint8_t index) override;
|
||||
|
||||
protected:
|
||||
ScreenMenu* menu;
|
||||
uint8_t pageIndex;
|
||||
|
||||
static LAYOUT_VAL_SCALED(ADD_TXT_W, 200)
|
||||
};
|
||||
|
||||
class ScreenSetupPage : public PageTab
|
||||
{
|
||||
public:
|
||||
ScreenSetupPage(ScreenMenu* menu, unsigned customScreenIndex);
|
||||
ScreenSetupPage(unsigned customScreenIndex, PageDef& pageDef);
|
||||
|
||||
void build(Window* form) override;
|
||||
|
||||
void update(uint8_t index) override;
|
||||
|
||||
bool isVisible() const override { return customScreens[customScreenIndex] != nullptr; }
|
||||
|
||||
static constexpr int FIRST_SCREEN_OFFSET = 2;
|
||||
|
||||
protected:
|
||||
ScreenMenu* menu;
|
||||
unsigned customScreenIndex;
|
||||
Window* layoutOptions = nullptr;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "screen_user_interface.h"
|
||||
|
||||
#include "file_preview.h"
|
||||
#include "menu_screen.h"
|
||||
#include "theme_manager.h"
|
||||
#include "topbar_impl.h"
|
||||
#include "view_main.h"
|
||||
@@ -35,10 +34,6 @@ static const lv_coord_t line_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
static const lv_coord_t line_row_dsc[] = {LV_GRID_CONTENT,
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
// theme details grid
|
||||
static const lv_coord_t* theme_col_dsc = line_col_dsc;
|
||||
static const lv_coord_t* theme_row_dsc = line_row_dsc;
|
||||
|
||||
#else
|
||||
|
||||
// form grid
|
||||
@@ -47,93 +42,10 @@ static const lv_coord_t line_col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2),
|
||||
static const lv_coord_t line_row_dsc[] = {LV_GRID_CONTENT,
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
// theme details grid
|
||||
static const lv_coord_t theme_col_dsc[] = {LV_GRID_FR(1),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
static const lv_coord_t theme_row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT,
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
#endif
|
||||
|
||||
constexpr coord_t MAX_PREVIEW_WIDTH = (100 * LV_DPI_DEF) / 57;
|
||||
constexpr coord_t MAX_PREVIEW_HEIGHT = LV_DPI_DEF;
|
||||
|
||||
class ThemeView : public Window
|
||||
{
|
||||
public:
|
||||
ThemeView(Window* parent) : Window(parent, rect_t{})
|
||||
{
|
||||
padAll(PAD_ZERO);
|
||||
setFlexLayout(LV_FLEX_FLOW_COLUMN, PAD_ZERO);
|
||||
|
||||
auto tp = ThemePersistance::instance();
|
||||
auto theme = tp->getCurrentTheme();
|
||||
|
||||
if (theme) {
|
||||
FlexGridLayout theme_grid(theme_col_dsc, theme_row_dsc, PAD_TINY);
|
||||
auto line = newLine(theme_grid);
|
||||
|
||||
details = new Window(line, rect_t{0, 0, 0, LV_SIZE_CONTENT});
|
||||
// vertical flow layout
|
||||
lv_obj_set_flex_flow(details->getLvObj(), LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(details->getLvObj(), PAD_TINY, LV_PART_MAIN);
|
||||
|
||||
// make the object fill the grid cell
|
||||
lv_obj_set_style_grid_cell_x_align(details->getLvObj(),
|
||||
LV_GRID_ALIGN_STRETCH, 0);
|
||||
lv_obj_set_style_grid_cell_y_align(details->getLvObj(),
|
||||
LV_GRID_ALIGN_START, 0);
|
||||
|
||||
new StaticText(details, rect_t{}, STR_AUTHOR, COLOR_THEME_PRIMARY1_INDEX, FONT(BOLD));
|
||||
author = new StaticText(details, rect_t{}, "");
|
||||
|
||||
// labels default to LV_SIZE_CONTENT,
|
||||
// which could overflow the width avail
|
||||
lv_obj_set_width(author->getLvObj(), lv_pct(100));
|
||||
|
||||
new StaticText(details, rect_t{}, STR_DESCRIPTION, COLOR_THEME_PRIMARY1_INDEX, FONT(BOLD));
|
||||
description =
|
||||
new StaticText(details, rect_t{}, "");
|
||||
|
||||
lv_obj_set_width(description->getLvObj(), lv_pct(100));
|
||||
|
||||
preview = new FilePreview(line, {0, 0, PREVIEW_W, LV_SIZE_CONTENT});
|
||||
|
||||
// align within cell
|
||||
lv_obj_set_style_grid_cell_x_align(preview->getLvObj(),
|
||||
LV_GRID_ALIGN_START, 0);
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
auto tp = ThemePersistance::instance();
|
||||
auto theme = tp->getCurrentTheme();
|
||||
if (theme) {
|
||||
author->setText(theme->getAuthor());
|
||||
description->setText(theme->getInfo());
|
||||
|
||||
auto themeImage = theme->getThemeImageFileNames();
|
||||
if (themeImage.size() > 0) {
|
||||
preview->setFile(themeImage[0].c_str());
|
||||
} else {
|
||||
preview->setFile("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static LAYOUT_SIZE(PREVIEW_W, (LCD_W - PAD_MEDIUM * 3) / 2, LCD_W - PAD_LARGE - PAD_SMALL)
|
||||
|
||||
protected:
|
||||
Window* details = nullptr;
|
||||
FilePreview* preview = nullptr;
|
||||
StaticText* author = nullptr;
|
||||
StaticText* description = nullptr;
|
||||
};
|
||||
|
||||
ScreenUserInterfacePage::ScreenUserInterfacePage(ScreenMenu* menu) :
|
||||
PageTab(STR_USER_INTERFACE, ICON_THEME_SETUP, PAD_TINY), menu(menu)
|
||||
ScreenUserInterfacePage::ScreenUserInterfacePage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef, PAD_TINY)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -150,7 +62,7 @@ void ScreenUserInterfacePage::build(Window* window)
|
||||
|
||||
new TextButton(line, rect_t{}, STR_SETUP_WIDGETS,
|
||||
[=]() -> uint8_t {
|
||||
menu->deleteLater();
|
||||
window->getParent()->deleteLater();
|
||||
new SetupTopBarWidgetsPage();
|
||||
return 0;
|
||||
});
|
||||
@@ -206,26 +118,4 @@ void ScreenUserInterfacePage::build(Window* window)
|
||||
if (g_model.topbarWidgetWidth[i] == 0)
|
||||
widths[i]->hide();
|
||||
}
|
||||
|
||||
// Theme choice
|
||||
line = window->newLine(grid);
|
||||
new StaticText(line, rect_t{}, STR_THEME);
|
||||
|
||||
auto tp = ThemePersistance::instance();
|
||||
tp->refresh();
|
||||
std::vector<std::string> names = tp->getNames();
|
||||
|
||||
new Choice(
|
||||
line, rect_t{}, names, 0, names.size() - 1,
|
||||
[=]() { return tp->getThemeIndex(); },
|
||||
[=](int value) {
|
||||
tp->setThemeIndex(value);
|
||||
tp->applyTheme(value);
|
||||
tp->setDefaultTheme(value);
|
||||
themeView->update();
|
||||
});
|
||||
|
||||
grid.setColSpan(2);
|
||||
line = window->newLine(grid);
|
||||
themeView = new ThemeView(line);
|
||||
}
|
||||
|
||||
@@ -21,24 +21,22 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
#include "widgets_container.h"
|
||||
|
||||
class ScreenMenu;
|
||||
class ThemeView;
|
||||
class Choice;
|
||||
|
||||
class ScreenUserInterfacePage : public PageTab
|
||||
class ScreenUserInterfacePage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ScreenUserInterfacePage(ScreenMenu* menu);
|
||||
ScreenUserInterfacePage(PageDef& pageDef);
|
||||
|
||||
void build(Window* window) override;
|
||||
|
||||
static LAYOUT_VAL_SCALED(WWBTN_W, 60)
|
||||
|
||||
protected:
|
||||
ScreenMenu* menu;
|
||||
Choice* widths[MAX_TOPBAR_ZONES];
|
||||
ThemeView* themeView = nullptr;
|
||||
};
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "select_fab_carousel.h"
|
||||
|
||||
#include "bitmaps.h"
|
||||
#include "button.h"
|
||||
#include "static.h"
|
||||
|
||||
static void etx_quick_button_constructor(const lv_obj_class_t* class_p,
|
||||
lv_obj_t* obj)
|
||||
{
|
||||
etx_obj_add_style(obj, styles->border_transparent, LV_PART_MAIN);
|
||||
etx_obj_add_style(obj, styles->rounded, LV_PART_MAIN);
|
||||
etx_txt_color(obj, COLOR_WHITE_INDEX, LV_PART_MAIN);
|
||||
etx_obj_add_style(obj, styles->pad_zero, LV_PART_MAIN);
|
||||
|
||||
etx_obj_add_style(obj, styles->border, LV_PART_MAIN | LV_STATE_FOCUSED);
|
||||
etx_obj_add_style(obj, styles->border_color[COLOR_WHITE_INDEX],
|
||||
LV_PART_MAIN | LV_STATE_FOCUSED);
|
||||
}
|
||||
|
||||
static const lv_obj_class_t etx_quick_button_class = {
|
||||
.base_class = &lv_btn_class,
|
||||
.constructor_cb = etx_quick_button_constructor,
|
||||
.destructor_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.width_def = SelectFabCarousel::FAB_BUTTON_WIDTH,
|
||||
.height_def = SelectFabCarousel::FAB_BUTTON_HEIGHT,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_INHERIT,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE,
|
||||
.instance_size = sizeof(lv_btn_t),
|
||||
};
|
||||
|
||||
static lv_obj_t* etx_quick_button_create(lv_obj_t* parent)
|
||||
{
|
||||
return etx_create(&etx_quick_button_class, parent);
|
||||
}
|
||||
|
||||
static void etx_quick_icon_constructor(const lv_obj_class_t* class_p,
|
||||
lv_obj_t* obj)
|
||||
{
|
||||
etx_obj_add_style(obj, styles->border, LV_PART_MAIN);
|
||||
etx_obj_add_style(obj, styles->border_color[COLOR_WHITE_INDEX], LV_PART_MAIN);
|
||||
etx_obj_add_style(obj, styles->outline, LV_PART_MAIN);
|
||||
lv_obj_set_style_outline_color(obj, lv_color_black(), LV_PART_MAIN);
|
||||
etx_obj_add_style(obj, styles->circle, LV_PART_MAIN);
|
||||
etx_solid_bg(obj, COLOR_BLACK_INDEX, LV_PART_MAIN);
|
||||
etx_obj_add_style(obj, styles->pad_zero, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
static const lv_obj_class_t etx_quick_icon_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = etx_quick_icon_constructor,
|
||||
.destructor_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.width_def = 0,
|
||||
.height_def = 0,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_FALSE,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_FALSE,
|
||||
.instance_size = sizeof(lv_obj_t),
|
||||
};
|
||||
|
||||
static lv_obj_t* etx_quick_icon_create(lv_obj_t* parent)
|
||||
{
|
||||
return etx_create(&etx_quick_icon_class, parent);
|
||||
}
|
||||
|
||||
class SelectFabButton : public ButtonBase
|
||||
{
|
||||
public:
|
||||
SelectFabButton(Window* parent, EdgeTxIcon icon, const char* title,
|
||||
std::function<uint8_t(void)> pressHandler) :
|
||||
ButtonBase(parent, {}, pressHandler, etx_quick_button_create)
|
||||
{
|
||||
padAll(PAD_ZERO);
|
||||
|
||||
auto newMask = getBuiltinIcon(icon);
|
||||
coord_t fabIconSize = newMask->width + PAD_MEDIUM * 2;
|
||||
|
||||
auto iconLayout =
|
||||
new Window(this,
|
||||
{(SelectFabCarousel::FAB_BUTTON_INNER_WIDTH - fabIconSize) / 2,
|
||||
(SelectFabCarousel::FAB_BUTTON_INNER_WIDTH - fabIconSize) / 2 - PAD_TINY,
|
||||
fabIconSize, fabIconSize},
|
||||
etx_quick_icon_create);
|
||||
iconLayout->setWindowFlag(NO_FOCUS);
|
||||
|
||||
(new StaticIcon(iconLayout, 0, 0, icon, COLOR_WHITE_INDEX))
|
||||
->center(fabIconSize - PAD_BORDER * 2, fabIconSize - PAD_BORDER * 2);
|
||||
|
||||
new StaticText(this, {-PAD_BORDER, SelectFabCarousel::FAB_BUTTON_HEIGHT - SelectFabCarousel::FAB_TXT_YO,
|
||||
SelectFabCarousel::FAB_BUTTON_WIDTH, 0},
|
||||
title, COLOR_WHITE_INDEX, CENTERED);
|
||||
}
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "SelectFabButton"; }
|
||||
#endif
|
||||
|
||||
void onEvent(event_t event) override
|
||||
{
|
||||
#if defined(HARDWARE_KEYS)
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
parent->deleteLater();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ButtonBase::onEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
SelectFabCarousel::SelectFabCarousel(Window* parent) : Window(parent, rect_t{})
|
||||
{
|
||||
padAll(PAD_ZERO);
|
||||
setFlexLayout(LV_FLEX_FLOW_ROW_WRAP, PAD_ZERO);
|
||||
}
|
||||
|
||||
void SelectFabCarousel::addButton(EdgeTxIcon icon, const char* title,
|
||||
std::function<uint8_t(void)> pressHandler)
|
||||
{
|
||||
new SelectFabButton(this, icon, title, pressHandler);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "form.h"
|
||||
#include "bitmaps.h"
|
||||
|
||||
class SelectFabCarousel : public Window
|
||||
{
|
||||
public:
|
||||
explicit SelectFabCarousel(Window* parent);
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "SelectFabCarousel"; }
|
||||
#endif
|
||||
|
||||
// Add a new button to the carousel
|
||||
void addButton(EdgeTxIcon icon, const char* title,
|
||||
std::function<uint8_t(void)> pressHandler);
|
||||
|
||||
static LAYOUT_VAL_SCALED_EVEN(FAB_BUTTON_WIDTH, 76)
|
||||
static LAYOUT_VAL_SCALED(FAB_BUTTON_HEIGHT, 114)
|
||||
|
||||
static LAYOUT_VAL_SCALED(FAB_TXT_YO, 48)
|
||||
static constexpr coord_t FAB_BUTTON_INNER_WIDTH = FAB_BUTTON_WIDTH - PAD_BORDER * 2;
|
||||
};
|
||||
@@ -22,13 +22,13 @@
|
||||
#include "topbar.h"
|
||||
|
||||
#include "layer.h"
|
||||
#include "menu_screen.h"
|
||||
#include "edgetx.h"
|
||||
#include "storage/storage.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "topbar_impl.h"
|
||||
#include "view_main.h"
|
||||
#include "widgets_setup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
TopBar* TopbarFactory::create(Window* parent) { return new TopBar(parent); }
|
||||
|
||||
@@ -72,7 +72,7 @@ void SetupTopBarWidgetsPage::deleteLater(bool detach, bool trash)
|
||||
Window::deleteLater(detach, trash);
|
||||
|
||||
// restore screen setting tab on top
|
||||
new ScreenMenu(0);
|
||||
(PageGroup::ScreenMenu())->setCurrentTab(1);
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
@@ -26,26 +26,12 @@
|
||||
|
||||
constexpr uint32_t TOPBAR_REFRESH = 1000 / 10; // 10 Hz
|
||||
|
||||
class TopBarEdgeTx : public HeaderIcon
|
||||
{
|
||||
public:
|
||||
TopBarEdgeTx(Window* parent) : HeaderIcon(parent, ICON_EDGETX)
|
||||
{
|
||||
lv_obj_add_flag(lvobj, LV_OBJ_FLAG_CLICKABLE);
|
||||
}
|
||||
|
||||
void onClicked() override
|
||||
{
|
||||
ViewMain::instance()->openMenu();
|
||||
}
|
||||
};
|
||||
|
||||
TopBar::TopBar(Window * parent) :
|
||||
TopBarBase(parent, {0, 0, LCD_W, EdgeTxStyles::MENU_HEADER_HEIGHT}, &g_model.topbarData)
|
||||
{
|
||||
etx_solid_bg(lvobj, COLOR_THEME_SECONDARY1_INDEX);
|
||||
|
||||
headerIcon = new TopBarEdgeTx(parent);
|
||||
headerIcon = new HeaderIcon(parent, ICON_EDGETX, [=]() { ViewMain::instance()->openMenu(); });
|
||||
}
|
||||
|
||||
unsigned int TopBar::getZonesCount() const
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "view_about.h"
|
||||
|
||||
#include "edgetx.h"
|
||||
#include "stamp.h"
|
||||
|
||||
#if defined(VERSION_TAG)
|
||||
const std::string about_str =
|
||||
"EdgeTX"
|
||||
" (" VERSION_TAG
|
||||
")\n"
|
||||
"\"" CODENAME "\"";
|
||||
#else
|
||||
const std::string about_str =
|
||||
"EdgeTX"
|
||||
" (" VERSION_PREFIX VERSION VERSION_SUFFIX ")";
|
||||
#endif
|
||||
const std::string copyright_str = "Copyright (C) " BUILD_YEAR " EdgeTX";
|
||||
const std::string edgetx_url = "https://edgetx.org";
|
||||
|
||||
AboutUs::AboutUs() :
|
||||
BaseDialog(STR_ABOUT_US, true, VIEW_W, LV_SIZE_CONTENT)
|
||||
{
|
||||
new StaticText(form, {0, 0, LV_PCT(100), LV_SIZE_CONTENT},
|
||||
about_str + "\n" + copyright_str,
|
||||
COLOR_THEME_SECONDARY1_INDEX, CENTERED);
|
||||
|
||||
auto qrBox = new Window(form, {0, 0, LV_PCT(100), QR_SZ});
|
||||
auto qr = new QRCode(qrBox, 0, 0, QR_SZ, edgetx_url);
|
||||
lv_obj_center(qr->getLvObj());
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
|
||||
class AboutUs : public BaseDialog
|
||||
{
|
||||
public:
|
||||
AboutUs();
|
||||
|
||||
static LAYOUT_VAL_SCALED(QR_SZ, 150)
|
||||
static LAYOUT_VAL_SCALED(VIEW_W, 220)
|
||||
};
|
||||
@@ -22,12 +22,9 @@
|
||||
#include "view_channels.h"
|
||||
|
||||
#include "channel_bar.h"
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
#include "libopenui.h"
|
||||
#include "model_select.h"
|
||||
#include "edgetx.h"
|
||||
#include "view_logical_switches.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -69,14 +66,14 @@ class ChannelsViewFooter : public Window
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class ChannelsViewPage : public PageTab
|
||||
class ChannelsViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
explicit ChannelsViewPage(uint8_t pageIndex = 0) :
|
||||
PageTab(STR_MONITOR_CHANNELS[pageIndex],
|
||||
(EdgeTxIcon)(ICON_MONITOR_CHANNELS1 + pageIndex)),
|
||||
PageGroupItem(STR_MONITOR_CHANNELS[pageIndex]),
|
||||
pageIndex(pageIndex)
|
||||
{
|
||||
icon = ICON_MONITOR;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -111,47 +108,13 @@ class ChannelsViewPage : public PageTab
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ChannelsViewMenu::ChannelsViewMenu(ModelMenu* parent) :
|
||||
TabsGroup(ICON_MONITOR), parentMenu(parent)
|
||||
ChannelsViewMenu::ChannelsViewMenu() :
|
||||
TabsGroup(ICON_MONITOR, STR_MAIN_MENU_CHANNEL_MONITOR)
|
||||
{
|
||||
QuickMenu::setCurrentPage(QuickMenu::TOOLS_CHAN_MON);
|
||||
|
||||
addTab(new ChannelsViewPage(0));
|
||||
addTab(new ChannelsViewPage(1));
|
||||
addTab(new ChannelsViewPage(2));
|
||||
addTab(new ChannelsViewPage(3));
|
||||
addTab(new LogicalSwitchesViewPage());
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void ChannelsViewMenu::onPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
if (parentMenu) parentMenu->onCancel();
|
||||
new RadioMenu();
|
||||
}
|
||||
void ChannelsViewMenu::onLongPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
if (parentMenu) parentMenu->onCancel();
|
||||
// Radio setup
|
||||
(new RadioMenu())->setCurrentTab(2);
|
||||
}
|
||||
void ChannelsViewMenu::onPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
if (!parentMenu) {
|
||||
new ModelMenu();
|
||||
}
|
||||
}
|
||||
void ChannelsViewMenu::onLongPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
if (parentMenu) parentMenu->onCancel();
|
||||
new ModelLabelsWindow();
|
||||
}
|
||||
void ChannelsViewMenu::onPressTELE()
|
||||
{
|
||||
onCancel();
|
||||
if (parentMenu) parentMenu->onCancel();
|
||||
new ScreenMenu();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -21,22 +21,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelMenu;
|
||||
|
||||
class ChannelsViewMenu: public TabsGroup {
|
||||
public:
|
||||
ChannelsViewMenu(ModelMenu* parent = nullptr);
|
||||
|
||||
protected:
|
||||
ModelMenu* parentMenu = nullptr;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onPressSYS() override;
|
||||
void onLongPressSYS() override;
|
||||
void onPressMDL() override;
|
||||
void onLongPressMDL() override;
|
||||
void onPressTELE() override;
|
||||
#endif
|
||||
ChannelsViewMenu();
|
||||
};
|
||||
|
||||
@@ -234,8 +234,8 @@ class LogicalSwitchDisplayButton : public TextButton
|
||||
bool value = false;
|
||||
};
|
||||
|
||||
LogicalSwitchesViewPage::LogicalSwitchesViewPage() :
|
||||
PageTab(STR_MONITOR_SWITCHES, ICON_MONITOR_LOGICAL_SWITCHES)
|
||||
LogicalSwitchesViewPage::LogicalSwitchesViewPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class LogicalSwitchDisplayFooter;
|
||||
|
||||
class LogicalSwitchesViewPage : public PageTab
|
||||
class LogicalSwitchesViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
LogicalSwitchesViewPage();
|
||||
LogicalSwitchesViewPage(PageDef& pageDef);
|
||||
|
||||
static LAYOUT_ORIENTATION_SCALED(FOOTER_HEIGHT, 20, 40)
|
||||
static LAYOUT_ORIENTATION(BTN_MATRIX_COL, 8, 6)
|
||||
|
||||
@@ -21,14 +21,12 @@
|
||||
|
||||
#include "view_main.h"
|
||||
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
#include "model_select.h"
|
||||
#include "edgetx.h"
|
||||
#include "topbar_impl.h"
|
||||
#include "quick_menu.h"
|
||||
#include "view_channels.h"
|
||||
#include "view_main_menu.h"
|
||||
#include "screen_setup.h"
|
||||
|
||||
static void tile_view_deleted_cb(lv_event_t* e)
|
||||
{
|
||||
@@ -247,46 +245,45 @@ void ViewMain::updateTopbarVisibility()
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void ViewMain::onPressSYS()
|
||||
{
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
new RadioMenu();
|
||||
if (!viewMainMenu) openMenu();
|
||||
}
|
||||
void ViewMain::onLongPressSYS()
|
||||
{
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
if (viewMainMenu) viewMainMenu->closeMenu();
|
||||
// Radio setup
|
||||
(new RadioMenu())->setCurrentTab(2);
|
||||
PageGroup::RadioMenu();
|
||||
}
|
||||
void ViewMain::onPressMDL()
|
||||
{
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
new ModelMenu();
|
||||
if (viewMainMenu) viewMainMenu->closeMenu();
|
||||
PageGroup::ModelMenu();
|
||||
}
|
||||
void ViewMain::onLongPressMDL()
|
||||
{
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
if (viewMainMenu) viewMainMenu->closeMenu();
|
||||
new ModelLabelsWindow();
|
||||
}
|
||||
void ViewMain::onPressTELE()
|
||||
{
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
new ScreenMenu();
|
||||
if (viewMainMenu) viewMainMenu->closeMenu();
|
||||
(PageGroup::ScreenMenu())->setCurrentTab(getCurrentMainView() + ScreenSetupPage::FIRST_SCREEN_OFFSET);
|
||||
}
|
||||
void ViewMain::onLongPressTELE()
|
||||
{
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
if (viewMainMenu) viewMainMenu->closeMenu();
|
||||
new ChannelsViewMenu();
|
||||
}
|
||||
void ViewMain::onPressPGUP()
|
||||
{
|
||||
if (!widget_select) {
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
if (viewMainMenu) viewMainMenu->closeMenu();
|
||||
previousMainView();
|
||||
}
|
||||
}
|
||||
void ViewMain::onPressPGDN()
|
||||
{
|
||||
if (!widget_select) {
|
||||
if (viewMainMenu) viewMainMenu->onCancel();
|
||||
if (viewMainMenu) viewMainMenu->closeMenu();
|
||||
nextMainView();
|
||||
}
|
||||
}
|
||||
@@ -351,7 +348,7 @@ bool ViewMain::enableWidgetSelect(bool enable)
|
||||
|
||||
void ViewMain::openMenu()
|
||||
{
|
||||
viewMainMenu = new ViewMainMenu(this, [=]() { viewMainMenu = nullptr; });
|
||||
viewMainMenu = QuickMenu::openQuickMenu([=]() { viewMainMenu = nullptr; });
|
||||
}
|
||||
|
||||
void ViewMain::ws_timer(lv_timer_t* t)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
class SetupWidgetsPage;
|
||||
class SetupTopBarWidgetsPage;
|
||||
class ViewMainMenu;
|
||||
class QuickMenu;
|
||||
|
||||
class ViewMain : public NavWindow
|
||||
{
|
||||
@@ -95,7 +95,7 @@ class ViewMain : public NavWindow
|
||||
TopBar* topbar = nullptr;
|
||||
bool widget_select = false;
|
||||
lv_timer_t* widget_select_timer = nullptr;
|
||||
ViewMainMenu* viewMainMenu = nullptr;
|
||||
QuickMenu* viewMainMenu = nullptr;
|
||||
|
||||
void deleteLater(bool detach = true, bool trash = true) override;
|
||||
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "view_main_menu.h"
|
||||
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
#include "model_select.h"
|
||||
#include "edgetx.h"
|
||||
#include "select_fab_carousel.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "view_about.h"
|
||||
#include "view_channels.h"
|
||||
#include "view_statistics.h"
|
||||
#include "view_text.h"
|
||||
|
||||
static void modal_dialog_constructor(const lv_obj_class_t* class_p,
|
||||
lv_obj_t* obj)
|
||||
{
|
||||
etx_obj_add_style(obj, styles->rounded, LV_PART_MAIN);
|
||||
etx_obj_add_style(obj, styles->bg_opacity_75, LV_PART_MAIN);
|
||||
etx_bg_color(obj, COLOR_BLACK_INDEX, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
static const lv_obj_class_t etx_modal_dialog_class = {
|
||||
.base_class = &window_base_class,
|
||||
.constructor_cb = modal_dialog_constructor,
|
||||
.destructor_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.width_def = 0,
|
||||
.height_def = 0,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_INHERIT,
|
||||
.group_def = LV_OBJ_CLASS_EDITABLE_INHERIT,
|
||||
.instance_size = sizeof(lv_obj_t)};
|
||||
|
||||
static lv_obj_t* etx_modal_dialog_create(lv_obj_t* parent)
|
||||
{
|
||||
return etx_create(&etx_modal_dialog_class, parent);
|
||||
}
|
||||
|
||||
ViewMainMenu::ViewMainMenu(Window* parent, std::function<void()> closeHandler) :
|
||||
Window(parent, {0, 0, LCD_W, LCD_H}),
|
||||
closeHandler(std::move(closeHandler))
|
||||
{
|
||||
// Save focus
|
||||
Layer::push(this);
|
||||
|
||||
coord_t w = SelectFabCarousel::FAB_BUTTON_WIDTH * QM_COLS + PAD_SMALL * 2;
|
||||
coord_t h = SelectFabCarousel::FAB_BUTTON_HEIGHT * QM_ROWS + PAD_SMALL * 2;
|
||||
|
||||
bool hasNotes = modelHasNotes();
|
||||
|
||||
#if LANDSCAPE
|
||||
if (hasNotes)
|
||||
w += SelectFabCarousel::FAB_BUTTON_WIDTH;
|
||||
#endif
|
||||
|
||||
auto box =
|
||||
new Window(this, {(LCD_W - w) / 2, (LCD_H - h) / 2, w, h},
|
||||
etx_modal_dialog_create);
|
||||
box->padAll(PAD_SMALL);
|
||||
|
||||
auto carousel = new SelectFabCarousel(box);
|
||||
carousel->addButton(ICON_MODEL_SELECT, STR_MAIN_MENU_MANAGE_MODELS,
|
||||
[=]() -> uint8_t {
|
||||
deleteLater();
|
||||
new ModelLabelsWindow();
|
||||
return 0;
|
||||
});
|
||||
|
||||
if (hasNotes) {
|
||||
carousel->addButton(ICON_MODEL_NOTES, STR_MAIN_MENU_MODEL_NOTES,
|
||||
[=]() -> uint8_t {
|
||||
deleteLater();
|
||||
readModelNotes(true);
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
carousel->addButton(ICON_MONITOR, STR_MAIN_MENU_CHANNEL_MONITOR,
|
||||
[=]() -> uint8_t {
|
||||
deleteLater();
|
||||
new ChannelsViewMenu();
|
||||
return 0;
|
||||
});
|
||||
|
||||
carousel->addButton(ICON_MODEL, STR_MAIN_MENU_MODEL_SETTINGS,
|
||||
[=]() -> uint8_t {
|
||||
deleteLater();
|
||||
new ModelMenu();
|
||||
return 0;
|
||||
});
|
||||
|
||||
carousel->addButton(ICON_RADIO, STR_MAIN_MENU_RADIO_SETTINGS,
|
||||
[=]() -> uint8_t {
|
||||
deleteLater();
|
||||
new RadioMenu();
|
||||
return 0;
|
||||
});
|
||||
|
||||
carousel->addButton(ICON_THEME, STR_MAIN_MENU_SCREEN_SETTINGS,
|
||||
[=]() -> uint8_t {
|
||||
deleteLater();
|
||||
new ScreenMenu();
|
||||
return 0;
|
||||
});
|
||||
|
||||
carousel->addButton(
|
||||
ICON_MODEL_TELEMETRY, STR_MAIN_MENU_RESET_TELEMETRY, [=]() -> uint8_t {
|
||||
deleteLater();
|
||||
Menu* resetMenu = new Menu();
|
||||
resetMenu->addLine(STR_RESET_FLIGHT, []() { flightReset(); });
|
||||
resetMenu->addLine(STR_RESET_TIMER1, []() { timerReset(0); });
|
||||
resetMenu->addLine(STR_RESET_TIMER2, []() { timerReset(1); });
|
||||
resetMenu->addLine(STR_RESET_TIMER3, []() { timerReset(2); });
|
||||
resetMenu->addLine(STR_RESET_TELEMETRY, []() { telemetryReset(); });
|
||||
return 0;
|
||||
});
|
||||
|
||||
carousel->addButton(ICON_STATS, STR_MAIN_MENU_STATISTICS, [=]() -> uint8_t {
|
||||
deleteLater();
|
||||
new StatisticsViewPageGroup();
|
||||
return 0;
|
||||
});
|
||||
|
||||
carousel->addButton(ICON_EDGETX, STR_MAIN_MENU_ABOUT_EDGETX,
|
||||
[=]() -> uint8_t {
|
||||
deleteLater();
|
||||
new AboutUs();
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
void ViewMainMenu::deleteLater(bool detach, bool trash)
|
||||
{
|
||||
if (closeHandler) closeHandler();
|
||||
Layer::pop(this);
|
||||
Window::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
void ViewMainMenu::onClicked() { deleteLater(); }
|
||||
|
||||
void ViewMainMenu::onCancel() { deleteLater(); }
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "window.h"
|
||||
|
||||
class ViewMainMenu : public Window
|
||||
{
|
||||
public:
|
||||
ViewMainMenu(Window* parent, std::function<void()> closeHandler);
|
||||
|
||||
void onCancel() override;
|
||||
void onClicked() override;
|
||||
void deleteLater(bool detach = true, bool trash = true) override;
|
||||
|
||||
static LAYOUT_ORIENTATION(QM_COLS, 4, 3)
|
||||
static LAYOUT_ORIENTATION(QM_ROWS, 2, 3)
|
||||
|
||||
protected:
|
||||
std::function<void()> closeHandler = nullptr;
|
||||
};
|
||||
@@ -28,33 +28,6 @@
|
||||
#include "mixer_scheduler.h"
|
||||
#include "lua/lua_states.h"
|
||||
|
||||
class StatisticsViewPage : public PageTab
|
||||
{
|
||||
public:
|
||||
StatisticsViewPage() :
|
||||
PageTab(STR_STATISTICS, ICON_STATS_THROTTLE_GRAPH, PAD_ZERO)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void build(Window* window) override;
|
||||
};
|
||||
|
||||
class DebugViewPage : public PageTab
|
||||
{
|
||||
public:
|
||||
DebugViewPage() : PageTab(STR_DEBUG, ICON_STATS_DEBUG, PAD_ZERO) {}
|
||||
|
||||
protected:
|
||||
void build(Window* window) override;
|
||||
};
|
||||
|
||||
class DebugViewMenu : public TabsGroup
|
||||
{
|
||||
public:
|
||||
DebugViewMenu();
|
||||
};
|
||||
|
||||
static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
LV_GRID_FR(1), LV_GRID_FR(1),
|
||||
LV_GRID_TEMPLATE_LAST};
|
||||
@@ -100,12 +73,6 @@ class DebugInfoNumber : public Window
|
||||
}
|
||||
};
|
||||
|
||||
StatisticsViewPageGroup::StatisticsViewPageGroup() : TabsGroup(ICON_STATS)
|
||||
{
|
||||
addTab(new StatisticsViewPage());
|
||||
addTab(new DebugViewPage());
|
||||
}
|
||||
|
||||
class ThrottleCurveWindow : public Window
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -21,10 +21,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class StatisticsViewPageGroup : public TabsGroup
|
||||
class StatisticsViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
StatisticsViewPageGroup();
|
||||
StatisticsViewPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef, PAD_ZERO)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void build(Window* window) override;
|
||||
};
|
||||
|
||||
class DebugViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
DebugViewPage(PageDef& pageDef) : PageGroupItem(pageDef, PAD_ZERO) {}
|
||||
|
||||
protected:
|
||||
void build(Window* window) override;
|
||||
};
|
||||
|
||||
@@ -23,12 +23,13 @@
|
||||
|
||||
#include "layer.h"
|
||||
#include "menu.h"
|
||||
#include "menu_screen.h"
|
||||
#include "myeeprom.h"
|
||||
#include "storage/storage.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "view_main.h"
|
||||
#include "widget_settings.h"
|
||||
#include "pagegroup.h"
|
||||
#include "screen_setup.h"
|
||||
|
||||
SetupWidgetsPageSlot::SetupWidgetsPageSlot(Window* parent, const rect_t& rect,
|
||||
WidgetsContainer* container,
|
||||
@@ -151,7 +152,11 @@ void SetupWidgetsPage::onClicked()
|
||||
// block event forwarding (window is transparent)
|
||||
}
|
||||
|
||||
void SetupWidgetsPage::onCancel() { deleteLater(); }
|
||||
void SetupWidgetsPage::onCancel()
|
||||
{
|
||||
deleteLater();
|
||||
(PageGroup::ScreenMenu())->setCurrentTab(customScreenIdx + ScreenSetupPage::FIRST_SCREEN_OFFSET);
|
||||
}
|
||||
|
||||
void SetupWidgetsPage::deleteLater(bool detach, bool trash)
|
||||
{
|
||||
@@ -166,7 +171,6 @@ void SetupWidgetsPage::deleteLater(bool detach, bool trash)
|
||||
viewMain->showTopBarEdgeTxButton();
|
||||
}
|
||||
Window::deleteLater(detach, trash);
|
||||
new ScreenMenu(customScreenIdx + 1);
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
@@ -343,8 +343,8 @@ class SwitchGroup : public Window
|
||||
|
||||
ModelFunctionSwitches::ModelFunctionSwitches() : Page(ICON_MODEL_SETUP)
|
||||
{
|
||||
header->setTitle(STR_MENU_MODEL_SETUP);
|
||||
header->setTitle2(STR_MENU_FSWITCH);
|
||||
header->setTitle(STR_MAIN_MENU_MODEL_SETTINGS);
|
||||
header->setTitle2(STR_FUNCTION_SWITCHES);
|
||||
|
||||
body->padAll(PAD_TINY);
|
||||
body->setFlexLayout(LV_FLEX_FLOW_COLUMN, PAD_ZERO);
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "menu_model.h"
|
||||
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
#include "model_curves.h"
|
||||
#include "model_flightmodes.h"
|
||||
#include "model_gvars.h"
|
||||
#include "model_heli.h"
|
||||
#include "model_inputs.h"
|
||||
#include "model_logical_switches.h"
|
||||
#include "model_mixer_scripts.h"
|
||||
#include "model_mixes.h"
|
||||
#include "model_outputs.h"
|
||||
#include "model_select.h"
|
||||
#include "model_setup.h"
|
||||
#include "model_telemetry.h"
|
||||
#include "edgetx.h"
|
||||
#include "special_functions.h"
|
||||
#include "translations.h"
|
||||
#include "view_channels.h"
|
||||
|
||||
ModelMenu::ModelMenu() : TabsGroup(ICON_MODEL) { build(); }
|
||||
|
||||
void ModelMenu::build()
|
||||
{
|
||||
addTab(new ModelSetupPage());
|
||||
#if defined(HELI)
|
||||
addTab(new ModelHeliPage());
|
||||
#endif
|
||||
#if defined(FLIGHT_MODES)
|
||||
addTab(new ModelFlightModesPage());
|
||||
#endif
|
||||
addTab(new ModelInputsPage());
|
||||
addTab(new ModelMixesPage());
|
||||
addTab(new ModelOutputsPage());
|
||||
addTab(new ModelCurvesPage());
|
||||
#if defined(GVARS)
|
||||
addTab(new ModelGVarsPage());
|
||||
#endif
|
||||
addTab(new ModelLogicalSwitchesPage());
|
||||
addTab(new SpecialFunctionsPage());
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
addTab(new ModelMixerScriptsPage());
|
||||
#endif
|
||||
addTab(new ModelTelemetryPage());
|
||||
|
||||
#if defined(PCBPL18) || defined(PCBST16)
|
||||
new TextButton(
|
||||
this,
|
||||
{LCD_W / 2 + 6, MENU_TITLE_TOP, LCD_W / 2 - 8, MENU_TITLE_HEIGHT},
|
||||
STR_OPEN_CHANNEL_MONITORS, [=]() {
|
||||
new ChannelsViewMenu(this);
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void ModelMenu::onPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
new RadioMenu();
|
||||
}
|
||||
void ModelMenu::onLongPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
// Radio setup
|
||||
(new RadioMenu())->setCurrentTab(2);
|
||||
}
|
||||
void ModelMenu::onPressMDL() { new ChannelsViewMenu(this); }
|
||||
void ModelMenu::onLongPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
new ModelLabelsWindow();
|
||||
}
|
||||
void ModelMenu::onPressTELE()
|
||||
{
|
||||
onCancel();
|
||||
new ScreenMenu();
|
||||
}
|
||||
void ModelMenu::onLongPressTELE() { new ChannelsViewMenu(this); }
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
|
||||
class ModelMenu : public TabsGroup
|
||||
{
|
||||
public:
|
||||
ModelMenu();
|
||||
|
||||
#if defined(DEBUG_WINDOWS)
|
||||
std::string getName() const override { return "ModelMenu"; }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void build();
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onPressSYS() override;
|
||||
void onLongPressSYS() override;
|
||||
void onPressMDL() override;
|
||||
void onLongPressMDL() override;
|
||||
void onPressTELE() override;
|
||||
void onLongPressTELE() override;
|
||||
#endif
|
||||
};
|
||||
@@ -108,7 +108,7 @@ void initPoints(const CurveHeader &curve, int8_t *points)
|
||||
}
|
||||
}
|
||||
|
||||
ModelCurvesPage::ModelCurvesPage() : PageTab(STR_MENUCURVES, ICON_MODEL_CURVES)
|
||||
ModelCurvesPage::ModelCurvesPage(PageDef& pageDef) : PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "edgetx.h"
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelCurvesPage : public PageTab
|
||||
class ModelCurvesPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ModelCurvesPage();
|
||||
ModelCurvesPage(PageDef& pageDef);
|
||||
|
||||
static void pushEditCurve(int index, std::function<void(void)> refreshView, mixsrc_t source);
|
||||
|
||||
bool isVisible() const override { return modelCurvesEnabled(); }
|
||||
|
||||
@@ -462,8 +462,8 @@ const lv_obj_class_t FlightModeBtn::fm_trim_value_class = {
|
||||
.instance_size = sizeof(lv_label_t),
|
||||
};
|
||||
|
||||
ModelFlightModesPage::ModelFlightModesPage() :
|
||||
PageTab(STR_MENUFLIGHTMODES, ICON_MODEL_FLIGHT_MODES)
|
||||
ModelFlightModesPage::ModelFlightModesPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "edgetx.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelFlightModesPage : public PageTab
|
||||
class ModelFlightModesPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ModelFlightModesPage();
|
||||
ModelFlightModesPage(PageDef& pageDef);
|
||||
|
||||
bool isVisible() const override { return modelFMEnabled(); }
|
||||
|
||||
|
||||
@@ -507,8 +507,8 @@ class GVarEditWindow : public Page
|
||||
}
|
||||
};
|
||||
|
||||
ModelGVarsPage::ModelGVarsPage() :
|
||||
PageTab(STR_MENU_GLOBAL_VARS, ICON_MODEL_GVARS)
|
||||
ModelGVarsPage::ModelGVarsPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -534,7 +534,7 @@ void ModelGVarsPage::build(Window* window)
|
||||
if (modelFMEnabled()) {
|
||||
window->padTop(PAD_OUTLINE);
|
||||
hdr = new GVarHeader(window->getParent());
|
||||
lv_obj_set_pos(hdr->getLvObj(), 0, TabsGroup::MENU_TITLE_TOP + TabsGroup::MENU_TITLE_HEIGHT);
|
||||
lv_obj_set_pos(hdr->getLvObj(), 0, PageGroup::PAGE_TOP_BAR_H);
|
||||
yo = GVarHeader::HDR_H;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "edgetx.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelGVarsPage : public PageTab
|
||||
class ModelGVarsPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ModelGVarsPage();
|
||||
ModelGVarsPage(PageDef& pageDef);
|
||||
|
||||
bool isVisible() const override { return modelGVEnabled(); }
|
||||
|
||||
|
||||
@@ -38,28 +38,24 @@ static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_CONTENT,
|
||||
#endif
|
||||
|
||||
ModelHeliPage::ModelHeliPage():
|
||||
PageTab(STR_MENUHELISETUP, ICON_MODEL_HELI)
|
||||
{
|
||||
}
|
||||
|
||||
void ModelHeliPage::build(Window* form)
|
||||
SubPage(ICON_MODEL_HELI, STR_MAIN_MENU_MODEL_SETTINGS, STR_MENUHELISETUP)
|
||||
{
|
||||
FlexGridLayout grid(col_dsc, row_dsc, PAD_TINY);
|
||||
form->setFlexLayout();
|
||||
body->setFlexLayout();
|
||||
|
||||
// Swash type
|
||||
auto line = form->newLine(grid);
|
||||
auto line = body->newLine(grid);
|
||||
new StaticText(line, rect_t{}, STR_SWASHTYPE);
|
||||
new Choice(line, rect_t{}, STR_VSWASHTYPE, 0, SWASH_TYPE_MAX,
|
||||
GET_SET_DEFAULT(g_model.swashR.type));
|
||||
|
||||
// Swash ring
|
||||
line = form->newLine(grid);
|
||||
line = body->newLine(grid);
|
||||
new StaticText(line, rect_t{}, STR_SWASHRING);
|
||||
new NumberEdit(line, rect_t{}, 0, 100, GET_SET_DEFAULT(g_model.swashR.value));
|
||||
|
||||
// Elevator source
|
||||
line = form->newLine(grid);
|
||||
line = body->newLine(grid);
|
||||
new StaticText(line, rect_t{}, STR_ELEVATOR);
|
||||
new SourceChoice(line, rect_t{}, 0, MIXSRC_LAST_CH,
|
||||
GET_SET_DEFAULT(g_model.swashR.elevatorSource));
|
||||
@@ -71,7 +67,7 @@ void ModelHeliPage::build(Window* form)
|
||||
GET_SET_DEFAULT(g_model.swashR.elevatorWeight));
|
||||
|
||||
// Aileron source
|
||||
line = form->newLine(grid);
|
||||
line = body->newLine(grid);
|
||||
new StaticText(line, rect_t{}, STR_AILERON);
|
||||
new SourceChoice(line, rect_t{}, 0, MIXSRC_LAST_CH,
|
||||
GET_SET_DEFAULT(g_model.swashR.aileronSource));
|
||||
@@ -83,7 +79,7 @@ void ModelHeliPage::build(Window* form)
|
||||
GET_SET_DEFAULT(g_model.swashR.aileronWeight));
|
||||
|
||||
// Collective source
|
||||
line = form->newLine(grid);
|
||||
line = body->newLine(grid);
|
||||
new StaticText(line, rect_t{}, STR_COLLECTIVE);
|
||||
new SourceChoice(line, rect_t{}, 0, MIXSRC_LAST_CH,
|
||||
GET_SET_DEFAULT(g_model.swashR.collectiveSource));
|
||||
|
||||
@@ -21,15 +21,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "edgetx.h"
|
||||
#include "tabsgroup.h"
|
||||
#include "page.h"
|
||||
|
||||
class ModelHeliPage : public PageTab
|
||||
class ModelHeliPage : public SubPage
|
||||
{
|
||||
public:
|
||||
ModelHeliPage();
|
||||
|
||||
bool isVisible() const override { return modelHeliEnabled(); }
|
||||
|
||||
void build(Window* window) override;
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ class InputGroup : public InputMixGroupBase
|
||||
}
|
||||
};
|
||||
|
||||
ModelInputsPage::ModelInputsPage() : InputMixPageBase(STR_MENUINPUTS, ICON_MODEL_INPUTS)
|
||||
ModelInputsPage::ModelInputsPage(PageDef& pageDef) : InputMixPageBase(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "list_line_button.h"
|
||||
#include <list>
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelInputsPage : public InputMixPageBase
|
||||
{
|
||||
public:
|
||||
ModelInputsPage();
|
||||
ModelInputsPage(PageDef& pageDef);
|
||||
|
||||
void build(Window *window) override;
|
||||
|
||||
|
||||
@@ -522,8 +522,8 @@ class LogicalSwitchButton : public ListLineButton
|
||||
lv_obj_t* lsDelay = nullptr;
|
||||
};
|
||||
|
||||
ModelLogicalSwitchesPage::ModelLogicalSwitchesPage() :
|
||||
PageTab(STR_MENULOGICALSWITCHES, ICON_MODEL_LOGICAL_SWITCHES)
|
||||
ModelLogicalSwitchesPage::ModelLogicalSwitchesPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "edgetx.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelLogicalSwitchesPage : public PageTab
|
||||
class ModelLogicalSwitchesPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ModelLogicalSwitchesPage();
|
||||
ModelLogicalSwitchesPage(PageDef& pageDef);
|
||||
|
||||
bool isVisible() const override { return modelLSEnabled(); }
|
||||
|
||||
|
||||
@@ -252,8 +252,8 @@ class ScriptLineButton : public ListLineButton
|
||||
const ScriptInternalData* runtimeData;
|
||||
};
|
||||
|
||||
ModelMixerScriptsPage::ModelMixerScriptsPage() :
|
||||
PageTab(STR_MENUCUSTOMSCRIPTS, ICON_MODEL_LUA_SCRIPTS)
|
||||
ModelMixerScriptsPage::ModelMixerScriptsPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "edgetx.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelMixerScriptsPage : public PageTab
|
||||
class ModelMixerScriptsPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ModelMixerScriptsPage();
|
||||
ModelMixerScriptsPage(PageDef& pageDef);
|
||||
|
||||
bool isVisible() const override { return modelCustomScriptsEnabled(); }
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ class MixGroup : public InputMixGroupBase
|
||||
bool monitorVisible = false;
|
||||
};
|
||||
|
||||
ModelMixesPage::ModelMixesPage() : InputMixPageBase(STR_MIXES, ICON_MODEL_MIXER)
|
||||
ModelMixesPage::ModelMixesPage(PageDef& pageDef) : InputMixPageBase(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "list_line_button.h"
|
||||
#include <list>
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelMixesPage : public InputMixPageBase
|
||||
{
|
||||
public:
|
||||
ModelMixesPage();
|
||||
ModelMixesPage(PageDef& pageDef);
|
||||
|
||||
void build(Window* window) override;
|
||||
|
||||
|
||||
@@ -210,8 +210,8 @@ class OutputLineButton : public ListLineButton
|
||||
}
|
||||
};
|
||||
|
||||
ModelOutputsPage::ModelOutputsPage() :
|
||||
PageTab(STR_MENULIMITS, ICON_MODEL_OUTPUTS)
|
||||
ModelOutputsPage::ModelOutputsPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,14 +21,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class OutputLineButton;
|
||||
|
||||
class ModelOutputsPage : public PageTab
|
||||
class ModelOutputsPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ModelOutputsPage();
|
||||
ModelOutputsPage(PageDef& pageDef);
|
||||
|
||||
void build(Window* window) override;
|
||||
|
||||
static constexpr coord_t ADD_TRIMS_X = PAD_SMALL;
|
||||
|
||||
@@ -21,14 +21,13 @@
|
||||
|
||||
#include "model_select.h"
|
||||
|
||||
#include "menu_model.h"
|
||||
#include "menu_radio.h"
|
||||
#include "menu_screen.h"
|
||||
#include "model_templates.h"
|
||||
#include "edgetx.h"
|
||||
#include "model_templates.h"
|
||||
#include "standalone_lua.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "view_main.h"
|
||||
#include "view_channels.h"
|
||||
#include "screen_setup.h"
|
||||
|
||||
inline tmr10ms_t getTicks() { return g_tmr10ms; }
|
||||
|
||||
@@ -520,8 +519,10 @@ class ModelLayoutButton : public IconButton
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ModelLabelsWindow::ModelLabelsWindow() : Page(ICON_MODEL, PAD_ZERO, true)
|
||||
ModelLabelsWindow::ModelLabelsWindow() : Page(ICON_MODEL_SELECT, PAD_ZERO, true)
|
||||
{
|
||||
QuickMenu::setCurrentPage(QuickMenu::MANAGE_MODELS);
|
||||
|
||||
buildHead(header);
|
||||
buildBody(body);
|
||||
|
||||
@@ -546,26 +547,21 @@ ModelLabelsWindow::ModelLabelsWindow() : Page(ICON_MODEL, PAD_ZERO, true)
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void ModelLabelsWindow::onPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
new RadioMenu();
|
||||
}
|
||||
void ModelLabelsWindow::onLongPressSYS()
|
||||
{
|
||||
onCancel();
|
||||
// Radio setup
|
||||
(new RadioMenu())->setCurrentTab(2);
|
||||
PageGroup::RadioMenu();
|
||||
}
|
||||
void ModelLabelsWindow::onPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
new ModelMenu();
|
||||
PageGroup::ModelMenu();
|
||||
}
|
||||
void ModelLabelsWindow::onPressTELE()
|
||||
{
|
||||
onCancel();
|
||||
new ScreenMenu();
|
||||
(PageGroup::ScreenMenu())->setCurrentTab(ViewMain::instance()->getCurrentMainView() + ScreenSetupPage::FIRST_SCREEN_OFFSET);
|
||||
}
|
||||
void ModelLabelsWindow::onLongPressTELE()
|
||||
{
|
||||
@@ -682,8 +678,9 @@ void ModelLabelsWindow::buildHead(Window *hdr)
|
||||
// page title
|
||||
setTitle();
|
||||
|
||||
#if !PORTRAIT
|
||||
// new model button
|
||||
new TextButton(hdr, {LCD_W - NEW_BTN_W - PAD_LARGE, PAD_MEDIUM, NEW_BTN_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, STR_NEW, [=]() {
|
||||
new TextButton(hdr, {LCD_W - PageGroup::PAGE_TOP_BAR_H - NEW_BTN_W - PAD_LARGE, PAD_MEDIUM, NEW_BTN_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, STR_NEW, [=]() {
|
||||
auto menu = new Menu();
|
||||
menu->setTitle(STR_CREATE_NEW);
|
||||
menu->addLine(STR_NEW_MODEL, [=]() { newModel(); });
|
||||
@@ -691,7 +688,7 @@ void ModelLabelsWindow::buildHead(Window *hdr)
|
||||
return 0;
|
||||
});
|
||||
|
||||
mdlLayout = new ModelLayoutButton(this, LCD_W - LAYOUT_BTN_XO, PAD_MEDIUM, g_eeGeneral.modelSelectLayout, [=]() {
|
||||
mdlLayout = new ModelLayoutButton(this, LCD_W - PageGroup::PAGE_TOP_BAR_H - LAYOUT_BTN_XO, PAD_MEDIUM, g_eeGeneral.modelSelectLayout, [=]() {
|
||||
uint8_t l = mdlLayout->getLayout();
|
||||
l = (l + 1) & 3;
|
||||
mdlLayout->setLayout(l);
|
||||
@@ -700,6 +697,7 @@ void ModelLabelsWindow::buildHead(Window *hdr)
|
||||
mdlselector->reload();
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void ModelLabelsWindow::buildBody(Window *window)
|
||||
@@ -731,6 +729,27 @@ void ModelLabelsWindow::buildBody(Window *window)
|
||||
[=](int newValue) { mdlselector->setSortOrder((ModelsSortBy)newValue); },
|
||||
STR_SORT_MODELS_BY);
|
||||
|
||||
#if PORTRAIT
|
||||
// new model button
|
||||
new TextButton(window, {LCD_W - NEW_BTN_W - PAD_LARGE, LABELS_Y + LABELS_HEIGHT + PAD_SMALL, NEW_BTN_W, EdgeTxStyles::UI_ELEMENT_HEIGHT}, STR_NEW, [=]() {
|
||||
auto menu = new Menu();
|
||||
menu->setTitle(STR_CREATE_NEW);
|
||||
menu->addLine(STR_NEW_MODEL, [=]() { newModel(); });
|
||||
menu->addLine(STR_NEW_LABEL, [=]() { newLabel(); });
|
||||
return 0;
|
||||
});
|
||||
|
||||
mdlLayout = new ModelLayoutButton(window, LCD_W - LAYOUT_BTN_XO, LABELS_Y + LABELS_HEIGHT + PAD_SMALL, g_eeGeneral.modelSelectLayout, [=]() {
|
||||
uint8_t l = mdlLayout->getLayout();
|
||||
l = (l + 1) & 3;
|
||||
mdlLayout->setLayout(l);
|
||||
g_eeGeneral.modelSelectLayout = l;
|
||||
storageDirty(EE_GENERAL);
|
||||
mdlselector->reload();
|
||||
return 0;
|
||||
});
|
||||
#endif
|
||||
|
||||
std::set<uint32_t> filteredLabels = modelslabels.filteredLabels();
|
||||
|
||||
if (g_eeGeneral.labelSingleSelect == 0) {
|
||||
|
||||
@@ -74,7 +74,6 @@ class ModelLabelsWindow : public Page
|
||||
void moveLabel(int selected, int direction);
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onPressSYS() override;
|
||||
void onLongPressSYS() override;
|
||||
void onPressMDL() override;
|
||||
void onPressTELE() override;
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "edgetx.h"
|
||||
#include "storage/modelslist.h"
|
||||
#include "etx_lv_theme.h"
|
||||
#include "model_heli.h"
|
||||
|
||||
#if defined(USBJ_EX)
|
||||
#include "model_usbjoystick.h"
|
||||
@@ -52,8 +53,8 @@
|
||||
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
ModelSetupPage::ModelSetupPage() :
|
||||
PageTab(STR_MENU_MODEL_SETUP, ICON_MODEL_SETUP)
|
||||
ModelSetupPage::ModelSetupPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
STR_RADIO_MENU_TABS, nullptr,
|
||||
},
|
||||
{
|
||||
STR_THEME_EDITOR,
|
||||
STR_MAIN_MENU_THEMES,
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_DEFAULT(g_model.radioThemesDisabled),
|
||||
@@ -363,13 +364,16 @@ void ModelSetupPage::build(Window * window)
|
||||
{STR_PREFLIGHT, []() { new PreflightChecks(); }},
|
||||
{STR_TRIMS, []() { new TrimsSetup(); }},
|
||||
{STR_THROTTLE_LABEL, []() { new ThrottleParams(); }},
|
||||
{STR_ENABLED_FEATURES, []() { new SubPage(ICON_MODEL_SETUP, STR_MENU_MODEL_SETUP, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
{STR_ENABLED_FEATURES, []() { new SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
#if defined(USBJ_EX)
|
||||
{STR_USBJOYSTICK_LABEL, []() { new ModelUSBJoystickPage(); }},
|
||||
#endif
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
{STR_FUNCTION_SWITCHES, []() { new ModelFunctionSwitches(); }},
|
||||
#endif
|
||||
{STR_MENU_OTHER, []() { new SubPage(ICON_MODEL_SETUP, STR_MENU_MODEL_SETUP, STR_MENU_OTHER, otherPageSetupLines, DIM(otherPageSetupLines)); }},
|
||||
{STR_MENU_OTHER, []() { new SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_MENU_OTHER, otherPageSetupLines, DIM(otherPageSetupLines)); }},
|
||||
#if defined(HELI)
|
||||
{STR_MENUHELISETUP, []() { return new ModelHeliPage(); }, nullptr, modelHeliEnabled},
|
||||
#endif
|
||||
}, BTN_H);
|
||||
}
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelSetupPage: public PageTab {
|
||||
class TextButton;
|
||||
|
||||
class ModelSetupPage: public PageGroupItem {
|
||||
public:
|
||||
ModelSetupPage();
|
||||
ModelSetupPage(PageDef& pageDef);
|
||||
|
||||
void build(Window * window) override;
|
||||
|
||||
|
||||
@@ -748,8 +748,8 @@ class SensorEditWindow : public SubPage
|
||||
static LAYOUT_SIZE(NUM_EDIT_W, EdgeTxStyles::EDIT_FLD_WIDTH_NARROW, LAYOUT_SCALE(80))
|
||||
};
|
||||
|
||||
ModelTelemetryPage::ModelTelemetryPage() :
|
||||
PageTab(STR_MENUTELEMETRY, ICON_MODEL_TELEMETRY)
|
||||
ModelTelemetryPage::ModelTelemetryPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
tsStyle.init();
|
||||
}
|
||||
@@ -770,7 +770,7 @@ void ModelTelemetryPage::checkEvents()
|
||||
lastKnownIndex = _lastKnownIndex;
|
||||
}
|
||||
|
||||
PageTab::checkEvents();
|
||||
PageGroupItem::checkEvents();
|
||||
}
|
||||
|
||||
void ModelTelemetryPage::editSensor(uint8_t index)
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "edgetx.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ModelTelemetryPage : public PageTab
|
||||
class ModelTelemetryPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ModelTelemetryPage();
|
||||
ModelTelemetryPage(PageDef& pageDef);
|
||||
|
||||
bool isVisible() const override { return modelTelemetryEnabled(); }
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ class USBChannelLineButton : public ListLineButton
|
||||
|
||||
ModelUSBJoystickPage::ModelUSBJoystickPage() : Page(ICON_MODEL_USB, PAD_BORDER)
|
||||
{
|
||||
header->setTitle(STR_MENU_MODEL_SETUP);
|
||||
header->setTitle(STR_MAIN_MENU_MODEL_SETTINGS);
|
||||
header->setTitle2(STR_USBJOYSTICK_LABEL);
|
||||
|
||||
body->setFlexLayout();
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#include "page.h"
|
||||
|
||||
class Window;
|
||||
class USBChannelLineButton;
|
||||
class TextButton;
|
||||
|
||||
class ModelUSBJoystickPage : public Page
|
||||
{
|
||||
|
||||
@@ -190,7 +190,7 @@ class PotWarnMatrix : public ButtonMatrix
|
||||
uint8_t pot_idx[MAX_POTS];
|
||||
};
|
||||
|
||||
PreflightChecks::PreflightChecks() : SubPage(ICON_MODEL_SETUP, STR_MENU_MODEL_SETUP, STR_PREFLIGHT)
|
||||
PreflightChecks::PreflightChecks() : SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_PREFLIGHT)
|
||||
{
|
||||
body->setFlexLayout();
|
||||
|
||||
|
||||
@@ -691,9 +691,9 @@ void FunctionEditPage::buildBody(Window *form)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
FunctionsPage::FunctionsPage(CustomFunctionData *functions, const char *title,
|
||||
const char *prefix, EdgeTxIcon icon) :
|
||||
PageTab(title, icon), functions(functions), title(title), prefix(prefix)
|
||||
FunctionsPage::FunctionsPage(CustomFunctionData *functions, PageDef& pageDef,
|
||||
const char *prefix) :
|
||||
PageGroupItem(pageDef), functions(functions), prefix(prefix)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -961,9 +961,8 @@ class SpecialFunctionEditPage : public FunctionEditPage
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
SpecialFunctionsPage::SpecialFunctionsPage() :
|
||||
FunctionsPage(g_model.customFn, STR_MENUCUSTOMFUNC, "SF",
|
||||
ICON_MODEL_SPECIAL_FUNCTIONS)
|
||||
SpecialFunctionsPage::SpecialFunctionsPage(PageDef& pageDef) :
|
||||
FunctionsPage(g_model.customFn, pageDef, "SF")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1042,9 +1041,8 @@ class GlobalFunctionEditPage : public FunctionEditPage
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
GlobalFunctionsPage::GlobalFunctionsPage() :
|
||||
FunctionsPage(g_eeGeneral.customFn, STR_MENUSPECIALFUNCS, "GF",
|
||||
ICON_RADIO_GLOBAL_FUNCTIONS)
|
||||
GlobalFunctionsPage::GlobalFunctionsPage(PageDef& pageDef) :
|
||||
FunctionsPage(g_eeGeneral.customFn, pageDef, "GF")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "list_line_button.h"
|
||||
#include "edgetx.h"
|
||||
#include "page.h"
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
struct CustomFunctionData;
|
||||
class FunctionEditPage;
|
||||
@@ -115,11 +115,10 @@ class FunctionEditPage : public Page
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class FunctionsPage : public PageTab
|
||||
class FunctionsPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
FunctionsPage(CustomFunctionData* functions, const char* title,
|
||||
const char* prefix, EdgeTxIcon icon);
|
||||
FunctionsPage(CustomFunctionData* functions, PageDef& pageDef, const char* prefix);
|
||||
|
||||
void build(Window* window) override;
|
||||
|
||||
@@ -131,7 +130,6 @@ class FunctionsPage : public PageTab
|
||||
bool isRebuilding = false;
|
||||
CustomFunctionData* functions;
|
||||
ButtonBase* addButton = nullptr;
|
||||
const char* title = nullptr;
|
||||
const char* prefix = nullptr;
|
||||
|
||||
void rebuild(Window* window);
|
||||
@@ -154,7 +152,7 @@ class FunctionsPage : public PageTab
|
||||
class SpecialFunctionsPage : public FunctionsPage
|
||||
{
|
||||
public:
|
||||
SpecialFunctionsPage();
|
||||
SpecialFunctionsPage(PageDef& pageDef);
|
||||
|
||||
bool isVisible() const override { return modelSFEnabled(); }
|
||||
|
||||
@@ -171,7 +169,7 @@ class SpecialFunctionsPage : public FunctionsPage
|
||||
class GlobalFunctionsPage : public FunctionsPage
|
||||
{
|
||||
public:
|
||||
GlobalFunctionsPage();
|
||||
GlobalFunctionsPage(PageDef& pageDef);
|
||||
|
||||
bool isVisible() const override { return radioGFEnabled(); }
|
||||
|
||||
|
||||
@@ -72,6 +72,6 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
};
|
||||
|
||||
ThrottleParams::ThrottleParams() : SubPage(ICON_MODEL_SETUP, STR_MENU_MODEL_SETUP, STR_THROTTLE_LABEL, setupLines, DIM(setupLines))
|
||||
ThrottleParams::ThrottleParams() : SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_THROTTLE_LABEL, setupLines, DIM(setupLines))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#define SET_DIRTY() storageDirty(EE_MODEL)
|
||||
|
||||
TimerWindow::TimerWindow(uint8_t timer) :
|
||||
SubPage(ICON_STATS_TIMERS, STR_MENU_MODEL_SETUP, (std::string(STR_TIMER) + std::to_string(timer + 1)).c_str())
|
||||
SubPage(ICON_STATS_TIMERS, STR_MAIN_MENU_MODEL_SETTINGS, (std::string(STR_TIMER) + std::to_string(timer + 1)).c_str())
|
||||
{
|
||||
body->setFlexLayout();
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ void TrainerModuleWindow::update()
|
||||
|
||||
TrainerPage::TrainerPage() : Page(ICON_MODEL_SETUP)
|
||||
{
|
||||
header->setTitle(STR_MENU_MODEL_SETUP);
|
||||
header->setTitle(STR_MAIN_MENU_MODEL_SETTINGS);
|
||||
header->setTitle2(STR_TRAINER);
|
||||
|
||||
body->setFlexLayout();
|
||||
|
||||
@@ -79,6 +79,6 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
};
|
||||
|
||||
TrimsSetup::TrimsSetup() : SubPage(ICON_MODEL_SETUP, STR_MENU_MODEL_SETUP, STR_TRIMS, setupLines, DIM(setupLines))
|
||||
TrimsSetup::TrimsSetup() : SubPage(ICON_MODEL_SETUP, STR_MAIN_MENU_MODEL_SETTINGS, STR_TRIMS, setupLines, DIM(setupLines))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "window.h"
|
||||
#include "module_setup.h"
|
||||
#include "form.h"
|
||||
|
||||
class Choice;
|
||||
struct ModuleData;
|
||||
|
||||
@@ -32,16 +32,16 @@ BindChoiceMenu::BindChoiceMenu(uint8_t moduleIdx,
|
||||
Menu(), moduleIdx(moduleIdx), onPressHandler(std::move(onPress))
|
||||
{
|
||||
if (isTelemAllowedOnBind(moduleIdx)) {
|
||||
addLine(STR_BINDING_1_8_TELEM_ON, [=]() { onSelect(Bind_1_8_TELEM_ON); });
|
||||
addLine(STR_BINDING_CH1_8_TELEM_ON, [=]() { onSelect(Bind_1_8_TELEM_ON); });
|
||||
}
|
||||
addLine(STR_BINDING_1_8_TELEM_OFF, [=]() { onSelect(Bind_1_8_TELEM_OFF); });
|
||||
addLine(STR_BINDING_CH1_8_TELEM_OFF, [=]() { onSelect(Bind_1_8_TELEM_OFF); });
|
||||
|
||||
if (isBindCh9To16Allowed(moduleIdx)) {
|
||||
if (isTelemAllowedOnBind(moduleIdx)) {
|
||||
addLine(STR_BINDING_9_16_TELEM_ON,
|
||||
addLine(STR_BINDING_CH9_16_TELEM_ON,
|
||||
[=]() { onSelect(Bind_9_16_TELEM_ON); });
|
||||
}
|
||||
addLine(STR_BINDING_9_16_TELEM_OFF,
|
||||
addLine(STR_BINDING_CH9_16_TELEM_OFF,
|
||||
[=]() { onSelect(Bind_9_16_TELEM_OFF); });
|
||||
}
|
||||
setTitle(STR_SELECT_MODE);
|
||||
|
||||
@@ -729,7 +729,7 @@ ModulePage::ModulePage(uint8_t moduleIdx) : Page(ICON_MODEL_SETUP)
|
||||
{
|
||||
const char* title2 =
|
||||
moduleIdx == INTERNAL_MODULE ? STR_INTERNALRF : STR_EXTERNALRF;
|
||||
header->setTitle(STR_MENU_MODEL_SETUP);
|
||||
header->setTitle(STR_MAIN_MENU_MODEL_SETTINGS);
|
||||
header->setTitle2(title2);
|
||||
|
||||
body->setFlexLayout();
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "menu_radio.h"
|
||||
|
||||
#include "menu_model.h"
|
||||
#include "menu_screen.h"
|
||||
#include "model_select.h"
|
||||
#include "myeeprom.h"
|
||||
#include "edgetx.h"
|
||||
#include "radio_calibration.h"
|
||||
#include "radio_hardware.h"
|
||||
#include "radio_sdmanager.h"
|
||||
#include "radio_setup.h"
|
||||
#include "radio_theme.h"
|
||||
#include "radio_tools.h"
|
||||
#include "radio_trainer.h"
|
||||
#include "radio_version.h"
|
||||
#include "special_functions.h"
|
||||
#include "view_channels.h"
|
||||
|
||||
RadioMenu::RadioMenu() : TabsGroup(ICON_RADIO) { build(); }
|
||||
|
||||
RadioMenu::~RadioMenu() { storageCheck(true); }
|
||||
|
||||
void RadioMenu::build()
|
||||
{
|
||||
addTab(new RadioToolsPage());
|
||||
addTab(new RadioSdManagerPage());
|
||||
addTab(new RadioSetupPage());
|
||||
addTab(new ThemeSetupPage(this));
|
||||
addTab(new GlobalFunctionsPage());
|
||||
addTab(new RadioTrainerPage());
|
||||
addTab(new RadioHardwarePage());
|
||||
addTab(new RadioVersionPage());
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void RadioMenu::onPressSYS() { setCurrentTab(0); }
|
||||
void RadioMenu::onLongPressSYS() { setCurrentTab(2); }
|
||||
void RadioMenu::onPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
new ModelMenu();
|
||||
}
|
||||
void RadioMenu::onLongPressMDL()
|
||||
{
|
||||
onCancel();
|
||||
new ModelLabelsWindow();
|
||||
}
|
||||
void RadioMenu::onPressTELE()
|
||||
{
|
||||
onCancel();
|
||||
new ScreenMenu();
|
||||
}
|
||||
void RadioMenu::onLongPressTELE()
|
||||
{
|
||||
onCancel();
|
||||
new ChannelsViewMenu();
|
||||
}
|
||||
#endif
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
|
||||
class RadioMenu : public TabsGroup
|
||||
{
|
||||
public:
|
||||
RadioMenu();
|
||||
~RadioMenu();
|
||||
|
||||
protected:
|
||||
void build();
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onPressSYS() override;
|
||||
void onLongPressSYS() override;
|
||||
void onPressMDL() override;
|
||||
void onLongPressMDL() override;
|
||||
void onPressTELE() override;
|
||||
void onLongPressTELE() override;
|
||||
#endif
|
||||
};
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "page.h"
|
||||
|
||||
class StaticText;
|
||||
class TextButton;
|
||||
|
||||
class RadioCalibrationPage: public Page {
|
||||
public:
|
||||
|
||||
@@ -257,7 +257,7 @@ class RadioFunctionSwitch : public Window
|
||||
RadioFunctionSwitches::RadioFunctionSwitches() : Page(ICON_RADIO_HARDWARE)
|
||||
{
|
||||
header->setTitle(STR_HARDWARE);
|
||||
header->setTitle2(STR_MENU_FSWITCH);
|
||||
header->setTitle2(STR_FUNCTION_SWITCHES);
|
||||
|
||||
body->padAll(PAD_TINY);
|
||||
body->setFlexLayout(LV_FLEX_FLOW_COLUMN, PAD_ZERO);
|
||||
|
||||
@@ -467,10 +467,14 @@ class AnaMinMaxViewWindow : public AnaViewWindow
|
||||
static LAYOUT_SIZE(GRIDCOLS, 10, 5)
|
||||
};
|
||||
|
||||
class AnaCalibratedViewPage : public PageTab
|
||||
class AnaCalibratedViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
AnaCalibratedViewPage() : PageTab(STR_ANADIAGS_CALIB, ICON_STATS_ANALOGS) {}
|
||||
AnaCalibratedViewPage(QuickMenu::SubMenu subMenu) :
|
||||
PageGroupItem(STR_ANADIAGS_CALIB, subMenu)
|
||||
{
|
||||
icon = ICON_STATS;
|
||||
}
|
||||
|
||||
protected:
|
||||
void build(Window* window) override
|
||||
@@ -479,12 +483,13 @@ class AnaCalibratedViewPage : public PageTab
|
||||
}
|
||||
};
|
||||
|
||||
class AnaFilteredDevViewPage : public PageTab
|
||||
class AnaFilteredDevViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
AnaFilteredDevViewPage() :
|
||||
PageTab(STR_ANADIAGS_FILTRAWDEV, ICON_STATS_THROTTLE_GRAPH)
|
||||
AnaFilteredDevViewPage(QuickMenu::SubMenu subMenu) :
|
||||
PageGroupItem(STR_ANADIAGS_FILTRAWDEV, subMenu)
|
||||
{
|
||||
icon = ICON_STATS;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -494,12 +499,13 @@ class AnaFilteredDevViewPage : public PageTab
|
||||
}
|
||||
};
|
||||
|
||||
class AnaUnfilteredRawViewPage : public PageTab
|
||||
class AnaUnfilteredRawViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
AnaUnfilteredRawViewPage() :
|
||||
PageTab(STR_ANADIAGS_UNFILTRAW, ICON_RADIO_HARDWARE)
|
||||
AnaUnfilteredRawViewPage(QuickMenu::SubMenu subMenu) :
|
||||
PageGroupItem(STR_ANADIAGS_UNFILTRAW, subMenu)
|
||||
{
|
||||
icon = ICON_STATS;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -509,10 +515,14 @@ class AnaUnfilteredRawViewPage : public PageTab
|
||||
}
|
||||
};
|
||||
|
||||
class AnaMinMaxViewPage : public PageTab
|
||||
class AnaMinMaxViewPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
AnaMinMaxViewPage() : PageTab(STR_ANADIAGS_MINMAX, ICON_RADIO_CALIBRATION) {}
|
||||
AnaMinMaxViewPage(QuickMenu::SubMenu subMenu) :
|
||||
PageGroupItem(STR_ANADIAGS_MINMAX, subMenu)
|
||||
{
|
||||
icon = ICON_STATS;
|
||||
}
|
||||
|
||||
protected:
|
||||
void build(Window* window) override
|
||||
@@ -521,11 +531,11 @@ class AnaMinMaxViewPage : public PageTab
|
||||
}
|
||||
};
|
||||
|
||||
RadioAnalogsDiagsViewPageGroup::RadioAnalogsDiagsViewPageGroup() :
|
||||
TabsGroup(ICON_STATS)
|
||||
RadioAnalogsDiagsViewPageGroup::RadioAnalogsDiagsViewPageGroup(QuickMenu::SubMenu subMenu) :
|
||||
TabsGroup(ICON_STATS, STR_ANALOGS_BTN)
|
||||
{
|
||||
addTab(new AnaCalibratedViewPage());
|
||||
addTab(new AnaFilteredDevViewPage());
|
||||
addTab(new AnaUnfilteredRawViewPage());
|
||||
addTab(new AnaMinMaxViewPage());
|
||||
addTab(new AnaCalibratedViewPage(subMenu));
|
||||
addTab(new AnaFilteredDevViewPage(subMenu));
|
||||
addTab(new AnaUnfilteredRawViewPage(subMenu));
|
||||
addTab(new AnaMinMaxViewPage(subMenu));
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class RadioAnalogsDiagsViewPageGroup : public TabsGroup
|
||||
{
|
||||
public:
|
||||
RadioAnalogsDiagsViewPageGroup();
|
||||
RadioAnalogsDiagsViewPageGroup(QuickMenu::SubMenu subMenu);
|
||||
};
|
||||
|
||||
@@ -105,8 +105,8 @@ class RadioCustSwitchesDiagsWindow : public Window
|
||||
|
||||
void RadioCustSwitchesDiagsPage::buildHeader(Window *window)
|
||||
{
|
||||
header->setTitle(STR_RADIO_SETUP);
|
||||
header->setTitle2(STR_MENU_FSWITCH);
|
||||
header->setTitle(STR_HARDWARE);
|
||||
header->setTitle2(STR_FUNCTION_SWITCHES);
|
||||
}
|
||||
|
||||
void RadioCustSwitchesDiagsPage::buildBody(Window *window)
|
||||
|
||||
@@ -238,7 +238,7 @@ class RadioKeyDiagsWindow : public Window
|
||||
|
||||
void RadioKeyDiagsPage::buildHeader(Window *window)
|
||||
{
|
||||
header->setTitle(STR_RADIO_SETUP);
|
||||
header->setTitle(STR_HARDWARE);
|
||||
header->setTitle2(STR_MENU_RADIO_SWITCHES);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ static const lv_coord_t col_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(2),
|
||||
|
||||
static const lv_coord_t row_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST};
|
||||
|
||||
RadioHardwarePage::RadioHardwarePage() :
|
||||
PageTab(STR_HARDWARE, ICON_RADIO_HARDWARE, PAD_TINY)
|
||||
RadioHardwarePage::RadioHardwarePage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef, PAD_TINY)
|
||||
{
|
||||
enableVBatBridge();
|
||||
}
|
||||
@@ -187,7 +187,7 @@ void RadioHardwarePage::build(Window* window)
|
||||
|
||||
// Calibration
|
||||
new SetupButtonGroup(window, {0, 0, LCD_W - padding * 2, 0}, STR_INPUTS, BTN_COLS, PAD_ZERO, {
|
||||
{STR_CALIBRATION, []() { new RadioCalibrationPage(); }},
|
||||
{STR_MENUCALIBRATION, []() { new RadioCalibrationPage(); }},
|
||||
{STR_STICKS, []() { new HWInputDialog<HWSticks>(STR_STICKS); }},
|
||||
{STR_POTS, []() { new HWInputDialog<HWPots>(STR_POTS, HWPots::POTS_WINDOW_WIDTH); }},
|
||||
{STR_SWITCHES, []() { new HWInputDialog<HWSwitches>(STR_SWITCHES, HWSwitches::SW_WINDOW_WIDTH); }},
|
||||
@@ -198,7 +198,7 @@ void RadioHardwarePage::build(Window* window)
|
||||
|
||||
// Debugs
|
||||
new SetupButtonGroup(window, {0, 0, LCD_W - padding * 2, 0}, STR_DEBUG, FS_BTN_COLS, PAD_ZERO, {
|
||||
{STR_ANALOGS_BTN, []() { new RadioAnalogsDiagsViewPageGroup(); }},
|
||||
{STR_ANALOGS_BTN, [=]() { new RadioAnalogsDiagsViewPageGroup(quickMenuId); }},
|
||||
{STR_KEYS_BTN, []() { new RadioKeyDiagsPage(); }},
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
{STR_FS_BTN, []() { new RadioCustSwitchesDiagsPage(); }},
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class RadioHardwarePage : public PageTab
|
||||
class RadioHardwarePage : public PageGroupItem
|
||||
{
|
||||
void checkEvents() override;
|
||||
|
||||
public:
|
||||
RadioHardwarePage();
|
||||
RadioHardwarePage(PageDef& pageDef);
|
||||
|
||||
void build(Window* window) override;
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ constexpr int WARN_FILE_LENGTH = 40 * 1024;
|
||||
#define CELL_CTRL_DIR LV_TABLE_CELL_CTRL_CUSTOM_1
|
||||
#define CELL_CTRL_FILE LV_TABLE_CELL_CTRL_CUSTOM_2
|
||||
|
||||
RadioSdManagerPage::RadioSdManagerPage() :
|
||||
PageTab(STR_SD_CARD, ICON_RADIO_SD_MANAGER)
|
||||
RadioSdManagerPage::RadioSdManagerPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ void RadioSdManagerPage::build(Window * window)
|
||||
|
||||
void RadioSdManagerPage::checkEvents()
|
||||
{
|
||||
PageTab::checkEvents();
|
||||
PageGroupItem::checkEvents();
|
||||
|
||||
if (loadPreview) {
|
||||
loadPreview -= 1;
|
||||
|
||||
@@ -22,20 +22,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "dataconstants.h"
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
enum MultiModuleType : short;
|
||||
|
||||
class FileBrowser;
|
||||
class FilePreview;
|
||||
|
||||
class RadioSdManagerPage : public PageTab
|
||||
class RadioSdManagerPage : public PageGroupItem
|
||||
{
|
||||
FileBrowser* browser = nullptr;
|
||||
FilePreview* preview = nullptr;
|
||||
|
||||
public:
|
||||
RadioSdManagerPage();
|
||||
RadioSdManagerPage(PageDef& pageDef);
|
||||
void build(Window* window) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -407,7 +407,7 @@ static SetupLineDef alarmsPageSetupLines[] = {
|
||||
class BacklightPage : public SubPage
|
||||
{
|
||||
public:
|
||||
BacklightPage() : SubPage(ICON_RADIO_SETUP, STR_RADIO_SETUP, STR_BACKLIGHT_LABEL, true)
|
||||
BacklightPage() : SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_BACKLIGHT_LABEL, true)
|
||||
{
|
||||
body->setFlexLayout();
|
||||
|
||||
@@ -584,7 +584,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
STR_RADIO_MENU_TABS, nullptr,
|
||||
},
|
||||
{
|
||||
STR_THEME_EDITOR,
|
||||
STR_MAIN_MENU_THEMES,
|
||||
[](Window* parent, coord_t x, coord_t y) {
|
||||
viewOption(parent, x, y,
|
||||
GET_SET_INVERTED(g_eeGeneral.radioThemesDisabled),
|
||||
@@ -687,7 +687,7 @@ static SetupLineDef viewOptionsPageSetupLines[] = {
|
||||
class ManageModelsSetupPage : public SubPage
|
||||
{
|
||||
public:
|
||||
ManageModelsSetupPage() : SubPage(ICON_MODEL, STR_RADIO_SETUP, STR_MANAGE_MODELS, true)
|
||||
ManageModelsSetupPage() : SubPage(ICON_MODEL, STR_MAIN_MENU_RADIO_SETTINGS, STR_MANAGE_MODELS, true)
|
||||
{
|
||||
body->setFlexLayout();
|
||||
|
||||
@@ -926,7 +926,7 @@ static SetupLineDef setupLines[] = {
|
||||
},
|
||||
};
|
||||
|
||||
RadioSetupPage::RadioSetupPage() : PageTab(STR_RADIO_SETUP, ICON_RADIO_SETUP, PAD_TINY) {}
|
||||
RadioSetupPage::RadioSetupPage(PageDef& pageDef) : PageGroupItem(pageDef, PAD_TINY) {}
|
||||
|
||||
void RadioSetupPage::build(Window* window)
|
||||
{
|
||||
@@ -940,18 +940,18 @@ void RadioSetupPage::build(Window* window)
|
||||
// Sub-pages
|
||||
w = new SetupButtonGroup(window, {0, y, LCD_W - padding * 2, 0}, nullptr, BTN_COLS, PAD_TINY, {
|
||||
#if defined(AUDIO)
|
||||
{STR_SOUND_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_RADIO_SETUP, STR_SOUND_LABEL, soundPageSetupLines, DIM(soundPageSetupLines)); }},
|
||||
{STR_SOUND_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_SOUND_LABEL, soundPageSetupLines, DIM(soundPageSetupLines)); }},
|
||||
#endif
|
||||
#if defined(VARIO)
|
||||
{STR_VARIO, []() { new SubPage(ICON_RADIO_SETUP, STR_RADIO_SETUP, STR_VARIO, varioPageSetupLines, DIM(varioPageSetupLines)); }},
|
||||
{STR_VARIO, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_VARIO, varioPageSetupLines, DIM(varioPageSetupLines)); }},
|
||||
#endif
|
||||
#if defined(HAPTIC)
|
||||
{STR_HAPTIC_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_RADIO_SETUP, STR_HAPTIC_LABEL, hapticPageSetupLines, DIM(hapticPageSetupLines)); }},
|
||||
{STR_HAPTIC_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_HAPTIC_LABEL, hapticPageSetupLines, DIM(hapticPageSetupLines)); }},
|
||||
#endif
|
||||
{STR_ALARMS_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_RADIO_SETUP, STR_ALARMS_LABEL, alarmsPageSetupLines, DIM(alarmsPageSetupLines)); }},
|
||||
{STR_ALARMS_LABEL, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_ALARMS_LABEL, alarmsPageSetupLines, DIM(alarmsPageSetupLines)); }},
|
||||
{STR_BACKLIGHT_LABEL, []() { new BacklightPage(); }},
|
||||
{STR_GPS, []() { new SubPage(ICON_RADIO_SETUP, STR_RADIO_SETUP, STR_GPS, gpsPageSetupLines, DIM(gpsPageSetupLines)); }},
|
||||
{STR_ENABLED_FEATURES, []() { new SubPage(ICON_RADIO_SETUP, STR_RADIO_SETUP, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
{STR_GPS, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_GPS, gpsPageSetupLines, DIM(gpsPageSetupLines)); }},
|
||||
{STR_ENABLED_FEATURES, []() { new SubPage(ICON_RADIO_SETUP, STR_MAIN_MENU_RADIO_SETTINGS, STR_ENABLED_FEATURES, viewOptionsPageSetupLines, DIM(viewOptionsPageSetupLines)); }},
|
||||
{STR_MAIN_MENU_MANAGE_MODELS, []() { new ManageModelsSetupPage(); }},
|
||||
}, BTN_H);
|
||||
y += w->height() + padding;
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class RadioSetupPage: public PageTab {
|
||||
class RadioSetupPage: public PageGroupItem
|
||||
{
|
||||
public:
|
||||
RadioSetupPage();
|
||||
RadioSetupPage(PageDef& pageDef);
|
||||
|
||||
void build(Window * window) override;
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ class ThemeEditPage : public Page
|
||||
#endif
|
||||
|
||||
// save and cancel
|
||||
rect_t r = {LCD_W - (ColorEditPage::BUTTON_WIDTH + PAD_SMALL + 1), PAD_MEDIUM, ColorEditPage::BUTTON_WIDTH, 0};
|
||||
rect_t r = {LCD_W - (ColorEditPage::BUTTON_WIDTH + PAD_SMALL + 1) - EdgeTxStyles::MENU_HEADER_HEIGHT, PAD_MEDIUM, ColorEditPage::BUTTON_WIDTH, 0};
|
||||
new TextButton(window, r, STR_DETAILS, [=]() {
|
||||
new ThemeDetailsDialog(_theme, [=](ThemeFile t) {
|
||||
_theme.setAuthor(t.getAuthor());
|
||||
@@ -432,8 +432,8 @@ class ThemeEditPage : public Page
|
||||
StaticText *_themeName = nullptr;
|
||||
};
|
||||
|
||||
ThemeSetupPage::ThemeSetupPage(TabsGroup *tabsGroup) :
|
||||
PageTab(STR_THEME_EDITOR, ICON_RADIO_EDIT_THEME), tabsGroup(tabsGroup)
|
||||
ThemeSetupPage::ThemeSetupPage(PageDef& pageDef) :
|
||||
PageGroupItem(pageDef)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ bool isTopWindow(Window *window)
|
||||
|
||||
void ThemeSetupPage::checkEvents()
|
||||
{
|
||||
PageTab::checkEvents();
|
||||
PageGroupItem::checkEvents();
|
||||
|
||||
if (fileCarosell) fileCarosell->pause(!isTopWindow(pageWindow));
|
||||
}
|
||||
|
||||
@@ -21,20 +21,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "edgetx.h"
|
||||
#include "pagegroup.h"
|
||||
|
||||
class ListBox;
|
||||
class TabsGroup;
|
||||
class PageGroup;
|
||||
class ThemeColorPreview;
|
||||
class ThemePersistance;
|
||||
class ThemeFile;
|
||||
class FileCarosell;
|
||||
|
||||
class ThemeSetupPage : public PageTab
|
||||
class ThemeSetupPage : public PageGroupItem
|
||||
{
|
||||
public:
|
||||
ThemeSetupPage(TabsGroup *tabsGroup);
|
||||
ThemeSetupPage(PageDef& pageDef);
|
||||
|
||||
void build(Window *window) override;
|
||||
void checkEvents() override;
|
||||
@@ -45,7 +45,6 @@ class ThemeSetupPage : public PageTab
|
||||
static LAYOUT_ORIENTATION(LIST_SIZE, (LCD_W - PAD_MEDIUM * 2) / 2 - COLOR_PREVIEW_SIZE, LCD_H / 2 - LAYOUT_SCALE(38));
|
||||
|
||||
protected:
|
||||
TabsGroup *tabsGroup = nullptr;
|
||||
Window *pageWindow = nullptr;
|
||||
Window *previewWindow = nullptr;
|
||||
FileCarosell *fileCarosell = nullptr;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user