From: b Date: Sat, 4 Jan 2025 11:17:33 +0000 (+0100) Subject: graphical indication of transposition X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=535ff87b182d9ad808122912e52c5557f0ea8774;p=klavirko%2Fui graphical indication of transposition --- diff --git a/font16.png b/font16.png index 035d0b3..7663495 100644 Binary files a/font16.png and b/font16.png differ diff --git a/font16.xcf b/font16.xcf index 4111270..06a103a 100644 Binary files a/font16.xcf and b/font16.xcf differ diff --git a/font8.png b/font8.png index 7cd4f40..db4acbf 100644 Binary files a/font8.png and b/font8.png differ diff --git a/font8.xcf b/font8.xcf index 980a6bb..6d7e5b4 100644 Binary files a/font8.xcf and b/font8.xcf differ diff --git a/gui.c b/gui.c index 5b9f228..cf974a5 100644 --- a/gui.c +++ b/gui.c @@ -71,6 +71,9 @@ const uint8_t gui_list_123[N_123+1] = LIST_123; uint8_t text_select[GUI_TITLE_SELECT_N] = GUI_TITLE_SELECT; uint8_t text_save[GUI_TITLE_SAVE_N] = GUI_TITLE_SAVE; +const uint8_t TEXT_KEYBOARD[12][GUI_KEYBOARD_N] = GUI_KEYBOARD; +const uint8_t *text_keyboard; + /* event handling */ inline void add_gui_event(const uint16_t event) @@ -944,8 +947,10 @@ inline void gui_event_options (const uint16_t event) if (gui_choice != 1) lcd_select_button(gui_choice, 0); gui_choice = 1; + make_text_keyboard(); lcd_select_button(1, 1); lcd_update_title(GUI_TITLE_OPTION_TRANSPOSE); + lcd_update_button(-1, text_keyboard, 0); } else if (event & BUTTON_C) { @@ -989,6 +994,8 @@ inline void gui_event_options (const uint16_t event) { set_transp(0); make_text_transpose(); + make_text_keyboard(); + lcd_update_button(-1, text_keyboard, 0); lcd_update_button(1, text_transpose, gui_choice == 1); reject_gui_events(); } @@ -1064,6 +1071,8 @@ inline void gui_event_options (const uint16_t event) set_transp(transp - 1); } make_text_transpose(); + make_text_keyboard(); + lcd_update_button(-1, text_keyboard, 0); lcd_update_button(1, text_transpose, 1); break; case 2: @@ -1499,6 +1508,19 @@ inline void make_text_transpose (void) text_transpose[x]='\0'; } +inline void make_text_keyboard (void) +{ + int8_t i; + + i = transp; + while (i < 0) + i += 12; + while (i >= 12) + i -= 12; + + text_keyboard = TEXT_KEYBOARD[i]; +} + inline void make_text_midi_in (void) { uint8_t x = GUI_BUTTONTEXT_MIDI_IN_INSERT; diff --git a/gui.h b/gui.h index 89c376b..2155127 100644 --- a/gui.h +++ b/gui.h @@ -165,6 +165,38 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #define GUI_TITLE_SAVE_INSERT 16 +#define GUI_KEYBOARD_BASE "\x80\x81\x83\x84\x90\x92\x94\x90\x91\x93\x94" + +#define GUI_KEYBOARD_0 " \x80\x82\x84" GUI_KEYBOARD_BASE "CDEFGAH" +#define GUI_KEYBOARD_1 "\x88\x8A\x8C\x98\x9A\x9D\x9F\x80\x82\x84" GUI_KEYBOARD_BASE " F C" +#define GUI_KEYBOARD_2 " \x95\x96 \x85\x86\x80\x82\x84" GUI_KEYBOARD_BASE "DE GAH " +#define GUI_KEYBOARD_3 "\x8B\x8C \x9B\x9D\x9F \x80\x82\x84" GUI_KEYBOARD_BASE " FG CD" +#define GUI_KEYBOARD_4 "\x95\x97\x99 \x85\x87\x89\x80\x82\x84" GUI_KEYBOARD_BASE "E AH " +#define GUI_KEYBOARD_5 " \x9E\x9F \x80\x82\x84" GUI_KEYBOARD_BASE "FGA CDE" +#define GUI_KEYBOARD_6 "\x98\x9A\x9C\x85\x87\x8A\x8C\x80\x82\x84" GUI_KEYBOARD_BASE " H " +#define GUI_KEYBOARD_7 " \x95\x96\x80\x82\x84" GUI_KEYBOARD_BASE "GAHCDE " +#define GUI_KEYBOARD_8 "\x9B\x9D\x9F\x88\x8A\x8C \x80\x82\x84" GUI_KEYBOARD_BASE " C FG" +#define GUI_KEYBOARD_9 " \x85\x86 \x95\x97\x99\x80\x82\x84" GUI_KEYBOARD_BASE "AH DE " +#define GUI_KEYBOARD_10 "\x9E\x9F \x8B\x8C \x80\x82\x84" GUI_KEYBOARD_BASE " CD FGA" +#define GUI_KEYBOARD_11 "\x85\x87\x89\x95\x97\x9A\x9C\x80\x82\x84" GUI_KEYBOARD_BASE "H E " + +#define GUI_KEYBOARD { \ + GUI_KEYBOARD_0, \ + GUI_KEYBOARD_1, \ + GUI_KEYBOARD_2, \ + GUI_KEYBOARD_3, \ + GUI_KEYBOARD_4, \ + GUI_KEYBOARD_5, \ + GUI_KEYBOARD_6, \ + GUI_KEYBOARD_7, \ + GUI_KEYBOARD_8, \ + GUI_KEYBOARD_9, \ + GUI_KEYBOARD_10, \ + GUI_KEYBOARD_11 \ +} + +#define GUI_KEYBOARD_N 29 + #define GET_JOG() ((JOG_A ? JOG_L : 0) ^ (JOG_B ? JOG_H : 0)) @@ -237,6 +269,7 @@ inline uint8_t convert_wave(int8_t x); inline void make_text_tuning (void); inline void make_text_transpose (void); +inline void make_text_keyboard (void); inline void make_text_midi_in (void); inline void make_text_midi_out (void); inline void make_text_select (void);