fix(color): restore previous 'Fullscreen' functionality and add new 'App mode' layout (#5248)

Co-authored-by: philmoz <phil.a.mitchell@gmail.com>
This commit is contained in:
philmoz
2024-07-06 06:55:12 +10:00
committed by GitHub
co-authored by philmoz
parent 6f8a5313d5
commit 9789a9d8ea
4 changed files with 66 additions and 8 deletions
@@ -0,0 +1,52 @@
/*
* 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 "layout.h"
#include "layout_factory_impl.h"
const ZoneOption OPTIONS_LAYOUT_APPMODE[] = {LAYOUT_OPTIONS_END};
class LayoutAppMode : public Layout
{
public:
LayoutAppMode(Window* parent, const LayoutFactory* factory,
Layout::PersistentData* persistentData, uint8_t zoneCount,
uint8_t* zoneMap) :
Layout(parent, factory, persistentData, zoneCount, zoneMap)
{
}
bool hasTopbar() const override { return false; }
bool hasFlightMode() const override { return false; }
bool hasSliders() const override { return false; }
bool hasTrims() const override { return false; }
bool isMirrored() const override { return false; }
bool isAppMode() const override { return true; }
protected:
};
static const uint8_t zmap[] = {
LAYOUT_MAP_0, LAYOUT_MAP_0, LAYOUT_MAP_FULL, LAYOUT_MAP_FULL,
};
BaseLayoutFactory<LayoutAppMode> layoutAppMode("Layout1x1AM", "App mode", OPTIONS_LAYOUT_APPMODE,
1, (uint8_t*)zmap);
@@ -78,26 +78,28 @@ class Layout: public LayoutBase
return factory; return factory;
} }
bool hasTopbar() const { virtual bool hasTopbar() const {
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_TOPBAR)->boolValue))[0]; return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_TOPBAR)->boolValue))[0];
} }
bool hasFlightMode() const { virtual bool hasFlightMode() const {
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_FM)->boolValue))[0]; return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_FM)->boolValue))[0];
} }
bool hasSliders() const { virtual bool hasSliders() const {
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_SLIDERS)->boolValue))[0]; return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_SLIDERS)->boolValue))[0];
} }
bool hasTrims() const { virtual bool hasTrims() const {
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_TRIMS)->boolValue))[0]; return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_TRIMS)->boolValue))[0];
} }
bool isMirrored() const { virtual bool isMirrored() const {
return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_MIRRORED)->boolValue))[0]; return ((uint8_t*)(&getOptionValue(LAYOUT_OPTION_MIRRORED)->boolValue))[0];
} }
virtual bool isAppMode() const { return false; }
// Set decoration visibility // Set decoration visibility
void setTrimsVisible(bool visible); void setTrimsVisible(bool visible);
void setSlidersVisible(bool visible); void setSlidersVisible(bool visible);
@@ -109,8 +111,6 @@ class Layout: public LayoutBase
bool isLayout() override { return true; } bool isLayout() override { return true; }
bool isAppMode() { return decorationSettings == DECORATION_NONE && zoneCount == 1; }
static LAYOUT_VAL(MAIN_ZONE_BORDER, 10, 10) static LAYOUT_VAL(MAIN_ZONE_BORDER, 10, 10)
protected: protected:
+2 -1
View File
@@ -353,10 +353,11 @@ bool ViewMain::onLongPress()
void ViewMain::show(bool visible) void ViewMain::show(bool visible)
{ {
if (deleted()) return;
isVisible = visible; isVisible = visible;
int view = getCurrentMainView(); int view = getCurrentMainView();
setTopbarVisible(visible && ::hasTopbar(view)); setTopbarVisible(visible && ::hasTopbar(view));
if (visible) if (visible && (::hasTopbar(view) || isAppMode()))
topbar->showEdgeTxButton(); topbar->showEdgeTxButton();
else else
topbar->hideEdgeTxButton(); topbar->hideEdgeTxButton();
+5
View File
@@ -25,6 +25,10 @@
#include "mixes.h" #include "mixes.h"
#include "switches.h" #include "switches.h"
#if defined(COLORLCD)
#include "view_main.h"
#endif
#if defined(USBJ_EX) #if defined(USBJ_EX)
#include "usb_joystick.h" #include "usb_joystick.h"
#endif #endif
@@ -281,6 +285,7 @@ if(g_model.rssiSource) {
#if defined(COLORLCD) #if defined(COLORLCD)
LayoutFactory::loadCustomScreens(); LayoutFactory::loadCustomScreens();
ViewMain::instance()->show(true);
#else #else
LOAD_MODEL_BITMAP(); LOAD_MODEL_BITMAP();
#endif #endif