Skip to content

Commit c46801d

Browse files
committed
cleanup settings
1 parent 27e5e0e commit c46801d

File tree

8 files changed

+29
-48
lines changed

8 files changed

+29
-48
lines changed

apps/notation_kb/src/index_panel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ impl IndexPanel {
126126
settings.hide_mini_map = true;
127127
settings.hide_bar_number = true;
128128
settings.layout.focus_bar_ease_ms = 0;
129-
settings.show_melody_pitch = true;
130-
settings.show_melody_syllable = true;
129+
settings.show_note_pitch = true;
130+
settings.show_note_syllable = true;
131131
if state.window_width > 0.0 && state.window_height > 0.0 {
132132
if state.window_width > state.window_height {
133133
let width = state.window_width / 3.0 + theme.sizes.layout.page_margin;

apps/notation_viewer/src/viewer.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,10 @@ impl NotationViewer {
102102
MidiControl::seek_forward(&midi_settings, &mut midi_state, &mut play_control_evts);
103103
} else if keyboard_input.just_released(KeyCode::Minus) {
104104
Control::toggle_layout_mode(&mut app_state, &mut settings, &mut theme);
105-
} else if keyboard_input.just_released(KeyCode::G) {
106-
Control::toggle_show_guitar_syllable(&mut app_state, &mut settings, &mut theme);
107-
} else if keyboard_input.just_released(KeyCode::M) {
108-
Control::toggle_show_melody_syllable(&mut app_state, &mut settings, &mut theme);
105+
} else if keyboard_input.just_released(KeyCode::S) {
106+
Control::toggle_show_note_syllable(&mut app_state, &mut settings, &mut theme);
109107
} else if keyboard_input.just_released(KeyCode::P) {
110-
Control::toggle_show_melody_pitch(&mut app_state, &mut settings, &mut theme);
108+
Control::toggle_show_note_pitch(&mut app_state, &mut settings, &mut theme);
111109
} else if keyboard_input.just_released(KeyCode::F) {
112110
Control::toggle_always_show_fret(&mut app_state, &mut settings, &mut theme);
113111
} else if keyboard_input.just_released(KeyCode::L) {

crates/notation_bevy/src/guitar/fret_finger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl FretFingerData {
176176
commands.entity(text_entity).despawn();
177177
}
178178
}
179-
if settings.show_guitar_syllable && self.value.extra.fret.is_some() {
179+
if settings.show_note_text() && self.value.extra.fret.is_some() {
180180
let syllable = self.value.calc_syllable();
181181
theme.guitar.syllable_text.spawn_scaled_note_text(
182182
commands,

crates/notation_bevy/src/notation/control.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,20 @@ impl Control {
6060
settings.hide_mini_map = !settings.hide_mini_map;
6161
Self::reload_tab(state, theme);
6262
}
63-
pub fn toggle_show_guitar_syllable(
63+
pub fn toggle_show_note_syllable(
6464
state: &mut NotationState,
6565
settings: &mut NotationSettings,
6666
theme: &mut NotationTheme,
6767
) {
68-
settings.show_guitar_syllable = !settings.show_guitar_syllable;
68+
settings.show_note_syllable = !settings.show_note_syllable;
6969
Self::reload_tab(state, theme);
7070
}
71-
pub fn toggle_show_melody_syllable(
71+
pub fn toggle_show_note_pitch(
7272
state: &mut NotationState,
7373
settings: &mut NotationSettings,
7474
theme: &mut NotationTheme,
7575
) {
76-
settings.show_melody_syllable = !settings.show_melody_syllable;
77-
Self::reload_tab(state, theme);
78-
}
79-
pub fn toggle_show_melody_pitch(
80-
state: &mut NotationState,
81-
settings: &mut NotationSettings,
82-
theme: &mut NotationTheme,
83-
) {
84-
settings.show_melody_pitch = !settings.show_melody_pitch;
76+
settings.show_note_pitch = !settings.show_note_pitch;
8577
Self::reload_tab(state, theme);
8678
}
8779
pub fn toggle_always_show_fret(
@@ -136,8 +128,8 @@ impl Control {
136128
show_melody_pitch: bool,
137129
) {
138130
settings.hide_melody_lane = false;
139-
settings.show_melody_pitch = show_melody_pitch;
140-
settings.show_melody_syllable = true;
131+
settings.show_note_pitch = show_melody_pitch;
132+
settings.show_note_syllable = true;
141133
settings.show_syllable_as_num = true;
142134
theme.sizes.layout.page_margin = 24.0;
143135
theme.sizes.melody.note_height = 9.0;

crates/notation_bevy/src/notation/control_panel.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,22 +192,17 @@ impl ControlPanel {
192192
Control::reload_tab(state, theme);
193193
}
194194
ui.separator();
195-
let show_guitar_syllable = settings.show_guitar_syllable;
196-
ui.checkbox(&mut settings.show_guitar_syllable, "Show Guitar Syllable");
197-
if show_guitar_syllable != settings.show_guitar_syllable {
198-
Control::reload_tab(state, theme);
199-
}
200-
let show_melody_pitch = settings.show_melody_pitch;
195+
let show_note_pitch = settings.show_note_pitch;
201196
ui.checkbox(
202-
&mut settings.show_melody_pitch,
203-
"Show Melody Pitch",
197+
&mut settings.show_note_pitch,
198+
"Show Note Pitch",
204199
);
205-
if show_melody_pitch != settings.show_melody_pitch {
200+
if show_note_pitch != settings.show_note_pitch {
206201
Control::reload_tab(state, theme);
207202
}
208-
let show_melody_syllable = settings.show_melody_syllable;
209-
ui.checkbox(&mut settings.show_melody_syllable, "Show Melody Syllable");
210-
if show_melody_syllable != settings.show_melody_syllable {
203+
let show_note_syllable = settings.show_note_syllable;
204+
ui.checkbox(&mut settings.show_note_syllable, "Show Note Syllable");
205+
if show_note_syllable != settings.show_note_syllable {
211206
Control::reload_tab(state, theme);
212207
}
213208
let show_syllable_as_num = settings.show_syllable_as_num;

crates/notation_bevy/src/settings/notation_settings.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ pub struct NotationSettings {
1616
pub speed_factor: f32,
1717
pub hide_bar_number: bool,
1818
pub hide_indicators: bool,
19-
pub show_guitar_syllable: bool,
20-
pub show_melody_pitch: bool,
21-
pub show_melody_syllable: bool,
19+
pub show_note_pitch: bool,
20+
pub show_note_syllable: bool,
2221
pub show_syllable_as_num: bool,
2322
pub always_show_fret: bool,
24-
pub melody_piano_mode: bool,
2523
pub allow_panning: bool,
2624
pub panning_line_size: f32,
2725
pub hide_guitar_view: bool,
@@ -49,12 +47,10 @@ impl FromWorld for NotationSettings {
4947
speed_factor: 1.0,
5048
hide_bar_number: false,
5149
hide_indicators: false,
52-
show_guitar_syllable: true,
53-
show_melody_pitch: false,
54-
show_melody_syllable: true,
50+
show_note_pitch: false,
51+
show_note_syllable: true,
5552
show_syllable_as_num: true,
5653
always_show_fret: false,
57-
melody_piano_mode: false,
5854
allow_panning: true,
5955
panning_line_size: 32.0,
6056
hide_shapes_lane: false,
@@ -87,8 +83,8 @@ impl NotationSettings {
8783
pub fn lang(&self) -> LanguageIdentifier {
8884
Self::parse_lang(self.lang.as_str())
8985
}
90-
pub fn show_melody_note(&self) -> bool {
91-
self.show_melody_pitch || self.show_melody_syllable
86+
pub fn show_note_text(&self) -> bool {
87+
self.show_note_pitch || self.show_note_syllable
9288
}
9389
pub fn hide_all_lanes(&mut self) {
9490
self.hide_shapes_lane = true;

crates/notation_bevy/src/theme/theme_texts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ impl NoteTexts {
282282
key: &Key,
283283
syllable: &Syllable,
284284
) -> String {
285-
let pitch_text = if settings.show_melody_pitch {
285+
let pitch_text = if settings.show_note_pitch {
286286
Some(scale.calc_pitch(key, syllable).to_text())
287287
} else {
288288
None
289289
};
290-
let syllable_text = if settings.show_melody_syllable {
290+
let syllable_text = if settings.show_note_syllable {
291291
Some(if settings.show_syllable_as_num {
292292
syllable.to_text()
293293
} else {
@@ -298,7 +298,7 @@ impl NoteTexts {
298298
};
299299
format!("{}{}{}",
300300
pitch_text.unwrap_or("".to_owned()),
301-
if settings.show_melody_pitch && settings.show_melody_syllable { " " } else { "" },
301+
if settings.show_note_pitch && settings.show_note_syllable { " " } else { "" },
302302
syllable_text.unwrap_or("".to_owned())
303303
)
304304
}

crates/notation_bevy/src/tone/tone_systems.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn create_tone_notes(
3030
for note in tone.get_notes() {
3131
let data = ToneNoteData::new(entry, ToneNoteValue::new(&bar, note, mode));
3232
let note_entity = data.create(commands, theme, entity);
33-
if settings.show_melody_note() && !entry.prev_is_tie() {
33+
if settings.show_note_text() && !entry.prev_is_tie() {
3434
if let Some(text) = match tone_mode {
3535
ToneMode::Melody => Some(theme.texts.melody),
3636
ToneMode::Harmony => Some(theme.texts.harmony),

0 commit comments

Comments
 (0)