[Horus] Themes introduction

This commit is contained in:
Bertrand Songis
2016-02-11 22:58:43 +01:00
parent 1da4df143c
commit 02f06706c2
34 changed files with 555 additions and 161 deletions
+94
View File
@@ -0,0 +1,94 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* 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 "opentx.h"
const uint8_t LBM_TOPMENU_MASK_OPENTX[] = {
#include "mask_topmenu_opentx.lbm"
};
const uint8_t LBM_MAINVIEW_BACKGROUND[] = {
#include "bmp_background.lbm"
};
class DefaultTheme: public Theme
{
public:
DefaultTheme(const char * name, const uint8_t * bitmap):
Theme(name, bitmap)
{
}
virtual void load() const
{
lcdColorTable[TEXT_COLOR_INDEX] = BLACK;
lcdColorTable[TEXT_BGCOLOR_INDEX] = WHITE;
lcdColorTable[TEXT_INVERTED_COLOR_INDEX] = WHITE;
lcdColorTable[TEXT_INVERTED_BGCOLOR_INDEX] = RED;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[SCROLLBOX_COLOR_INDEX] = RED;
lcdColorTable[MENU_TITLE_BGCOLOR_INDEX] = DARKGREY;
lcdColorTable[MENU_TITLE_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(130, 1, 5);
lcdColorTable[HEADER_COLOR_INDEX] = DARKGREY;
lcdColorTable[ALARM_COLOR_INDEX] = RED;
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = GREY;
lcdColorTable[CURVE_AXIS_COLOR_INDEX] = LIGHTGREY;
lcdColorTable[CURVE_COLOR_INDEX] = RED;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED;
lcdColorTable[TITLE_BGCOLOR_INDEX] = RED;
lcdColorTable[TRIM_BGCOLOR_INDEX] = RED;
lcdColorTable[TRIM_SHADOW_COLOR_INDEX] = BLACK;
lcdColorTable[MAINVIEW_PANES_COLOR_INDEX] = WHITE;
lcdColorTable[MAINVIEW_GRAPHICS_COLOR_INDEX] = RED;
lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKRED;
lcdColorTable[HEADER_ICON_BGCOLOR_INDEX] = RED;
lcdColorTable[HEADER_CURRENT_BGCOLOR_INDEX] = RED;
lcdColorTable[OVERLAY_COLOR_INDEX] = BLACK;
}
virtual void drawBackground() const
{
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
}
virtual void drawTopbarBackground(const uint8_t * icon) const
{
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
if (icon) {
lcdDrawBitmapPattern(5, 7, icon, MENU_TITLE_COLOR);
}
else {
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_MASK_OPENTX, MENU_TITLE_COLOR);
}
drawTopbarDatetime();
}
};
const uint8_t LBM_THEME_DEFAULT[] __DMA = {
#include "bmp_default.lbm"
};
const DefaultTheme defaultTheme("Default", LBM_THEME_DEFAULT);
const Theme * theme = &defaultTheme;