libopenui latest updates

This commit is contained in:
Bertrand Songis
2019-10-10 13:58:15 +02:00
parent 7fcd657b68
commit 887616091b
53 changed files with 784 additions and 135 deletions
@@ -97,7 +97,7 @@ local function run(event)
lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5,"CROSSFIRE SETUP", MENU_TITLE_COLOR)
lcd.drawText(1, 5,"CROSSFIRE SETUP", MENU_COLOR)
if #devices == 0 then
@@ -470,7 +470,7 @@ local function runDevicePage(event)
lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5,deviceName, MENU_TITLE_COLOR)
lcd.drawText(1, 5,deviceName, MENU_COLOR)
for y = 1, 11 do
local field = getField(pageOffset+y)
@@ -47,8 +47,8 @@ local function drawScreenTitle(title,page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -39,8 +39,8 @@ local function drawScreenTitle(title,page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -86,8 +86,8 @@ local function drawScreenTitle(title, page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W - 40, 5, page .. "/" .. pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W - 40, 5, page .. "/" .. pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -77,8 +77,8 @@ local calibrationFields = {
local function drawScreenTitle(title,page, pages)
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
end
-- Change display attribute to current field
+1 -1
View File
@@ -97,7 +97,7 @@ local function run(event)
lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5,"CROSSFIRE SETUP", MENU_TITLE_COLOR)
lcd.drawText(1, 5,"CROSSFIRE SETUP", MENU_COLOR)
if #devices == 0 then
+1 -1
View File
@@ -471,7 +471,7 @@ local function runDevicePage(event)
lcd.clear()
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5,deviceName, MENU_TITLE_COLOR)
lcd.drawText(1, 5,deviceName, MENU_COLOR)
for y = 1, 11 do
local field = getField(pageOffset+y)
+2 -2
View File
@@ -75,8 +75,8 @@ local calibrationFields = {
local function drawScreenTitle(title,page, pages)
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
end
-- Change display attribute to current field
+2 -2
View File
@@ -77,8 +77,8 @@ local calibrationFields = {
local function drawScreenTitle(title,page, pages)
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
end
-- Change display attribute to current field
@@ -47,8 +47,8 @@ local function drawScreenTitle(title,page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -39,8 +39,8 @@ local function drawScreenTitle(title,page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -86,8 +86,8 @@ local function drawScreenTitle(title, page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W - 40, 5, page .. "/" .. pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W - 40, 5, page .. "/" .. pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -47,8 +47,8 @@ local function drawScreenTitle(title,page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -39,8 +39,8 @@ local function drawScreenTitle(title,page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W-40, 5, page.."/"..pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
@@ -86,8 +86,8 @@ local function drawScreenTitle(title, page, pages)
end
if LCD_W == 480 then
lcd.drawFilledRectangle(0, 0, LCD_W, 30, TITLE_BGCOLOR)
lcd.drawText(1, 5, title, MENU_TITLE_COLOR)
lcd.drawText(LCD_W - 40, 5, page .. "/" .. pages, MENU_TITLE_COLOR)
lcd.drawText(1, 5, title, MENU_COLOR)
lcd.drawText(LCD_W - 40, 5, page .. "/" .. pages, MENU_COLOR)
else
lcd.drawScreenTitle(title, page, pages)
end
+3 -1
View File
@@ -16,8 +16,10 @@ set(GUI_SRC
fonts.cpp
curves.cpp
bitmaps.cpp
theme.cpp
tabsgroup.cpp
page.cpp
fab_button.cpp
# topbar.cpp
layout.cpp
# widget.cpp
+3 -3
View File
@@ -38,12 +38,12 @@
#define TEXT_STATUSBAR_COLOR COLOR(TEXT_STATUSBAR_COLOR_INDEX)
#define LINE_COLOR COLOR(LINE_COLOR_INDEX)
#define HEADER_SEPARATOR_COLOR COLOR(HEADER_SEPARATOR_COLOR_INDEX)
#define MENU_TITLE_BGCOLOR COLOR(MENU_TITLE_BGCOLOR_INDEX)
#define MENU_TITLE_COLOR COLOR(MENU_TITLE_COLOR_INDEX)
#define MENU_BGCOLOR COLOR(MENU_BGCOLOR_INDEX)
#define MENU_COLOR COLOR(MENU_COLOR_INDEX)
#define MENU_TITLE_DISABLE_COLOR COLOR(MENU_TITLE_DISABLE_COLOR_INDEX)
#define HEADER_COLOR COLOR(HEADER_COLOR_INDEX)
#define ALARM_COLOR COLOR(ALARM_COLOR_INDEX)
#define WARNING_COLOR COLOR(WARNING_COLOR_INDEX)
#define HIGHLIGHT_COLOR COLOR(HIGHLIGHT_COLOR_INDEX)
#define TEXT_DISABLE_COLOR COLOR(TEXT_DISABLE_COLOR_INDEX)
#define CURVE_COLOR COLOR(CURVE_COLOR_INDEX)
#define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX)
+1 -3
View File
@@ -27,7 +27,7 @@ void drawStatusText(BitmapBuffer * dc, const char * text)
void drawColumnHeader(BitmapBuffer * dc, const char * const * headers, const char * const * descriptions, uint8_t index)
{
dc->drawText(LCD_W-MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 2, headers[index], RIGHT | SMLSIZE | MENU_TITLE_COLOR);
dc->drawText(LCD_W-MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 2, headers[index], RIGHT | SMLSIZE | MENU_COLOR);
if (descriptions) {
drawStatusText(dc, descriptions[index]);
}
@@ -169,7 +169,6 @@ void drawHorizontalSlider(BitmapBuffer * dc, coord_t x, coord_t y, int len, int
}
}
#if defined(GVARS)
bool noZero(int val)
{
return val != 0;
@@ -188,7 +187,6 @@ void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t value, LcdF
{
dc->drawNumber(x, y, value, flags, 0, nullptr, "%");
}
#endif
void drawSleepBitmap()
{
+49
View File
@@ -0,0 +1,49 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#include "libopenui_config.h"
#include "fab_button.h"
#include "font.h"
#include "theme.h"
const uint8_t __alpha_button_on[] {
#include "alpha_button_on.lbm"
};
Bitmap ALPHA_BUTTON_ON(BMP_ARGB4444, (const uint16_t*)__alpha_button_on);
const uint8_t __alpha_button_off[] {
#include "alpha_button_off.lbm"
};
Bitmap ALPHA_BUTTON_OFF(BMP_ARGB4444, (const uint16_t*)__alpha_button_off);
FabButton::FabButton(Window * parent, coord_t x, coord_t y, uint8_t icon, std::function<uint8_t(void)> pressHandler, uint8_t flags):
Button(parent, { x - 34, y - 34, 68, 68 }, pressHandler, flags),
icon(icon)
{
}
void FabButton::paint(BitmapBuffer * dc)
{
dc->drawBitmap(0, 0, checked() ? &ALPHA_BUTTON_ON : &ALPHA_BUTTON_OFF);
const BitmapBuffer * mask = theme->getIconMask(icon);
if (mask) {
dc->drawMask((68 - mask->getWidth()) / 2, (68 - mask->getHeight()) / 2, mask, DEFAULT_BGCOLOR);
}
}
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef _FAB_ICON_BUTTON_H_
#define _FAB_ICON_BUTTON_H_
#include "button.h"
class FabButton: public Button {
public:
FabButton(Window * parent, coord_t x, coord_t y, uint8_t icon, std::function<uint8_t(void)> pressHandler, uint8_t flags=0);
#if defined(DEBUG_WINDOWS)
std::string getName() override
{
return "FabButton(" + std::to_string(icon) + ")";
}
#endif
void paint(BitmapBuffer * dc) override;
protected:
uint8_t icon;
};
#endif
+1 -1
View File
@@ -30,7 +30,7 @@ FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string
confirmHandler(confirmHandler)
{
#if defined(HARDWARE_TOUCH)
new FabIconButton(this, LCD_W - 50, ALERT_BUTTON_TOP, ICON_NEXT,
new FabButton(this, LCD_W - 50, ALERT_BUTTON_TOP, ICON_NEXT,
[=]() -> uint8_t {
if (confirmHandler)
confirmHandler();
+5
View File
@@ -210,3 +210,8 @@ void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t
}
}
#endif
event_t getWindowEvent()
{
return getEvent(false);
}
+1 -1
View File
@@ -28,7 +28,7 @@
#include "mainwindow.h"
#include "static.h"
#include "button.h"
#include "fab_icon_button.h"
#include "fab_button.h"
#include "checkbox.h"
#include "numberedit.h"
#include "timeedit.h"
+2 -2
View File
@@ -40,10 +40,10 @@ class CurveEditWindow : public Page {
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUCURVE, MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUCURVE, MENU_COLOR);
char s[16];
strAppendStringWithIndex(s, STR_CV, index + 1);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, s, MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, s, MENU_COLOR);
}
#if LCD_W > LCD_H
+1 -1
View File
@@ -55,7 +55,7 @@ class FlightModeGroup: public FormGroup
void paint(BitmapBuffer * dc) override
{
if (index == getFlightMode()) {
dc->drawSolidFilledRect(0, 0, width(), height(), WARNING_COLOR);
dc->drawSolidFilledRect(0, 0, width(), height(), HIGHLIGHT_COLOR);
}
FormGroup::paint(dc);
}
+4 -4
View File
@@ -132,16 +132,16 @@ void GVarRenderer::paint(BitmapBuffer * dc) {
lastFlightMode = getFlightMode();
FlightModeData * fmData = &g_model.flightModeData[lastFlightMode];
lastGVar = fmData->gvars[index];
drawStringWithIndex(0, TEXT_OFFSET_TOP, TR_GV, index + 1, MENU_TITLE_COLOR);
drawStringWithIndex(0, TEXT_OFFSET_TOP, TR_GV, index + 1, MENU_COLOR);
if (lastGVar > GVAR_MAX) {
uint8_t fm = lastGVar - GVAR_MAX - 1;
if (fm >= lastFlightMode) fm++;
char label[16];
getFlightModeString(label, fm + 1);
dc->drawSizedText(GVAR_NAME_SIZE, TEXT_OFFSET_TOP, label, strlen(label), MENU_TITLE_COLOR);
dc->drawSizedText(GVAR_NAME_SIZE, TEXT_OFFSET_TOP, label, strlen(label), MENU_COLOR);
}
else {
drawGVarValue(dc, GVAR_NAME_SIZE, TEXT_OFFSET_TOP, index, lastGVar, MENU_TITLE_COLOR);
drawGVarValue(dc, GVAR_NAME_SIZE, TEXT_OFFSET_TOP, index, lastGVar, MENU_COLOR);
}
}
@@ -165,7 +165,7 @@ const std::string GVarEditWindow::unitPercent = "%";
void GVarEditWindow::buildHeader(Window * window)
{
new StaticText(window, {70, 4, window->width() - 70, 20}, STR_GLOBAL_VAR, MENU_TITLE_COLOR);
new StaticText(window, {70, 4, window->width() - 70, 20}, STR_GLOBAL_VAR, MENU_COLOR);
gVarInHeader = new GVarRenderer(window, {70, 28, window->width() - 70, 20}, index);
}
void GVarEditWindow::checkEvents() {
+3 -3
View File
@@ -119,8 +119,8 @@ class InputEditWindow: public Page {
Choice * curveTypeChoice = nullptr;
void buildHeader(Window * window) {
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUINPUTS, MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_FIRST_INPUT + input), MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENUINPUTS, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_FIRST_INPUT + input), MENU_COLOR);
}
void updateCurves() {
@@ -312,7 +312,7 @@ void CommonInputOrMixButton::drawFlightModes(BitmapBuffer *dc, FlightModesType v
void CommonInputOrMixButton::paint(BitmapBuffer * dc)
{
if (active)
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, HIGHLIGHT_COLOR);
paintBody(dc);
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, hasFocus() ? CHECKBOX_COLOR : DISABLE_COLOR);
}
@@ -64,14 +64,14 @@ class LogicalSwitchEditPage: public Page {
{
Page::checkEvents();
if (active != isActive()) {
headerSwitchName->setFlags(isActive() ? BOLD|WARNING_COLOR : MENU_TITLE_COLOR);
headerSwitchName->setFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
active = !active;
}
}
void buildHeader(Window * window) {
new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, STR_MENULOGICALSWITCHES, MENU_TITLE_COLOR);
headerSwitchName = new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, getSwitchPositionName(SWSRC_SW1 + index), MENU_TITLE_COLOR);
new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, STR_MENULOGICALSWITCHES, MENU_COLOR);
headerSwitchName = new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT }, getSwitchPositionName(SWSRC_SW1 + index), MENU_COLOR);
}
void updateLogicalSwitchOneWindow(FormField * functionChoice)
@@ -311,7 +311,7 @@ class LogicalSwitchButton : public Button {
void paint(BitmapBuffer * dc) override
{
if (active)
dc->drawSolidFilledRect(2, 2, rect.w-4, rect.h-4, WARNING_COLOR);
dc->drawSolidFilledRect(2, 2, rect.w-4, rect.h-4, HIGHLIGHT_COLOR);
paintLogicalSwitchLine(dc);
+2 -2
View File
@@ -72,8 +72,8 @@ class MixEditWindow : public Page {
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MIXER, MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MIXER, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), MENU_COLOR);
}
void updateCurves()
+2 -2
View File
@@ -39,8 +39,8 @@ class OutputEditWindow : public Page {
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENULIMITS, MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_MENULIMITS, MENU_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, getSourceString(MIXSRC_CH1 + channel), MENU_COLOR);
}
void buildBody(Window * window)
+1 -1
View File
@@ -497,7 +497,7 @@ class ModuleWindow : public Window {
// Module Type
new StaticText(this, grid.getLabelSlot(true), STR_MODE);
moduleChoice = new Choice(this, grid.getFieldSlot(), STR_INTERNAL_MODULE_PROTOCOLS,
moduleChoice = new Choice(this, grid.getFieldSlot(2, 0), STR_INTERNAL_MODULE_PROTOCOLS,
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1,
GET_DEFAULT(g_model.moduleData[moduleIdx].type),
[=](int32_t newValue) {
+3 -3
View File
@@ -74,7 +74,7 @@ class SensorButton : public Button {
TelemetryItem &telemetryItem = telemetryItems[index];
if (telemetryItem.isFresh()) {
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, HIGHLIGHT_COLOR);
}
dc->drawNumber(2, 1, number, LEFT, 0, NULL, ":");
@@ -125,9 +125,9 @@ class SensorEditWindow : public Page {
void buildHeader(Window * window)
{
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_SENSOR + std::to_string(index + 1), MENU_TITLE_COLOR);
new StaticText(window, {PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, PAGE_LINE_HEIGHT}, STR_SENSOR + std::to_string(index + 1), MENU_COLOR);
// dynamic display of sensor value ?
//new StaticText(window, {70, 28, 100, 20}, "SF" + std::to_string(index), MENU_TITLE_COLOR);
//new StaticText(window, {70, 28, 100, 20}, "SF" + std::to_string(index), MENU_COLOR);
}
void updateSensorParametersWindow()
+95
View File
@@ -0,0 +1,95 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#include "page.h"
#include "mainwindow.h"
#include "keyboard_base.h"
#include "opentx.h"
PageHeader::PageHeader(Page * parent, uint8_t icon):
Window(parent, { 0, 0, LCD_W, MENU_HEADER_HEIGHT }, OPAQUE),
icon(icon)
#if defined(HARDWARE_TOUCH)
, back(this, { 0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH }, ICON_BACK,
[=]() -> uint8_t {
parent->deleteLater();
return 0;
}, BUTTON_NOFOCUS)
#endif
{
}
void PageHeader::paint(BitmapBuffer * dc)
{
static_cast<ThemeBase *>(theme)->drawMenuBackground(dc, getIcon(), "");
dc->drawSolidFilledRect(MENU_HEADER_HEIGHT, 0, LCD_W - MENU_HEADER_HEIGHT, MENU_HEADER_HEIGHT, MENU_BGCOLOR);
}
Page::Page(unsigned icon):
Window(&mainWindow, {0, 0, LCD_W, LCD_H}, OPAQUE),
header(this, icon),
body(this, { 0, MENU_HEADER_HEIGHT, LCD_W, LCD_H - MENU_HEADER_HEIGHT }),
previousFocus(focusWindow)
{
setFocus();
}
Page::~Page()
{
#if defined(HARDWARE_TOUCH)
Keyboard::hide();
#endif
}
void Page::deleteLater()
{
if (previousFocus) {
previousFocus->setFocus();
}
Window::deleteLater();
}
void Page::paint(BitmapBuffer * dc)
{
dc->clear(DEFAULT_BGCOLOR);
}
#if defined(HARDWARE_KEYS)
void Page::onEvent(event_t event)
{
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
if (event == EVT_KEY_LONG(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) {
killEvents(event);
deleteLater();
}
}
#endif
#if defined(HARDWARE_TOUCH)
bool Page::onTouchEnd(coord_t x, coord_t y)
{
if (Window::onTouchEnd(x, y))
return true;
Keyboard::hide();
return true;
}
#endif
+89
View File
@@ -0,0 +1,89 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef _PAGE_H_
#define _PAGE_H_
#include "window.h"
#include "button.h"
class Page;
class PageHeader: public Window {
public:
PageHeader(Page * parent, uint8_t icon);
void paint(BitmapBuffer * dc) override;
uint8_t getIcon() const
{
return icon;
}
protected:
uint8_t icon;
#if defined(HARDWARE_TOUCH)
IconButton back;
#endif
};
class Page: public Window {
public:
explicit Page(unsigned icon);
~Page() override;
#if defined(DEBUG_WINDOWS)
std::string getName() override
{
return "Page";
}
#endif
#if defined(HARDWARE_KEYS)
void onEvent(event_t event) override;
#endif
#if defined(HARDWARE_TOUCH)
bool onTouchStart(coord_t x, coord_t y) override
{
Window::onTouchStart(x, y);
return true;
}
bool onTouchEnd(coord_t x, coord_t y) override;
bool onTouchSlide(coord_t x, coord_t y, coord_t startX, coord_t startY, coord_t slideX, coord_t slideY) override
{
Window::onTouchSlide(x, y, startX, startY, slideX, slideY);
return true;
}
#endif
void deleteLater();
void paint(BitmapBuffer * dc) override;
protected:
PageHeader header;
FormWindow body;
Window * previousFocus;
};
#endif // _PAGE_H_
+2 -2
View File
@@ -109,8 +109,8 @@ RadioCalibrationPage::RadioCalibrationPage(bool initial):
void RadioCalibrationPage::buildHeader(Window * window)
{
new StaticText(window, { 55, 0, 300, 20 }, STR_MENUCALIBRATION, MENU_TITLE_COLOR);
text = new StaticText(window, { 55, FH+2, LCD_W-55, 20 }, STR_MENUTOSTART, MENU_TITLE_COLOR);
new StaticText(window, { 55, 0, 300, 20 }, STR_MENUCALIBRATION, MENU_COLOR);
text = new StaticText(window, { 55, FH+2, LCD_W-55, 20 }, STR_MENUTOSTART, MENU_COLOR);
}
void RadioCalibrationPage::buildBody(FormWindow * window)
+1 -1
View File
@@ -351,7 +351,7 @@ bool menuWidgetsSetup(event_t event)
LcdFlags color;
int padding, thickness;
if (currentContainer == topbar) {
color = MENU_TITLE_COLOR;
color = MENU_COLOR;
padding = 2;
thickness = 1;
}
+4 -4
View File
@@ -51,15 +51,15 @@ class SpecialFunctionEditPage : public Page {
Page::checkEvents();
if (active != isActive()) {
invalidate();
headerSF->setFlags(isActive() ? BOLD|WARNING_COLOR : MENU_TITLE_COLOR);
headerSF->setFlags(isActive() ? BOLD|HIGHLIGHT_COLOR : MENU_COLOR);
active = !active;
}
}
void buildHeader(Window * window)
{
new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, 20 }, functions == g_model.customFn ? STR_MENUCUSTOMFUNC : STR_MENUSPECIALFUNCS, MENU_TITLE_COLOR);
headerSF = new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, 20 }, (functions == g_model.customFn ? "SF" : "GF" ) + std::to_string(index), MENU_TITLE_COLOR);
new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP, LCD_W - PAGE_TITLE_LEFT, 20 }, functions == g_model.customFn ? STR_MENUCUSTOMFUNC : STR_MENUSPECIALFUNCS, MENU_COLOR);
headerSF = new StaticText(window, { PAGE_TITLE_LEFT, PAGE_TITLE_TOP + PAGE_LINE_HEIGHT, LCD_W - PAGE_TITLE_LEFT, 20 }, (functions == g_model.customFn ? "SF" : "GF" ) + std::to_string(index), MENU_COLOR);
}
void updateSpecialFunctionOneWindow(FormField * previousField, FormField * nextField)
@@ -376,7 +376,7 @@ class SpecialFunctionButton : public Button {
void paint(BitmapBuffer * dc) override
{
if (active)
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, WARNING_COLOR);
dc->drawSolidFilledRect(2, 2, rect.w - 4, rect.h - 4, HIGHLIGHT_COLOR);
paintSpecialFunctionLine(dc);
+186
View File
@@ -0,0 +1,186 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#include "tabsgroup.h"
#include "mainwindow.h"
#include "view_main.h"
#if defined(HARDWARE_TOUCH)
#include "keyboard_base.h"
#endif
#include "opentx.h" // TODO for constants...
TabsGroupHeader::TabsGroupHeader(TabsGroup * parent, uint8_t icon):
Window(parent, { 0, 0, LCD_W, MENU_BODY_TOP }, OPAQUE),
#if defined(HARDWARE_TOUCH)
back(this, { 0, 0, MENU_HEADER_BUTTON_WIDTH, MENU_HEADER_BUTTON_WIDTH }, ICON_BACK,
[=]() -> uint8_t {
parent->deleteLater();
return 1;
}, BUTTON_NOFOCUS),
#endif
icon(icon),
carousel(this, parent)
{
}
void TabsGroupHeader::paint(BitmapBuffer * dc)
{
static_cast<ThemeBase *>(theme)->drawMenuBackground(dc, icon, title);
}
TabsCarousel::TabsCarousel(Window * parent, TabsGroup * menu):
Window(parent, { MENU_HEADER_BUTTONS_LEFT, 0, LCD_W - MENU_HEADER_BUTTONS_LEFT, MENU_HEADER_HEIGHT + 10 }, TRANSPARENT),
menu(menu)
{
}
void TabsCarousel::updateInnerWidth()
{
setInnerWidth(padding_left + MENU_HEADER_BUTTON_WIDTH * menu->tabs.size());
}
void TabsCarousel::paint(BitmapBuffer * dc)
{
static_cast<ThemeBase *>(theme)->drawMenuHeader(dc, menu->tabs, currentIndex);
}
#if defined(HARDWARE_TOUCH)
bool TabsCarousel::onTouchEnd(coord_t x, coord_t y)
{
unsigned index = (x - padding_left) / MENU_HEADER_BUTTON_WIDTH;
menu->setCurrentTab(index);
setCurrentIndex(index);
return true;
}
#endif
TabsGroup::TabsGroup(uint8_t icon):
Window(&mainWindow, { 0, 0, LCD_W, LCD_H }, OPAQUE),
header(this, icon),
body(this, { 0, MENU_BODY_TOP, LCD_W, MENU_BODY_HEIGHT })
{
}
TabsGroup::~TabsGroup()
{
#if defined(HARDWARE_TOUCH)
Keyboard::hide();
#endif
for (auto tab: tabs) {
delete tab;
}
body.deleteChildren();
}
void TabsGroup::addTab(PageTab * page)
{
tabs.push_back(page);
if (!currentTab) {
setCurrentTab(0);
}
header.carousel.updateInnerWidth();
}
void TabsGroup::removeTab(unsigned index)
{
if (currentTab == tabs[index]) {
setCurrentTab(max<unsigned>(0, index - 1));
}
tabs.erase(tabs.begin() + index);
header.carousel.updateInnerWidth();
}
void TabsGroup::removeAllTabs()
{
for (auto * tab: tabs) {
delete tab;
}
tabs.clear();
currentTab = nullptr;
header.carousel.updateInnerWidth();
}
void TabsGroup::setVisibleTab(PageTab * tab)
{
if (tab != currentTab) {
setFocus();
FormField::clearCurrentField();
body.clear();
#if defined(HARDWARE_TOUCH)
Keyboard::hide();
#endif
currentTab = tab;
tab->build(&body);
header.setTitle(tab->title.c_str());
invalidate();
}
}
void TabsGroup::checkEvents()
{
Window::checkEvents();
if (currentTab) {
currentTab->checkEvents();
}
}
#if defined(HARDWARE_KEYS)
void TabsGroup::onEvent(event_t event)
{
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
if (event == EVT_KEY_BREAK(KEY_PGDN)) {
uint8_t current = header.carousel.getCurrentIndex() + 1;
setCurrentTab(current >= tabs.size() ? 0 : current);
}
else if (event == EVT_KEY_LONG(KEY_PGDN)) {
killEvents(event);
uint8_t current = header.carousel.getCurrentIndex();
setCurrentTab(current == 0 ? tabs.size() - 1 : current - 1);
}
else if (event == EVT_KEY_LONG(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT)) {
killEvents(event);
ViewMain::instance->setFocus();
deleteLater();
}
else if (parent) {
parent->onEvent(event);
}
}
#endif
void TabsGroup::paint(BitmapBuffer * dc)
{
dc->clear(DEFAULT_BGCOLOR);
}
#if defined(HARDWARE_TOUCH)
bool TabsGroup::onTouchEnd(coord_t x, coord_t y)
{
if (Window::onTouchEnd(x, y))
return true;
Keyboard::hide();
return true;
}
#endif
+191
View File
@@ -0,0 +1,191 @@
/*
* Copyright (C) OpenTX
*
* Source:
* https://github.com/opentx/libopenui
*
* This file is a part of libopenui library.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef _TABSGROUP_H_
#define _TABSGROUP_H_
#include <vector>
#include "button.h"
#include "form.h"
class TabsGroup;
class PageTab {
friend class TabsCarousel;
friend class TabsGroup;
public:
PageTab(std::string title, unsigned icon):
title(std::move(title)),
icon(icon)
{
}
virtual ~PageTab() = default;
virtual void build(FormWindow * window) = 0;
virtual void checkEvents()
{
}
void destroy()
{
if (onPageDestroyed) {
onPageDestroyed();
}
delete this;
}
void setOnPageDestroyedHandler(std::function<void()> handler)
{
onPageDestroyed = std::move(handler);
}
void setTitle(std::string value)
{
title = std::move(value);
}
unsigned getIcon() const
{
return icon;
}
protected:
std::string title;
unsigned icon;
std::function<void()> onPageDestroyed;
};
class TabsCarousel: public Window {
public:
TabsCarousel(Window * parent, TabsGroup * menu);
#if defined(DEBUG_WINDOWS)
std::string getName() override
{
return "TabsCarousel";
}
#endif
inline void setCurrentIndex(uint8_t index)
{
currentIndex = index;
}
inline uint8_t getCurrentIndex()
{
return currentIndex;
}
void updateInnerWidth();
void paint(BitmapBuffer * dc) override;
#if defined(HARDWARE_TOUCH)
bool onTouchEnd(coord_t x, coord_t y) override;
#endif
protected:
constexpr static uint8_t padding_left = 3;
TabsGroup * menu;
uint8_t currentIndex = 0;
};
class TabsGroupHeader: public Window {
friend class TabsGroup;
public:
TabsGroupHeader(TabsGroup * menu, uint8_t icon);
#if defined(DEBUG_WINDOWS)
std::string getName() override
{
return "TabsGroupHeader";
}
#endif
void paint(BitmapBuffer * dc) override;
void setTitle(const char * value)
{
title = value;
}
protected:
#if defined(HARDWARE_TOUCH)
IconButton back;
#endif
uint8_t icon;
TabsCarousel carousel;
const char * title = nullptr;
};
class TabsGroup: public Window {
friend class TabsCarousel;
public:
explicit TabsGroup(uint8_t icon);
~TabsGroup() override;
#if defined(DEBUG_WINDOWS)
std::string getName() override
{
return "TabsGroup";
}
#endif
void addTab(PageTab * page);
void removeTab(unsigned index);
void removeAllTabs();
void setCurrentTab(unsigned index)
{
if (index < tabs.size()) {
header.carousel.setCurrentIndex(index);
setVisibleTab(tabs[index]);
}
}
void checkEvents() override;
#if defined(HARDWARE_KEYS)
void onEvent(event_t event) override;
#endif
void paint(BitmapBuffer * dc) override;
#if defined(HARDWARE_TOUCH)
bool onTouchEnd(coord_t x, coord_t y) override;
#endif
protected:
TabsGroupHeader header;
FormWindow body;
std::vector<PageTab *> tabs;
PageTab * currentTab = nullptr;
void setVisibleTab(PageTab * tab);
};
#endif
-6
View File
@@ -200,12 +200,6 @@ void ThemeBase::drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, con
}
}
void ThemeBase::drawPageHeader(BitmapBuffer * dc, const PageHeader * header) const
{
drawMenuBackground(dc, header->getIcon(), "");
dc->drawSolidFilledRect(MENU_HEADER_HEIGHT, 0, LCD_W - MENU_HEADER_HEIGHT, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
}
ThemeBase * getTheme(const char * name)
{
std::list<ThemeBase *>::const_iterator it = getRegisteredThemes().cbegin();
-2
View File
@@ -88,8 +88,6 @@ class ThemeBase: public Theme
void drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const override;
void drawPageHeader(BitmapBuffer * dc, const PageHeader * page) const override;
protected:
const char * name;
const ZoneOption * options;
+9 -9
View File
@@ -47,12 +47,12 @@ class FlyskyTheme: public ThemeBase
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RED;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(GET_RED(RED)>>1, GET_GREEN(RED)>>1, GET_BLUE(RED)>>1);
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
lcdColorTable[ALARM_COLOR_INDEX] = RED;
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
lcdColorTable[HIGHLIGHT_COLOR_INDEX] = YELLOW;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[DISABLE_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
@@ -78,7 +78,7 @@ class FlyskyTheme: public ThemeBase
lcdColorTable[BARGRAPH_BGCOLOR_INDEX] = RGB(222, 222, 222);
}
void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=MENU_TITLE_COLOR) const
void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=MENU_COLOR) const
{
TRACE("loadMenuIcon %s", getFilePath(filename));
@@ -192,7 +192,7 @@ class FlyskyTheme: public ThemeBase
currentMenuBackground->drawSolidFilledRect(0, MENU_TITLE_TOP, currentMenuBackground->getWidth(), currentMenuBackground->getHeight() - MENU_TITLE_TOP, TITLE_BGCOLOR);
currentMenuBackground->drawMask(0, 0, background, HEADER_CURRENT_BGCOLOR);
currentMenuBackground->drawMask(0, 0, shadow, TRIM_SHADOW_COLOR);
currentMenuBackground->drawMask(10, 39, dot, MENU_TITLE_COLOR);
currentMenuBackground->drawMask(10, 39, dot, MENU_COLOR);
}
delete topleftBitmap;
@@ -254,13 +254,13 @@ class FlyskyTheme: public ThemeBase
// Mixer setup screen
delete mixerSetupMixerBitmap;
mixerSetupMixerBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_mixer.png", MENU_TITLE_COLOR, HEADER_BGCOLOR);
mixerSetupMixerBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_mixer.png", MENU_COLOR, HEADER_BGCOLOR);
delete mixerSetupToBitmap;
mixerSetupToBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_to.png", MENU_TITLE_COLOR, HEADER_BGCOLOR);
mixerSetupToBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_to.png", MENU_COLOR, HEADER_BGCOLOR);
delete mixerSetupOutputBitmap;
mixerSetupOutputBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_output.png", MENU_TITLE_COLOR, HEADER_BGCOLOR);
mixerSetupOutputBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_output.png", MENU_COLOR, HEADER_BGCOLOR);
delete mixerSetupAddBitmap;
mixerSetupAddBitmap = BitmapBuffer::loadMaskOnBackground("mask_mplex_add.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
@@ -361,7 +361,7 @@ class FlyskyTheme: public ThemeBase
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR); // the title line background
//
if (title) {
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP, title, MENU_TITLE_COLOR);
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP, title, MENU_COLOR);
}
}
+16 -16
View File
@@ -46,12 +46,12 @@ class FrskyTheme: public ThemeBase
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RED;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(GET_RED(RED)>>1, GET_GREEN(RED)>>1, GET_BLUE(RED)>>1);
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
lcdColorTable[ALARM_COLOR_INDEX] = RED;
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
lcdColorTable[HIGHLIGHT_COLOR_INDEX] = YELLOW;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[DISABLE_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
@@ -61,7 +61,7 @@ class FrskyTheme: public ThemeBase
lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = BLACK;
lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = WHITE;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = RED;
lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKRED;
lcdColorTable[MENU_BGCOLOR_INDEX] = DARKRED;
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED;
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
@@ -70,7 +70,7 @@ class FrskyTheme: public ThemeBase
lcdColorTable[BARGRAPH_BGCOLOR_INDEX] = RGB(222, 222, 222);
}
void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=MENU_TITLE_COLOR) const
void loadMenuIcon(uint8_t index, const char * filename, uint32_t color=MENU_COLOR) const
{
TRACE("loadMenuIcon %s", getFilePath(filename));
BitmapBuffer * mask = BitmapBuffer::loadMask(getFilePath(filename));
@@ -81,7 +81,7 @@ class FrskyTheme: public ThemeBase
delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->getWidth(), mask->getHeight());
if (menuIconNormal[index]) {
menuIconNormal[index]->clear(HEADER_BGCOLOR);
menuIconNormal[index]->clear(MENU_BGCOLOR);
menuIconNormal[index]->drawMask(0, 0, mask, color);
}
@@ -157,16 +157,16 @@ class FrskyTheme: public ThemeBase
}
if (currentMenuBackground) {
currentMenuBackground->drawSolidFilledRect(0, 0, currentMenuBackground->getWidth(), MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, 0, currentMenuBackground->getWidth(), MENU_HEADER_HEIGHT, MENU_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, currentMenuBackground->getWidth(), MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_TITLE_TOP, currentMenuBackground->getWidth(), currentMenuBackground->getHeight() - MENU_TITLE_TOP, TITLE_BGCOLOR);
currentMenuBackground->drawMask(0, 0, background, HEADER_CURRENT_BGCOLOR);
currentMenuBackground->drawMask(0, 0, shadow, TRIM_SHADOW_COLOR);
currentMenuBackground->drawMask(10, 39, dot, MENU_TITLE_COLOR);
currentMenuBackground->drawMask(10, 39, dot, MENU_COLOR);
}
delete topleftBitmap;
topleftBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("topleft.png"), TITLE_BGCOLOR, HEADER_BGCOLOR);
topleftBitmap = BitmapBuffer::loadMaskOnBackground(getFilePath("topleft.png"), TITLE_BGCOLOR, MENU_BGCOLOR);
delete background;
delete shadow;
@@ -233,13 +233,13 @@ class FrskyTheme: public ThemeBase
// Mixer setup screen
delete mixerSetupMixerBitmap;
mixerSetupMixerBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_mixer.png", MENU_TITLE_COLOR, HEADER_BGCOLOR);
mixerSetupMixerBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_mixer.png", MENU_COLOR, MENU_BGCOLOR);
delete mixerSetupToBitmap;
mixerSetupToBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_to.png", MENU_TITLE_COLOR, HEADER_BGCOLOR);
mixerSetupToBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_to.png", MENU_COLOR, MENU_BGCOLOR);
delete mixerSetupOutputBitmap;
mixerSetupOutputBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_output.png", MENU_TITLE_COLOR, HEADER_BGCOLOR);
mixerSetupOutputBitmap = BitmapBuffer::loadMaskOnBackground("mask_sbar_output.png", MENU_COLOR, MENU_BGCOLOR);
delete mixerSetupAddBitmap;
mixerSetupAddBitmap = BitmapBuffer::loadMaskOnBackground("mask_mplex_add.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
@@ -300,7 +300,7 @@ class FrskyTheme: public ThemeBase
lcdColorTable[TRIM_BGCOLOR_INDEX] = color;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = color;
#define DARKER(x) ((x * 70) / 100)
lcdColorTable[HEADER_BGCOLOR_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color)));
lcdColorTable[MENU_BGCOLOR_INDEX] = RGB(DARKER(GET_RED(color)), DARKER(GET_GREEN(color)), DARKER(GET_BLUE(color)));
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = color;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = color;
#endif
@@ -324,10 +324,10 @@ class FrskyTheme: public ThemeBase
if (topleftBitmap) {
dc->drawBitmap(0, 0, topleftBitmap);
uint16_t width = topleftBitmap->getWidth();
dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, MENU_BGCOLOR);
}
else {
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
dc->drawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, MENU_BGCOLOR);
}
if (icon == ICON_OPENTX)
@@ -338,7 +338,7 @@ class FrskyTheme: public ThemeBase
dc->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR); // the white separation line
dc->drawSolidFilledRect(0, MENU_TITLE_TOP, LCD_W, MENU_TITLE_HEIGHT, TITLE_BGCOLOR); // the title line background
if (title) {
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 1, title, MENU_TITLE_COLOR);
dc->drawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP + 1, title, MENU_COLOR);
}
drawMenuDatetime(dc);
+12 -12
View File
@@ -44,7 +44,7 @@ void drawTopBar()
// USB icon
if (usbPlugged()) {
lcdDrawBitmapPattern(LCD_W-98, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-98, 8, LBM_TOPMENU_USB, MENU_COLOR);
}
// RSSI
@@ -52,41 +52,41 @@ void drawTopBar()
const uint8_t rssiBarsHeight[] = {5, 10, 15, 21, 31};
for (unsigned int i = 0; i < DIM(rssiBarsHeight); i++) {
uint8_t height = rssiBarsHeight[i];
lcdDrawSolidFilledRect(LCD_W-90 + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
lcdDrawSolidFilledRect(LCD_W-90 + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_COLOR : MENU_TITLE_DISABLE_COLOR);
}
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) {
lcdDrawBitmapPattern(LCD_W-94, 4, LBM_TOPMENU_ANTENNA, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-94, 4, LBM_TOPMENU_ANTENNA, MENU_COLOR);
}
#endif
/* Audio volume */
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR);
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_0, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_0, MENU_COLOR);
else if (requiredSpeakerVolume < 7)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_1, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_1, MENU_COLOR);
else if (requiredSpeakerVolume < 13)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_2, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_2, MENU_COLOR);
else if (requiredSpeakerVolume < 19)
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_3, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_3, MENU_COLOR);
else
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_4, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_4, MENU_COLOR);
/* Tx battery */
uint8_t bars = GET_TXBATT_BARS(5);
lcdDrawBitmapPattern(LCD_W-130, 24, LBM_TOPMENU_TXBATT, MENU_TITLE_COLOR);
lcdDrawBitmapPattern(LCD_W-130, 24, LBM_TOPMENU_TXBATT, MENU_COLOR);
for (unsigned int i = 0; i < 5; i++) {
lcdDrawSolidFilledRect(LCD_W-122+4*i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : MENU_TITLE_COLOR);
lcdDrawSolidFilledRect(LCD_W-122+4*i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : MENU_COLOR);
}
topbar->refresh();
#if 0
// Radio battery - TODO
// drawValueWithUnit(370, 8, g_vbat100mV, UNIT_VOLTS, PREC1|SMLSIZE|MENU_TITLE_COLOR);
// lcdDrawSolidRect(300, 3, 20, 50, MENU_TITLE_COLOR);
// drawValueWithUnit(370, 8, g_vbat100mV, UNIT_VOLTS, PREC1|SMLSIZE|MENU_COLOR);
// lcdDrawSolidRect(300, 3, 20, 50, MENU_COLOR);
// lcdDrawRect(batt_icon_x+FW, BAR_Y+1, 13, 7);
// lcdDrawSolidVerticalLine(batt_icon_x+FW+13, BAR_Y+2, 5);
+3 -3
View File
@@ -138,19 +138,19 @@ ViewMain::ViewMain(bool icons):
#if defined(HARDWARE_TOUCH)
if (icons) {
new FabIconButton(this, 50, 100, ICON_MODEL,
new FabButton(this, 50, 100, ICON_MODEL,
[=]() -> uint8_t {
new ModelMenu();
return 0;
});
new FabIconButton(this, LCD_W / 2, 100, ICON_RADIO,
new FabButton(this, LCD_W / 2, 100, ICON_RADIO,
[=]() -> uint8_t {
new RadioMenu();
return 0;
});
// new FabIconButton(this, LCD_W - 50, 100, ICON_THEME,
// new FabButton(this, LCD_W - 50, 100, ICON_THEME,
// [=]() -> uint8_t {
// new ScreensMenu();
// return 0;
+6 -6
View File
@@ -89,7 +89,7 @@ bool menuStatsGraph(event_t event)
prev_yv = yv;
}
lcdDrawText(LCD_W/2, MENU_FOOTER_TOP, STR_MENUTORESET, MENU_TITLE_COLOR | CENTERED);
lcdDrawText(LCD_W/2, MENU_FOOTER_TOP, STR_MENUTORESET, MENU_COLOR | CENTERED);
return true;
}
@@ -184,7 +184,7 @@ bool menuStatsDebug(event_t event)
lcdDrawNumber(lcdNextPos+5, y, gpsData.hdop, PREC2|LEFT);
#endif
lcdDrawText(LCD_W/2, MENU_FOOTER_TOP, STR_MENUTORESET, MENU_TITLE_COLOR | CENTERED);
lcdDrawText(LCD_W/2, MENU_FOOTER_TOP, STR_MENUTORESET, MENU_COLOR | CENTERED);
return true;
}
@@ -248,10 +248,10 @@ bool menuStatsTraces(event_t event)
uint8_t k = 0;
int8_t sub = menuVerticalPosition;
lcdDrawChar(STATS_TRACES_INDEX_POS, MENU_TITLE_TOP+2, '#', MENU_TITLE_COLOR);
lcdDrawText(STATS_TRACES_TIME_POS, MENU_TITLE_TOP+2, "Time", MENU_TITLE_COLOR);
lcdDrawText(STATS_TRACES_EVENT_POS, MENU_TITLE_TOP+2, "Event", MENU_TITLE_COLOR);
lcdDrawText(STATS_TRACES_DATA_POS, MENU_TITLE_TOP+2, "Data", MENU_TITLE_COLOR);
lcdDrawChar(STATS_TRACES_INDEX_POS, MENU_TITLE_TOP+2, '#', MENU_COLOR);
lcdDrawText(STATS_TRACES_TIME_POS, MENU_TITLE_TOP+2, "Time", MENU_COLOR);
lcdDrawText(STATS_TRACES_EVENT_POS, MENU_TITLE_TOP+2, "Event", MENU_COLOR);
lcdDrawText(STATS_TRACES_DATA_POS, MENU_TITLE_TOP+2, "Data", MENU_COLOR);
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_CONTENT_TOP + i * FH;
+1 -1
View File
@@ -49,7 +49,7 @@ void TimerWidget::refresh()
lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, MAINVIEW_PANES_COLOR);
}
else {
lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, HEADER_BGCOLOR);
lcdDrawBitmapPattern(zone.x, zone.y, LBM_TIMER_BACKGROUND, MENU_BGCOLOR);
}
if (timerData.start && timerState.val >= 0) {
lcdDrawBitmapPatternPie(
+3 -3
View File
@@ -1642,11 +1642,11 @@ const luaR_value_entry opentxConstants[] = {
{ "FOCUS_BGCOLOR", FOCUS_BGCOLOR },
{ "LINE_COLOR", LINE_COLOR },
{ "CHECKBOX_COLOR", CHECKBOX_COLOR },
{ "MENU_TITLE_BGCOLOR", MENU_TITLE_BGCOLOR },
{ "MENU_TITLE_COLOR", MENU_TITLE_COLOR },
{ "MENU_BGCOLOR", MENU_BGCOLOR },
{ "MENU_COLOR", MENU_COLOR },
{ "MENU_TITLE_DISABLE_COLOR", MENU_TITLE_DISABLE_COLOR },
{ "ALARM_COLOR", ALARM_COLOR },
{ "WARNING_COLOR", WARNING_COLOR },
{ "HIGHLIGHT_COLOR", HIGHLIGHT_COLOR },
{ "TEXT_DISABLE_COLOR", TEXT_DISABLE_COLOR },
{ "HEADER_COLOR", HEADER_COLOR },
{ "DISABLE_COLOR", DISABLE_COLOR },
+4 -4
View File
@@ -783,12 +783,12 @@ Set a color for specific area
* `FOCUS_BGCOLOR`
* `LINE_COLOR`
* `CHECKBOX_COLOR`
* `MENU_TITLE_BGCOLOR`
* `MENU_TITLE_COLOR`
* `MENU_BGCOLOR`
* `MENU_COLOR`
* `MENU_TITLE_DISABLE_COLOR`
* `HEADER_COLOR`
* `ALARM_COLOR`
* `WARNING_COLOR`
* `HIGHLIGHT_COLOR`
* `TEXT_DISABLE_COLOR`
* `HEADER_COLOR`
* `DISABLE_COLOR`
@@ -798,7 +798,7 @@ Set a color for specific area
* `TRIM_SHADOW_COLOR`
* `MAINVIEW_PANES_COLOR`
* `MAINVIEW_GRAPHICS_COLOR`
* `HEADER_BGCOLOR`
* `MENU_BGCOLOR`
* `HEADER_ICON_BGCOLOR`
* `HEADER_CURRENT_BGCOLOR`
* `OVERLAY_COLOR`
+3 -3
View File
@@ -101,12 +101,12 @@ enum LcdColorIndex
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
MENU_TITLE_BGCOLOR_INDEX,
MENU_TITLE_COLOR_INDEX,
MENU_BGCOLOR_INDEX,
MENU_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
HEADER_COLOR_INDEX,
ALARM_COLOR_INDEX,
WARNING_COLOR_INDEX,
HIGHLIGHT_COLOR_INDEX,
TEXT_DISABLE_COLOR_INDEX,
DISABLE_COLOR_INDEX,
CURVE_COLOR_INDEX,
+3 -3
View File
@@ -99,12 +99,12 @@ enum LcdColorIndex
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
MENU_TITLE_BGCOLOR_INDEX,
MENU_TITLE_COLOR_INDEX,
MENU_BGCOLOR_INDEX,
MENU_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
HEADER_COLOR_INDEX,
ALARM_COLOR_INDEX,
WARNING_COLOR_INDEX,
HIGHLIGHT_COLOR_INDEX,
TEXT_DISABLE_COLOR_INDEX,
DISABLE_COLOR_INDEX,
CURVE_COLOR_INDEX,