Merge pull request #15 from EdgeTX/embedded-default-theme

Embedded default theme
This commit is contained in:
Raphael Coeffic
2021-06-12 07:28:00 +02:00
committed by GitHub
107 changed files with 442 additions and 167 deletions
+8 -3
View File
@@ -20,6 +20,8 @@ set(BITMAP_RLE_ARGS ${BITMAP_ARGS} --rle)
set(MASK_RLE_ARGS ${MASK_ARGS} --rle)
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/bmp_*.png" "5/6/5" "${BITMAP_ARGS}")
add_png_target(${BITMAP_TARGET_PREFIX}_splash "${RADIO_SRC_DIR}/bitmaps/480x272/big_logo.png")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_calibration_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/calibration/bmp_*.png" "5/6/5" "${BITMAP_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_button_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/button/alpha_*.png" "4/4/4/4" "${BITMAP_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_alpha_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/alpha_*.png" "4/4/4/4" "${BITMAP_ARGS}")
@@ -27,13 +29,16 @@ add_bitmaps_target(${BITMAP_TARGET_PREFIX}_alpha_calibration_bitmaps "${RADIO_SR
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_masks ${RADIO_SRC_DIR}/bitmaps/480x272/mask_*.png 8bits "${MASK_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_slider_masks "${RADIO_SRC_DIR}/bitmaps/480x272/slider/*.png" 8bits "${MASK_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_layouts_masks "${RADIO_SRC_DIR}/gui/colorlcd/layouts/*.png" 8bits "${MASK_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_themes_bitmaps "${RADIO_SRC_DIR}/gui/colorlcd/themes/*.png" "5/6/5" "${BITMAPS_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_fonts ${RADIO_SRC_DIR}/fonts/truetype/*.png 8bits "${MASK_RLE_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_volume_masks ${RADIO_SRC_DIR}/bitmaps/480x272/volume/*.png 8bits "${MASK_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_themes_masks "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/mask_*.png" 8bits "${BITMAPS_ARGS}")
add_png_target(${BITMAP_TARGET_PREFIX}_themes_alpha "${RADIO_SRC_DIR}/bitmaps/480x272/default_theme/alpha_*.png")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bootloader_bitmaps ${RADIO_SRC_DIR}/bitmaps/480x272/bootloader/bmp_*.png "4/4/4/4" "${BITMAP_RLE_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bootloader_icons ${RADIO_SRC_DIR}/bitmaps/480x272/bootloader/icon_*.png 8bits "${MASK_ARGS}")
add_dependencies(${BITMAP_TARGET_PREFIX}_bitmaps ${BITMAP_TARGET_PREFIX}_calibration_bitmaps ${BITMAP_TARGET_PREFIX}_button_bitmaps ${BITMAP_TARGET_PREFIX}_alpha_bitmaps
${BITMAP_TARGET_PREFIX}_alpha_calibration_bitmaps ${BITMAP_TARGET_PREFIX}_masks ${BITMAP_TARGET_PREFIX}_slider_masks ${BITMAP_TARGET_PREFIX}_layouts_masks
${BITMAP_TARGET_PREFIX}_themes_bitmaps ${BITMAP_TARGET_PREFIX}_fonts ${BITMAP_TARGET_PREFIX}_volume_masks ${BITMAP_TARGET_PREFIX}_bootloader_bitmaps
${BITMAP_TARGET_PREFIX}_bootloader_icons)
${BITMAP_TARGET_PREFIX}_fonts ${BITMAP_TARGET_PREFIX}_themes_masks ${BITMAP_TARGET_PREFIX}_themes_alpha ${BITMAP_TARGET_PREFIX}_splash ${BITMAP_TARGET_PREFIX}_volume_masks
${BITMAP_TARGET_PREFIX}_bootloader_bitmaps ${BITMAP_TARGET_PREFIX}_bootloader_icons )
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

+1 -2
View File
@@ -195,8 +195,7 @@ const uint8_t LBM_SWIPE_RIGHT[] = {
BitmapBuffer * calibStick = nullptr;
BitmapBuffer * calibStickBackground = nullptr;
BitmapBuffer * calibTrackpBackground = nullptr;
BitmapBuffer * calibRadioPict = nullptr;
BitmapBuffer * modelselIconBitmap = nullptr;
//BitmapBuffer * modelselIconBitmap = nullptr;
BitmapBuffer * modelselSdFreeBitmap = nullptr;
BitmapBuffer * modelselModelQtyBitmap = nullptr;
BitmapBuffer * modelselModelNameBitmap = nullptr;
+1 -2
View File
@@ -74,7 +74,7 @@ extern const uint8_t LBM_SWIPE_CIRCLE[];
extern const uint8_t LBM_SWIPE_LEFT[];
extern const uint8_t LBM_SWIPE_RIGHT[];
extern BitmapBuffer * modelselIconBitmap;
//extern BitmapBuffer * modelselIconBitmap;
extern BitmapBuffer * modelselSdFreeBitmap;
extern BitmapBuffer * modelselModelQtyBitmap;
extern BitmapBuffer * modelselModelNameBitmap;
@@ -86,7 +86,6 @@ extern BitmapBuffer * modelselWizardBackground;
extern BitmapBuffer * calibStick;
extern BitmapBuffer * calibStickBackground;
extern BitmapBuffer * calibTrackpBackground;
extern BitmapBuffer * calibRadioPict;
// Channels monitor bitmaps
extern BitmapBuffer * chanMonLockedBitmap;
+22 -22
View File
@@ -74,68 +74,68 @@ void drawValueOrGVar(BitmapBuffer * dc, coord_t x, coord_t y, gvar_t value, gvar
}
}
constexpr LcdFlags splash_background_color =
COLOR2FLAGS(((0xC >> 3) << 11) | ((0x3F >> 2) << 5) | (0x66 >> 3));
void drawSleepBitmap()
{
lcd->reset();
lcd->clear();
const BitmapBuffer * bitmap = BitmapBuffer::loadBitmap(OpenTxTheme::instance()->getFilePath("sleep.bmp"));
const BitmapBuffer* bitmap = OpenTxTheme::instance()->shutdown;
if (bitmap) {
lcd->drawBitmap((LCD_W-bitmap->width())/2, (LCD_H-bitmap->height())/2, bitmap);
delete bitmap;
lcd->drawMask((LCD_W-bitmap->width())/2, (LCD_H-bitmap->height())/2,
bitmap, splash_background_color);
}
lcdRefresh();
}
//
// TODO: move shutdown animation to Theme
//
#define SHUTDOWN_CIRCLE_DIAMETER 150
void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration, const char * message)
void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration,
const char* message)
{
if (totalDuration == 0)
return;
static const BitmapBuffer* shutdown = nullptr;
if (!shutdown) {
shutdown = BitmapBuffer::loadBitmap(
OpenTxTheme::instance()->getFilePath("shutdown.bmp"));
}
static const BitmapBuffer * shutdown = OpenTxTheme::instance()->shutdown;
lcd->reset();
lcd->clear(splash_background_color);
if (shutdown) {
OpenTxTheme::instance()->drawBackground(lcd);
lcd->drawBitmap((LCD_W - shutdown->width()) / 2,
(LCD_H - shutdown->height()) / 2, shutdown);
lcd->drawMask((LCD_W - shutdown->width()) / 2,
(LCD_H - shutdown->height()) / 2, shutdown,
COLOR2FLAGS(WHITE));
int quarter = duration / (totalDuration / 5);
if (quarter >= 1)
lcd->drawBitmapPattern(LCD_W / 2, (LCD_H - SHUTDOWN_CIRCLE_DIAMETER) / 2,
LBM_SHUTDOWN_CIRCLE, DEFAULT_COLOR, 0,
LBM_SHUTDOWN_CIRCLE, COLOR2FLAGS(WHITE), 0,
SHUTDOWN_CIRCLE_DIAMETER / 2);
if (quarter >= 2)
lcd->drawBitmapPattern(LCD_W / 2, LCD_H / 2, LBM_SHUTDOWN_CIRCLE,
DEFAULT_COLOR, SHUTDOWN_CIRCLE_DIAMETER / 2,
COLOR2FLAGS(WHITE), SHUTDOWN_CIRCLE_DIAMETER / 2,
SHUTDOWN_CIRCLE_DIAMETER / 2);
if (quarter >= 3)
lcd->drawBitmapPattern((LCD_W - SHUTDOWN_CIRCLE_DIAMETER) / 2, LCD_H / 2,
LBM_SHUTDOWN_CIRCLE, DEFAULT_COLOR,
LBM_SHUTDOWN_CIRCLE, COLOR2FLAGS(WHITE),
SHUTDOWN_CIRCLE_DIAMETER,
SHUTDOWN_CIRCLE_DIAMETER / 2);
if (quarter >= 4)
lcd->drawBitmapPattern((LCD_W - SHUTDOWN_CIRCLE_DIAMETER) / 2,
(LCD_H - SHUTDOWN_CIRCLE_DIAMETER) / 2,
LBM_SHUTDOWN_CIRCLE, DEFAULT_COLOR,
LBM_SHUTDOWN_CIRCLE, COLOR2FLAGS(WHITE),
SHUTDOWN_CIRCLE_DIAMETER * 3 / 2,
SHUTDOWN_CIRCLE_DIAMETER / 2);
} else {
lcd->clear();
//lcd->clear();
int quarter = duration / (totalDuration / 5);
for (int i = 1; i <= 4; i++) {
if (quarter >= i) {
lcd->drawSolidFilledRect(LCD_W / 2 - 70 + 24 * i, LCD_H / 2 - 10, 20,
20, DEFAULT_BGCOLOR);
20, COLOR2FLAGS(WHITE));
}
}
}
+8 -10
View File
@@ -54,16 +54,14 @@ void FullScreenDialog::paint(BitmapBuffer * dc)
FOCUS_COLOR, OPACITY(8));
if (type == WARNING_TYPE_ALERT || type == WARNING_TYPE_ASTERISK) {
dc->drawBitmap(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->asterisk);
}
else if (type == WARNING_TYPE_INFO) {
dc->drawBitmap(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->busy);
}
else { // confirmation
dc->drawBitmap(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->question);
dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->error, ALARM_COLOR);
} else if (type == WARNING_TYPE_INFO) {
dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->busy, ALARM_COLOR);
} else { // confirmation
dc->drawMask(ALERT_BITMAP_LEFT, ALERT_BITMAP_TOP,
OpenTxTheme::instance()->error, ALARM_COLOR);
}
if (type == WARNING_TYPE_ALERT) {
+2 -9
View File
@@ -69,16 +69,9 @@ void RadioCalibrationPage::buildBody(FormWindow * window)
{
menuCalibrationState = CALIB_START;
if (calibRadioPict) {
// Background radio image
#if LCD_W > LCD_H
new StaticBitmap(window, {LCD_W / 2 - calibRadioPict->width() / 2, 5, calibRadioPict->height(), calibRadioPict->width()}, calibRadioPict);
#else
new StaticBitmap(window, {LCD_W / 2 - calibRadioPict->width() / 2, LCD_H / 2 - calibRadioPict->height() / 2, calibRadioPict->height(), calibRadioPict->width()}, calibRadioPict);
#endif
}
// The two sticks
//TODO: dynamic placing
new StickCalibrationWindow(window, {40, 20, 90, 90}, STICK1, STICK2);
new StickCalibrationWindow(window, {LCD_W - 130, 20, 90, 90}, STICK4, STICK3);
+16 -13
View File
@@ -22,35 +22,38 @@
#if defined(SPLASH)
const uint8_t __bmp_splash[] __ALIGNED(4) {
#include "bmp_splash.lbm"
const uint8_t __bmp_splash[] {
#include "big_logo.lbm"
};
Bitmap BMP_SPLASH(BMP_RGB565, (const uint16_t *)__bmp_splash);
void drawSplash()
{
static bool loadImgFromSD = true;
constexpr LcdFlags splash_background_color =
COLOR2FLAGS(((0xC >> 3) << 11) | ((0x3F >> 2) << 5) | (0x66 >> 3));
static bool loadSplashImg = true;
static BitmapBuffer * splashImg = nullptr;
if (loadImgFromSD && splashImg == nullptr) {
// try splash from SD card first
if (loadSplashImg && splashImg == nullptr) {
if (!sdMounted()) sdInit();
splashImg = BitmapBuffer::loadBitmap(BITMAPS_PATH "/" SPLASH_FILE);
loadImgFromSD = false;
loadSplashImg = false;
// otherwise load from FLASH
if (splashImg == nullptr) {
splashImg = BitmapBuffer::loadRamBitmap(__bmp_splash, sizeof(__bmp_splash));
}
}
lcd->clear();
lcd->clear(splash_background_color);
if (splashImg) {
lcd->drawBitmap((LCD_W - splashImg->width())/2,
(LCD_H - splashImg->height())/2,
splashImg);
}
else {
lcd->drawBitmap((LCD_W - BMP_SPLASH.width())/2,
(LCD_H - BMP_SPLASH.height())/2,
&BMP_SPLASH);
}
lcdRefresh();
}
#endif
+20 -7
View File
@@ -25,9 +25,9 @@
//#include "modal_window.h"
extern OpenTxTheme * defaultTheme;
const BitmapBuffer * OpenTxTheme::asterisk = nullptr;
const BitmapBuffer * OpenTxTheme::question = nullptr;
const BitmapBuffer * OpenTxTheme::error = nullptr;
const BitmapBuffer * OpenTxTheme::busy = nullptr;
const BitmapBuffer * OpenTxTheme::shutdown = nullptr;
const uint8_t LBM_FOLDER[] = {
#include "mask_folder.lbm"
@@ -44,6 +44,19 @@ const uint8_t LBM_USB_PLUGGED[] = {
#include "mask_usb_symbol.lbm"
};
const uint8_t error_bitmap[] = {
#include "mask_error.lbm"
};
const uint8_t busy_bitmap[] = {
#include "mask_busy.lbm"
};
const uint8_t shutdown_bitmap[] = {
#include "mask_shutdown.lbm"
};
std::list<OpenTxTheme *> & getRegisteredThemes()
{
static std::list<OpenTxTheme *> themes;
@@ -71,12 +84,12 @@ void OpenTxTheme::init() const
void OpenTxTheme::load() const
{
if (!asterisk)
asterisk = BitmapBuffer::loadBitmap(getFilePath("asterisk.bmp"));
if (!question)
question = BitmapBuffer::loadBitmap(getFilePath("question.bmp"));
if (!error)
error = BitmapBuffer::load8bitMask(error_bitmap);
if (!busy)
busy = BitmapBuffer::loadBitmap(getFilePath("busy.bmp"));
busy = BitmapBuffer::load8bitMask(busy_bitmap);
if (!shutdown)
shutdown = BitmapBuffer::load8bitMask(shutdown_bitmap);
}
ZoneOptionValue * OpenTxTheme::getOptionValue(unsigned int index) const
+2 -2
View File
@@ -111,9 +111,9 @@ class OpenTxTheme: public Theme
BitmapBuffer * thumb;
public:
static const BitmapBuffer * asterisk;
static const BitmapBuffer * question;
static const BitmapBuffer * error;
static const BitmapBuffer * busy;
static const BitmapBuffer * shutdown;
};
OpenTxTheme * getTheme(const char * name);

Some files were not shown because too many files have changed in this diff Show More