Model select cosmetics
This commit is contained in:
@@ -39,10 +39,6 @@ FullScreenDialog::FullScreenDialog(uint8_t type, std::string title, std::string
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FullScreenDialog::~FullScreenDialog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void FullScreenDialog::paint(BitmapBuffer * dc)
|
void FullScreenDialog::paint(BitmapBuffer * dc)
|
||||||
{
|
{
|
||||||
static_cast<ThemeBase *>(theme)->drawBackground(dc);
|
static_cast<ThemeBase *>(theme)->drawBackground(dc);
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ class FullScreenDialog : public Dialog {
|
|||||||
public:
|
public:
|
||||||
FullScreenDialog(uint8_t type, std::string title, std::string message = "", std::string action = "", std::function<void(void)> confirmHandler = nullptr);
|
FullScreenDialog(uint8_t type, std::string title, std::string message = "", std::string action = "", std::function<void(void)> confirmHandler = nullptr);
|
||||||
|
|
||||||
~FullScreenDialog() override;
|
|
||||||
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
std::string getName() override
|
std::string getName() override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -195,8 +195,8 @@ class ModelButton: public Button {
|
|||||||
|
|
||||||
class ModelSelectFooter: public Window {
|
class ModelSelectFooter: public Window {
|
||||||
public:
|
public:
|
||||||
ModelSelectFooter(Window * parent, const rect_t & rect):
|
explicit ModelSelectFooter(Window * parent):
|
||||||
Window(parent, rect)
|
Window(parent, {0, parent->height() - MODEL_SELECT_FOOTER_HEIGHT, LCD_W, MODEL_SELECT_FOOTER_HEIGHT}, OPAQUE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,14 +209,20 @@ class ModelSelectFooter: public Window {
|
|||||||
void paint(BitmapBuffer * dc) override
|
void paint(BitmapBuffer * dc) override
|
||||||
{
|
{
|
||||||
dc->drawSolidFilledRect(0, 0, width(), height(), DISABLE_COLOR);
|
dc->drawSolidFilledRect(0, 0, width(), height(), DISABLE_COLOR);
|
||||||
dc->drawBitmap(7, 12, modelselSdFreeBitmap);
|
|
||||||
uint32_t size = sdGetSize() / 100;
|
uint32_t size = sdGetSize() / 100;
|
||||||
dc->drawNumber(24, 11, size, PREC1|FONT(XS), 0, NULL, "GB");
|
coord_t x = 7;
|
||||||
dc->drawBitmap(77, 12, modelselModelQtyBitmap);
|
dc->drawMask(7, 4, modelselSdFreeBitmap, DEFAULT_COLOR);
|
||||||
dc->drawNumber(99, 11, modelslist.getModelsCount(), FONT(XS));
|
x += modelselSdFreeBitmap->width() + 3;
|
||||||
|
x = dc->drawNumber(x, 3, size, PREC1|FONT(XS), 0, nullptr, "GB");
|
||||||
|
x += 20;
|
||||||
|
dc->drawMask(x, 4, modelselModelQtyBitmap, DEFAULT_COLOR);
|
||||||
|
x += modelselModelQtyBitmap->width() + 3;
|
||||||
|
x = dc->drawNumber(x, 3, modelslist.getModelsCount(), FONT(XS));
|
||||||
if (currentModel) {
|
if (currentModel) {
|
||||||
dc->drawBitmap(7, 37, modelselModelNameBitmap);
|
x += 20;
|
||||||
dc->drawText(24, 32, currentModel->modelFilename, FONT(XS) | DEFAULT_COLOR);
|
dc->drawMask(x, 4, modelselModelNameBitmap, DEFAULT_COLOR);
|
||||||
|
x += modelselModelNameBitmap->width() + 3;
|
||||||
|
dc->drawText(x, 3, currentModel->modelFilename, FONT(XS) | DEFAULT_COLOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,6 +230,13 @@ class ModelSelectFooter: public Window {
|
|||||||
ModelCell * currentModel = nullptr;
|
ModelCell * currentModel = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(PCBX10)
|
||||||
|
constexpr coord_t MODEL_SELECT_CELL_WIDTH = (LCD_W - 3 * PAGE_PADDING) / 2;
|
||||||
|
#else
|
||||||
|
constexpr coord_t MODEL_SELECT_CELL_WIDTH = LCD_W - 2 * PAGE_PADDING;
|
||||||
|
#endif
|
||||||
|
constexpr coord_t MODEL_SELECT_CELL_HEIGHT = 94;
|
||||||
|
|
||||||
class ModelCategoryPageBody: public FormWindow {
|
class ModelCategoryPageBody: public FormWindow {
|
||||||
public:
|
public:
|
||||||
ModelCategoryPageBody(FormWindow * parent, const rect_t & rect, ModelsCategory * category, ModelSelectFooter * footer):
|
ModelCategoryPageBody(FormWindow * parent, const rect_t & rect, ModelsCategory * category, ModelSelectFooter * footer):
|
||||||
@@ -239,8 +252,10 @@ class ModelCategoryPageBody: public FormWindow {
|
|||||||
clear();
|
clear();
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
coord_t y = PAGE_PADDING;
|
||||||
|
coord_t x = PAGE_PADDING;
|
||||||
for (auto & model: * category) {
|
for (auto & model: * category) {
|
||||||
auto button = new ModelButton(this, {10, 10 + index * 104, LCD_W - 20, 94}, model, nullptr);
|
auto button = new ModelButton(this, {x, y, MODEL_SELECT_CELL_WIDTH, MODEL_SELECT_CELL_HEIGHT}, model, nullptr);
|
||||||
|
|
||||||
button->setFocusHandler([=] {
|
button->setFocusHandler([=] {
|
||||||
footer->setCurrentModel(model);
|
footer->setCurrentModel(model);
|
||||||
@@ -296,18 +311,30 @@ class ModelCategoryPageBody: public FormWindow {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
button->setFocus();
|
button->setFocus();
|
||||||
// footer->invalidate();
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (selected == index) {
|
if (selected == index) {
|
||||||
button->setFocus();
|
button->setFocus();
|
||||||
|
footer->setCurrentModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
#if LCD_W >= 480
|
||||||
|
if (x == PAGE_PADDING) {
|
||||||
|
x = PAGE_PADDING + MODEL_SELECT_CELL_WIDTH + PAGE_PADDING;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
x = PAGE_PADDING;
|
||||||
|
y += MODEL_SELECT_CELL_HEIGHT + PAGE_PADDING;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
y += MODEL_SELECT_CELL_HEIGHT + PAGE_PADDING;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustInnerHeight();
|
setInnerHeight(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -328,8 +355,8 @@ class ModelCategoryPage: public PageTab {
|
|||||||
|
|
||||||
void build(FormWindow * window) override
|
void build(FormWindow * window) override
|
||||||
{
|
{
|
||||||
auto footer = new ModelSelectFooter(window, {0, window->height() - 55, LCD_W, 55});
|
auto footer = new ModelSelectFooter(window);
|
||||||
new ModelCategoryPageBody(window, {0, 0, LCD_W, window->height() - 55}, category, footer);
|
new ModelCategoryPageBody(window, {0, 0, LCD_W, window->height() - MODEL_SELECT_FOOTER_HEIGHT}, category, footer);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -228,13 +228,13 @@ class FlyskyTheme: public ThemeBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete modelselSdFreeBitmap;
|
delete modelselSdFreeBitmap;
|
||||||
modelselSdFreeBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_sdfree.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
|
modelselSdFreeBitmap = BitmapBuffer::loadMask(getFilePath("modelsel/mask_sdfree.png"));
|
||||||
|
|
||||||
delete modelselModelQtyBitmap;
|
delete modelselModelQtyBitmap;
|
||||||
modelselModelQtyBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelqty.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
|
modelselModelQtyBitmap = BitmapBuffer::loadMask(getFilePath("modelsel/mask_modelqty.png"));
|
||||||
|
|
||||||
delete modelselModelNameBitmap;
|
delete modelselModelNameBitmap;
|
||||||
modelselModelNameBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelname.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
|
modelselModelNameBitmap = BitmapBuffer::loadMask(getFilePath("modelsel/mask_modelname.png"));
|
||||||
|
|
||||||
delete modelselModelMoveBackground;
|
delete modelselModelMoveBackground;
|
||||||
modelselModelMoveBackground = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveback.png"));
|
modelselModelMoveBackground = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveback.png"));
|
||||||
|
|||||||
@@ -208,13 +208,13 @@ class FrskyTheme: public ThemeBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete modelselSdFreeBitmap;
|
delete modelselSdFreeBitmap;
|
||||||
modelselSdFreeBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_sdfree.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
|
modelselSdFreeBitmap = BitmapBuffer::loadMask(getFilePath("modelsel/mask_sdfree.png"));
|
||||||
|
|
||||||
delete modelselModelQtyBitmap;
|
delete modelselModelQtyBitmap;
|
||||||
modelselModelQtyBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelqty.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
|
modelselModelQtyBitmap = BitmapBuffer::loadMask(getFilePath("modelsel/mask_modelqty.png"));
|
||||||
|
|
||||||
delete modelselModelNameBitmap;
|
delete modelselModelNameBitmap;
|
||||||
modelselModelNameBitmap = BitmapBuffer::loadMaskOnBackground("modelsel/mask_modelname.png", DEFAULT_COLOR, DEFAULT_BGCOLOR);
|
modelselModelNameBitmap = BitmapBuffer::loadMask(getFilePath("modelsel/mask_modelname.png"));
|
||||||
|
|
||||||
delete modelselModelMoveBackground;
|
delete modelselModelMoveBackground;
|
||||||
modelselModelMoveBackground = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveback.png"));
|
modelselModelMoveBackground = BitmapBuffer::loadMask(getFilePath("modelsel/mask_moveback.png"));
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ constexpr uint32_t DEFAULT_SCROLLBAR_X = LCD_W - 10;
|
|||||||
constexpr uint32_t DEFAULT_SCROLLBAR_Y = MENU_CONTENT_TOP;
|
constexpr uint32_t DEFAULT_SCROLLBAR_Y = MENU_CONTENT_TOP;
|
||||||
constexpr uint32_t DEFAULT_SCROLLBAR_H = MENU_FOOTER_TOP - DEFAULT_SCROLLBAR_Y - 6;
|
constexpr uint32_t DEFAULT_SCROLLBAR_H = MENU_FOOTER_TOP - DEFAULT_SCROLLBAR_Y - 6;
|
||||||
|
|
||||||
constexpr uint32_t PAGE_PADDING = 6;
|
constexpr coord_t PAGE_PADDING = 6;
|
||||||
constexpr uint32_t PAGE_LINE_HEIGHT = 20;
|
constexpr uint32_t PAGE_LINE_HEIGHT = 20;
|
||||||
constexpr uint32_t PAGE_LINE_SPACING = 2;
|
constexpr uint32_t PAGE_LINE_SPACING = 2;
|
||||||
constexpr uint32_t PAGE_INDENT_WIDTH = 10;
|
constexpr uint32_t PAGE_INDENT_WIDTH = 10;
|
||||||
@@ -159,6 +159,7 @@ constexpr coord_t MENUS_HEADER_HEIGHT = 30;
|
|||||||
constexpr coord_t MENUS_FOOTER_HEIGHT = 0;
|
constexpr coord_t MENUS_FOOTER_HEIGHT = 0;
|
||||||
constexpr coord_t MENUS_MIN_HEIGHT = 2 * MENUS_LINE_HEIGHT - 1;
|
constexpr coord_t MENUS_MIN_HEIGHT = 2 * MENUS_LINE_HEIGHT - 1;
|
||||||
constexpr coord_t MENUS_MAX_HEIGHT = 7 * MENUS_LINE_HEIGHT - 1;
|
constexpr coord_t MENUS_MAX_HEIGHT = 7 * MENUS_LINE_HEIGHT - 1;
|
||||||
|
constexpr coord_t MODEL_SELECT_FOOTER_HEIGHT = 24;
|
||||||
|
|
||||||
constexpr int CJK_FIRST_LETTER_INDEX = 187;
|
constexpr int CJK_FIRST_LETTER_INDEX = 187;
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ constexpr coord_t MENUS_FOOTER_HEIGHT = 0;
|
|||||||
constexpr coord_t MENUS_MIN_HEIGHT = 2 * MENUS_LINE_HEIGHT - 1;
|
constexpr coord_t MENUS_MIN_HEIGHT = 2 * MENUS_LINE_HEIGHT - 1;
|
||||||
constexpr coord_t MENUS_MAX_HEIGHT = 7 * MENUS_LINE_HEIGHT - 1;
|
constexpr coord_t MENUS_MAX_HEIGHT = 7 * MENUS_LINE_HEIGHT - 1;
|
||||||
|
|
||||||
|
constexpr coord_t MODEL_SELECT_FOOTER_HEIGHT = 24;
|
||||||
|
|
||||||
constexpr int CJK_FIRST_LETTER_INDEX = 187;
|
constexpr int CJK_FIRST_LETTER_INDEX = 187;
|
||||||
|
|
||||||
#endif // _LIBOPENUI_CONFIG_H_
|
#endif // _LIBOPENUI_CONFIG_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user