@@ -10,6 +10,11 @@ pub struct Control();
1010
1111impl Control {
1212 pub const PRESET_GUITAR_STRINGS : & ' static str = "guitar_strings" ;
13+ pub const PRESET_MELODY : & ' static str = "melody" ;
14+ pub const ALL_PRESETS : [ & ' static str ; 2 ] = [
15+ Self :: PRESET_GUITAR_STRINGS ,
16+ Self :: PRESET_MELODY ,
17+ ] ;
1318
1419 pub fn reload_tab ( state : & mut NotationState , theme : & mut NotationTheme ) {
1520 state. reload_tab ( ) ;
@@ -67,12 +72,12 @@ impl Control {
6772 settings. show_melody_syllable = !settings. show_melody_syllable ;
6873 Self :: reload_tab ( state, theme) ;
6974 }
70- pub fn toggle_show_syllable_as_pitch (
75+ pub fn toggle_show_melody_pitch (
7176 state : & mut NotationState ,
7277 settings : & mut NotationSettings ,
7378 theme : & mut NotationTheme ,
7479 ) {
75- settings. show_syllable_as_pitch = !settings. show_syllable_as_pitch ;
80+ settings. show_melody_pitch = !settings. show_melody_pitch ;
7681 Self :: reload_tab ( state, theme) ;
7782 }
7883 pub fn toggle_always_show_fret (
@@ -105,26 +110,37 @@ impl Control {
105110 _window_resized_evts : & mut EventWriter < WindowResizedEvent > ,
106111 preset : & ' static str ,
107112 ) {
113+ state. show_kb = false ;
114+ state. preset = Some ( preset. to_owned ( ) ) ;
115+ #[ cfg( not( target_arch = "wasm32" ) ) ]
116+ Self :: set_primary_window_size ( windows, 1080 , 1920 ) ;
108117 match preset {
109118 Self :: PRESET_GUITAR_STRINGS => {
110- state. preset = Some ( preset. to_owned ( ) ) ;
111- settings. add_ready_section = false ;
112- settings. hide_indicators = true ;
113- settings. hide_guitar_view = true ;
114- settings. hide_chords_view = true ;
115- settings. hide_shapes_lane = true ;
119+ settings. hack_for_screenshot ( ) ;
120+ settings. hide_strings_lane = false ;
116121 settings. always_show_fret = true ;
117- settings . override_beat_size = Some ( 128.0 ) ;
122+ theme . sizes . layout . page_margin = 24.0 ;
118123 theme. sizes . strings . string_space = 20.0 ;
119124 theme. sizes . strings . note_height = 9.0 ;
120125 theme. texts . strings . fret_font_size = 20.0 ;
121126 theme. texts . strings . text_y = 8.0 ;
127+ } ,
128+ Self :: PRESET_MELODY => {
129+ settings. hack_for_screenshot ( ) ;
130+ settings. hide_melody_lane = false ;
131+ settings. show_melody_pitch = true ;
132+ settings. show_melody_syllable = true ;
133+ settings. show_syllable_as_num = true ;
122134 theme. sizes . layout . page_margin = 24.0 ;
123- #[ cfg( not( target_arch = "wasm32" ) ) ]
124- Self :: set_primary_window_size ( windows, 1080 , 1920 ) ;
125- Self :: reload_tab ( state, theme) ;
135+ theme. sizes . melody . note_height = 9.0 ;
136+ theme. sizes . melody . semitone_height = 9.0 ;
137+ theme. texts . melody . text_y = -18.0 ;
138+ theme. texts . melody . syllable_font_size = 20.0 ;
139+ } ,
140+ _ => {
141+ println ! ( "Control::set_preset() Invalid Preset: {}" , preset) ;
126142 } ,
127- _ => { } ,
128143 }
144+ Self :: reload_tab ( state, theme) ;
129145 }
130146}
0 commit comments