Scrolling is now handled 100% by LVGL
This commit is contained in:
committed by
Raphael Coeffic
parent
131e26cfa0
commit
12f51350ce
@@ -602,8 +602,6 @@ void ModuleOptions::update()
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
grid.spacer(PAGE_PADDING);
|
grid.spacer(PAGE_PADDING);
|
||||||
|
|
||||||
form->setInnerHeight(grid.getWindowHeight());
|
|
||||||
form->setHeight(form->getInnerHeight());
|
|
||||||
|
|
||||||
content->adjustHeight();
|
content->adjustHeight();
|
||||||
content->setWindowCentered();
|
content->setWindowCentered();
|
||||||
@@ -918,12 +916,6 @@ void RxOptions::update()
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
grid.spacer(PAGE_PADDING);
|
grid.spacer(PAGE_PADDING);
|
||||||
|
|
||||||
form->setInnerHeight(grid.getWindowHeight());
|
|
||||||
if (form->getInnerHeight() < LCD_H - 2*POPUP_HEADER_HEIGHT) {
|
|
||||||
form->setHeight(form->getInnerHeight());
|
|
||||||
} else {
|
|
||||||
form->setHeight(LCD_H - 2*POPUP_HEADER_HEIGHT);
|
|
||||||
}
|
|
||||||
|
|
||||||
content->adjustHeight();
|
content->adjustHeight();
|
||||||
content->setWindowCentered();
|
content->setWindowCentered();
|
||||||
|
|||||||
@@ -224,7 +224,6 @@ bool ColorEditor::onTouchSlide(coord_t x, coord_t y, coord_t startX, coord_t sta
|
|||||||
y -= BAR_TOP_MARGIN;
|
y -= BAR_TOP_MARGIN;
|
||||||
auto value = _colorType->screenToValue(i, y);
|
auto value = _colorType->screenToValue(i, y);
|
||||||
if (value != _colorType->barInfo[i].value) {
|
if (value != _colorType->barInfo[i].value) {
|
||||||
slidingWindow = this;
|
|
||||||
_colorType->barInfo[i].value = value;
|
_colorType->barInfo[i].value = value;
|
||||||
setRGB();
|
setRGB();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ bool ColorEditorContent::onTouchSlide(coord_t x, coord_t y, coord_t startX, coor
|
|||||||
if (touchState.event == TE_SLIDE_END) {
|
if (touchState.event == TE_SLIDE_END) {
|
||||||
sliding = false;
|
sliding = false;
|
||||||
colorPicking = false;
|
colorPicking = false;
|
||||||
slidingWindow = nullptr;
|
|
||||||
invalidate();
|
invalidate();
|
||||||
} else if (sliding) {
|
} else if (sliding) {
|
||||||
x -= SCREEN_LEFT_MARGIN;
|
x -= SCREEN_LEFT_MARGIN;
|
||||||
@@ -102,7 +101,6 @@ bool ColorEditorContent::onTouchSlide(coord_t x, coord_t y, coord_t startX, coor
|
|||||||
x = min(x, MAX_HUE);
|
x = min(x, MAX_HUE);
|
||||||
if (hue != x) {
|
if (hue != x) {
|
||||||
hue = x;
|
hue = x;
|
||||||
slidingWindow = this; // KLK: (Hack IMHO) so we get the end slide message
|
|
||||||
setRGB();
|
setRGB();
|
||||||
}
|
}
|
||||||
} else if (colorPicking) {
|
} else if (colorPicking) {
|
||||||
@@ -237,13 +235,15 @@ ColorEditorPopup::ColorEditorPopup(Window *window, std::function<uint32_t ()> ge
|
|||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
bool ColorEditorPopup::onTouchStart(coord_t x, coord_t y)
|
bool ColorEditorPopup::onTouchStart(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
content->onTouchStart(x - content->rect.x + content->scrollPositionX, y - content->rect.y + content->scrollPositionY);
|
TRACE("ColorEditorPopup::onTouchStart");
|
||||||
|
// content->onTouchStart(x - content->rect.x + content->scrollPositionX, y - content->rect.y + content->scrollPositionY);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColorEditorPopup::onTouchEnd(coord_t x, coord_t y)
|
bool ColorEditorPopup::onTouchEnd(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
content->onTouchEnd(x - content->rect.x + content->scrollPositionX, y - content->rect.y + content->scrollPositionY);
|
TRACE("ColorEditorPopup::onTouchEnd");
|
||||||
|
// content->onTouchEnd(x - content->rect.x + content->scrollPositionX, y - content->rect.y + content->scrollPositionY);
|
||||||
if (!Window::onTouchEnd(x, y) && closeWhenClickOutside) {
|
if (!Window::onTouchEnd(x, y) && closeWhenClickOutside) {
|
||||||
onKeyPress();
|
onKeyPress();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ void CurveDataEdit::update()
|
|||||||
0, RIGHT);
|
0, RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
setInnerWidth(curvePointsCount * boxWidth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurveDataEdit::paint(BitmapBuffer * dc)
|
void CurveDataEdit::paint(BitmapBuffer * dc)
|
||||||
@@ -120,7 +119,6 @@ void CurveDataEdit::paint(BitmapBuffer * dc)
|
|||||||
dc->clear(COLOR_THEME_SECONDARY3);
|
dc->clear(COLOR_THEME_SECONDARY3);
|
||||||
// dc->drawSolidHorizontalLine(0, rect.h / 3, getInnerWidth(), 0);
|
// dc->drawSolidHorizontalLine(0, rect.h / 3, getInnerWidth(), 0);
|
||||||
// dc->drawSolidHorizontalLine(0, 2 * rect.h / 3, getInnerWidth(), 0);
|
// dc->drawSolidHorizontalLine(0, 2 * rect.h / 3, getInnerWidth(), 0);
|
||||||
drawHorizontalScrollbar(dc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CurveEdit::CurveEdit(Window * parent, const rect_t & rect, uint8_t index) :
|
CurveEdit::CurveEdit(Window * parent, const rect_t & rect, uint8_t index) :
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ class FailSafeBody : public FormGroup
|
|||||||
});
|
});
|
||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
setInnerHeight(grid.getWindowHeight() + PAGE_PADDING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ coord_t FilePreview::getBitmapHeight() const
|
|||||||
void FilePreview::paint(BitmapBuffer *dc)
|
void FilePreview::paint(BitmapBuffer *dc)
|
||||||
{
|
{
|
||||||
dc->setFormat(BMP_RGB565);
|
dc->setFormat(BMP_RGB565);
|
||||||
coord_t y = _drawCentered ? parent->getScrollPositionY() + 2 : 2;
|
coord_t y = /*_drawCentered ? parent->getScrollPositionY() + 2 :*/ 2;
|
||||||
coord_t h = _drawCentered ? MENU_BODY_HEIGHT - 4 : rect.h;
|
coord_t h = _drawCentered ? MENU_BODY_HEIGHT - 4 : rect.h;
|
||||||
if (bitmap != nullptr) {
|
if (bitmap != nullptr) {
|
||||||
coord_t bitmapHeight = min<coord_t>(h, bitmap->height());
|
coord_t bitmapHeight = min<coord_t>(h, bitmap->height());
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ ListBase::ListBase(Window *parent, const rect_t &rect, std::vector<std::string>
|
|||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
duration10ms = 0;
|
duration10ms = 0;
|
||||||
#endif
|
#endif
|
||||||
setInnerHeight(names.size() * lineHeight);
|
|
||||||
if (_getValue != nullptr)
|
if (_getValue != nullptr)
|
||||||
setSelected(_getValue());
|
setSelected(_getValue());
|
||||||
else
|
else
|
||||||
@@ -58,7 +57,7 @@ void ListBase::setSelected(int selected)
|
|||||||
if(selectionType == LISTBOX_SINGLE_SELECT) {
|
if(selectionType == LISTBOX_SINGLE_SELECT) {
|
||||||
if (selected != this->selected) {
|
if (selected != this->selected) {
|
||||||
this->selected = selected;
|
this->selected = selected;
|
||||||
setScrollPositionY(lineHeight * this->selected - lineHeight);
|
lv_obj_scroll_to_y(lvobj, lineHeight * this->selected - lineHeight, LV_ANIM_OFF);
|
||||||
if (_setValue != nullptr) {
|
if (_setValue != nullptr) {
|
||||||
_setValue(this->selected);
|
_setValue(this->selected);
|
||||||
}
|
}
|
||||||
@@ -143,8 +142,7 @@ void ListBase::paint(BitmapBuffer *dc)
|
|||||||
curY += lineHeight;
|
curY += lineHeight;
|
||||||
}
|
}
|
||||||
if (!(windowFlags & (FORM_NO_BORDER | FORM_FORWARD_FOCUS))) {
|
if (!(windowFlags & (FORM_NO_BORDER | FORM_FORWARD_FOCUS))) {
|
||||||
dc->drawSolidRect(0, getScrollPositionY(), rect.w, rect.h, 2,
|
dc->drawSolidRect(0, 0, rect.w, rect.h, 2, COLOR_THEME_FOCUS);
|
||||||
COLOR_THEME_FOCUS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,10 +193,10 @@ void ListBase::paint(BitmapBuffer *dc)
|
|||||||
bool ListBase::isLongPress()
|
bool ListBase::isLongPress()
|
||||||
{
|
{
|
||||||
unsigned int curTimer = getTicks();
|
unsigned int curTimer = getTicks();
|
||||||
return (slidingWindow == nullptr && duration10ms != 0 && curTimer - duration10ms > LONG_PRESS_10MS);
|
return // slidingWindow == nullptr &&
|
||||||
|
duration10ms != 0 && curTimer - duration10ms > LONG_PRESS_10MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ListBase::checkEvents(void)
|
void ListBase::checkEvents(void)
|
||||||
{
|
{
|
||||||
Window::checkEvents();
|
Window::checkEvents();
|
||||||
@@ -234,7 +232,6 @@ bool ListBase::onTouchStart(coord_t x, coord_t y)
|
|||||||
duration10ms = getTicks();
|
duration10ms = getTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
captureWindow(this);
|
|
||||||
yDown = y;
|
yDown = y;
|
||||||
|
|
||||||
return true; // stop the processing and say that i handled it
|
return true; // stop the processing and say that i handled it
|
||||||
@@ -243,7 +240,8 @@ bool ListBase::onTouchStart(coord_t x, coord_t y)
|
|||||||
bool ListBase::onTouchEnd(coord_t x, coord_t y)
|
bool ListBase::onTouchEnd(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
if (!isEnabled()) return false;
|
if (!isEnabled()) return false;
|
||||||
if (slidingWindow || waslongpress)
|
if (// slidingWindow ||
|
||||||
|
waslongpress)
|
||||||
return false; // if we slide then this is not a selection
|
return false; // if we slide then this is not a selection
|
||||||
|
|
||||||
auto selected = yDown / lineHeight;
|
auto selected = yDown / lineHeight;
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ class ListBase : public FormField
|
|||||||
inline void setNames(std::vector<std::string> names)
|
inline void setNames(std::vector<std::string> names)
|
||||||
{
|
{
|
||||||
this->names.assign(names.begin(), names.end());
|
this->names.assign(names.begin(), names.end());
|
||||||
setInnerHeight(names.size() * lineHeight);
|
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -408,5 +408,4 @@ void ModelCurvesPage::build(FormWindow * window, int8_t focusIndex)
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,5 +229,4 @@ void ModelFlightModesPage::build(FormWindow * window)
|
|||||||
return trimsCheckTimer;
|
return trimsCheckTimer;
|
||||||
});
|
});
|
||||||
|
|
||||||
window->setInnerHeight(y + 40);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,7 +342,6 @@ void GVarEditWindow::buildBody(FormWindow * window)
|
|||||||
|
|
||||||
setProperties();
|
setProperties();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelGVarsPage::rebuild(FormWindow * window)
|
void ModelGVarsPage::rebuild(FormWindow * window)
|
||||||
@@ -380,5 +379,4 @@ void ModelGVarsPage::build(FormWindow * window)
|
|||||||
|
|
||||||
grid.nextLine(button->height());
|
grid.nextLine(button->height());
|
||||||
}
|
}
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,12 +88,4 @@ void ModelHeliPage::build(FormWindow* form)
|
|||||||
GET_SET_DEFAULT(g_model.swashR.collectiveWeight));
|
GET_SET_DEFAULT(g_model.swashR.collectiveWeight));
|
||||||
|
|
||||||
|
|
||||||
auto obj = form->getLvObj();
|
|
||||||
lv_obj_update_layout(obj);
|
|
||||||
lv_coord_t h =
|
|
||||||
lv_obj_get_height(obj)
|
|
||||||
+ lv_obj_get_scroll_top(obj)
|
|
||||||
+ lv_obj_get_scroll_bottom(obj);
|
|
||||||
|
|
||||||
form->setInnerHeight(h);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,6 @@ class InputEditWindow : public Page
|
|||||||
#if LCD_W > LCD_H
|
#if LCD_W > LCD_H
|
||||||
auto BODY_WIDTH = LCD_W - preview.width() - PAGE_PADDING;
|
auto BODY_WIDTH = LCD_W - preview.width() - PAGE_PADDING;
|
||||||
body.setWidth(BODY_WIDTH);
|
body.setWidth(BODY_WIDTH);
|
||||||
body.setInnerWidth(BODY_WIDTH);
|
|
||||||
body.setLeft(preview.width() + PAGE_PADDING);
|
body.setLeft(preview.width() + PAGE_PADDING);
|
||||||
#else
|
#else
|
||||||
body.setRect({0, INPUT_EDIT_CURVE_TOP + INPUT_EDIT_CURVE_HEIGHT, LCD_W,
|
body.setRect({0, INPUT_EDIT_CURVE_TOP + INPUT_EDIT_CURVE_HEIGHT, LCD_W,
|
||||||
@@ -377,7 +376,6 @@ class InputEditWindow : public Page
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -644,7 +642,6 @@ void ModelInputsPage::build(FormWindow *window, int8_t focusIndex)
|
|||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO port: avoid global s_currCh on ARM boards (as done here)...
|
// TODO port: avoid global s_currCh on ARM boards (as done here)...
|
||||||
|
|||||||
@@ -447,5 +447,4 @@ void ModelLogicalSwitchesPage::build(FormWindow* window, int8_t focusIndex)
|
|||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ class ScriptEditWindow : public Page {
|
|||||||
grid.addWindow(gOutputs);
|
grid.addWindow(gOutputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
if (focusScript) { fc->setFocus(); }
|
if (focusScript) { fc->setFocus(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +297,6 @@ void ModelMixerScriptsPage::build(FormWindow * window, int8_t focusIdx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelMixerScriptsPage::editLine(FormWindow * window, uint8_t idx)
|
void ModelMixerScriptsPage::editLine(FormWindow * window, uint8_t idx)
|
||||||
|
|||||||
@@ -247,7 +247,6 @@ class MixEditWindow : public Page
|
|||||||
edit->setSuffix("s");
|
edit->setSuffix("s");
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO share this code with INPUT
|
// TODO share this code with INPUT
|
||||||
@@ -575,7 +574,6 @@ void ModelMixesPage::build(FormWindow * window, int8_t focusMixIndex)
|
|||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteMix(uint8_t idx)
|
void deleteMix(uint8_t idx)
|
||||||
|
|||||||
@@ -191,7 +191,6 @@ class OutputEditWindow : public Page
|
|||||||
GET_SET_DEFAULT(output->symetrical));
|
GET_SET_DEFAULT(output->symetrical));
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -384,7 +383,6 @@ void ModelOutputsPage::build(FormWindow *window, int8_t focusChannel)
|
|||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelOutputsPage::editOutput(FormWindow *window, uint8_t channel)
|
void ModelOutputsPage::editOutput(FormWindow *window, uint8_t channel)
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ class SelectTemplate : public TemplatePage
|
|||||||
tb->setHeight(PAGE_LINE_HEIGHT * 2);
|
tb->setHeight(PAGE_LINE_HEIGHT * 2);
|
||||||
grid.spacer(tb->height() + 5);
|
grid.spacer(tb->height() + 5);
|
||||||
}
|
}
|
||||||
body.setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
f_closedir(&dir);
|
f_closedir(&dir);
|
||||||
@@ -295,7 +294,6 @@ class SelectTemplateFolder : public TemplatePage
|
|||||||
tfb->setHeight(PAGE_LINE_HEIGHT * 2);
|
tfb->setHeight(PAGE_LINE_HEIGHT * 2);
|
||||||
grid.spacer(tfb->height() + 5);
|
grid.spacer(tfb->height() + 5);
|
||||||
}
|
}
|
||||||
body.setInnerHeight(grid.getWindowHeight());
|
|
||||||
#if not defined(LUA)
|
#if not defined(LUA)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -601,7 +599,6 @@ class ModelCategoryPageBody : public FormWindow
|
|||||||
if (index % MODEL_CELLS_PER_LINE != 0) {
|
if (index % MODEL_CELLS_PER_LINE != 0) {
|
||||||
y += MODEL_SELECT_CELL_HEIGHT + MODEL_CELL_PADDING;
|
y += MODEL_SELECT_CELL_HEIGHT + MODEL_CELL_PADDING;
|
||||||
}
|
}
|
||||||
setInnerHeight(y);
|
|
||||||
|
|
||||||
if (category->empty()) {
|
if (category->empty()) {
|
||||||
setFocus();
|
setFocus();
|
||||||
@@ -783,7 +780,6 @@ class CategoryEditPage : public PageTab
|
|||||||
|
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
|
|
||||||
if(scrolltobot) {
|
if(scrolltobot) {
|
||||||
lv_obj_scroll_to_y(window->getLvObj(), y + 40, LV_ANIM_OFF);
|
lv_obj_scroll_to_y(window->getLvObj(), y + 40, LV_ANIM_OFF);
|
||||||
|
|||||||
@@ -375,7 +375,5 @@ void ModelSetupPage::build(FormWindow * window)
|
|||||||
grid.addWindow(new TrainerModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
|
grid.addWindow(new TrainerModuleWindow(window, {0, grid.getWindowHeight(), LCD_W, 0}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -416,7 +416,6 @@ class SensorEditWindow : public Page {
|
|||||||
updateSensorParametersWindow();
|
updateSensorParametersWindow();
|
||||||
grid.addWindow(sensorParametersWindow);
|
grid.addWindow(sensorParametersWindow);
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -647,5 +646,4 @@ void ModelTelemetryPage::build(FormWindow * window, int8_t focusSensorIndex)
|
|||||||
GET_SET_DEFAULT(g_model.varioData.centerSilent));
|
GET_SET_DEFAULT(g_model.varioData.centerSilent));
|
||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -517,5 +517,4 @@ void RadioHardwarePage::build(FormWindow * window)
|
|||||||
new StaticText(window, grid.getLabelSlot());
|
new StaticText(window, grid.getLabelSlot());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -474,7 +474,6 @@ void RadioSdManagerPage::build(FormWindow * window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
preview->setHeight(max(window->height(), grid.getWindowHeight()));
|
preview->setHeight(max(window->height(), grid.getWindowHeight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -530,7 +530,6 @@ void RadioSetupPage::build(FormWindow * window)
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioSetupPage::updateBacklightControls()
|
void RadioSetupPage::updateBacklightControls()
|
||||||
|
|||||||
@@ -388,5 +388,4 @@ void RadioToolsPage::rebuild(FormWindow * window)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,24 +24,21 @@
|
|||||||
SelectFabCarousel::SelectFabCarousel(Window* parent) :
|
SelectFabCarousel::SelectFabCarousel(Window* parent) :
|
||||||
FormGroup(parent, {}, FORM_FORWARD_FOCUS | NO_SCROLLBAR)
|
FormGroup(parent, {}, FORM_FORWARD_FOCUS | NO_SCROLLBAR)
|
||||||
{
|
{
|
||||||
setPageWidth(FAB_BUTTON_SIZE + SELECT_BUTTON_BORDER);
|
|
||||||
setHeight(FAB_BUTTON_SIZE + 2 * PAGE_LINE_HEIGHT + SELECT_BUTTON_BORDER / 2);
|
setHeight(FAB_BUTTON_SIZE + 2 * PAGE_LINE_HEIGHT + SELECT_BUTTON_BORDER / 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectFabCarousel::setMaxButtons(uint8_t max)
|
void SelectFabCarousel::setMaxButtons(uint8_t max)
|
||||||
{
|
{
|
||||||
maxButtons = max;
|
maxButtons = max;
|
||||||
setWidth(maxButtons * pageWidth);
|
setWidth(maxButtons * (FAB_BUTTON_SIZE + SELECT_BUTTON_BORDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectFabCarousel::addButton(uint8_t icon, const char* title,
|
void SelectFabCarousel::addButton(uint8_t icon, const char* title,
|
||||||
std::function<uint8_t(void)> pressHandler)
|
std::function<uint8_t(void)> pressHandler)
|
||||||
{
|
{
|
||||||
coord_t y_pos = 0;
|
coord_t y_pos = 0;
|
||||||
coord_t x_pos = pageWidth * buttons;
|
coord_t x_pos = (FAB_BUTTON_SIZE + SELECT_BUTTON_BORDER) * buttons;
|
||||||
buttons++;
|
buttons++;
|
||||||
|
|
||||||
new SelectFabButton(this, x_pos, y_pos, icon, title, pressHandler);
|
new SelectFabButton(this, x_pos, y_pos, icon, title, pressHandler);
|
||||||
setInnerWidth(pageWidth * buttons);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -751,5 +751,4 @@ void SpecialFunctionsPage::build(FormWindow *window, int8_t focusIndex)
|
|||||||
grid.nextLine();
|
grid.nextLine();
|
||||||
|
|
||||||
// window->setLastField();
|
// window->setLastField();
|
||||||
window->setInnerHeight(grid.getWindowHeight());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ TabsCarousel::TabsCarousel(Window* parent, TabsGroup* menu) :
|
|||||||
|
|
||||||
void TabsCarousel::updateInnerWidth()
|
void TabsCarousel::updateInnerWidth()
|
||||||
{
|
{
|
||||||
setInnerWidth(padding_left + MENU_HEADER_BUTTON_WIDTH * menu->tabs.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabsCarousel::paint(BitmapBuffer * dc)
|
void TabsCarousel::paint(BitmapBuffer * dc)
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ AboutUs::AboutUs() :
|
|||||||
MessageDialog(MainWindow::instance(), STR_ABOUT_US, "")
|
MessageDialog(MainWindow::instance(), STR_ABOUT_US, "")
|
||||||
{
|
{
|
||||||
content->setRect({(LCD_W - ABOUT_WIDTH) / 2, 20, ABOUT_WIDTH, LCD_H - 40});
|
content->setRect({(LCD_W - ABOUT_WIDTH) / 2, 20, ABOUT_WIDTH, LCD_H - 40});
|
||||||
content->setInnerWidth(ABOUT_WIDTH);
|
|
||||||
|
|
||||||
messageWidget->setTextFlags(CENTERED | FONT(BOLD) | COLOR_THEME_SECONDARY1);
|
messageWidget->setTextFlags(CENTERED | FONT(BOLD) | COLOR_THEME_SECONDARY1);
|
||||||
messageWidget->setTop(content->top() + 40);
|
messageWidget->setTop(content->top() + 40);
|
||||||
|
|||||||
@@ -40,12 +40,17 @@ static void tile_view_deleted_cb(lv_event_t* e)
|
|||||||
if (obj == target) { lv_obj_del(obj); }
|
if (obj == target) { lv_obj_del(obj); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void tile_view_scroll(lv_event_t* e)
|
||||||
|
{
|
||||||
|
(void)e;
|
||||||
|
if (ViewMain::instance()) ViewMain::instance()->updateTopbarVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
ViewMain * ViewMain::_instance = nullptr;
|
ViewMain * ViewMain::_instance = nullptr;
|
||||||
|
|
||||||
ViewMain::ViewMain():
|
ViewMain::ViewMain():
|
||||||
Window(MainWindow::instance(), MainWindow::instance()->getRect(), NO_SCROLLBAR)
|
Window(MainWindow::instance(), MainWindow::instance()->getRect(), NO_SCROLLBAR)
|
||||||
{
|
{
|
||||||
//setPageWidth(getParent()->width());
|
|
||||||
focusWindow = this;
|
focusWindow = this;
|
||||||
|
|
||||||
setFocusHandler([&](bool focus) {
|
setFocusHandler([&](bool focus) {
|
||||||
@@ -62,6 +67,7 @@ ViewMain::ViewMain():
|
|||||||
|
|
||||||
lv_obj_add_flag(tile_view, LV_OBJ_FLAG_EVENT_BUBBLE);
|
lv_obj_add_flag(tile_view, LV_OBJ_FLAG_EVENT_BUBBLE);
|
||||||
lv_obj_set_user_data(tile_view, this);
|
lv_obj_set_user_data(tile_view, this);
|
||||||
|
lv_obj_add_event_cb(tile_view, tile_view_scroll, LV_EVENT_SCROLL, nullptr);
|
||||||
|
|
||||||
// create last to be on top
|
// create last to be on top
|
||||||
topbar = dynamic_cast<TopbarImpl*>(TopbarFactory::create(this));
|
topbar = dynamic_cast<TopbarImpl*>(TopbarFactory::create(this));
|
||||||
@@ -105,7 +111,7 @@ rect_t ViewMain::getMainZone(rect_t zone, bool hasTopbar) const
|
|||||||
|
|
||||||
unsigned ViewMain::getCurrentMainView() const
|
unsigned ViewMain::getCurrentMainView() const
|
||||||
{
|
{
|
||||||
return lv_obj_get_scroll_x(tile_view) / LCD_W;
|
return lv_obj_get_scroll_x(tile_view) / width();
|
||||||
// return g_model.view;
|
// return g_model.view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,17 +157,23 @@ static bool hasTopbar(unsigned view)
|
|||||||
|
|
||||||
void ViewMain::updateTopbarVisibility()
|
void ViewMain::updateTopbarVisibility()
|
||||||
{
|
{
|
||||||
// relative to left visible page
|
if (!tile_view) return;
|
||||||
return;
|
|
||||||
|
|
||||||
int leftScroll = getScrollPositionX() % pageWidth;
|
coord_t scrollPos = lv_obj_get_scroll_x(tile_view);
|
||||||
|
coord_t pageWidth = width();
|
||||||
|
if (!pageWidth) return;
|
||||||
|
|
||||||
|
int view = scrollPos / pageWidth;
|
||||||
|
// TODO: cap view ???
|
||||||
|
|
||||||
|
int leftScroll = scrollPos % width();
|
||||||
if (leftScroll == 0) {
|
if (leftScroll == 0) {
|
||||||
setTopbarVisible(hasTopbar(g_model.view));
|
setTopbarVisible(hasTopbar(view));
|
||||||
if (customScreens[g_model.view])
|
if (customScreens[view])
|
||||||
customScreens[g_model.view]->adjustLayout();
|
customScreens[view]->adjustLayout();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int leftIdx = getScrollPositionX() / pageWidth;
|
int leftIdx = scrollPos / pageWidth;
|
||||||
bool leftTopbar = hasTopbar(leftIdx);
|
bool leftTopbar = hasTopbar(leftIdx);
|
||||||
bool rightTopbar = hasTopbar(leftIdx+1);
|
bool rightTopbar = hasTopbar(leftIdx+1);
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ ViewMainMenu::ViewMainMenu(Window* parent) :
|
|||||||
// Take over the screen
|
// Take over the screen
|
||||||
setWidth(parent->width());
|
setWidth(parent->width());
|
||||||
setHeight(parent->height());
|
setHeight(parent->height());
|
||||||
setLeft(parent->getScrollPositionX());
|
|
||||||
|
|
||||||
auto carousel = new SelectFabCarousel(this);
|
auto carousel = new SelectFabCarousel(this);
|
||||||
carousel->setMaxButtons(4);
|
carousel->setMaxButtons(4);
|
||||||
@@ -100,7 +99,6 @@ ViewMainMenu::ViewMainMenu(Window* parent) :
|
|||||||
resetMenu->addLine(STR_RESET_TIMER2, []() { timerReset(1); });
|
resetMenu->addLine(STR_RESET_TIMER2, []() { timerReset(1); });
|
||||||
resetMenu->addLine(STR_RESET_TIMER3, []() { timerReset(2); });
|
resetMenu->addLine(STR_RESET_TIMER3, []() { timerReset(2); });
|
||||||
resetMenu->addLine(STR_RESET_TELEMETRY, []() { telemetryReset(); });
|
resetMenu->addLine(STR_RESET_TELEMETRY, []() { telemetryReset(); });
|
||||||
resetMenu->setLeft(parent->getScrollPositionX());
|
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,6 @@ void Widget::setFullscreen(bool fullscreen)
|
|||||||
// Set window opaque (inhibits redraw from windows bellow)
|
// Set window opaque (inhibits redraw from windows bellow)
|
||||||
setWindowFlags(getWindowFlags() | OPAQUE);
|
setWindowFlags(getWindowFlags() | OPAQUE);
|
||||||
setRect(parent->getRect());
|
setRect(parent->getRect());
|
||||||
setLeft(parent->getScrollPositionX());
|
|
||||||
this->fullscreen = true;
|
this->fullscreen = true;
|
||||||
bringToTop();
|
bringToTop();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,6 @@ class WidgetsContainerImpl : public WidgetsContainer
|
|||||||
if (widgets[i]) {
|
if (widgets[i]) {
|
||||||
auto zone = getZone(i);
|
auto zone = getZone(i);
|
||||||
widgets[i]->setRect(zone);
|
widgets[i]->setRect(zone);
|
||||||
widgets[i]->setInnerHeight(zone.h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -635,8 +635,8 @@ bool LuaWidget::onTouchSlide(coord_t x, coord_t y, coord_t startX, coord_t start
|
|||||||
if (es) {
|
if (es) {
|
||||||
ViewMain* vm = ViewMain::instance();
|
ViewMain* vm = ViewMain::instance();
|
||||||
es->event = EVT_TOUCH_SLIDE;
|
es->event = EVT_TOUCH_SLIDE;
|
||||||
es->touchX = x + vm->getScrollPositionX();
|
// es->touchX = x + vm->getScrollPositionX();
|
||||||
es->touchY = y + vm->getScrollPositionY();
|
// es->touchY = y + vm->getScrollPositionY();
|
||||||
es->startX = startX;
|
es->startX = startX;
|
||||||
es->startY = startY;
|
es->startY = startY;
|
||||||
es->slideX += slideX;
|
es->slideX += slideX;
|
||||||
|
|||||||
@@ -1403,7 +1403,7 @@ void opentxClose(uint8_t shutdown)
|
|||||||
RTOS_WAIT_MS(100);
|
RTOS_WAIT_MS(100);
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
MainWindow::instance()->deleteChildren();
|
MainWindow::instance()->clear();
|
||||||
// this is necessary as the custom screens are not deleted
|
// this is necessary as the custom screens are not deleted
|
||||||
// by using deleteCustomScreens(), but here through it's parent window
|
// by using deleteCustomScreens(), but here through it's parent window
|
||||||
memset(customScreens, 0, sizeof(customScreens));
|
memset(customScreens, 0, sizeof(customScreens));
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 9432ca3019...a877a5ff4b
Reference in New Issue
Block a user