Added auto-topbar (dis-)appearance

This commit is contained in:
Raphael Coeffic
2021-04-18 07:58:27 +02:00
parent dd14fff628
commit 50d6e113f2
2 changed files with 16 additions and 5 deletions
+3 -3
View File
@@ -111,6 +111,9 @@ class Layout: public LayoutBase
// Re-calculate positions
void adjustDecoration();
// Updates settings for trims, sliders, pots, etc...
void decorate();
protected:
const LayoutFactory * factory = nullptr;
ViewMainDecoration* decoration = nullptr;
@@ -121,9 +124,6 @@ class Layout: public LayoutBase
// Last time we refreshed the window
uint32_t lastRefresh = 0;
// Updates settings for trims, sliders, pots, etc...
void decorate();
void createDecoration();
// Get the available space for widgets
+13 -2
View File
@@ -112,8 +112,7 @@ unsigned ViewMain::getCurrentMainView() const
void ViewMain::setCurrentMainView(unsigned view)
{
if (view < getMainViewsCount()) {
g_model.view = view;
setScrollPositionX(g_model.view * pageWidth);
setScrollPositionX(view * pageWidth);
TRACE("### switched to view #%i", g_model.view);
}
}
@@ -142,10 +141,22 @@ void ViewMain::setScrollPositionX(coord_t value)
{
Window::setScrollPositionX(value);
topbar->setLeft(getScrollPositionX());
auto pageIdx = getPageIndex();
if (pageIdx != g_model.view) {
g_model.view = pageIdx;
// crude on/off for now
setTopbarVisible(customScreens[pageIdx]->hasTopbar());
customScreens[pageIdx]->decorate();
//TODO: compute topbar visibility
//auto relativeScrollPosition = getScrollPositionX() % pageWidth;
}
}
void ViewMain::setScrollPositionY(coord_t value)
{
// this one is not used yet, but could
// usefull to place the screens upwards
Window::setScrollPositionY(value);
topbar->setTop(getScrollPositionY());
}