Skip to content

Commit

Permalink
Info button opens Patch Description panel
Browse files Browse the repository at this point in the history
  • Loading branch information
danngreen committed Oct 3, 2023
1 parent 4a45ff8 commit 063c432
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 27 deletions.
33 changes: 29 additions & 4 deletions firmware/src/gui/pages/patch_view.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ struct PatchViewPage : PageBase {
: PageBase{info}
, base(ui_PatchViewPage)
, modules_cont(ui_ModulesPanel)
, cable_drawer{modules_cont, drawn_elements} {
, cable_drawer{modules_cont, drawn_elements}
, info_group(lv_group_create()) {
PageList::register_page(this, PageId::PatchView);

init_bg(base);
lv_group_set_editing(group, false);

lv_obj_add_event_cb(ui_PlayButton, playbut_cb, LV_EVENT_PRESSED, this);
lv_obj_add_event_cb(ui_InfoButton, infobut_cb, LV_EVENT_PRESSED, this);

// Scroll to top when focussing on a button
lv_obj_add_event_cb(ui_PlayButton, button_focussed_cb, LV_EVENT_FOCUSED, this);
Expand All @@ -51,10 +53,16 @@ struct PatchViewPage : PageBase {

lv_obj_add_style(ui_ModuleName, &Gui::header_style, LV_PART_MAIN);
lv_label_set_text(ui_ModuleName, "");
lv_obj_add_flag(ui_ModuleName, LV_OBJ_FLAG_HIDDEN);
lv_hide(ui_ModuleName);

lv_hide(ui_DescriptionPanel);
lv_group_add_obj(info_group, ui_DescriptionPanel);
}

void prepare_focus() override {
lv_hide(ui_DescriptionPanel);
lv_label_set_text(ui_Description, patch.description.c_str());

if (active_knob_set == PageList::get_active_knobset() && patch_revision == PageList::get_patch_revision() &&
displayed_patch_loc == PageList::get_selected_patch_location())
{
Expand Down Expand Up @@ -145,6 +153,8 @@ struct PatchViewPage : PageBase {
knobset_menu.hide();
lv_obj_clear_state(ui_SettingsButton, LV_STATE_PRESSED);
lv_obj_clear_state(ui_SettingsButton, LV_STATE_FOCUSED);
lv_obj_clear_state(ui_InfoButton, LV_STATE_PRESSED);
lv_obj_clear_state(ui_InfoButton, LV_STATE_FOCUSED);
}

void clear() {
Expand Down Expand Up @@ -185,6 +195,11 @@ struct PatchViewPage : PageBase {
settings_menu.hide();
} else if (knobset_menu.visible) {
knobset_menu.hide();
} else if (showing_info) {
showing_info = false;
lv_hide(ui_DescriptionPanel);
lv_indev_set_group(lv_indev_get_next(nullptr), group);
lv_obj_clear_state(ui_InfoButton, LV_STATE_PRESSED);
} else if (PageList::request_last_page()) {
blur();
}
Expand Down Expand Up @@ -273,7 +288,7 @@ struct PatchViewPage : PageBase {
const auto this_slug = page->patch.module_slugs[module_id];
auto module_x = lv_obj_get_x(this_module_obj);

lv_obj_clear_flag(ui_ModuleName, LV_OBJ_FLAG_HIDDEN);
lv_show(ui_ModuleName);
lv_label_set_text(ui_ModuleName, this_slug.c_str());
lv_obj_set_x(ui_ModuleName, module_x);

Expand All @@ -290,10 +305,17 @@ struct PatchViewPage : PageBase {
page->start_changing_patch();
}

static void infobut_cb(lv_event_t *event) {
auto page = static_cast<PatchViewPage *>(event->user_data);
lv_show(ui_DescriptionPanel);
page->showing_info = true;
lv_indev_set_group(lv_indev_get_act(), page->info_group);
}

static void button_focussed_cb(lv_event_t *event) {
auto page = static_cast<PatchViewPage *>(event->user_data);
lv_label_set_text(ui_ModuleName, "");
lv_obj_add_flag(ui_ModuleName, LV_OBJ_FLAG_HIDDEN);
lv_hide(ui_ModuleName);
lv_obj_scroll_to_y(page->base, 0, LV_ANIM_ON);
page->highlighted_module_id = std::nullopt;
page->settings_menu.hide();
Expand All @@ -306,6 +328,9 @@ private:
lv_obj_t *modules_cont;
CableDrawer cable_drawer;

lv_group_t *info_group;
bool showing_info = false;

PatchViewSettingsMenu::ViewSettings view_settings;
PatchViewSettingsMenu settings_menu{view_settings};

Expand Down
2 changes: 1 addition & 1 deletion firmware/src/gui/slsexport/meta5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SET(SOURCES components/ui_comp_knobcontainer.c
components/ui_comp_knobcontainerbig.c
components/ui_comp_knobsetgroup.c
components/ui_comp_unmappedsetitem.c
components/ui_comp_mappedknobsetitem.c
components/ui_comp_unmappedsetitem.c
components/ui_comp.c
screens/ui_PatchSelectorPage.c
screens/ui_PatchViewPage.c
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/gui/slsexport/meta5/components/ui_comp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ extern uint32_t LV_EVENT_GET_COMP_CHILD;
#include "ui_comp_knobcontainer.h"
#include "ui_comp_knobcontainerbig.h"
#include "ui_comp_knobsetgroup.h"
#include "ui_comp_unmappedsetitem.h"
#include "ui_comp_mappedknobsetitem.h"
#include "ui_comp_unmappedsetitem.h"

#ifdef __cplusplus
} /*extern "C"*/
Expand Down
4 changes: 2 additions & 2 deletions firmware/src/gui/slsexport/meta5/components/ui_comp_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ void ui_comp_KnobSetGroup_create_hook( lv_obj_t * comp)
{
}

void ui_comp_UnmappedSetItem_create_hook( lv_obj_t * comp)
void ui_comp_MappedKnobSetItem_create_hook( lv_obj_t * comp)
{
}

void ui_comp_MappedKnobSetItem_create_hook( lv_obj_t * comp)
void ui_comp_UnmappedSetItem_create_hook( lv_obj_t * comp)
{
}
2 changes: 1 addition & 1 deletion firmware/src/gui/slsexport/meta5/components/ui_comp_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ extern "C" {
void ui_comp_KnobContainer_create_hook( lv_obj_t *comp );
void ui_comp_KnobContainerBig_create_hook( lv_obj_t *comp );
void ui_comp_KnobSetGroup_create_hook( lv_obj_t *comp );
void ui_comp_UnmappedSetItem_create_hook( lv_obj_t *comp );
void ui_comp_MappedKnobSetItem_create_hook( lv_obj_t *comp );
void ui_comp_UnmappedSetItem_create_hook( lv_obj_t *comp );

#ifdef __cplusplus
} /*extern "C"*/
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/gui/slsexport/meta5/filelist.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
components/ui_comp_knobcontainer.c
components/ui_comp_knobcontainerbig.c
components/ui_comp_knobsetgroup.c
components/ui_comp_unmappedsetitem.c
components/ui_comp_mappedknobsetitem.c
components/ui_comp_unmappedsetitem.c
components/ui_comp.c
screens/ui_PatchSelectorPage.c
screens/ui_PatchViewPage.c
Expand Down
13 changes: 1 addition & 12 deletions firmware/src/gui/slsexport/meta5/screens/ui_MappingMenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ lv_obj_set_y( ui_MappedListPane, 1 );
lv_obj_set_align( ui_MappedListPane, LV_ALIGN_CENTER );
lv_obj_set_flex_flow(ui_MappedListPane,LV_FLEX_FLOW_ROW_WRAP);
lv_obj_set_flex_align(ui_MappedListPane, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START);
lv_obj_clear_flag( ui_MappedListPane, LV_OBJ_FLAG_SCROLLABLE ); /// Flags
lv_obj_clear_flag( ui_MappedListPane, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN ); /// Flags
lv_obj_set_style_radius(ui_MappedListPane, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_MappedListPane, lv_color_hex(0x555555), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_bg_opa(ui_MappedListPane, 255, LV_PART_MAIN| LV_STATE_DEFAULT);
Expand Down Expand Up @@ -373,17 +373,6 @@ lv_obj_set_style_pad_bottom(ui_MapList, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_row(ui_MapList, 1, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_column(ui_MapList, 0, LV_PART_MAIN| LV_STATE_DEFAULT);

ui_MappedKnobSetItem1 = ui_MappedKnobSetItem_create(ui_MapList);
lv_obj_set_x( ui_MappedKnobSetItem1, 0 );
lv_obj_set_y( ui_MappedKnobSetItem1, 0 );



ui_UnmappedSetItem1 = ui_UnmappedSetItem_create(ui_MapList);
lv_obj_set_x( ui_UnmappedSetItem1, 0 );
lv_obj_set_y( ui_UnmappedSetItem1, 0 );


ui_ControlAlert = lv_obj_create(ui_MappingParameters);
lv_obj_set_height( ui_ControlAlert, 142);
lv_obj_set_width( ui_ControlAlert, lv_pct(100));
Expand Down
41 changes: 40 additions & 1 deletion firmware/src/gui/slsexport/meta5/screens/ui_PatchViewPage.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void ui_PatchViewPage_screen_init(void)
{
ui_PatchViewPage = lv_obj_create(NULL);
lv_obj_clear_flag( ui_PatchViewPage, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM ); /// Flags
lv_obj_set_scrollbar_mode(ui_PatchViewPage, LV_SCROLLBAR_MODE_ON);
lv_obj_set_scrollbar_mode(ui_PatchViewPage, LV_SCROLLBAR_MODE_ACTIVE);
lv_obj_set_scroll_dir(ui_PatchViewPage, LV_DIR_VER);
lv_obj_set_flex_flow(ui_PatchViewPage,LV_FLEX_FLOW_ROW_WRAP);
lv_obj_set_flex_align(ui_PatchViewPage, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
Expand Down Expand Up @@ -1150,4 +1150,43 @@ lv_obj_set_style_radius(ui_ModuleName, 4, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_ModuleName, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_bg_opa(ui_ModuleName, 128, LV_PART_MAIN| LV_STATE_DEFAULT);

ui_DescriptionPanel = lv_obj_create(ui_PatchViewPage);
lv_obj_set_width( ui_DescriptionPanel, lv_pct(100));
lv_obj_set_height( ui_DescriptionPanel, LV_SIZE_CONTENT); /// 1
lv_obj_set_align( ui_DescriptionPanel, LV_ALIGN_CENTER );
lv_obj_add_flag( ui_DescriptionPanel, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING ); /// Flags
lv_obj_clear_flag( ui_DescriptionPanel, LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM ); /// Flags
lv_obj_set_scroll_dir(ui_DescriptionPanel, LV_DIR_VER);
lv_obj_set_style_pad_left(ui_DescriptionPanel, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui_DescriptionPanel, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui_DescriptionPanel, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui_DescriptionPanel, 0, LV_PART_MAIN| LV_STATE_DEFAULT);

lv_obj_set_style_radius(ui_DescriptionPanel, 4, LV_PART_SCROLLBAR| LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_DescriptionPanel, lv_color_hex(0xFF8918), LV_PART_SCROLLBAR | LV_STATE_DEFAULT );
lv_obj_set_style_bg_opa(ui_DescriptionPanel, 255, LV_PART_SCROLLBAR| LV_STATE_DEFAULT);

ui_Description = lv_label_create(ui_DescriptionPanel);
lv_obj_set_width( ui_Description, lv_pct(100));
lv_obj_set_height( ui_Description, LV_SIZE_CONTENT); /// 1
lv_obj_set_align( ui_Description, LV_ALIGN_BOTTOM_MID );
lv_label_set_text(ui_Description,"");
lv_obj_add_flag( ui_Description, LV_OBJ_FLAG_CLICKABLE ); /// Flags
lv_obj_clear_flag( ui_Description, LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM ); /// Flags
lv_obj_set_scrollbar_mode(ui_Description, LV_SCROLLBAR_MODE_ON);
lv_obj_set_scroll_dir(ui_Description, LV_DIR_VER);
lv_obj_set_style_text_letter_space(ui_Description, 0, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_text_line_space(ui_Description, 2, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui_Description, &ui_font_MuseoSansRounded70016, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui_Description, 6, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui_Description, lv_color_hex(0x222222), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_bg_opa(ui_Description, 255, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui_Description, lv_color_hex(0x888888), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_border_opa(ui_Description, 255, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_border_width(ui_Description, 2, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui_Description, 10, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui_Description, 10, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui_Description, 10, LV_PART_MAIN| LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui_Description, 10, LV_PART_MAIN| LV_STATE_DEFAULT);

}
4 changes: 2 additions & 2 deletions firmware/src/gui/slsexport/meta5/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ lv_obj_t *ui_KnobsetHeaderLabel;
lv_obj_t *ui_KnobsetCloseButton;
lv_obj_t *ui_KnobsetHeaderLine;
lv_obj_t *ui_ModuleName;
lv_obj_t *ui_DescriptionPanel;
lv_obj_t *ui_Description;


// SCREEN: ui_MappingMenu
Expand All @@ -95,8 +97,6 @@ lv_obj_t *ui_MappedItemHeader;
lv_obj_t *ui_MappedItemHeaderMapText;
lv_obj_t *ui_MappedItemHeaderKnobSetText;
lv_obj_t *ui_MapList;
lv_obj_t *ui_MappedKnobSetItem1;
lv_obj_t *ui_UnmappedSetItem1;
lv_obj_t *ui_ControlAlert;
lv_obj_t *ui_ControlArc;
lv_obj_t *ui_ControlAlertLabel;
Expand Down
4 changes: 2 additions & 2 deletions firmware/src/gui/slsexport/meta5/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ extern lv_obj_t *ui_KnobsetHeaderLabel;
extern lv_obj_t *ui_KnobsetCloseButton;
extern lv_obj_t *ui_KnobsetHeaderLine;
extern lv_obj_t *ui_ModuleName;
extern lv_obj_t *ui_DescriptionPanel;
extern lv_obj_t *ui_Description;
// SCREEN: ui_MappingMenu
void ui_MappingMenu_screen_init(void);
extern lv_obj_t *ui_MappingMenu;
Expand All @@ -98,8 +100,6 @@ extern lv_obj_t *ui_MappedItemHeader;
extern lv_obj_t *ui_MappedItemHeaderMapText;
extern lv_obj_t *ui_MappedItemHeaderKnobSetText;
extern lv_obj_t *ui_MapList;
extern lv_obj_t *ui_MappedKnobSetItem1;
extern lv_obj_t *ui_UnmappedSetItem1;
extern lv_obj_t *ui_ControlAlert;
extern lv_obj_t *ui_ControlArc;
extern lv_obj_t *ui_ControlAlertLabel;
Expand Down

0 comments on commit 063c432

Please sign in to comment.