Added auto-topbar (dis-)appearance
This commit is contained in:
@@ -111,6 +111,9 @@ class Layout: public LayoutBase
|
|||||||
// Re-calculate positions
|
// Re-calculate positions
|
||||||
void adjustDecoration();
|
void adjustDecoration();
|
||||||
|
|
||||||
|
// Updates settings for trims, sliders, pots, etc...
|
||||||
|
void decorate();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const LayoutFactory * factory = nullptr;
|
const LayoutFactory * factory = nullptr;
|
||||||
ViewMainDecoration* decoration = nullptr;
|
ViewMainDecoration* decoration = nullptr;
|
||||||
@@ -121,9 +124,6 @@ class Layout: public LayoutBase
|
|||||||
// Last time we refreshed the window
|
// Last time we refreshed the window
|
||||||
uint32_t lastRefresh = 0;
|
uint32_t lastRefresh = 0;
|
||||||
|
|
||||||
// Updates settings for trims, sliders, pots, etc...
|
|
||||||
void decorate();
|
|
||||||
|
|
||||||
void createDecoration();
|
void createDecoration();
|
||||||
|
|
||||||
// Get the available space for widgets
|
// Get the available space for widgets
|
||||||
|
|||||||
@@ -112,8 +112,7 @@ unsigned ViewMain::getCurrentMainView() const
|
|||||||
void ViewMain::setCurrentMainView(unsigned view)
|
void ViewMain::setCurrentMainView(unsigned view)
|
||||||
{
|
{
|
||||||
if (view < getMainViewsCount()) {
|
if (view < getMainViewsCount()) {
|
||||||
g_model.view = view;
|
setScrollPositionX(view * pageWidth);
|
||||||
setScrollPositionX(g_model.view * pageWidth);
|
|
||||||
TRACE("### switched to view #%i", g_model.view);
|
TRACE("### switched to view #%i", g_model.view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,10 +141,22 @@ void ViewMain::setScrollPositionX(coord_t value)
|
|||||||
{
|
{
|
||||||
Window::setScrollPositionX(value);
|
Window::setScrollPositionX(value);
|
||||||
topbar->setLeft(getScrollPositionX());
|
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)
|
void ViewMain::setScrollPositionY(coord_t value)
|
||||||
{
|
{
|
||||||
|
// this one is not used yet, but could
|
||||||
|
// usefull to place the screens upwards
|
||||||
Window::setScrollPositionY(value);
|
Window::setScrollPositionY(value);
|
||||||
topbar->setTop(getScrollPositionY());
|
topbar->setTop(getScrollPositionY());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user