Skip to content

Commit 6b6e30f

Browse files
committed
Add an option to use the flat symbol on key names
1 parent 5564b3c commit 6b6e30f

4 files changed

Lines changed: 24 additions & 18 deletions

File tree

scripts/control_create/control_create.gml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ function control_create() {
222222
changepitch = 1
223223

224224
keynames = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"];
225+
keynames_flat = 0
225226

226227
// History
227228
historypos = 0
@@ -517,6 +518,7 @@ function control_create() {
517518
window_set_min_width(800 * window_scale)
518519
window_set_min_height(500 * window_scale)
519520
if ((theme = 3 && fdark) || theme = 2) window_set_darkmode()
521+
if (keynames_flat) keynames = ["A", "Bb", "B", "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab"]
520522

521523
// Updates
522524
if (check_update)

scripts/draw_window_preferences/draw_window_preferences.gml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -455,20 +455,21 @@ function draw_window_preferences() {
455455
draw_areaheader(x1 + 22, y1 + 294 + (theme = 3) * 22, 456, 171, "Piano")
456456
if (theme = 3) draw_theme_font(font_main)
457457
if (draw_checkbox(x1 + 40, y1 + 310 + (theme = 3) * 22, show_piano, "Show piano", "Whether the piano should be visible.", false, true)) show_piano = !show_piano
458-
if (draw_checkbox(x1 + 40, y1 + 355 + (theme = 3) * 22, show_keynames, "Show key names", "If the names of the keys should be shown.")) show_keynames=!show_keynames
459-
if (draw_checkbox(x1 + 40, y1 + 375 + (theme = 3) * 22, show_keynumbers, "Show key numbers", "Whether to show the amount of right-clicks required\non each key inside the 2 octave range.")) show_keynumbers=!show_keynumbers
460-
if (draw_checkbox(x1 + 40, y1 + 395 + (theme = 3) * 22, show_keyboard, "Show keyboard shortcuts", "Show the keyboard shortcuts of the keys.")) show_keyboard=!show_keyboard
461-
if (draw_checkbox(x1 + 40, y1 + 415 + (theme = 3) * 22, show_notechart, "Show note chart when hovering over keys", "Whether to show a note chart\nwhen hovering over the keys.")) show_notechart=!show_notechart
462-
if (draw_checkbox(x1 + 40, y1 + 435 + (theme = 3) * 22, show_outofrange, "Highlight out-of-range keys", "Whether to show a red tint on keys\noutside of the 2 octave range.")) show_outofrange=!show_outofrange
458+
if (draw_checkbox(x1 + 40, y1 + 350 + (theme = 3) * 22, show_keynames, "Show key names", "If the names of the keys should be shown.")) show_keynames=!show_keynames
459+
if (draw_checkbox(x1 + 40, y1 + 370 + (theme = 3) * 22, show_keynumbers, "Show key numbers", "Whether to show the amount of right-clicks required\non each key inside the 2 octave range.")) show_keynumbers=!show_keynumbers
460+
if (draw_checkbox(x1 + 40, y1 + 390 + (theme = 3) * 22, show_keyboard, "Show keyboard shortcuts", "Show the keyboard shortcuts of the keys.")) show_keyboard=!show_keyboard
461+
if (draw_checkbox(x1 + 40, y1 + 410 + (theme = 3) * 22, show_notechart, "Show note chart when hovering over keys", "Whether to show a note chart\nwhen hovering over the keys.")) show_notechart=!show_notechart
462+
if (draw_checkbox(x1 + 40, y1 + 430 + (theme = 3) * 22, show_outofrange, "Highlight out-of-range keys", "Whether to show a red tint on keys\noutside of the 2 octave range.")) show_outofrange=!show_outofrange
463+
if (draw_checkbox(x1 + 40, y1 + 450 + (theme = 3) * 22, keynames_flat, "Use flat symbol", "Whether to use the flat symbol (b) instead of\nthe sharp symbol (#) on keynames.")) {keynames_flat=!keynames_flat; if (keynames_flat) {keynames = ["A", "Bb", "B", "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab"]} else {keynames = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]}}
463464
if (!show_piano) draw_set_color(c_gray)
464-
draw_text_dynamic(x1 + 70, y1 + 330 + (theme = 3) * 22, "Keys to show:")
465+
draw_text_dynamic(x1 + 70, y1 + 328 + (theme = 3) * 22, "Keys to show:")
465466
if (show_piano) {
466-
keysmax = median(20, draw_dragvalue(4, x1 + 150, y1 + 330 + (theme = 3) * 22, keysmax, 2), 50)
467+
keysmax = median(20, draw_dragvalue(4, x1 + 150, y1 + 328 + (theme = 3) * 22, keysmax, 2), 50)
467468
} else {
468-
draw_text_dynamic(x1 + 150, y1 + 330 + (theme = 3) * 22, keysmax)
469+
draw_text_dynamic(x1 + 150, y1 + 328 + (theme = 3) * 22, keysmax)
469470
}
470471
draw_theme_color()
471-
popup_set_window(x1 + 180, y1 + 275 + (theme = 3) * 22, 150, 21, "The amount of keys to show. A high number may\nslow down the program on old computers.")
472+
popup_set_window(x1 + 70, y1 + 328 + (theme = 3) * 22, 150, 21, "The amount of keys to show. A high number may\nslow down the program on old computers.")
472473
} else {
473474
if (theme = 3) draw_theme_font(font_info_med)
474475
draw_areaheader(x1 + 22, y1 + 74 + (theme = 3) * 22, 456, 196, "音符盒")
@@ -486,20 +487,21 @@ function draw_window_preferences() {
486487
draw_areaheader(x1 + 22, y1 + 294 + (theme = 3) * 22, 456, 171, "琴键")
487488
if (theme = 3) draw_theme_font(font_main)
488489
if (draw_checkbox(x1 + 40, y1 + 310 + (theme = 3) * 22, show_piano, "显示琴键", "钢琴键是否可见。", false, true)) show_piano = !show_piano
489-
if (draw_checkbox(x1 + 40, y1 + 355 + (theme = 3) * 22, show_keynames, "显示键名", "显示琴键所对应音的名称。")) show_keynames=!show_keynames
490-
if (draw_checkbox(x1 + 40, y1 + 375 + (theme = 3) * 22, show_keynumbers, "显示音符序号", "在 2 八度内的琴键上显示需要按右键次数。")) show_keynumbers=!show_keynumbers
491-
if (draw_checkbox(x1 + 40, y1 + 395 + (theme = 3) * 22, show_keyboard, "显示键盘键位", "在琴键上显示绑定的键盘键位。")) show_keyboard=!show_keyboard
492-
if (draw_checkbox(x1 + 40, y1 + 415 + (theme = 3) * 22, show_notechart, "在琴键上时显示五线谱对应音符", "在鼠标停留在琴键上时是否显示五线谱。")) show_notechart=!show_notechart
493-
if (draw_checkbox(x1 + 40, y1 + 435 + (theme = 3) * 22, show_outofrange, "标记超范围琴键", "是否为在 2 八度之外的琴键上标红。")) show_outofrange=!show_outofrange
490+
if (draw_checkbox(x1 + 40, y1 + 350 + (theme = 3) * 22, show_keynames, "显示键名", "显示琴键所对应音的名称。")) show_keynames=!show_keynames
491+
if (draw_checkbox(x1 + 40, y1 + 370 + (theme = 3) * 22, show_keynumbers, "显示音符序号", "在 2 八度内的琴键上显示需要按右键次数。")) show_keynumbers=!show_keynumbers
492+
if (draw_checkbox(x1 + 40, y1 + 390 + (theme = 3) * 22, show_keyboard, "显示键盘键位", "在琴键上显示绑定的键盘键位。")) show_keyboard=!show_keyboard
493+
if (draw_checkbox(x1 + 40, y1 + 410 + (theme = 3) * 22, show_notechart, "在琴键上时显示五线谱对应音符", "在鼠标停留在琴键上时是否显示五线谱。")) show_notechart=!show_notechart
494+
if (draw_checkbox(x1 + 40, y1 + 430 + (theme = 3) * 22, show_outofrange, "标记超范围琴键", "是否为在 2 八度之外的琴键上标红。")) show_outofrange=!show_outofrange
495+
if (draw_checkbox(x1 + 40, y1 + 450 + (theme = 3) * 22, keynames_flat, "使用降记号", "是否为键名使用降记号(b)而不是升记号(#)。")) {keynames_flat=!keynames_flat; if (keynames_flat) {keynames = ["A", "Bb", "B", "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab"]} else {keynames = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]}}
494496
if (!show_piano) draw_set_color(c_gray)
495-
draw_text_dynamic(x1 + 70, y1 + 330 + (theme = 3) * 22, "最多显示键数:")
497+
draw_text_dynamic(x1 + 70, y1 + 328 + (theme = 3) * 22, "最多显示键数:")
496498
if (show_piano) {
497-
keysmax = median(20, draw_dragvalue(4, x1 + 150, y1 + 330 + (theme = 3) * 22, keysmax, 2), 50)
499+
keysmax = median(20, draw_dragvalue(4, x1 + 150, y1 + 328 + (theme = 3) * 22, keysmax, 2), 50)
498500
} else {
499-
draw_text_dynamic(x1 + 150, y1 + 330 + (theme = 3) * 22, keysmax)
501+
draw_text_dynamic(x1 + 150, y1 + 328 + (theme = 3) * 22, keysmax)
500502
}
501503
draw_theme_color()
502-
popup_set_window(x1 + 180, y1 + 275 + (theme = 3) * 22, 150, 21, "同屏显示的琴键数。过多可能会在老电脑上造成卡顿。")
504+
popup_set_window(x1 + 70, y1 + 328 + (theme = 3) * 22, 150, 21, "同屏显示的琴键数。过多可能会在老电脑上造成卡顿。")
503505
}
504506
} else if (selected_tab = 3) {
505507
if (language != 1) {

scripts/load_settings/load_settings.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function load_settings() {
7373
taskbar = ini_read_real( "preferences", "taskbar", taskbar)
7474
remove_effect = ini_read_real( "preferences", "remove_effect", remove_effect)
7575
window_icon = ini_read_real( "preferences", "window_icon", window_icon)
76+
keynames_flat = ini_read_real( "preferences", "keynames_flat", keynames_flat)
7677

7778
// Midi import settings
7879
w_midi_remember = ini_read_real( "midi_import", "remember", w_midi_remember)

scripts/save_settings/save_settings.gml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ function save_settings() {
7171
ini_write_real_clean("preferences", "taskbar", taskbar)
7272
ini_write_real_clean("preferences", "remove_effect", remove_effect)
7373
ini_write_real_clean("preferences", "window_icon", window_icon)
74+
ini_write_real_clean("preferences", "keynames_flat", keynames_flat)
7475

7576
// Midi import settings
7677
ini_write_real_clean("midi_import", "remember", w_midi_remember)

0 commit comments

Comments
 (0)