TextEdit focus issues

This commit is contained in:
Bertrand Songis
2019-10-28 15:05:58 +01:00
parent 0141946b02
commit da5512bef3
14 changed files with 38 additions and 32 deletions
+2 -2
View File
@@ -205,7 +205,7 @@ void drawSleepBitmap()
const BitmapBuffer * bitmap = BitmapBuffer::loadBitmap(static_cast<ThemeBase *>(theme)->getFilePath("sleep.bmp"));
if (bitmap) {
lcd->drawBitmap((LCD_W-bitmap->getWidth())/2, (LCD_H-bitmap->getHeight())/2, bitmap);
lcd->drawBitmap((LCD_W-bitmap->width())/2, (LCD_H-bitmap->height())/2, bitmap);
delete bitmap;
}
@@ -224,7 +224,7 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration, const char
if (shutdown) {
if (duration < lastDuration) {
static_cast<ThemeBase *>(theme)->drawBackground(lcd);
lcd->drawBitmap((LCD_W-shutdown->getWidth())/2, (LCD_H-shutdown->getHeight())/2, shutdown);
lcd->drawBitmap((LCD_W-shutdown->width())/2, (LCD_H-shutdown->height())/2, shutdown);
lcdStoreBackupBuffer();
}
else {
+1 -1
View File
@@ -44,6 +44,6 @@ 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);
dc->drawMask((68 - mask->width()) / 2, (68 - mask->height()) / 2, mask, DEFAULT_BGCOLOR);
}
}
+2 -2
View File
@@ -67,8 +67,8 @@ void drawModel(coord_t x, coord_t y, ModelCell * model, bool current, bool selec
lcdDrawSolidRect(x, y, MODELCELL_WIDTH+2, MODELCELL_HEIGHT+2, 1, TITLE_BGCOLOR);
drawShadow(x, y, MODELCELL_WIDTH+2, MODELCELL_HEIGHT+2);
if (selectMode == MODE_MOVE_MODEL) {
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->getWidth(), y, modelselModelMoveBackground, TITLE_BGCOLOR);
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->getWidth()+12, y+5, modelselModelMoveIcon, TEXT_BGCOLOR);
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->width(), y, modelselModelMoveBackground, TITLE_BGCOLOR);
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->width()+12, y+5, modelselModelMoveIcon, TEXT_BGCOLOR);
}
}
}
+2 -2
View File
@@ -63,8 +63,8 @@ void drawModel(coord_t x, coord_t y, ModelCell * model, bool current, bool selec
lcdDrawSolidRect(x, y, MODELCELL_WIDTH+2, MODELCELL_HEIGHT+2, 1, TITLE_BGCOLOR);
drawShadow(x, y, MODELCELL_WIDTH+2, MODELCELL_HEIGHT+2);
if (selectMode == MODE_MOVE_MODEL) {
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->getWidth(), y, modelselModelMoveBackground, TITLE_BGCOLOR);
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->getWidth()+12, y+5, modelselModelMoveIcon, DEFAULT_BGCOLOR);
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->width(), y, modelselModelMoveBackground, TITLE_BGCOLOR);
lcd->drawMask(x+MODELCELL_WIDTH+2-modelselModelMoveBackground->width()+12, y+5, modelselModelMoveIcon, DEFAULT_BGCOLOR);
}
}
}
+2 -2
View File
@@ -119,9 +119,9 @@ void RadioCalibrationPage::buildBody(FormWindow * window)
if (calibRadioPict) {
// Background radio image
#if LCD_W > LCD_H
new StaticBitmap(window, {LCD_W / 2 - calibRadioPict->getWidth() / 2, 5, calibRadioPict->getHeight(), calibRadioPict->getWidth()}, calibRadioPict);
new StaticBitmap(window, {LCD_W / 2 - calibRadioPict->width() / 2, 5, calibRadioPict->height(), calibRadioPict->width()}, calibRadioPict);
#else
new StaticBitmap(window, {LCD_W / 2 - calibRadioPict->getWidth() / 2, LCD_H / 2 - calibRadioPict->getHeight() / 2, calibRadioPict->getHeight(), calibRadioPict->getWidth()}, calibRadioPict);
new StaticBitmap(window, {LCD_W / 2 - calibRadioPict->width() / 2, LCD_H / 2 - calibRadioPict->height() / 2, calibRadioPict->height(), calibRadioPict->width()}, calibRadioPict);
#endif
}
+2 -2
View File
@@ -74,8 +74,8 @@ class FilePreview : public Window
coord_t h = MENU_BODY_HEIGHT - 4;
lcd->drawSolidFilledRect(0, y, width(), h, DISABLE_COLOR);
if (bitmap) {
coord_t bitmapHeight = min<coord_t>(h, bitmap->getHeight());
coord_t bitmapWidth = min<coord_t>(width(), bitmap->getWidth());
coord_t bitmapHeight = min<coord_t>(h, bitmap->height());
coord_t bitmapWidth = min<coord_t>(width(), bitmap->width());
dc->drawScaledBitmap(bitmap, (width() - bitmapWidth) / 2, y + (h - bitmapHeight) / 2, bitmapWidth,
bitmapHeight);
}
@@ -50,8 +50,8 @@ class SpectrumWindow : public Window
}
coord_t y = max<coord_t>(FH, SPECTRUM_HEIGHT - peak_y - FH);
dc->drawNumber(min<coord_t>(100, peak_x), y, ((reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2) + peak_x * (reusableBuffer.spectrumAnalyser.span / 128)) / 1000000, TINSIZE);
dc->drawText(lcdNextPos, y, "M", TINSIZE);
dc->drawNumber(min<coord_t>(100, peak_x), y, ((reusableBuffer.spectrumAnalyser.freq - reusableBuffer.spectrumAnalyser.span / 2) + peak_x * (reusableBuffer.spectrumAnalyser.span / 128)) / 1000000, FONT(XXS));
dc->drawText(lcdNextPos, y, "M", FONT(XXS));
}
protected:
+4 -4
View File
@@ -45,13 +45,13 @@ void drawSplash()
lcd->clear();
if (splashImg) {
lcd->drawBitmap((LCD_W - splashImg->getWidth())/2,
(LCD_H - splashImg->getHeight())/2,
lcd->drawBitmap((LCD_W - splashImg->width())/2,
(LCD_H - splashImg->height())/2,
splashImg);
}
else {
lcd->drawBitmap((LCD_W - BMP_SPLASH.getWidth())/2,
(LCD_H - BMP_SPLASH.getHeight())/2,
lcd->drawBitmap((LCD_W - BMP_SPLASH.width())/2,
(LCD_H - BMP_SPLASH.height())/2,
&BMP_SPLASH);
}
+8 -6
View File
@@ -47,6 +47,7 @@ class FlyskyTheme: public ThemeBase
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RGB(0, 71, 157);
lcdColorTable[SCROLLBAR_COLOR_INDEX] = RGB(0, 71, 157);
lcdColorTable[MENU_BGCOLOR_INDEX] = DARKBLUE;
lcdColorTable[MENU_COLOR_INDEX] = WHITE;
lcdColorTable[MENU_TITLE_DISABLE_COLOR_INDEX] = RGB(GET_RED(RED)>>1, GET_GREEN(RED)>>1, GET_BLUE(RED)>>1);
@@ -86,8 +87,8 @@ class FlyskyTheme: public ThemeBase
delete iconMask[index];
iconMask[index] = mask;
uint8_t width = mask->getWidth();
uint8_t height = mask->getHeight();
uint8_t width = mask->width();
uint8_t height = mask->height();
if (0) {
delete menuIconNormal[index];
@@ -186,9 +187,9 @@ class FlyskyTheme: public ThemeBase
currentMenuBackground = new BitmapBuffer(BMP_RGB565, 36, 53);
}
if (currentMenuBackground) {
currentMenuBackground->drawSolidFilledRect(0, 0, currentMenuBackground->getWidth(), MENU_HEADER_HEIGHT, HEADER_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->drawSolidFilledRect(0, 0, currentMenuBackground->width(), MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, currentMenuBackground->width(), MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_TITLE_TOP, currentMenuBackground->width(), currentMenuBackground->height() - 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_COLOR);
@@ -313,6 +314,7 @@ class FlyskyTheme: public ThemeBase
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = bg_color;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = color;
lcdColorTable[CHECKBOX_COLOR_INDEX] = color;
lcdColorTable[SCROLLBAR_COLOR_INDEX] = color;
lcdColorTable[CURVE_COLOR_INDEX] = color;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = color;
lcdColorTable[TITLE_BGCOLOR_INDEX] = color;
@@ -344,7 +346,7 @@ class FlyskyTheme: public ThemeBase
{
// if (topleftBitmap) {
// dc->drawBitmap(0, 0, topleftBitmap);
// uint16_t width = topleftBitmap->getWidth();
// uint16_t width = topleftBitmap->width();
// dc->drawSolidFilledRect(width, 0, LCD_W-width, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
// }
// else {
+8 -6
View File
@@ -46,6 +46,7 @@ class FrskyTheme: public ThemeBase
lcdColorTable[TEXT_STATUSBAR_COLOR_INDEX] = WHITE;
lcdColorTable[LINE_COLOR_INDEX] = GREY;
lcdColorTable[CHECKBOX_COLOR_INDEX] = RED;
lcdColorTable[SCROLLBAR_COLOR_INDEX] = RED;
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);
@@ -79,14 +80,14 @@ class FrskyTheme: public ThemeBase
iconMask[index] = mask;
delete menuIconNormal[index];
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->getWidth(), mask->getHeight());
menuIconNormal[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconNormal[index]) {
menuIconNormal[index]->clear(MENU_BGCOLOR);
menuIconNormal[index]->drawMask(0, 0, mask, color);
}
delete menuIconSelected[index];
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->getWidth(), mask->getHeight());
menuIconSelected[index] = new BitmapBuffer(BMP_RGB565, mask->width(), mask->height());
if (menuIconSelected[index]) {
menuIconSelected[index]->clear(HEADER_CURRENT_BGCOLOR);
menuIconSelected[index]->drawMask(0, 0, mask, color);
@@ -157,9 +158,9 @@ class FrskyTheme: public ThemeBase
}
if (currentMenuBackground) {
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->drawSolidFilledRect(0, 0, currentMenuBackground->width(), MENU_HEADER_HEIGHT, MENU_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_HEADER_HEIGHT, currentMenuBackground->width(), MENU_TITLE_TOP - MENU_HEADER_HEIGHT, DEFAULT_BGCOLOR);
currentMenuBackground->drawSolidFilledRect(0, MENU_TITLE_TOP, currentMenuBackground->width(), currentMenuBackground->height() - 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_COLOR);
@@ -292,6 +293,7 @@ class FrskyTheme: public ThemeBase
lcdColorTable[DEFAULT_BGCOLOR_INDEX] = bg_color;
lcdColorTable[FOCUS_BGCOLOR_INDEX] = color;
lcdColorTable[CHECKBOX_COLOR_INDEX] = color;
lcdColorTable[SCROLLBAR_COLOR_INDEX] = color;
lcdColorTable[CURVE_COLOR_INDEX] = color;
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = color;
lcdColorTable[TITLE_BGCOLOR_INDEX] = color;
@@ -323,7 +325,7 @@ class FrskyTheme: public ThemeBase
{
if (topleftBitmap) {
dc->drawBitmap(0, 0, topleftBitmap);
uint16_t width = topleftBitmap->getWidth();
uint16_t width = topleftBitmap->width();
dc->drawSolidFilledRect(width, 0, LCD_W - width, MENU_HEADER_HEIGHT, MENU_BGCOLOR);
}
else {
+2 -2
View File
@@ -454,8 +454,8 @@ static int luaGetBitmapSize(lua_State * L)
{
const BitmapBuffer * b = checkBitmap(L, 1);
if (b) {
lua_pushinteger(L, b->getWidth());
lua_pushinteger(L, b->getHeight());
lua_pushinteger(L, b->width());
lua_pushinteger(L, b->height());
}
else {
lua_pushinteger(L, 0);
@@ -101,6 +101,7 @@ enum LcdColorIndex
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
SCROLLBAR_COLOR_INDEX,
MENU_BGCOLOR_INDEX,
MENU_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,
@@ -99,6 +99,7 @@ enum LcdColorIndex
TEXT_STATUSBAR_COLOR_INDEX,
LINE_COLOR_INDEX,
CHECKBOX_COLOR_INDEX,
SCROLLBAR_COLOR_INDEX,
MENU_BGCOLOR_INDEX,
MENU_COLOR_INDEX,
MENU_TITLE_DISABLE_COLOR_INDEX,