@@ -9,9 +9,13 @@ use super::events::WindowResizedEvent;
99pub struct Control ( ) ;
1010
1111impl Control {
12+ pub const PRESET_GUITAR_TAB : & ' static str = "guitar_tab" ;
13+ pub const PRESET_GUITAR_NOTES : & ' static str = "guitar_notes" ;
1214 pub const PRESET_GUITAR_STRINGS : & ' static str = "guitar_strings" ;
1315 pub const PRESET_MELODY : & ' static str = "melody" ;
14- pub const ALL_PRESETS : [ & ' static str ; 2 ] = [
16+ pub const ALL_PRESETS : [ & ' static str ; 4 ] = [
17+ Self :: PRESET_GUITAR_TAB ,
18+ Self :: PRESET_GUITAR_NOTES ,
1519 Self :: PRESET_GUITAR_STRINGS ,
1620 Self :: PRESET_MELODY ,
1721 ] ;
@@ -102,6 +106,45 @@ impl Control {
102106 Self :: set_window_size ( window, width, height) ;
103107 }
104108 }
109+ fn set_preset_strings (
110+ settings : & mut NotationSettings ,
111+ theme : & mut NotationTheme ,
112+ always_show_fret : bool ,
113+ ) {
114+ settings. hide_strings_lane = false ;
115+ settings. always_show_fret = always_show_fret;
116+ theme. sizes . layout . page_margin = 24.0 ;
117+ theme. sizes . strings . string_space = 20.0 ;
118+ theme. sizes . strings . note_height = 9.0 ;
119+ theme. texts . strings . text_y = -4.0 ;
120+ theme. texts . strings . fret_font_size = 20.0 ;
121+ }
122+ fn set_preset_harmony (
123+ settings : & mut NotationSettings ,
124+ theme : & mut NotationTheme ,
125+ ) {
126+ settings. hide_harmony_lane = false ;
127+ theme. sizes . layout . page_margin = 24.0 ;
128+ theme. sizes . harmony . note_height = 6.0 ;
129+ theme. sizes . harmony . semitone_height = 6.0 ;
130+ theme. texts . harmony . text_y = 9.0 ;
131+ theme. texts . harmony . syllable_font_size = 20.0 ;
132+ }
133+ fn set_preset_melody (
134+ settings : & mut NotationSettings ,
135+ theme : & mut NotationTheme ,
136+ show_melody_pitch : bool ,
137+ ) {
138+ settings. hide_melody_lane = false ;
139+ settings. show_melody_pitch = show_melody_pitch;
140+ settings. show_melody_syllable = true ;
141+ settings. show_syllable_as_num = true ;
142+ theme. sizes . layout . page_margin = 24.0 ;
143+ theme. sizes . melody . note_height = 9.0 ;
144+ theme. sizes . melody . semitone_height = 9.0 ;
145+ theme. texts . melody . text_y = -18.0 ;
146+ theme. texts . melody . syllable_font_size = 20.0 ;
147+ }
105148 pub fn set_preset (
106149 state : & mut NotationState ,
107150 settings : & mut NotationSettings ,
@@ -115,27 +158,23 @@ impl Control {
115158 #[ cfg( not( target_arch = "wasm32" ) ) ]
116159 Self :: set_primary_window_size ( windows, 1080 , 1920 ) ;
117160 match preset {
161+ Self :: PRESET_GUITAR_TAB => {
162+ settings. hack_for_screenshot ( ) ;
163+ Self :: set_preset_strings ( settings, theme, true ) ;
164+ Self :: set_preset_harmony ( settings, theme) ;
165+ settings. hide_shapes_lane = false ;
166+ } ,
167+ Self :: PRESET_GUITAR_NOTES => {
168+ settings. hack_for_screenshot ( ) ;
169+ Self :: set_preset_harmony ( settings, theme) ;
170+ } ,
118171 Self :: PRESET_GUITAR_STRINGS => {
119172 settings. hack_for_screenshot ( ) ;
120- settings. hide_strings_lane = false ;
121- settings. always_show_fret = true ;
122- theme. sizes . layout . page_margin = 24.0 ;
123- theme. sizes . strings . string_space = 20.0 ;
124- theme. sizes . strings . note_height = 9.0 ;
125- theme. texts . strings . fret_font_size = 20.0 ;
126- theme. texts . strings . text_y = 8.0 ;
173+ Self :: set_preset_strings ( settings, theme, true ) ;
127174 } ,
128175 Self :: PRESET_MELODY => {
129176 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 ;
134- theme. sizes . layout . page_margin = 24.0 ;
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 ;
177+ Self :: set_preset_melody ( settings, theme, true ) ;
139178 } ,
140179 _ => {
141180 println ! ( "Control::set_preset() Invalid Preset: {}" , preset) ;
0 commit comments