Debian Codegraph @

src/gui/settings.cpp

raw
1 /**
2 * Furnace Tracker - multi-system chiptune tracker
3 * Copyright (C) 2021-2025 tildearrow and contributors
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include "gui.h"
21 #include "imgui_internal.h"
22 #include "fonts.h"
23 #include "../ta-log.h"
24 #include "../fileutils.h"
25 #include "../utfutils.h"
26 #include "util.h"
27 #include "guiConst.h"
28 #include "intConst.h"
29 #include "ImGuiFileDialog.h"
30 #include "IconsFontAwesome4.h"
31 #include "furIcons.h"
32 #include "misc/cpp/imgui_stdlib.h"
33 #include "misc/freetype/imgui_freetype.h"
34 #include "scaling.h"
35 #include <fmt/printf.h>
36
37 #ifdef _WIN32
38 #include <windows.h>
39 #include <shlobj.h>
40 #include <shlwapi.h>
41 #else
42 #include <sys/types.h>
43 #include <sys/stat.h>
44 #include <unistd.h>
45 #include <dirent.h>
46 #endif
47
48 #define DEFAULT_NOTE_KEYS "5:7;6:4;7:3;8:16;10:6;11:8;12:24;13:10;16:11;17:9;18:26;19:28;20:12;21:17;22:1;23:19;24:23;25:5;26:14;27:2;28:21;29:0;30:100;31:13;32:15;34:18;35:20;36:22;38:25;39:27;43:100;46:101;47:29;48:31;53:102;"
49
50 #if defined(_WIN32) || defined(__APPLE__) || defined(IS_MOBILE)
51 #define POWER_SAVE_DEFAULT 1
52 #else
53 // currently off on Linux/other due to Mesa catch-up behavior.
54 #define POWER_SAVE_DEFAULT 0
55 #endif
56
57 #ifdef HAVE_FREETYPE
58 #define FONT_BACKEND_DEFAULT 1
59 #else
60 #define FONT_BACKEND_DEFAULT 0
61 #endif
62
63 #if defined(__HAIKU__) || defined(IS_MOBILE) || (defined(_WIN32) && !defined(_WIN64))
64 // NFD doesn't support Haiku
65 // NFD doesn't support Windows XP either
66 #define SYS_FILE_DIALOG_DEFAULT 0
67 #else
68 #define SYS_FILE_DIALOG_DEFAULT 1
69 #endif
70
71 // name, locale, restart message
72 const char* locales[][3]={
73 {"<System>", "", ""},
74 {"English", "en", "restart Furnace for this setting to take effect."},
75 {"Bahasa Indonesia (50%?)", "id", "???"},
76 //{"Deutsch (0%)", "de", "Starten Sie Furnace neu, damit diese Einstellung wirksam wird."},
77 {"Español", "es", "reinicia Furnace para que esta opción tenga efecto."},
78 //{"Suomi (0%)", "fi", "käynnistä Furnace uudelleen, jotta tämä asetus tulee voimaan."},
79 {"Français (10%)", "fr", "redémarrer Furnace pour que ce réglage soit effectif."},
80 //{"Հայերեն (1%)", "hy", "???"},
81 //{"日本語 (0%)", "ja", "???"},
82 {"한국어 (25%)", "ko", "이 설정을 적용하려면 Furnace를 다시 시작해야 합니다."},
83 //{"Nederlands (4%)", "nl", "start Furnace opnieuw op om deze instelling effectief te maken."},
84 {"Polski (95%)", "pl", "aby to ustawienie było skuteczne, należy ponownie uruchomić program."},
85 {"Português (Brasil) (70%)", "pt_BR", "reinicie o Furnace para que essa configuração entre em vigor."},
86 {"Русский", "ru", "перезапустите программу, чтобы эта настройка вступила в силу."},
87 {"Slovenčina (15%)", "sk", "???"},
88 {"Svenska", "sv", "starta om programmet för att denna inställning ska träda i kraft."},
89 //{"ไทย (0%)", "th", "???"},
90 //{"Türkçe (0%)", "tr", "bu ayarı etkin hale getirmek için programı yeniden başlatın."},
91 //{"Українська (0%)", "uk", "перезапустіть програму, щоб це налаштування набуло чинності."},
92 {"中文 (15%)", "zh", "???"},
93 {NULL, NULL, NULL}
94 };
95
96 const char* fontBackends[]={
97 "stb_truetype",
98 "FreeType"
99 };
100
101 const char* mainFonts[]={
102 "IBM Plex Sans",
103 "Liberation Sans",
104 "Exo",
105 "Proggy Clean",
106 "GNU Unifont",
107 _N("<Use system font>"),
108 _N("<Custom...>")
109 };
110
111 const char* headFonts[]={
112 "IBM Plex Sans",
113 "Liberation Sans",
114 "Exo",
115 "Proggy Clean",
116 "GNU Unifont",
117 _N("<Use system font>"),
118 _N("<Custom...>")
119 };
120
121 const char* patFonts[]={
122 "IBM Plex Mono",
123 "Mononoki",
124 "PT Mono",
125 "Proggy Clean",
126 "GNU Unifont",
127 _N("<Use system font>"),
128 _N("<Custom...>")
129 };
130
131 const char* audioBackends[]={
132 "JACK",
133 "SDL",
134 "PortAudio"
135 };
136
137 const char* audioQualities[]={
138 _N("High"),
139 _N("Low")
140 };
141
142 const char* arcadeCores[]={
143 "ymfm",
144 "Nuked-OPM"
145 };
146
147 const char* ym2612Cores[]={
148 "Nuked-OPN2",
149 "ymfm",
150 "YMF276-LLE"
151 };
152
153 const char* snCores[]={
154 "MAME",
155 "Nuked-PSG Mod"
156 };
157
158 const char* nesCores[]={
159 "puNES",
160 "NSFplay"
161 };
162
163 const char* c64Cores[]={
164 "reSID",
165 "reSIDfp",
166 "dSID"
167 };
168
169 const char* pokeyCores[]={
170 "Atari800 (mzpokeysnd)",
171 _N("ASAP (C++ port)")
172 };
173
174 const char* opnCores[]={
175 "ymfm",
176 "Nuked-OPN2 (FM) + ymfm (SSG/ADPCM)",
177 "YM2608-LLE"
178 };
179
180 const char* opl2Cores[]={
181 "Nuked-OPL3",
182 "ymfm",
183 "YM3812-LLE"
184 };
185
186 const char* opl3Cores[]={
187 "Nuked-OPL3",
188 "ymfm",
189 "YMF262-LLE"
190 };
191
192 const char* opl4Cores[]={
193 "Nuked-OPL3 (FM) + openMSX (PCM)",
194 "ymfm"
195 };
196
197 const char* esfmCores[]={
198 "ESFMu",
199 _N("ESFMu (fast)")
200 };
201
202 const char* opllCores[]={
203 "Nuked-OPLL",
204 "emu2413"
205 };
206
207 const char* ayCores[]={
208 "MAME",
209 "AtomicSSG"
210 };
211
212 const char* swanCores[]={
213 "asiekierka new core",
214 "Mednafen"
215 };
216
217 const char* coreQualities[]={
218 _N("Lower"),
219 _N("Low"),
220 _N("Medium"),
221 _N("High"),
222 _N("Ultra"),
223 _N("Ultimate")
224 };
225
226 const char* pcspkrOutMethods[]={
227 _N("evdev SND_TONE"),
228 _N("KIOCSOUND on /dev/tty1"),
229 _N("/dev/port"),
230 _N("KIOCSOUND on standard output"),
231 _N("outb()")
232 };
233
234 const char* valueInputStyles[]={
235 _N("Disabled/custom"),
236 _N("Two octaves (0 is C-4, F is D#5)"),
237 _N("Raw (note number is value)"),
238 _N("Two octaves alternate (lower keys are 0-9, upper keys are A-F)"),
239 _N("Use dual control change (one for each nibble)"),
240 _N("Use 14-bit control change"),
241 _N("Use single control change (imprecise)")
242 };
243
244 const char* valueSInputStyles[]={
245 _N("Disabled/custom"),
246 _N("Use dual control change (one for each nibble)"),
247 _N("Use 14-bit control change"),
248 _N("Use single control change (imprecise)")
249 };
250
251 const char* messageTypes[]={
252 _N("--select--"),
253 _N("???"),
254 _N("???"),
255 _N("???"),
256 _N("???"),
257 _N("???"),
258 _N("???"),
259 _N("???"),
260 _N("Note Off"),
261 _N("Note On"),
262 _N("Aftertouch"),
263 _N("Control"),
264 _N("Program"),
265 _N("ChanPressure"),
266 _N("Pitch Bend"),
267 _N("SysEx")
268 };
269
270 const char* messageChannels[]={
271 "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", _N("Any")
272 };
273
274 const char* specificControls[18]={
275 _N("Instrument"),
276 _N("Volume"),
277 _N("Effect 1 type"),
278 _N("Effect 1 value"),
279 _N("Effect 2 type"),
280 _N("Effect 2 value"),
281 _N("Effect 3 type"),
282 _N("Effect 3 value"),
283 _N("Effect 4 type"),
284 _N("Effect 4 value"),
285 _N("Effect 5 type"),
286 _N("Effect 5 value"),
287 _N("Effect 6 type"),
288 _N("Effect 6 value"),
289 _N("Effect 7 type"),
290 _N("Effect 7 value"),
291 _N("Effect 8 type"),
292 _N("Effect 8 value")
293 };
294
295 #define SAMPLE_RATE_SELECTABLE(x) \
296 if (ImGui::Selectable(#x,settings.audioRate==x)) { \
297 settings.audioRate=x; \
298 settingsChanged=true; \
299 }
300
301 #define BUFFER_SIZE_SELECTABLE(x) \
302 if (ImGui::Selectable(#x,settings.audioBufSize==x)) { \
303 settings.audioBufSize=x; \
304 settingsChanged=true; \
305 }
306
307 #define UI_COLOR_CONFIG(what,label) \
308 ImGui::PushID(what); \
309 if (ImGui::ColorEdit4(label,(float*)&uiColors[what])) { \
310 applyUISettings(false); \
311 settingsChanged=true; \
312 } \
313 ImGui::PopID();
314
315 #define KEYBIND_CONFIG_BEGIN(id) \
316 if (ImGui::BeginTable(id,2,ImGuiTableFlags_SizingFixedFit|ImGuiTableFlags_NoHostExtendX|ImGuiTableFlags_NoClip)) {
317
318 #define KEYBIND_CONFIG_END \
319 ImGui::EndTable(); \
320 }
321
322 #define CONFIG_SUBSECTION(what) \
323 if (_subInit) { \
324 ImGui::Separator(); \
325 } else { \
326 _subInit=true; \
327 } \
328 ImGui::PushFont(headFont); \
329 ImGui::TextUnformatted(what); \
330 ImGui::PopFont();
331
332 #define CONFIG_SECTION(what) \
333 if (ImGui::BeginTabItem(what)) { \
334 bool _subInit=false; \
335 ImVec2 settingsViewSize=ImGui::GetContentRegionAvail(); \
336 settingsViewSize.y-=ImGui::GetFrameHeight()+ImGui::GetStyle().WindowPadding.y; \
337 if (ImGui::BeginChild("SettingsView",settingsViewSize,0))
338
339 #define END_SECTION } \
340 ImGui::EndChild(); \
341 ImGui::EndTabItem();
342
343 #define CORE_QUALITY(_name,_play,_render) \
344 ImGui::TableNextRow(); \
345 ImGui::TableNextColumn(); \
346 ImGui::AlignTextToFramePadding(); \
347 ImGui::Text(_name); \
348 ImGui::TableNextColumn(); \
349 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \
350 if (ImGui::Combo("##" _name "Q",&settings._play,LocalizedComboGetter,coreQualities,6)) settingsChanged=true; \
351 ImGui::TableNextColumn(); \
352 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); \
353 if (ImGui::Combo("##" _name "QR",&settings._render,LocalizedComboGetter,coreQualities,6)) settingsChanged=true;
354
355 String stripName(String what) {
356 String ret;
357 for (char& i: what) {
358 if ((i>='A' && i<='Z') || (i>='a' && i<='z') || (i>='0' && i<='9')) {
359 ret+=i;
360 } else {
361 ret+='-';
362 }
363 }
364 return ret;
365 }
366
367 bool FurnaceGUI::splitBackupName(const char* input, String& backupName, struct tm& backupTime) {
368 size_t len=strlen(input);
369 if (len<4) return false;
370
371 const char* firstHyphen=NULL;
372 const char* secondHyphen=NULL;
373 bool whichHyphen=false;
374 bool isDateValid=true;
375 // -YYYYMMDD-hhmmss.fur
376 if (strcmp(&input[len-4],".fur")!=0) return false;
377 // find two hyphens
378 for (const char* i=input+len; i!=input; i--) {
379 if ((*i)=='-') {
380 if (whichHyphen) {
381 firstHyphen=i;
382 break;
383 } else {
384 secondHyphen=i;
385 whichHyphen=true;
386 }
387 }
388 }
389 if (firstHyphen==NULL) return false;
390 if (secondHyphen==NULL) return false;
391
392 // get the time
393 int whichChar=0;
394 for (const char* i=secondHyphen+1; *i; i++) {
395 if ((*i)<'0' || (*i)>'9') {
396 isDateValid=false;
397 break;
398 }
399 switch (whichChar++) {
400 case 0:
401 backupTime.tm_hour=((*i)-'0')*10;
402 break;
403 case 1:
404 backupTime.tm_hour+=(*i)-'0';
405 break;
406 case 2:
407 backupTime.tm_min=((*i)-'0')*10;
408 break;
409 case 3:
410 backupTime.tm_min+=(*i)-'0';
411 break;
412 case 4:
413 backupTime.tm_sec=((*i)-'0')*10;
414 break;
415 case 5:
416 backupTime.tm_sec+=(*i)-'0';
417 break;
418 }
419 if (whichChar>=6) break;
420 }
421 if (whichChar!=6) return false;
422 if (!isDateValid) return false;
423 if (backupTime.tm_hour>23) return false;
424 if (backupTime.tm_min>59) return false;
425 // intentional
426 if (backupTime.tm_sec>60) return false;
427
428 // get the date
429 String theDate="";
430 for (const char* i=firstHyphen+1; *i; i++) {
431 if ((*i)=='-') break;
432 if ((*i)<'0' || (*i)>'9') {
433 isDateValid=false;
434 break;
435 }
436 theDate+=*i;
437 }
438 if (!isDateValid) return false;
439 if (theDate.size()<5) return false;
440 if (theDate.size()>14) return false;
441 String mmdd=theDate.substr(theDate.size()-4);
442 if (mmdd.size()!=4) return false;
443 backupTime.tm_mon=(mmdd[0]-'0')*10+(mmdd[1]-'0')-1;
444 backupTime.tm_mday=(mmdd[2]-'0')*10+(mmdd[3]-'0');
445 if (backupTime.tm_mon>12) return false;
446 if (backupTime.tm_mday>31) return false;
447 String yyyy=theDate.substr(0,theDate.size()-4);
448 try {
449 backupTime.tm_year=std::stoi(yyyy)-1900;
450 } catch (std::exception& e) {
451 return false;
452 }
453
454 backupName="";
455 for (const char* i=input; i!=firstHyphen && (*i); i++) {
456 backupName+=*i;
457 }
458
459 return true;
460 }
461
462 void FurnaceGUI::purgeBackups(int year, int month, int day) {
463 #ifdef _WIN32
464 String findPath=backupPath+String(DIR_SEPARATOR_STR)+String("*.fur");
465 WString findPathW=utf8To16(findPath.c_str());
466 WIN32_FIND_DATAW next;
467 HANDLE backDir=FindFirstFileW(findPathW.c_str(),&next);
468 if (backDir!=INVALID_HANDLE_VALUE) {
469 do {
470 String backupName;
471 struct tm backupTime;
472 String cFileNameU=utf16To8(next.cFileName);
473 bool deleteBackup=false;
474 if (!splitBackupName(cFileNameU.c_str(),backupName,backupTime)) continue;
475
476 if (year==0) {
477 deleteBackup=true;
478 } else if (backupTime.tm_year<(year-1900)) {
479 deleteBackup=true;
480 } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) {
481 deleteBackup=true;
482 } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mday<day) {
483 deleteBackup=true;
484 }
485
486 if (deleteBackup) {
487 String nextPath=backupPath+DIR_SEPARATOR_STR+cFileNameU;
488 deleteFile(nextPath.c_str());
489 }
490 } while (FindNextFileW(backDir,&next)!=0);
491 FindClose(backDir);
492 }
493 #else
494 DIR* backDir=opendir(backupPath.c_str());
495 if (backDir==NULL) {
496 logW("could not open backups dir!");
497 return;
498 }
499 while (true) {
500 String backupName;
501 struct tm backupTime;
502 struct dirent* next=readdir(backDir);
503 bool deleteBackup=false;
504 if (next==NULL) break;
505 if (strcmp(next->d_name,".")==0) continue;
506 if (strcmp(next->d_name,"..")==0) continue;
507 if (!splitBackupName(next->d_name,backupName,backupTime)) continue;
508
509 if (year==0) {
510 deleteBackup=true;
511 } else if (backupTime.tm_year<(year-1900)) {
512 deleteBackup=true;
513 } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon<(month-1)) {
514 deleteBackup=true;
515 } else if (backupTime.tm_year==(year-1900) && backupTime.tm_mon==(month-1) && backupTime.tm_mday<day) {
516 deleteBackup=true;
517 }
518
519 if (deleteBackup) {
520 String nextPath=backupPath+DIR_SEPARATOR_STR+next->d_name;
521 deleteFile(nextPath.c_str());
522 }
523 }
524 closedir(backDir);
525 #endif
526 refreshBackups=true;
527 }
528
529 void FurnaceGUI::promptKey(int which, int bindIdx) {
530 bindSetTarget=which;
531 bindSetTargetIdx=bindIdx;
532 bindSetActive=true;
533 bindSetPending=true;
534 if (bindIdx>=(int)actionKeys[which].size()) {
535 bindSetPrevValue=0;
536 actionKeys[which].push_back(0);
537 } else {
538 bindSetPrevValue=actionKeys[which][bindIdx];
539 actionKeys[which][bindIdx]=0;
540 }
541 }
542
543 void FurnaceGUI::drawSettings() {
544 if (nextWindow==GUI_WINDOW_SETTINGS) {
545 settingsOpen=true;
546 ImGui::SetNextWindowFocus();
547 nextWindow=GUI_WINDOW_NOTHING;
548 }
549 if (!settingsOpen) return;
550 if (mobileUI) {
551 ImVec2 setWindowPos=ImVec2(0,0);
552 ImVec2 setWindowSize=ImVec2(canvasW,canvasH);
553 ImGui::SetNextWindowPos(setWindowPos);
554 ImGui::SetNextWindowSize(setWindowSize);
555 } else {
556 ImGui::SetNextWindowSizeConstraints(ImVec2(200.0f*dpiScale,100.0f*dpiScale),ImVec2(canvasW,canvasH));
557 }
558 if (ImGui::Begin("Settings",&settingsOpen,ImGuiWindowFlags_NoDocking|globalWinFlags,_("Settings"))) {
559 if (!settingsOpen) {
560 if (settingsChanged) {
561 settingsOpen=true;
562 showWarning(_("Do you want to save your settings?"),GUI_WARN_CLOSE_SETTINGS);
563 } else {
564 settingsOpen=false;
565 }
566 }
567 if (ImGui::BeginTabBar("settingsTab")) {
568 // NEW SETTINGS HERE
569 CONFIG_SECTION(_("General")) {
570 // SUBSECTION PROGRAM
571 CONFIG_SUBSECTION(_("Program"));
572
573 #ifdef HAVE_LOCALE
574 String curLocale=settings.locale;
575 const char* localeRestart=locales[0][2];
576 if (curLocale=="") {
577 curLocale="<System>";
578 } else {
579 for (int i=1; locales[i][0]; i++) {
580 if (strcmp(curLocale.c_str(),locales[i][1])==0) {
581 curLocale=locales[i][0];
582 break;
583 }
584 }
585 }
586 if (ImGui::BeginCombo(_("Language"),curLocale.c_str())) {
587 for (int i=0; locales[i][0]; i++) {
588 if (ImGui::Selectable(locales[i][0],strcmp(settings.locale.c_str(),locales[i][1])==0)) {
589 settings.locale=locales[i][1];
590 settingsChanged=true;
591 }
592 if (ImGui::IsItemHovered()) {
593 ImGui::SetTooltip("%s",locales[i][2]);
594 }
595 }
596 ImGui::EndCombo();
597 } else {
598 if (ImGui::IsItemHovered()) {
599 ImGui::SetTooltip("%s",localeRestart);
600 }
601 }
602 #endif
603
604 String curRenderBackend=settings.renderBackend.empty()?GUI_BACKEND_DEFAULT_NAME:settings.renderBackend;
605 if (ImGui::BeginCombo(_("Render backend"),curRenderBackend.c_str())) {
606 #ifdef HAVE_RENDER_SDL
607 if (ImGui::Selectable("SDL Renderer",curRenderBackend=="SDL")) {
608 settings.renderBackend="SDL";
609 settingsChanged=true;
610 }
611 #endif
612 #ifdef HAVE_RENDER_DX11
613 if (ImGui::Selectable("DirectX 11",curRenderBackend=="DirectX 11")) {
614 settings.renderBackend="DirectX 11";
615 settingsChanged=true;
616 }
617 #endif
618 #ifdef HAVE_RENDER_DX9
619 if (ImGui::Selectable("DirectX 9",curRenderBackend=="DirectX 9")) {
620 settings.renderBackend="DirectX 9";
621 settingsChanged=true;
622 }
623 #endif
624 #ifdef HAVE_RENDER_METAL
625 if (ImGui::Selectable("Metal",curRenderBackend=="Metal")) {
626 settings.renderBackend="Metal";
627 settingsChanged=true;
628 }
629 #endif
630 #ifdef HAVE_RENDER_GL
631 #ifdef USE_GLES
632 if (ImGui::Selectable("OpenGL ES 2.0",curRenderBackend=="OpenGL ES 2.0")) {
633 settings.renderBackend="OpenGL ES 2.0";
634 settingsChanged=true;
635 }
636 #else
637 if (ImGui::Selectable("OpenGL 3.0",curRenderBackend=="OpenGL 3.0")) {
638 settings.renderBackend="OpenGL 3.0";
639 settingsChanged=true;
640 }
641 if (ImGui::Selectable("OpenGL 2.0",curRenderBackend=="OpenGL 2.0")) {
642 settings.renderBackend="OpenGL 2.0";
643 settingsChanged=true;
644 }
645 #endif
646 #endif
647 #ifdef HAVE_RENDER_GL1
648 if (ImGui::Selectable("OpenGL 1.1",curRenderBackend=="OpenGL 1.1")) {
649 settings.renderBackend="OpenGL 1.1";
650 settingsChanged=true;
651 }
652 #endif
653 if (ImGui::Selectable("Software",curRenderBackend=="Software")) {
654 settings.renderBackend="Software";
655 settingsChanged=true;
656 }
657 ImGui::EndCombo();
658 }
659 if (ImGui::IsItemHovered()) {
660 ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect."));
661 }
662
663 if (ImGui::TreeNode(_("Advanced render backend settings"))) {
664 if (curRenderBackend=="SDL") {
665 if (ImGui::BeginCombo(_("Render driver"),settings.renderDriver.empty()?_("Automatic"):settings.renderDriver.c_str())) {
666 if (ImGui::Selectable(_("Automatic"),settings.renderDriver.empty())) {
667 settings.renderDriver="";
668 settingsChanged=true;
669 }
670 for (String& i: availRenderDrivers) {
671 if (ImGui::Selectable(i.c_str(),i==settings.renderDriver)) {
672 settings.renderDriver=i;
673 settingsChanged=true;
674 }
675 }
676 ImGui::EndCombo();
677 }
678 if (ImGui::IsItemHovered()) {
679 ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect."));
680 }
681 } else if (curRenderBackend.find("OpenGL")==0) {
682 ImGui::TextWrapped(_("beware: changing these settings may render Furnace unusable! do so at your own risk.\nstart Furnace with -safemode if you mess something up."));
683 if (ImGui::InputInt(_("Red bits"),&settings.glRedSize)) {
684 if (settings.glRedSize<0) settings.glRedSize=0;
685 if (settings.glRedSize>32) settings.glRedSize=32;
686 settingsChanged=true;
687 }
688 if (ImGui::InputInt(_("Green bits"),&settings.glGreenSize)) {
689 if (settings.glGreenSize<0) settings.glGreenSize=0;
690 if (settings.glGreenSize>32) settings.glGreenSize=32;
691 settingsChanged=true;
692 }
693 if (ImGui::InputInt(_("Blue bits"),&settings.glBlueSize)) {
694 if (settings.glBlueSize<0) settings.glBlueSize=0;
695 if (settings.glBlueSize>32) settings.glBlueSize=32;
696 settingsChanged=true;
697 }
698 if (ImGui::InputInt(_("Alpha bits"),&settings.glAlphaSize)) {
699 if (settings.glAlphaSize<0) settings.glAlphaSize=0;
700 if (settings.glAlphaSize>32) settings.glAlphaSize=32;
701 settingsChanged=true;
702 }
703 if (ImGui::InputInt(_("Color depth"),&settings.glDepthSize)) {
704 if (settings.glDepthSize<0) settings.glDepthSize=0;
705 if (settings.glDepthSize>128) settings.glDepthSize=128;
706 settingsChanged=true;
707 }
708
709 bool glSetBSB=settings.glSetBS;
710 if (ImGui::Checkbox(_("Set stencil and buffer sizes"),&glSetBSB)) {
711 settings.glSetBS=glSetBSB;
712 settingsChanged=true;
713 }
714
715 if (settings.glSetBS) {
716 if (ImGui::InputInt(_("Stencil buffer size"),&settings.glStencilSize)) {
717 if (settings.glStencilSize<0) settings.glStencilSize=0;
718 if (settings.glStencilSize>32) settings.glStencilSize=32;
719 settingsChanged=true;
720 }
721 if (ImGui::InputInt(_("Buffer size"),&settings.glBufferSize)) {
722 if (settings.glBufferSize<0) settings.glBufferSize=0;
723 if (settings.glBufferSize>128) settings.glBufferSize=128;
724 settingsChanged=true;
725 }
726 }
727
728 bool glDoubleBufferB=settings.glDoubleBuffer;
729 if (ImGui::Checkbox(_("Double buffer"),&glDoubleBufferB)) {
730 settings.glDoubleBuffer=glDoubleBufferB;
731 settingsChanged=true;
732 }
733
734 ImGui::TextWrapped(_("the following values are common (in red, green, blue, alpha order):\n- 24 bits: 8, 8, 8, 0\n- 16 bits: 5, 6, 5, 0\n- 32 bits (with alpha): 8, 8, 8, 8\n- 30 bits (deep): 10, 10, 10, 0"));
735 } else {
736 ImGui::Text(_("nothing to configure"));
737 }
738 ImGui::TreePop();
739 }
740
741 ImGui::TextWrapped(_("current backend: %s\n%s\n%s\n%s"),rend->getBackendName(),rend->getVendorName(),rend->getDeviceName(),rend->getAPIVersion());
742
743 bool vsyncB=settings.vsync;
744 if (ImGui::Checkbox(_("VSync"),&vsyncB)) {
745 settings.vsync=vsyncB;
746 settingsChanged=true;
747 if (rend!=NULL) {
748 rend->setSwapInterval(settings.vsync);
749 }
750 }
751
752 if (ImGui::SliderInt(_("Frame rate limit"),&settings.frameRateLimit,0,250,settings.frameRateLimit==0?_("Unlimited"):"%d")) {
753 settingsChanged=true;
754 }
755 if (settings.frameRateLimit<0) settings.frameRateLimit=0;
756 if (settings.frameRateLimit>1000) settings.frameRateLimit=1000;
757 if (ImGui::IsItemHovered()) {
758 ImGui::SetTooltip(_("only applies when VSync is disabled."));
759 }
760
761 bool displayRenderTimeB=settings.displayRenderTime;
762 if (ImGui::Checkbox(_("Display render time"),&displayRenderTimeB)) {
763 settings.displayRenderTime=displayRenderTimeB;
764 settingsChanged=true;
765 }
766
767 if (settings.renderBackend!="Metal") {
768 bool renderClearPosB=settings.renderClearPos;
769 if (ImGui::Checkbox(_("Late render clear"),&renderClearPosB)) {
770 settings.renderClearPos=renderClearPosB;
771 settingsChanged=true;
772 }
773 if (ImGui::IsItemHovered()) {
774 ImGui::SetTooltip(_("calls rend->clear() after rend->present(). might reduce UI latency by one frame in some drivers."));
775 }
776 }
777
778 bool powerSaveB=settings.powerSave;
779 if (ImGui::Checkbox(_("Power-saving mode"),&powerSaveB)) {
780 settings.powerSave=powerSaveB;
781 settingsChanged=true;
782 }
783 if (ImGui::IsItemHovered()) {
784 ImGui::SetTooltip(_("saves power by lowering the frame rate to 2fps when idle.\nmay cause issues under Mesa drivers!"));
785 }
786
787 #ifndef IS_MOBILE
788 bool noThreadedInputB=settings.noThreadedInput;
789 if (ImGui::Checkbox(_("Disable threaded input (restart after changing!)"),&noThreadedInputB)) {
790 settings.noThreadedInput=noThreadedInputB;
791 settingsChanged=true;
792 }
793 if (ImGui::IsItemHovered()) {
794 ImGui::SetTooltip(_("threaded input processes key presses for note preview on a separate thread (on supported platforms), which reduces latency.\nhowever, crashes have been reported when threaded input is on. enable this option if that is the case."));
795 }
796 #endif
797
798 bool eventDelayB=settings.eventDelay;
799 if (ImGui::Checkbox(_("Enable event delay"),&eventDelayB)) {
800 settings.eventDelay=eventDelayB;
801 settingsChanged=true;
802 applyUISettings(false);
803 }
804 if (ImGui::IsItemHovered()) {
805 ImGui::SetTooltip(_("may cause issues with high-polling-rate mice when previewing notes."));
806 }
807
808 #ifdef IS_MOBILE
809 // SUBSECTION VIBRATION
810 CONFIG_SUBSECTION(_("Vibration"));
811
812 if (ImGui::SliderFloat(_("Strength"),&settings.vibrationStrength,0.0f,1.0f)) {
813 if (settings.vibrationStrength<0.0f) settings.vibrationStrength=0.0f;
814 if (settings.vibrationStrength>1.0f) settings.vibrationStrength=1.0f;
815 settingsChanged=true;
816 }
817
818 if (ImGui::SliderInt(_("Length"),&settings.vibrationLength,10,500)) {
819 if (settings.vibrationLength<10) settings.vibrationLength=10;
820 if (settings.vibrationLength>500) settings.vibrationLength=500;
821 settingsChanged=true;
822 }
823 #endif
824
825 // SUBSECTION FILE
826 CONFIG_SUBSECTION(_("File"));
827
828 #ifndef FLATPAK_WORKAROUNDS
829 bool sysFileDialogB=settings.sysFileDialog;
830 if (ImGui::Checkbox(_("Use system file picker"),&sysFileDialogB)) {
831 settings.sysFileDialog=sysFileDialogB;
832 settingsChanged=true;
833 }
834 #endif
835
836 if (ImGui::InputInt(_("Number of recent files"),&settings.maxRecentFile,1,5)) {
837 if (settings.maxRecentFile<0) settings.maxRecentFile=0;
838 if (settings.maxRecentFile>30) settings.maxRecentFile=30;
839 settingsChanged=true;
840 }
841
842 bool compressB=settings.compress;
843 if (ImGui::Checkbox(_("Compress when saving"),&compressB)) {
844 settings.compress=compressB;
845 settingsChanged=true;
846 }
847 if (ImGui::IsItemHovered()) {
848 ImGui::SetTooltip(_("use zlib to compress saved songs."));
849 }
850
851 bool saveUnusedPatternsB=settings.saveUnusedPatterns;
852 if (ImGui::Checkbox(_("Save unused patterns"),&saveUnusedPatternsB)) {
853 settings.saveUnusedPatterns=saveUnusedPatternsB;
854 settingsChanged=true;
855 }
856
857 bool newPatternFormatB=settings.newPatternFormat;
858 if (ImGui::Checkbox(_("Use new pattern format when saving"),&newPatternFormatB)) {
859 settings.newPatternFormat=newPatternFormatB;
860 settingsChanged=true;
861 }
862 if (ImGui::IsItemHovered()) {
863 ImGui::SetTooltip(_("use a packed format which saves space when saving songs.\ndisable if you need compatibility with older Furnace and/or tools\nwhich do not support this format."));
864 }
865
866 bool noDMFCompatB=settings.noDMFCompat;
867 if (ImGui::Checkbox(_("Don't apply compatibility flags when loading .dmf"),&noDMFCompatB)) {
868 settings.noDMFCompat=noDMFCompatB;
869 settingsChanged=true;
870 }
871 if (ImGui::IsItemHovered()) {
872 ImGui::SetTooltip(_("do not report any issues arising from the use of this option!"));
873 }
874
875 ImGui::Text(_("Play after opening song:"));
876 ImGui::Indent();
877 if (ImGui::RadioButton(_("No##pol0"),settings.playOnLoad==0)) {
878 settings.playOnLoad=0;
879 settingsChanged=true;
880 }
881 if (ImGui::RadioButton(_("Only if already playing##pol1"),settings.playOnLoad==1)) {
882 settings.playOnLoad=1;
883 settingsChanged=true;
884 }
885 if (ImGui::RadioButton(_("Yes##pol0"),settings.playOnLoad==2)) {
886 settings.playOnLoad=2;
887 settingsChanged=true;
888 }
889 ImGui::Unindent();
890
891 ImGui::Text(_("Audio export loop/fade out time:"));
892 ImGui::Indent();
893 if (ImGui::RadioButton(_("Set to these values on start-up:##fot0"),settings.persistFadeOut==0)) {
894 settings.persistFadeOut=0;
895 settingsChanged=true;
896 }
897 ImGui::BeginDisabled(settings.persistFadeOut);
898 ImGui::Indent();
899 if (ImGui::InputInt(_("Loops"),&settings.exportLoops,1,2)) {
900 if (settings.exportLoops<0) settings.exportLoops=0;
901 audioExportOptions.loops=settings.exportLoops;
902 settingsChanged=true;
903 }
904 if (ImGui::InputDouble(_("Fade out (seconds)"),&settings.exportFadeOut,1.0,2.0,"%.1f")) {
905 if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
906 audioExportOptions.fadeOut=settings.exportFadeOut;
907 settingsChanged=true;
908 }
909 ImGui::Unindent();
910 ImGui::EndDisabled();
911 if (ImGui::RadioButton(_("Remember last values##fot1"),settings.persistFadeOut==1)) {
912 settings.persistFadeOut=1;
913 settingsChanged=true;
914 }
915 ImGui::Unindent();
916
917 bool writeInsNamesB=settings.writeInsNames;
918 if (ImGui::Checkbox(_("Store instrument name in .fui"),&writeInsNamesB)) {
919 settings.writeInsNames=writeInsNamesB;
920 settingsChanged=true;
921 }
922 if (ImGui::IsItemHovered()) {
923 ImGui::SetTooltip(_("when enabled, saving an instrument will store its name.\nthis may increase file size."));
924 }
925
926 bool readInsNamesB=settings.readInsNames;
927 if (ImGui::Checkbox(_("Load instrument name from .fui"),&readInsNamesB)) {
928 settings.readInsNames=readInsNamesB;
929 settingsChanged=true;
930 }
931 if (ImGui::IsItemHovered()) {
932 ImGui::SetTooltip(_("when enabled, loading an instrument will use the stored name (if present).\notherwise, it will use the file name."));
933 }
934
935 bool autoFillSaveB=settings.autoFillSave;
936 if (ImGui::Checkbox(_("Auto-fill file name when saving"),&autoFillSaveB)) {
937 settings.autoFillSave=autoFillSaveB;
938 settingsChanged=true;
939 }
940 if (ImGui::IsItemHovered()) {
941 ImGui::SetTooltip(_("fill the file name field with an appropriate file name when saving or exporting."));
942 }
943
944 // SUBSECTION NEW SONG
945 CONFIG_SUBSECTION(_("New Song"));
946 ImGui::AlignTextToFramePadding();
947 ImGui::Text(_("Initial system:"));
948 ImGui::SameLine();
949 if (ImGui::Button(_("Current system"))) {
950 settings.initialSys.clear();
951 for (int i=0; i<e->song.systemLen; i++) {
952 settings.initialSys.set(fmt::sprintf("id%d",i),e->systemToFileFur(e->song.system[i]));
953 settings.initialSys.set(fmt::sprintf("vol%d",i),(float)e->song.systemVol[i]);
954 settings.initialSys.set(fmt::sprintf("pan%d",i),(float)e->song.systemPan[i]);
955 settings.initialSys.set(fmt::sprintf("fr%d",i),(float)e->song.systemPanFR[i]);
956 settings.initialSys.set(fmt::sprintf("flags%d",i),e->song.systemFlags[i].toBase64());
957 }
958 settings.initialSysName=e->song.systemName;
959 settingsChanged=true;
960 }
961 ImGui::SameLine();
962 if (ImGui::Button(_("Randomize"))) {
963 settings.initialSys.clear();
964 int howMany=1+rand()%3;
965 int totalAvailSys=0;
966 for (totalAvailSys=0; availableSystems[totalAvailSys]; totalAvailSys++);
967 if (totalAvailSys>0) {
968 for (int i=0; i<howMany; i++) {
969 DivSystem theSystem=DIV_SYSTEM_DUMMY;
970 do {
971 theSystem=(DivSystem)availableSystems[rand()%totalAvailSys];
972 } while (!settings.hiddenSystems && CHECK_HIDDEN_SYSTEM(theSystem));
973 settings.initialSys.set(fmt::sprintf("id%d",i),e->systemToFileFur(theSystem));
974 settings.initialSys.set(fmt::sprintf("vol%d",i),1.0f);
975 settings.initialSys.set(fmt::sprintf("pan%d",i),0.0f);
976 settings.initialSys.set(fmt::sprintf("fr%d",i),0.0f);
977 settings.initialSys.set(fmt::sprintf("flags%d",i),"");
978 }
979 } else {
980 settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_DUMMY));
981 settings.initialSys.set("vol0",1.0f);
982 settings.initialSys.set("pan0",0.0f);
983 settings.initialSys.set("fr0",0.0f);
984 settings.initialSys.set("flags0","");
985 howMany=1;
986 }
987 // randomize system name
988 std::vector<String> wordPool[6];
989 for (int i=0; i<howMany; i++) {
990 int wpPos=0;
991 DivSystem sysID=e->systemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0));
992 String sName=e->getSystemName(sysID);
993 String nameWord;
994 sName+=" ";
995 for (char& i: sName) {
996 if (i==' ') {
997 if (nameWord!="") {
998 wordPool[wpPos++].push_back(nameWord);
999 if (wpPos>=6) break;
1000 nameWord="";
1001 }
1002 } else {
1003 nameWord+=i;
1004 }
1005 }
1006 }
1007 settings.initialSysName="";
1008 for (int i=0; i<6; i++) {
1009 if (wordPool[i].empty()) continue;
1010 settings.initialSysName+=wordPool[i][rand()%wordPool[i].size()];
1011 settings.initialSysName+=" ";
1012 }
1013 settingsChanged=true;
1014 }
1015 ImGui::SameLine();
1016 if (ImGui::Button(_("Reset to defaults"))) {
1017 settings.initialSys.clear();
1018 settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612));
1019 settings.initialSys.set("vol0",1.0f);
1020 settings.initialSys.set("pan0",0.0f);
1021 settings.initialSys.set("fr0",0.0f);
1022 settings.initialSys.set("flags0","");
1023 settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS));
1024 settings.initialSys.set("vol1",0.5f);
1025 settings.initialSys.set("pan1",0.0f);
1026 settings.initialSys.set("fr1",0.0f);
1027 settings.initialSys.set("flags1","");
1028 settings.initialSysName="Sega Genesis/Mega Drive";
1029 settingsChanged=true;
1030 }
1031
1032 ImGui::AlignTextToFramePadding();
1033 ImGui::Text(_("Name"));
1034 ImGui::SameLine();
1035 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1036 if (ImGui::InputText("##InitSysName",&settings.initialSysName)) settingsChanged=true;
1037
1038 int sysCount=0;
1039 int doRemove=-1;
1040 for (size_t i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) {
1041 DivSystem sysID=e->systemFromFileFur(settings.initialSys.getInt(fmt::sprintf("id%d",i),0));
1042 float sysVol=settings.initialSys.getFloat(fmt::sprintf("vol%d",i),0);
1043 float sysPan=settings.initialSys.getFloat(fmt::sprintf("pan%d",i),0);
1044 float sysPanFR=settings.initialSys.getFloat(fmt::sprintf("fr%d",i),0);
1045
1046 sysCount=i+1;
1047
1048 //bool doRemove=false;
1049 bool doInvert=(sysVol<0);
1050 float vol=fabs(sysVol);
1051 ImGui::PushID(i);
1052
1053 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::CalcTextSize(_("Invert")).x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0);
1054 if (ImGui::BeginCombo("##System",getSystemName(sysID),ImGuiComboFlags_HeightLargest)) {
1055
1056 sysID=systemPicker(true);
1057
1058 if (sysID!=DIV_SYSTEM_NULL)
1059 {
1060 settings.initialSys.set(fmt::sprintf("id%d",i),(int)e->systemToFileFur(sysID));
1061 settings.initialSys.set(fmt::sprintf("flags%d",i),"");
1062 settingsChanged=true;
1063
1064 ImGui::CloseCurrentPopup();
1065 }
1066
1067 ImGui::EndCombo();
1068 }
1069
1070 ImGui::SameLine();
1071 if (ImGui::Checkbox(_("Invert"),&doInvert)) {
1072 sysVol=-sysVol;
1073 settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol);
1074 settingsChanged=true;
1075 }
1076 ImGui::SameLine();
1077 //ImGui::BeginDisabled(settings.initialSys.size()<=4);
1078 pushDestColor();
1079 if (ImGui::Button(ICON_FA_MINUS "##InitSysRemove")) {
1080 doRemove=i;
1081 settingsChanged=true;
1082 }
1083 popDestColor();
1084 //ImGui::EndDisabled();
1085 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0);
1086 if (CWSliderFloat(_("Volume"),&vol,0.0f,3.0f)) {
1087 if (doInvert) {
1088 if (vol<0.0001) vol=0.0001;
1089 }
1090 if (vol<0) vol=0;
1091 if (vol>10) vol=10;
1092 sysVol=doInvert?-vol:vol;
1093 settings.initialSys.set(fmt::sprintf("vol%d",i),(float)sysVol);
1094 settingsChanged=true;
1095 } rightClickable
1096 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0);
1097 if (CWSliderFloat(_("Panning"),&sysPan,-1.0f,1.0f)) {
1098 if (sysPan<-1.0f) sysPan=-1.0f;
1099 if (sysPan>1.0f) sysPan=1.0f;
1100 settings.initialSys.set(fmt::sprintf("pan%d",i),(float)sysPan);
1101 settingsChanged=true;
1102 } rightClickable
1103 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0-ImGui::GetStyle().ItemSpacing.x*2.0);
1104 if (CWSliderFloat(_("Front/Rear"),&sysPanFR,-1.0f,1.0f)) {
1105 if (sysPanFR<-1.0f) sysPanFR=-1.0f;
1106 if (sysPanFR>1.0f) sysPanFR=1.0f;
1107 settings.initialSys.set(fmt::sprintf("fr%d",i),(float)sysPanFR);
1108 settingsChanged=true;
1109 } rightClickable
1110
1111 // oh please MSVC don't cry
1112 if (ImGui::TreeNode(_("Configure"))) {
1113 String sysFlagsS=settings.initialSys.getString(fmt::sprintf("flags%d",i),"");
1114 DivConfig sysFlags;
1115 sysFlags.loadFromBase64(sysFlagsS.c_str());
1116 if (drawSysConf(-1,i,sysID,sysFlags,false)) {
1117 settings.initialSys.set(fmt::sprintf("flags%d",i),sysFlags.toBase64());
1118 }
1119 ImGui::TreePop();
1120 settingsChanged=true;
1121 }
1122
1123 ImGui::PopID();
1124 }
1125
1126 if (doRemove>=0 && sysCount>1) {
1127 for (int i=doRemove; i<sysCount-1; i++) {
1128 int sysID=settings.initialSys.getInt(fmt::sprintf("id%d",i+1),0);
1129 float sysVol=settings.initialSys.getFloat(fmt::sprintf("vol%d",i+1),0);
1130 float sysPan=settings.initialSys.getFloat(fmt::sprintf("pan%d",i+1),0);
1131 float sysPanFR=settings.initialSys.getFloat(fmt::sprintf("fr%d",i+1),0);
1132 String sysFlags=settings.initialSys.getString(fmt::sprintf("flags%d",i+1),"");
1133 settings.initialSys.set(fmt::sprintf("id%d",i),sysID);
1134 settings.initialSys.set(fmt::sprintf("vol%d",i),sysVol);
1135 settings.initialSys.set(fmt::sprintf("pan%d",i),sysPan);
1136 settings.initialSys.set(fmt::sprintf("fr%d",i),sysPanFR);
1137 settings.initialSys.set(fmt::sprintf("flags%d",i),sysFlags);
1138 }
1139
1140 settings.initialSys.remove(fmt::sprintf("id%d",sysCount-1));
1141 settings.initialSys.remove(fmt::sprintf("vol%d",sysCount-1));
1142 settings.initialSys.remove(fmt::sprintf("pan%d",sysCount-1));
1143 settings.initialSys.remove(fmt::sprintf("fr%d",sysCount-1));
1144 settings.initialSys.remove(fmt::sprintf("flags%d",sysCount-1));
1145 }
1146
1147 if (sysCount<32) if (ImGui::Button(ICON_FA_PLUS "##InitSysAdd")) {
1148 settings.initialSys.set(fmt::sprintf("id%d",sysCount),(int)e->systemToFileFur(DIV_SYSTEM_YM2612));
1149 settings.initialSys.set(fmt::sprintf("vol%d",sysCount),1.0f);
1150 settings.initialSys.set(fmt::sprintf("pan%d",sysCount),0.0f);
1151 settings.initialSys.set(fmt::sprintf("fr%d",sysCount),0.0f);
1152 settings.initialSys.set(fmt::sprintf("flags%d",sysCount),"");
1153 }
1154
1155 ImGui::Text(_("When creating new song:"));
1156 ImGui::Indent();
1157 if (ImGui::RadioButton(_("Display system preset selector##NSB0"),settings.newSongBehavior==0)) {
1158 settings.newSongBehavior=0;
1159 settingsChanged=true;
1160 }
1161 if (ImGui::RadioButton(_("Start with initial system##NSB1"),settings.newSongBehavior==1)) {
1162 settings.newSongBehavior=1;
1163 settingsChanged=true;
1164 }
1165 if (ImGui::InputText(_("Default author name"), &settings.defaultAuthorName)) settingsChanged=true;
1166 ImGui::Unindent();
1167
1168 // SUBSECTION START-UP
1169 CONFIG_SUBSECTION(_("Start-up"));
1170 #ifndef NO_INTRO
1171 ImGui::Text(_("Play intro on start-up:"));
1172 ImGui::Indent();
1173 if (ImGui::RadioButton(_("No##pis0"),settings.alwaysPlayIntro==0)) {
1174 settings.alwaysPlayIntro=0;
1175 settingsChanged=true;
1176 }
1177 if (ImGui::RadioButton(_("Short##pis1"),settings.alwaysPlayIntro==1)) {
1178 settings.alwaysPlayIntro=1;
1179 settingsChanged=true;
1180 }
1181 if (ImGui::RadioButton(_("Full (short when loading song)##pis2"),settings.alwaysPlayIntro==2)) {
1182 settings.alwaysPlayIntro=2;
1183 settingsChanged=true;
1184 }
1185 if (ImGui::RadioButton(_("Full (always)##pis3"),settings.alwaysPlayIntro==3)) {
1186 settings.alwaysPlayIntro=3;
1187 settingsChanged=true;
1188 }
1189 ImGui::Unindent();
1190 #endif
1191
1192 bool disableFadeInB=settings.disableFadeIn;
1193 if (ImGui::Checkbox(_("Disable fade-in during start-up"),&disableFadeInB)) {
1194 settings.disableFadeIn=disableFadeInB;
1195 settingsChanged=true;
1196 }
1197
1198 bool noMaximizeWorkaroundB=settings.noMaximizeWorkaround;
1199 if (ImGui::Checkbox(_("Do not maximize on start-up when the Furnace window is too big"),&noMaximizeWorkaroundB)) {
1200 settings.noMaximizeWorkaround=noMaximizeWorkaroundB;
1201 settingsChanged=true;
1202 }
1203
1204 // SUBSECTION BEHAVIOR
1205 CONFIG_SUBSECTION(_("Behavior"));
1206 bool blankInsB=settings.blankIns;
1207 if (ImGui::Checkbox(_("New instruments are blank"),&blankInsB)) {
1208 settings.blankIns=blankInsB;
1209 settingsChanged=true;
1210 }
1211 // SUBSECTION CONFIGURATION
1212 CONFIG_SUBSECTION(_("Configuration"));
1213 if (ImGui::Button(_("Import"))) {
1214 openFileDialog(GUI_FILE_IMPORT_CONFIG);
1215 }
1216 ImGui::SameLine();
1217 if (ImGui::Button(_("Export"))) {
1218 openFileDialog(GUI_FILE_EXPORT_CONFIG);
1219 }
1220 pushDestColor();
1221 if (ImGui::Button(_("Factory Reset"))) {
1222 showWarning(_("Are you sure you want to reset all Furnace settings?\nYou must restart Furnace after doing so."),GUI_WARN_RESET_CONFIG);
1223 }
1224 popDestColor();
1225
1226 // SUBSECTION IMPORT
1227 CONFIG_SUBSECTION(_("Import"));
1228 bool s3mOPL3B=settings.s3mOPL3;
1229 if (ImGui::Checkbox(_("Use OPL3 instead of OPL2 for S3M import"),&s3mOPL3B)) {
1230 settings.s3mOPL3=s3mOPL3B;
1231 settingsChanged=true;
1232 }
1233
1234 #ifdef ANDROID
1235 // SUBSECTION ANDROID
1236 CONFIG_SUBSECTION(_("Android"));
1237 bool backgroundPlayB=settings.backgroundPlay;
1238 if (ImGui::Checkbox(_("Enable background playback (restart!)"),&backgroundPlayB)) {
1239 settings.backgroundPlay=backgroundPlayB;
1240 settingsChanged=true;
1241 }
1242 #endif
1243
1244 END_SECTION;
1245 }
1246 CONFIG_SECTION(_("Audio")) {
1247 // SUBSECTION OUTPUT
1248 CONFIG_SUBSECTION(_("Output"));
1249 if (ImGui::BeginTable("##Output",2)) {
1250 ImGui::TableSetupColumn("##Label",ImGuiTableColumnFlags_WidthFixed);
1251 ImGui::TableSetupColumn("##Combo",ImGuiTableColumnFlags_WidthStretch);
1252 #if defined(HAVE_JACK) || defined(HAVE_PA)
1253 ImGui::TableNextRow();
1254 ImGui::TableNextColumn();
1255 ImGui::AlignTextToFramePadding();
1256 ImGui::Text(_("Backend"));
1257 ImGui::TableNextColumn();
1258 int prevAudioEngine=settings.audioEngine;
1259 if (ImGui::BeginCombo("##Backend",audioBackends[settings.audioEngine])) {
1260 #ifdef HAVE_JACK
1261 if (ImGui::Selectable("JACK",settings.audioEngine==DIV_AUDIO_JACK)) {
1262 settings.audioEngine=DIV_AUDIO_JACK;
1263 settingsChanged=true;
1264 }
1265 #endif
1266 if (ImGui::Selectable("SDL",settings.audioEngine==DIV_AUDIO_SDL)) {
1267 settings.audioEngine=DIV_AUDIO_SDL;
1268 settingsChanged=true;
1269 }
1270 #ifdef HAVE_PA
1271 if (ImGui::Selectable("PortAudio",settings.audioEngine==DIV_AUDIO_PORTAUDIO)) {
1272 settings.audioEngine=DIV_AUDIO_PORTAUDIO;
1273 settingsChanged=true;
1274 }
1275 #endif
1276 if (settings.audioEngine!=prevAudioEngine) {
1277 audioEngineChanged=true;
1278 settings.audioDevice="";
1279 settings.audioChans=2;
1280 }
1281 ImGui::EndCombo();
1282 }
1283 #endif
1284
1285 if (settings.audioEngine==DIV_AUDIO_SDL) {
1286 ImGui::TableNextRow();
1287 ImGui::TableNextColumn();
1288 ImGui::AlignTextToFramePadding();
1289 ImGui::Text(_("Driver"));
1290 ImGui::TableNextColumn();
1291 if (ImGui::BeginCombo("##SDLADriver",settings.sdlAudioDriver.empty()?_("Automatic"):settings.sdlAudioDriver.c_str())) {
1292 if (ImGui::Selectable(_("Automatic"),settings.sdlAudioDriver.empty())) {
1293 settings.sdlAudioDriver="";
1294 settingsChanged=true;
1295 }
1296 for (String& i: availAudioDrivers) {
1297 if (ImGui::Selectable(i.c_str(),i==settings.sdlAudioDriver)) {
1298 settings.sdlAudioDriver=i;
1299 settingsChanged=true;
1300 }
1301 }
1302 ImGui::EndCombo();
1303 }
1304 if (ImGui::IsItemHovered()) {
1305 ImGui::SetTooltip(_("you may need to restart Furnace for this setting to take effect."));
1306 }
1307 }
1308
1309 ImGui::TableNextRow();
1310 ImGui::TableNextColumn();
1311 ImGui::AlignTextToFramePadding();
1312 ImGui::Text(_("Device"));
1313 ImGui::TableNextColumn();
1314 if (audioEngineChanged) {
1315 ImGui::BeginDisabled();
1316 if (ImGui::BeginCombo("##AudioDevice",_("<click on OK or Apply first>"))) {
1317 ImGui::Text(_("ALERT - TRESPASSER DETECTED"));
1318 if (ImGui::IsItemHovered()) {
1319 showError(_("you have been arrested for trying to engage with a disabled combo box."));
1320 ImGui::CloseCurrentPopup();
1321 }
1322 ImGui::EndCombo();
1323 }
1324 ImGui::EndDisabled();
1325 } else {
1326 String audioDevName=settings.audioDevice.empty()?_("<System default>"):settings.audioDevice;
1327 if (ImGui::BeginCombo("##AudioDevice",audioDevName.c_str())) {
1328 if (ImGui::Selectable(_("<System default>"),settings.audioDevice.empty())) {
1329 settings.audioDevice="";
1330 settingsChanged=true;
1331 }
1332 for (String& i: e->getAudioDevices()) {
1333 if (ImGui::Selectable(i.c_str(),i==settings.audioDevice)) {
1334 settings.audioDevice=i;
1335 settingsChanged=true;
1336 }
1337 }
1338 ImGui::EndCombo();
1339 }
1340 }
1341
1342 ImGui::TableNextRow();
1343 ImGui::TableNextColumn();
1344 ImGui::AlignTextToFramePadding();
1345 ImGui::Text(_("Sample rate"));
1346 ImGui::TableNextColumn();
1347 String sr=fmt::sprintf("%d",settings.audioRate);
1348 if (ImGui::BeginCombo("##SampleRate",sr.c_str())) {
1349 SAMPLE_RATE_SELECTABLE(8000);
1350 SAMPLE_RATE_SELECTABLE(16000);
1351 SAMPLE_RATE_SELECTABLE(22050);
1352 SAMPLE_RATE_SELECTABLE(32000);
1353 SAMPLE_RATE_SELECTABLE(44100);
1354 SAMPLE_RATE_SELECTABLE(48000);
1355 SAMPLE_RATE_SELECTABLE(88200);
1356 SAMPLE_RATE_SELECTABLE(96000);
1357 SAMPLE_RATE_SELECTABLE(192000);
1358 ImGui::EndCombo();
1359 }
1360
1361 ImGui::TableNextRow();
1362 ImGui::TableNextColumn();
1363 ImGui::AlignTextToFramePadding();
1364 ImGui::Text(_("Outputs"));
1365 ImGui::TableNextColumn();
1366 if (ImGui::InputInt("##AudioChansI",&settings.audioChans,1,2)) {
1367 if (settings.audioChans<1) settings.audioChans=1;
1368 if (settings.audioChans>16) settings.audioChans=16;
1369 settingsChanged=true;
1370 }
1371 if (ImGui::IsItemHovered()) {
1372 ImGui::SetTooltip(_("common values:\n- 1 for mono\n- 2 for stereo"));
1373 }
1374
1375 ImGui::TableNextRow();
1376 ImGui::TableNextColumn();
1377 ImGui::AlignTextToFramePadding();
1378 ImGui::Text(_("Buffer size"));
1379 ImGui::TableNextColumn();
1380 String bs=fmt::sprintf(_("%d (latency: ~%.1fms)"),settings.audioBufSize,2000.0*(double)settings.audioBufSize/(double)MAX(1,settings.audioRate));
1381 if (ImGui::BeginCombo("##BufferSize",bs.c_str())) {
1382 BUFFER_SIZE_SELECTABLE(64);
1383 BUFFER_SIZE_SELECTABLE(128);
1384 BUFFER_SIZE_SELECTABLE(256);
1385 BUFFER_SIZE_SELECTABLE(512);
1386 BUFFER_SIZE_SELECTABLE(1024);
1387 BUFFER_SIZE_SELECTABLE(2048);
1388 ImGui::EndCombo();
1389 }
1390 ImGui::EndTable();
1391 }
1392
1393 bool renderPoolThreadsB=(settings.renderPoolThreads>0);
1394 if (ImGui::Checkbox(_("Multi-threaded (EXPERIMENTAL)"),&renderPoolThreadsB)) {
1395 if (renderPoolThreadsB) {
1396 settings.renderPoolThreads=2;
1397 } else {
1398 settings.renderPoolThreads=0;
1399 }
1400 settingsChanged=true;
1401 }
1402 if (ImGui::IsItemHovered()) {
1403 ImGui::SetTooltip(_("runs chip emulation on separate threads.\nmay increase performance when using heavy emulation cores.\n\nwarnings:\n- experimental!\n- only useful on multi-chip songs."));
1404 }
1405
1406 if (renderPoolThreadsB) {
1407 pushWarningColor(settings.renderPoolThreads>cpuCores,settings.renderPoolThreads>cpuCores);
1408 if (ImGui::InputInt(_("Number of threads"),&settings.renderPoolThreads)) {
1409 if (settings.renderPoolThreads<2) settings.renderPoolThreads=2;
1410 if (settings.renderPoolThreads>32) settings.renderPoolThreads=32;
1411 settingsChanged=true;
1412 }
1413 if (settings.renderPoolThreads>=DIV_MAX_CHIPS) {
1414 if (ImGui::IsItemHovered()) {
1415 ImGui::SetTooltip(_("that's the limit!"));
1416 }
1417 } else if (settings.renderPoolThreads>cpuCores) {
1418 if (ImGui::IsItemHovered()) {
1419 ImGui::SetTooltip(_("it is a VERY bad idea to set this number higher than your CPU core count (%d)!"),cpuCores);
1420 }
1421 }
1422 popWarningColor();
1423 }
1424
1425 bool lowLatencyB=settings.lowLatency;
1426 if (ImGui::Checkbox(_("Low-latency mode"),&lowLatencyB)) {
1427 settings.lowLatency=lowLatencyB;
1428 settingsChanged=true;
1429 }
1430 if (ImGui::IsItemHovered()) {
1431 ImGui::SetTooltip(_("reduces latency by running the engine faster than the tick rate.\nuseful for live playback/jam mode.\n\nwarning: only enable if your buffer size is small (10ms or less)."));
1432 }
1433
1434 bool forceMonoB=settings.forceMono;
1435 if (ImGui::Checkbox(_("Force mono audio"),&forceMonoB)) {
1436 settings.forceMono=forceMonoB;
1437 settingsChanged=true;
1438 }
1439
1440 if (settings.audioEngine==DIV_AUDIO_PORTAUDIO) {
1441 if (settings.audioDevice.find("[Windows WASAPI] ")==0) {
1442 bool wasapiExB=settings.wasapiEx;
1443 if (ImGui::Checkbox(_("Exclusive mode"),&wasapiExB)) {
1444 settings.wasapiEx=wasapiExB;
1445 settingsChanged=true;
1446 }
1447 }
1448 }
1449
1450 TAAudioDesc& audioWant=e->getAudioDescWant();
1451 TAAudioDesc& audioGot=e->getAudioDescGot();
1452
1453 #ifdef HAVE_LOCALE
1454 ImGui::Text(ngettext("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans);
1455 ImGui::Text(ngettext("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans);
1456 #else
1457 ImGui::Text(_GN("want: %d samples @ %.0fHz (%d channel)","want: %d samples @ %.0fHz (%d channels)",audioWant.outChans),audioWant.bufsize,audioWant.rate,audioWant.outChans);
1458 ImGui::Text(_GN("got: %d samples @ %.0fHz (%d channel)","got: %d samples @ %.0fHz (%d channels)",audioGot.outChans),audioGot.bufsize,audioGot.rate,audioGot.outChans);
1459 #endif
1460
1461 // SUBSECTION MIXING
1462 CONFIG_SUBSECTION(_("Mixing"));
1463 ImGui::AlignTextToFramePadding();
1464 ImGui::Text(_("Quality"));
1465 ImGui::SameLine();
1466 if (ImGui::Combo("##Quality",&settings.audioQuality,LocalizedComboGetter,audioQualities,2)) settingsChanged=true;
1467
1468 bool clampSamplesB=settings.clampSamples;
1469 if (ImGui::Checkbox(_("Software clipping"),&clampSamplesB)) {
1470 settings.clampSamples=clampSamplesB;
1471 settingsChanged=true;
1472 }
1473
1474 bool audioHiPassB=settings.audioHiPass;
1475 if (ImGui::Checkbox(_("DC offset correction"),&audioHiPassB)) {
1476 settings.audioHiPass=audioHiPassB;
1477 settingsChanged=true;
1478 }
1479
1480 // SUBSECTION METRONOME
1481 CONFIG_SUBSECTION(_("Metronome"));
1482 ImGui::AlignTextToFramePadding();
1483 ImGui::Text(_("Volume"));
1484 ImGui::SameLine();
1485 if (ImGui::SliderInt("##MetroVol",&settings.metroVol,0,200,"%d%%")) {
1486 if (settings.metroVol<0) settings.metroVol=0;
1487 if (settings.metroVol>200) settings.metroVol=200;
1488 e->setMetronomeVol(((float)settings.metroVol)/100.0f);
1489 settingsChanged=true;
1490 }
1491
1492 // SUBSECTION SAMPLE PREVIEW
1493 CONFIG_SUBSECTION(_("Sample preview"));
1494 ImGui::AlignTextToFramePadding();
1495 ImGui::Text(_("Volume"));
1496 ImGui::SameLine();
1497 if (ImGui::SliderInt("##SampleVol",&settings.sampleVol,0,100,"%d%%")) {
1498 if (settings.sampleVol<0) settings.sampleVol=0;
1499 if (settings.sampleVol>100) settings.sampleVol=100;
1500 e->setSamplePreviewVol(((float)settings.sampleVol)/100.0f);
1501 settingsChanged=true;
1502 }
1503
1504 END_SECTION;
1505 }
1506 CONFIG_SECTION(_("MIDI")) {
1507 // SUBSECTION MIDI INPUT
1508 CONFIG_SUBSECTION(_("MIDI input"));
1509 ImGui::AlignTextToFramePadding();
1510 ImGui::Text(_("MIDI input"));
1511 ImGui::SameLine();
1512 String midiInName=settings.midiInDevice.empty()?_("<disabled>"):settings.midiInDevice;
1513 bool hasToReloadMidi=false;
1514 if (ImGui::BeginCombo("##MidiInDevice",midiInName.c_str())) {
1515 if (ImGui::Selectable(_("<disabled>"),settings.midiInDevice.empty())) {
1516 settings.midiInDevice="";
1517 hasToReloadMidi=true;
1518 settingsChanged=true;
1519 }
1520 for (String& i: e->getMidiIns()) {
1521 if (ImGui::Selectable(i.c_str(),i==settings.midiInDevice)) {
1522 settings.midiInDevice=i;
1523 hasToReloadMidi=true;
1524 settingsChanged=true;
1525 }
1526 }
1527 ImGui::EndCombo();
1528 }
1529
1530 ImGui::SameLine();
1531 if (ImGui::Button(_("Re-scan MIDI devices"))) {
1532 e->rescanMidiDevices();
1533 audioEngineChanged=true;
1534 settingsChanged=false;
1535 }
1536
1537 if (hasToReloadMidi) {
1538 midiMap.read(e->getConfigPath()+DIR_SEPARATOR_STR+"midiIn_"+stripName(settings.midiInDevice)+".cfg");
1539 midiMap.compile();
1540 }
1541
1542 if (ImGui::Checkbox(_("Note input"),&midiMap.noteInput)) settingsChanged=true;
1543 if (ImGui::Checkbox(_("Velocity input"),&midiMap.volInput)) settingsChanged=true;
1544 // TODO
1545 //ImGui::Checkbox(_("Use raw velocity value (don't map from linear to log)"),&midiMap.rawVolume);
1546 //ImGui::Checkbox(_("Polyphonic/chord input"),&midiMap.polyInput);
1547 if (ImGui::Checkbox(_("Map MIDI channels to direct channels"),&midiMap.directChannel)) {
1548 e->setMidiDirect(midiMap.directChannel);
1549 e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram);
1550 settingsChanged=true;
1551 }
1552 if (midiMap.directChannel) {
1553 if (ImGui::Checkbox(_("Program change pass-through"),&midiMap.directProgram)) {
1554 e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram);
1555 settingsChanged=true;
1556 }
1557 }
1558 if (ImGui::Checkbox(_("Map Yamaha FM voice data to instruments"),&midiMap.yamahaFMResponse)) settingsChanged=true;
1559 if (!(midiMap.directChannel && midiMap.directProgram)) {
1560 if (ImGui::Checkbox(_("Program change is instrument selection"),&midiMap.programChange)) settingsChanged=true;
1561 }
1562 //ImGui::Checkbox(_("Listen to MIDI clock"),&midiMap.midiClock);
1563 //ImGui::Checkbox(_("Listen to MIDI time code"),&midiMap.midiTimeCode);
1564 if (ImGui::Combo(_("Value input style"),&midiMap.valueInputStyle,LocalizedComboGetter,valueInputStyles,7)) settingsChanged=true;
1565 if (midiMap.valueInputStyle>3) {
1566 if (midiMap.valueInputStyle==6) {
1567 if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputControlSingle,1,16)) {
1568 if (midiMap.valueInputControlSingle<0) midiMap.valueInputControlSingle=0;
1569 if (midiMap.valueInputControlSingle>127) midiMap.valueInputControlSingle=127;
1570 settingsChanged=true;
1571 }
1572 } else {
1573 if (ImGui::InputInt((midiMap.valueInputStyle==4)?_("CC of upper nibble##valueCC1"):_("MSB CC##valueCC1"),&midiMap.valueInputControlMSB,1,16)) {
1574 if (midiMap.valueInputControlMSB<0) midiMap.valueInputControlMSB=0;
1575 if (midiMap.valueInputControlMSB>127) midiMap.valueInputControlMSB=127;
1576 settingsChanged=true;
1577 }
1578 if (ImGui::InputInt((midiMap.valueInputStyle==4)?_("CC of lower nibble##valueCC2"):_("LSB CC##valueCC2"),&midiMap.valueInputControlLSB,1,16)) {
1579 if (midiMap.valueInputControlLSB<0) midiMap.valueInputControlLSB=0;
1580 if (midiMap.valueInputControlLSB>127) midiMap.valueInputControlLSB=127;
1581 settingsChanged=true;
1582 }
1583 }
1584 }
1585 if (ImGui::TreeNode(_("Per-column control change"))) {
1586 for (int i=0; i<18; i++) {
1587 ImGui::PushID(i);
1588 if (ImGui::Combo(specificControls[i],&midiMap.valueInputSpecificStyle[i],LocalizedComboGetter,valueSInputStyles,4)) settingsChanged=true;
1589 if (midiMap.valueInputSpecificStyle[i]>0) {
1590 ImGui::Indent();
1591 if (midiMap.valueInputSpecificStyle[i]==3) {
1592 if (ImGui::InputInt(_("Control##valueCCS"),&midiMap.valueInputSpecificSingle[i],1,16)) {
1593 if (midiMap.valueInputSpecificSingle[i]<0) midiMap.valueInputSpecificSingle[i]=0;
1594 if (midiMap.valueInputSpecificSingle[i]>127) midiMap.valueInputSpecificSingle[i]=127;
1595 settingsChanged=true;
1596 }
1597 } else {
1598 if (ImGui::InputInt((midiMap.valueInputSpecificStyle[i]==4)?_("CC of upper nibble##valueCC1"):_("MSB CC##valueCC1"),&midiMap.valueInputSpecificMSB[i],1,16)) {
1599 if (midiMap.valueInputSpecificMSB[i]<0) midiMap.valueInputSpecificMSB[i]=0;
1600 if (midiMap.valueInputSpecificMSB[i]>127) midiMap.valueInputSpecificMSB[i]=127;
1601 settingsChanged=true;
1602 }
1603 if (ImGui::InputInt((midiMap.valueInputSpecificStyle[i]==4)?_("CC of lower nibble##valueCC2"):_("LSB CC##valueCC2"),&midiMap.valueInputSpecificLSB[i],1,16)) {
1604 if (midiMap.valueInputSpecificLSB[i]<0) midiMap.valueInputSpecificLSB[i]=0;
1605 if (midiMap.valueInputSpecificLSB[i]>127) midiMap.valueInputSpecificLSB[i]=127;
1606 settingsChanged=true;
1607 }
1608 }
1609 ImGui::Unindent();
1610 }
1611 ImGui::PopID();
1612 }
1613 ImGui::TreePop();
1614 }
1615 if (ImGui::SliderFloat(_("Volume curve"),&midiMap.volExp,0.01,8.0,"%.2f")) {
1616 if (midiMap.volExp<0.01) midiMap.volExp=0.01;
1617 if (midiMap.volExp>8.0) midiMap.volExp=8.0;
1618 e->setMidiVolExp(midiMap.volExp);
1619 settingsChanged=true;
1620 } rightClickable
1621 float curve[128];
1622 for (int i=0; i<128; i++) {
1623 curve[i]=(int)(pow((double)i/127.0,midiMap.volExp)*127.0);
1624 }
1625 ImGui::PlotLines("##VolCurveDisplay",curve,128,0,_("Volume curve"),0.0,127.0,ImVec2(200.0f*dpiScale,200.0f*dpiScale));
1626
1627 ImGui::AlignTextToFramePadding();
1628 ImGui::Text(_("Actions:"));
1629 ImGui::SameLine();
1630 if (ImGui::Button(ICON_FA_PLUS "##AddAction")) {
1631 midiMap.binds.push_back(MIDIBind());
1632 settingsChanged=true;
1633 }
1634 ImGui::SameLine();
1635 if (ImGui::Button(ICON_FA_EXTERNAL_LINK "##AddLearnAction")) {
1636 midiMap.binds.push_back(MIDIBind());
1637 learning=midiMap.binds.size()-1;
1638 settingsChanged=true;
1639 }
1640 if (learning!=-1) {
1641 ImGui::SameLine();
1642 ImGui::Text(_("(learning! press a button or move a slider/knob/something on your device.)"));
1643 }
1644
1645 if (ImGui::BeginTable("MIDIActions",7)) {
1646 ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,0.2);
1647 ImGui::TableSetupColumn("c1",ImGuiTableColumnFlags_WidthStretch,0.1);
1648 ImGui::TableSetupColumn("c2",ImGuiTableColumnFlags_WidthStretch,0.3);
1649 ImGui::TableSetupColumn("c3",ImGuiTableColumnFlags_WidthStretch,0.2);
1650 ImGui::TableSetupColumn("c4",ImGuiTableColumnFlags_WidthStretch,0.5);
1651 ImGui::TableSetupColumn("c5",ImGuiTableColumnFlags_WidthFixed);
1652 ImGui::TableSetupColumn("c6",ImGuiTableColumnFlags_WidthFixed);
1653
1654 ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
1655 ImGui::TableNextColumn();
1656 ImGui::Text(_("Type"));
1657 ImGui::TableNextColumn();
1658 ImGui::Text(_("Channel"));
1659 ImGui::TableNextColumn();
1660 ImGui::Text(_("Note/Control"));
1661 ImGui::TableNextColumn();
1662 ImGui::Text(_("Velocity/Value"));
1663 ImGui::TableNextColumn();
1664 ImGui::Text(_("Action"));
1665 ImGui::TableNextColumn();
1666 ImGui::TableNextColumn();
1667
1668 for (size_t i=0; i<midiMap.binds.size(); i++) {
1669 MIDIBind& bind=midiMap.binds[i];
1670 char bindID[1024];
1671 ImGui::PushID(i);
1672 ImGui::TableNextRow();
1673
1674 ImGui::TableNextColumn();
1675 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1676 if (ImGui::BeginCombo("##BType",messageTypes[bind.type])) {
1677 for (int j=8; j<15; j++) {
1678 if (ImGui::Selectable(messageTypes[j],bind.type==j)) {
1679 bind.type=j;
1680 settingsChanged=true;
1681 }
1682 }
1683 ImGui::EndCombo();
1684 }
1685
1686 ImGui::TableNextColumn();
1687 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1688 if (ImGui::BeginCombo("##BChannel",messageChannels[bind.channel])) {
1689 if (ImGui::Selectable(messageChannels[16],bind.channel==16)) {
1690 bind.channel=16;
1691 settingsChanged=true;
1692 }
1693 for (int j=0; j<16; j++) {
1694 if (ImGui::Selectable(messageChannels[j],bind.channel==j)) {
1695 bind.channel=j;
1696 settingsChanged=true;
1697 }
1698 }
1699 ImGui::EndCombo();
1700 }
1701
1702 ImGui::TableNextColumn();
1703 if (bind.data1==128) {
1704 snprintf(bindID,1024,_("Any"));
1705 } else {
1706 const char* nName="???";
1707 if ((bind.data1+60)>0 && (bind.data1+60)<180) {
1708 nName=noteNames[bind.data1+60];
1709 }
1710 snprintf(bindID,1024,"%d (0x%.2X, %s)",bind.data1,bind.data1,nName);
1711 }
1712 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1713 if (ImGui::BeginCombo("##BValue1",bindID)) {
1714 if (ImGui::Selectable(_("Any"),bind.data1==128)) {
1715 bind.data1=128;
1716 settingsChanged=true;
1717 }
1718 for (int j=0; j<128; j++) {
1719 const char* nName="???";
1720 if ((j+60)>0 && (j+60)<180) {
1721 nName=noteNames[j+60];
1722 }
1723 snprintf(bindID,1024,"%d (0x%.2X, %s)##BV1_%d",j,j,nName,j);
1724 if (ImGui::Selectable(bindID,bind.data1==j)) {
1725 bind.data1=j;
1726 settingsChanged=true;
1727 }
1728 }
1729 ImGui::EndCombo();
1730 }
1731
1732 ImGui::TableNextColumn();
1733 if (bind.data2==128) {
1734 snprintf(bindID,1024,_("Any"));
1735 } else {
1736 snprintf(bindID,1024,"%d (0x%.2X)",bind.data2,bind.data2);
1737 }
1738 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1739 if (ImGui::BeginCombo("##BValue2",bindID)) {
1740 if (ImGui::Selectable(_("Any"),bind.data2==128)) {
1741 bind.data2=128;
1742 settingsChanged=true;
1743 }
1744 for (int j=0; j<128; j++) {
1745 snprintf(bindID,1024,"%d (0x%.2X)##BV2_%d",j,j,j);
1746 if (ImGui::Selectable(bindID,bind.data2==j)) {
1747 bind.data2=j;
1748 settingsChanged=true;
1749 }
1750 }
1751 ImGui::EndCombo();
1752 }
1753
1754 ImGui::TableNextColumn();
1755 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1756 if (ImGui::BeginCombo("##BAction",(bind.action==0)?_("--none--"):guiActions[bind.action].friendlyName)) {
1757 if (ImGui::Selectable(_("--none--"),bind.action==0)) {
1758 bind.action=0;
1759 settingsChanged=true;
1760 }
1761 for (int j=0; j<GUI_ACTION_MAX; j++) {
1762 if (strcmp(guiActions[j].friendlyName,"")==0) continue;
1763 if (strstr(guiActions[j].friendlyName,"---")==guiActions[j].friendlyName) {
1764 ImGui::TextUnformatted(guiActions[j].friendlyName);
1765 } else {
1766 snprintf(bindID,1024,"%s##BA_%d",_(guiActions[j].friendlyName),j);
1767 if (ImGui::Selectable(bindID,bind.action==j)) {
1768 bind.action=j;
1769 settingsChanged=true;
1770 }
1771 }
1772 }
1773 ImGui::EndCombo();
1774 }
1775
1776 ImGui::TableNextColumn();
1777 pushToggleColors(learning==(int)i);
1778 if (ImGui::Button((learning==(int)i)?(_("waiting...##BLearn")):(_("Learn##BLearn")))) {
1779 if (learning==(int)i) {
1780 learning=-1;
1781 } else {
1782 learning=i;
1783 }
1784 settingsChanged=true;
1785 }
1786 popToggleColors();
1787
1788 ImGui::TableNextColumn();
1789 if (ImGui::Button(ICON_FA_TIMES "##BRemove")) {
1790 midiMap.binds.erase(midiMap.binds.begin()+i);
1791 if (learning==(int)i) learning=-1;
1792 i--;
1793 settingsChanged=true;
1794 }
1795
1796 ImGui::PopID();
1797 }
1798 ImGui::EndTable();
1799 }
1800
1801 // SUBSECTION MIDI OUTPUT
1802 CONFIG_SUBSECTION(_("MIDI output"));
1803 ImGui::AlignTextToFramePadding();
1804 ImGui::Text(_("MIDI output"));
1805 ImGui::SameLine();
1806 String midiOutName=settings.midiOutDevice.empty()?_("<disabled>"):settings.midiOutDevice;
1807 if (ImGui::BeginCombo("##MidiOutDevice",midiOutName.c_str())) {
1808 if (ImGui::Selectable(_("<disabled>"),settings.midiOutDevice.empty())) {
1809 settings.midiOutDevice="";
1810 settingsChanged=true;
1811 }
1812 for (String& i: e->getMidiIns()) {
1813 if (ImGui::Selectable(i.c_str(),i==settings.midiOutDevice)) {
1814 settings.midiOutDevice=i;
1815 settingsChanged=true;
1816 }
1817 }
1818 ImGui::EndCombo();
1819 }
1820
1821 ImGui::Text(_("Output mode:"));
1822 ImGui::Indent();
1823 if (ImGui::RadioButton(_("Off (use for TX81Z)"),settings.midiOutMode==0)) {
1824 settings.midiOutMode=0;
1825 settingsChanged=true;
1826 }
1827 if (ImGui::RadioButton(_("Melodic"),settings.midiOutMode==1)) {
1828 settings.midiOutMode=1;
1829 settingsChanged=true;
1830 }
1831 /*
1832 if (ImGui::RadioButton(_("Light Show (use for Launchpad)"),settings.midiOutMode==2)) {
1833 settings.midiOutMode=2;
1834 }*/
1835 ImGui::Unindent();
1836
1837 bool midiOutProgramChangeB=settings.midiOutProgramChange;
1838 if (ImGui::Checkbox(_("Send Program Change"),&midiOutProgramChangeB)) {
1839 settings.midiOutProgramChange=midiOutProgramChangeB;
1840 settingsChanged=true;
1841 }
1842
1843 bool midiOutClockB=settings.midiOutClock;
1844 if (ImGui::Checkbox(_("Send MIDI clock"),&midiOutClockB)) {
1845 settings.midiOutClock=midiOutClockB;
1846 settingsChanged=true;
1847 }
1848
1849 bool midiOutTimeB=settings.midiOutTime;
1850 if (ImGui::Checkbox(_("Send MIDI timecode"),&midiOutTimeB)) {
1851 settings.midiOutTime=midiOutTimeB;
1852 settingsChanged=true;
1853 }
1854
1855 if (settings.midiOutTime) {
1856 ImGui::Text(_("Timecode frame rate:"));
1857 ImGui::Indent();
1858 if (ImGui::RadioButton(_("Closest to Tick Rate"),settings.midiOutTimeRate==0)) {
1859 settings.midiOutTimeRate=0;
1860 settingsChanged=true;
1861 }
1862 if (ImGui::RadioButton(_("Film (24fps)"),settings.midiOutTimeRate==1)) {
1863 settings.midiOutTimeRate=1;
1864 settingsChanged=true;
1865 }
1866 if (ImGui::RadioButton(_("PAL (25fps)"),settings.midiOutTimeRate==2)) {
1867 settings.midiOutTimeRate=2;
1868 settingsChanged=true;
1869 }
1870 if (ImGui::RadioButton(_("NTSC drop (29.97fps)"),settings.midiOutTimeRate==3)) {
1871 settings.midiOutTimeRate=3;
1872 settingsChanged=true;
1873 }
1874 if (ImGui::RadioButton(_("NTSC non-drop (30fps)"),settings.midiOutTimeRate==4)) {
1875 settings.midiOutTimeRate=4;
1876 settingsChanged=true;
1877 }
1878 ImGui::Unindent();
1879 }
1880
1881 END_SECTION;
1882 }
1883 CONFIG_SECTION(_("Emulation")) {
1884 // SUBSECTION CORES
1885 CONFIG_SUBSECTION(_("Cores"));
1886 if (ImGui::BeginTable("##Cores",3)) {
1887 ImGui::TableSetupColumn("##System",ImGuiTableColumnFlags_WidthFixed);
1888 ImGui::TableSetupColumn("##PlaybackCores",ImGuiTableColumnFlags_WidthStretch);
1889 ImGui::TableSetupColumn("##RenderCores",ImGuiTableColumnFlags_WidthStretch);
1890 ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
1891 ImGui::TableNextColumn();
1892 ImGui::Text(_("System"));
1893 ImGui::TableNextColumn();
1894 ImGui::Text(_("Playback Core(s)"));
1895 if (ImGui::IsItemHovered()) {
1896 ImGui::SetTooltip(_("used for playback"));
1897 }
1898 ImGui::TableNextColumn();
1899 ImGui::Text(_("Render Core(s)"));
1900 if (ImGui::IsItemHovered()) {
1901 ImGui::SetTooltip(_("used in audio export"));
1902 }
1903
1904 ImGui::TableNextRow();
1905 ImGui::TableNextColumn();
1906 ImGui::AlignTextToFramePadding();
1907 ImGui::Text("YM2151");
1908 ImGui::TableNextColumn();
1909 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1910 if (ImGui::Combo("##ArcadeCore",&settings.arcadeCore,arcadeCores,2)) settingsChanged=true;
1911 ImGui::TableNextColumn();
1912 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1913 if (ImGui::Combo("##ArcadeCoreRender",&settings.arcadeCoreRender,arcadeCores,2)) settingsChanged=true;
1914
1915 ImGui::TableNextRow();
1916 ImGui::TableNextColumn();
1917 ImGui::AlignTextToFramePadding();
1918 ImGui::Text("YM2612");
1919 ImGui::TableNextColumn();
1920 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1921 if (ImGui::Combo("##YM2612Core",&settings.ym2612Core,ym2612Cores,3)) settingsChanged=true;
1922 ImGui::TableNextColumn();
1923 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1924 if (ImGui::Combo("##YM2612CoreRender",&settings.ym2612CoreRender,ym2612Cores,3)) settingsChanged=true;
1925
1926 ImGui::TableNextRow();
1927 ImGui::TableNextColumn();
1928 ImGui::AlignTextToFramePadding();
1929 ImGui::Text("SN76489");
1930 ImGui::TableNextColumn();
1931 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1932 if (ImGui::Combo("##SNCore",&settings.snCore,snCores,2)) settingsChanged=true;
1933 ImGui::TableNextColumn();
1934 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1935 if (ImGui::Combo("##SNCoreRender",&settings.snCoreRender,snCores,2)) settingsChanged=true;
1936
1937 ImGui::TableNextRow();
1938 ImGui::TableNextColumn();
1939 ImGui::AlignTextToFramePadding();
1940 ImGui::Text("NES");
1941 ImGui::TableNextColumn();
1942 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1943 if (ImGui::Combo("##NESCore",&settings.nesCore,nesCores,2)) settingsChanged=true;
1944 ImGui::TableNextColumn();
1945 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1946 if (ImGui::Combo("##NESCoreRender",&settings.nesCoreRender,nesCores,2)) settingsChanged=true;
1947
1948 ImGui::TableNextRow();
1949 ImGui::TableNextColumn();
1950 ImGui::AlignTextToFramePadding();
1951 ImGui::Text("FDS");
1952 ImGui::TableNextColumn();
1953 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1954 if (ImGui::Combo("##FDSCore",&settings.fdsCore,nesCores,2)) settingsChanged=true;
1955 ImGui::TableNextColumn();
1956 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1957 if (ImGui::Combo("##FDSCoreRender",&settings.fdsCoreRender,nesCores,2)) settingsChanged=true;
1958
1959 ImGui::TableNextRow();
1960 ImGui::TableNextColumn();
1961 ImGui::AlignTextToFramePadding();
1962 ImGui::Text("SID");
1963 ImGui::TableNextColumn();
1964 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1965 if (ImGui::Combo("##C64Core",&settings.c64Core,c64Cores,3)) settingsChanged=true;
1966 ImGui::TableNextColumn();
1967 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1968 if (ImGui::Combo("##C64CoreRender",&settings.c64CoreRender,c64Cores,3)) settingsChanged=true;
1969
1970 ImGui::TableNextRow();
1971 ImGui::TableNextColumn();
1972 ImGui::AlignTextToFramePadding();
1973 ImGui::Text("POKEY");
1974 ImGui::TableNextColumn();
1975 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1976 if (ImGui::Combo("##POKEYCore",&settings.pokeyCore,pokeyCores,2)) settingsChanged=true;
1977 ImGui::TableNextColumn();
1978 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1979 if (ImGui::Combo("##POKEYCoreRender",&settings.pokeyCoreRender,pokeyCores,2)) settingsChanged=true;
1980
1981 ImGui::TableNextRow();
1982 ImGui::TableNextColumn();
1983 ImGui::AlignTextToFramePadding();
1984 ImGui::Text("OPN");
1985 ImGui::TableNextColumn();
1986 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1987 if (ImGui::Combo("##OPNCore",&settings.opn1Core,opnCores,3)) settingsChanged=true;
1988 ImGui::TableNextColumn();
1989 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1990 if (ImGui::Combo("##OPNCoreRender",&settings.opn1CoreRender,opnCores,3)) settingsChanged=true;
1991
1992 ImGui::TableNextRow();
1993 ImGui::TableNextColumn();
1994 ImGui::AlignTextToFramePadding();
1995 ImGui::Text("OPNA");
1996 ImGui::TableNextColumn();
1997 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
1998 if (ImGui::Combo("##OPNACore",&settings.opnaCore,opnCores,3)) settingsChanged=true;
1999 ImGui::TableNextColumn();
2000 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2001 if (ImGui::Combo("##OPNACoreRender",&settings.opnaCoreRender,opnCores,3)) settingsChanged=true;
2002
2003 ImGui::TableNextRow();
2004 ImGui::TableNextColumn();
2005 ImGui::AlignTextToFramePadding();
2006 ImGui::Text("OPNB");
2007 ImGui::TableNextColumn();
2008 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2009 if (ImGui::Combo("##OPNBCore",&settings.opnbCore,opnCores,3)) settingsChanged=true;
2010 ImGui::TableNextColumn();
2011 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2012 if (ImGui::Combo("##OPNBCoreRender",&settings.opnbCoreRender,opnCores,3)) settingsChanged=true;
2013
2014 ImGui::TableNextRow();
2015 ImGui::TableNextColumn();
2016 ImGui::AlignTextToFramePadding();
2017 ImGui::Text("OPL/OPL2/Y8950");
2018 ImGui::TableNextColumn();
2019 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2020 if (ImGui::Combo("##OPL2Core",&settings.opl2Core,opl2Cores,3)) settingsChanged=true;
2021 ImGui::TableNextColumn();
2022 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2023 if (ImGui::Combo("##OPL2CoreRender",&settings.opl2CoreRender,opl2Cores,3)) settingsChanged=true;
2024
2025 ImGui::TableNextRow();
2026 ImGui::TableNextColumn();
2027 ImGui::AlignTextToFramePadding();
2028 ImGui::Text("OPL3");
2029 ImGui::TableNextColumn();
2030 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2031 if (ImGui::Combo("##OPL3Core",&settings.opl3Core,opl3Cores,3)) settingsChanged=true;
2032 ImGui::TableNextColumn();
2033 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2034 if (ImGui::Combo("##OPL3CoreRender",&settings.opl3CoreRender,opl3Cores,3)) settingsChanged=true;
2035
2036 ImGui::TableNextRow();
2037 ImGui::TableNextColumn();
2038 ImGui::AlignTextToFramePadding();
2039 ImGui::Text("OPL4");
2040 ImGui::TableNextColumn();
2041 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2042 if (ImGui::Combo("##OPL4Core",&settings.opl4Core,opl4Cores,2)) settingsChanged=true;
2043 ImGui::TableNextColumn();
2044 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2045 if (ImGui::Combo("##OPL4CoreRender",&settings.opl4CoreRender,opl4Cores,2)) settingsChanged=true;
2046
2047 ImGui::TableNextRow();
2048 ImGui::TableNextColumn();
2049 ImGui::AlignTextToFramePadding();
2050 ImGui::Text("ESFM");
2051 ImGui::TableNextColumn();
2052 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2053 if (ImGui::Combo("##ESFMCore",&settings.esfmCore,LocalizedComboGetter,esfmCores,2)) settingsChanged=true;
2054 ImGui::TableNextColumn();
2055 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2056 if (ImGui::Combo("##ESFMCoreRender",&settings.esfmCoreRender,LocalizedComboGetter,esfmCores,2)) settingsChanged=true;
2057
2058 ImGui::TableNextRow();
2059 ImGui::TableNextColumn();
2060 ImGui::AlignTextToFramePadding();
2061 ImGui::Text("OPLL");
2062 ImGui::TableNextColumn();
2063 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2064 if (ImGui::Combo("##OPLLCore",&settings.opllCore,opllCores,2)) settingsChanged=true;
2065 ImGui::TableNextColumn();
2066 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2067 if (ImGui::Combo("##OPLLCoreRender",&settings.opllCoreRender,opllCores,2)) settingsChanged=true;
2068
2069 ImGui::TableNextRow();
2070 ImGui::TableNextColumn();
2071 ImGui::AlignTextToFramePadding();
2072 ImGui::Text("AY-3-8910/SSG");
2073 ImGui::TableNextColumn();
2074 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2075 if (ImGui::Combo("##AYCore",&settings.ayCore,ayCores,2)) settingsChanged=true;
2076 ImGui::TableNextColumn();
2077 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2078 if (ImGui::Combo("##AYCoreRender",&settings.ayCoreRender,ayCores,2)) settingsChanged=true;
2079
2080 ImGui::TableNextRow();
2081 ImGui::TableNextColumn();
2082 ImGui::AlignTextToFramePadding();
2083 ImGui::Text("WonderSwan");
2084 ImGui::TableNextColumn();
2085 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2086 if (ImGui::Combo("##SwanCore",&settings.swanCore,swanCores,2)) settingsChanged=true;
2087 ImGui::TableNextColumn();
2088 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
2089 if (ImGui::Combo("##SwanCoreRender",&settings.swanCoreRender,swanCores,2)) settingsChanged=true;
2090
2091 ImGui::EndTable();
2092 }
2093
2094 // SUBSECTION OTHER
2095 CONFIG_SUBSECTION(_("Quality"));
2096 if (ImGui::BeginTable("##CoreQual",3)) {
2097 ImGui::TableSetupColumn("##System",ImGuiTableColumnFlags_WidthFixed);
2098 ImGui::TableSetupColumn("##PlaybackCores",ImGuiTableColumnFlags_WidthStretch);
2099 ImGui::TableSetupColumn("##RenderCores",ImGuiTableColumnFlags_WidthStretch);
2100 ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
2101 ImGui::TableNextColumn();
2102 ImGui::Text(_("System"));
2103 ImGui::TableNextColumn();
2104 ImGui::Text(_("Playback"));
2105 if (ImGui::IsItemHovered()) {
2106 ImGui::SetTooltip(_("used for playback"));
2107 }
2108 ImGui::TableNextColumn();
2109 ImGui::Text(_("Render"));
2110 if (ImGui::IsItemHovered()) {
2111 ImGui::SetTooltip(_("used in audio export"));
2112 }
2113
2114 CORE_QUALITY("Game Boy",gbQuality,gbQualityRender);
2115 CORE_QUALITY("PowerNoise",pnQuality,pnQualityRender);
2116 CORE_QUALITY("SAA1099",saaQuality,saaQualityRender);
2117 CORE_QUALITY("SID (dSID)",dsidQuality,dsidQualityRender);
2118
2119 ImGui::EndTable();
2120 }
2121
2122 // SUBSECTION OTHER
2123 CONFIG_SUBSECTION(_("Other"));
2124
2125 ImGui::AlignTextToFramePadding();
2126 ImGui::Text(_("PC Speaker strategy"));
2127 ImGui::SameLine();
2128 if (ImGui::Combo("##PCSOutMethod",&settings.pcSpeakerOutMethod,LocalizedComboGetter,pcspkrOutMethods,5)) settingsChanged=true;
2129
2130 ImGui::Separator();
2131 ImGui::Text(_("Sample ROMs:"));
2132
2133 ImGui::AlignTextToFramePadding();
2134 ImGui::Text(_("OPL4 YRW801 path"));
2135 ImGui::SameLine();
2136 ImGui::InputText("##YRW801Path",&settings.yrw801Path);
2137 ImGui::SameLine();
2138 if (ImGui::Button(ICON_FA_FOLDER "##YRW801Load")) {
2139 openFileDialog(GUI_FILE_YRW801_ROM_OPEN);
2140 }
2141
2142 /*
2143 ImGui::AlignTextToFramePadding();
2144 ImGui::Text(_("MultiPCM TG100 path"));
2145 ImGui::SameLine();
2146 ImGui::InputText("##TG100Path",&settings.tg100Path);
2147 ImGui::SameLine();
2148 if (ImGui::Button(ICON_FA_FOLDER "##TG100Load")) {
2149 openFileDialog(GUI_FILE_TG100_ROM_OPEN);
2150 }
2151
2152 ImGui::AlignTextToFramePadding();
2153 ImGui::Text(_("MultiPCM MU5 path"));
2154 ImGui::SameLine();
2155 ImGui::InputText("##MU5Path",&settings.mu5Path);
2156 ImGui::SameLine();
2157 if (ImGui::Button(ICON_FA_FOLDER "##MU5Load")) {
2158 openFileDialog(GUI_FILE_MU5_ROM_OPEN);
2159 }
2160 */
2161
2162 END_SECTION;
2163 }
2164 CONFIG_SECTION(_("Keyboard")) {
2165 // SUBSECTION LAYOUT
2166 CONFIG_SUBSECTION(_("Keyboard"));
2167 if (ImGui::Button(_("Import"))) {
2168 openFileDialog(GUI_FILE_IMPORT_KEYBINDS);
2169 }
2170 ImGui::SameLine();
2171 if (ImGui::Button(_("Export"))) {
2172 openFileDialog(GUI_FILE_EXPORT_KEYBINDS);
2173 }
2174 ImGui::SameLine();
2175 if (ImGui::Button(_("Reset defaults"))) {
2176 showWarning(_("Are you sure you want to reset the keyboard settings?"),GUI_WARN_RESET_KEYBINDS);
2177 }
2178 if (ImGui::BeginChild("##HotkeysList",ImVec2(0,0),0,ImGuiWindowFlags_HorizontalScrollbar)) {
2179 if (ImGui::TreeNode(_("Global hotkeys"))) {
2180 KEYBIND_CONFIG_BEGIN("keysGlobal");
2181
2182 drawKeybindSettingsTableRow(GUI_ACTION_NEW);
2183 drawKeybindSettingsTableRow(GUI_ACTION_CLEAR);
2184 drawKeybindSettingsTableRow(GUI_ACTION_OPEN);
2185 drawKeybindSettingsTableRow(GUI_ACTION_OPEN_BACKUP);
2186 drawKeybindSettingsTableRow(GUI_ACTION_SAVE);
2187 drawKeybindSettingsTableRow(GUI_ACTION_SAVE_AS);
2188 drawKeybindSettingsTableRow(GUI_ACTION_EXPORT);
2189 drawKeybindSettingsTableRow(GUI_ACTION_UNDO);
2190 drawKeybindSettingsTableRow(GUI_ACTION_REDO);
2191 drawKeybindSettingsTableRow(GUI_ACTION_PLAY_TOGGLE);
2192 drawKeybindSettingsTableRow(GUI_ACTION_PLAY);
2193 drawKeybindSettingsTableRow(GUI_ACTION_STOP);
2194 drawKeybindSettingsTableRow(GUI_ACTION_PLAY_START);
2195 drawKeybindSettingsTableRow(GUI_ACTION_PLAY_REPEAT);
2196 drawKeybindSettingsTableRow(GUI_ACTION_PLAY_CURSOR);
2197 drawKeybindSettingsTableRow(GUI_ACTION_STEP_ONE);
2198 drawKeybindSettingsTableRow(GUI_ACTION_OCTAVE_UP);
2199 drawKeybindSettingsTableRow(GUI_ACTION_OCTAVE_DOWN);
2200 drawKeybindSettingsTableRow(GUI_ACTION_INS_UP);
2201 drawKeybindSettingsTableRow(GUI_ACTION_INS_DOWN);
2202 drawKeybindSettingsTableRow(GUI_ACTION_STEP_UP);
2203 drawKeybindSettingsTableRow(GUI_ACTION_STEP_DOWN);
2204 drawKeybindSettingsTableRow(GUI_ACTION_TOGGLE_EDIT);
2205 drawKeybindSettingsTableRow(GUI_ACTION_METRONOME);
2206 drawKeybindSettingsTableRow(GUI_ACTION_ORDER_LOCK);
2207 drawKeybindSettingsTableRow(GUI_ACTION_REPEAT_PATTERN);
2208 drawKeybindSettingsTableRow(GUI_ACTION_FOLLOW_ORDERS);
2209 drawKeybindSettingsTableRow(GUI_ACTION_FOLLOW_PATTERN);
2210 drawKeybindSettingsTableRow(GUI_ACTION_FULLSCREEN);
2211 drawKeybindSettingsTableRow(GUI_ACTION_TX81Z_REQUEST);
2212 drawKeybindSettingsTableRow(GUI_ACTION_PANIC);
2213
2214 KEYBIND_CONFIG_END;
2215 ImGui::TreePop();
2216 }
2217 if (ImGui::TreeNode(_("Window activation"))) {
2218 KEYBIND_CONFIG_BEGIN("keysWindow");
2219
2220 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_FIND);
2221 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SETTINGS);
2222 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SONG_INFO);
2223 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SUBSONGS);
2224 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SPEED);
2225 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_INS_LIST);
2226 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_WAVE_LIST);
2227 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SAMPLE_LIST);
2228 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_ORDERS);
2229 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PATTERN);
2230 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_MIXER);
2231 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_GROOVES);
2232 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CHANNELS);
2233 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PAT_MANAGER);
2234 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SYS_MANAGER);
2235 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_COMPAT_FLAGS);
2236 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_NOTES);
2237 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_INS_EDIT);
2238 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_WAVE_EDIT);
2239 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_SAMPLE_EDIT);
2240 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_EDIT_CONTROLS);
2241 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_PIANO);
2242 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_OSCILLOSCOPE);
2243 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CHAN_OSC);
2244 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_XY_OSC);
2245 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_VOL_METER);
2246 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CLOCK);
2247 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_REGISTER_VIEW);
2248 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_LOG);
2249 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_STATS);
2250 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_MEMORY);
2251 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_EFFECT_LIST);
2252 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_DEBUG);
2253 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_CS_PLAYER);
2254 drawKeybindSettingsTableRow(GUI_ACTION_WINDOW_ABOUT);
2255 drawKeybindSettingsTableRow(GUI_ACTION_COLLAPSE_WINDOW);
2256 drawKeybindSettingsTableRow(GUI_ACTION_CLOSE_WINDOW);
2257
2258 drawKeybindSettingsTableRow(GUI_ACTION_COMMAND_PALETTE);
2259 drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_RECENT);
2260 drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_INSTRUMENTS);
2261 drawKeybindSettingsTableRow(GUI_ACTION_CMDPAL_SAMPLES);
2262
2263 KEYBIND_CONFIG_END;
2264 ImGui::TreePop();
2265 }
2266 if (ImGui::TreeNode(_("Note input"))) {
2267 if (ImGui::BeginTable("keysNoteInput",4)) {
2268 static char id[4096];
2269
2270 ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
2271 ImGui::TableNextColumn();
2272 ImGui::Text(_("Key"));
2273 ImGui::TableNextColumn();
2274 ImGui::Text(_("Type"));
2275 ImGui::TableNextColumn();
2276 ImGui::Text(_("Value"));
2277 ImGui::TableNextColumn();
2278 ImGui::Text(_("Remove"));
2279
2280 for (size_t _i=0; _i<noteKeysRaw.size(); _i++) {
2281 MappedInput& i=noteKeysRaw[_i];
2282 ImGui::TableNextRow();
2283 ImGui::TableNextColumn();
2284 ImGui::Text("%s",SDL_GetScancodeName((SDL_Scancode)i.scan));
2285 ImGui::TableNextColumn();
2286 if (i.val==102) {
2287 snprintf(id,4095,_("Macro release##SNType_%d"),i.scan);
2288 if (ImGui::Button(id)) {
2289 i.val=0;
2290 }
2291 } else if (i.val==101) {
2292 snprintf(id,4095,_("Note release##SNType_%d"),i.scan);
2293 if (ImGui::Button(id)) {
2294 i.val=102;
2295 }
2296 } else if (i.val==100) {
2297 snprintf(id,4095,_("Note off##SNType_%d"),i.scan);
2298 if (ImGui::Button(id)) {
2299 i.val=101;
2300 }
2301 } else {
2302 snprintf(id,4095,_("Note##SNType_%d"),i.scan);
2303 if (ImGui::Button(id)) {
2304 i.val=100;
2305 }
2306 }
2307 ImGui::TableNextColumn();
2308 if (i.val<100) {
2309 snprintf(id,4095,"##SNValue_%d",i.scan);
2310 if (ImGui::InputInt(id,&i.val,1,12)) {
2311 if (i.val<0) i.val=0;
2312 if (i.val>96) i.val=96;
2313 settingsChanged=true;
2314 }
2315 }
2316 ImGui::TableNextColumn();
2317 snprintf(id,4095,ICON_FA_TIMES "##SNRemove_%d",i.scan);
2318 if (ImGui::Button(id)) {
2319 noteKeysRaw.erase(noteKeysRaw.begin()+_i);
2320 _i--;
2321 settingsChanged=true;
2322 }
2323 }
2324 ImGui::EndTable();
2325
2326 if (ImGui::BeginCombo("##SNAddNew",_("Add..."))) {
2327 for (int i=0; i<SDL_NUM_SCANCODES; i++) {
2328 const char* sName=SDL_GetScancodeName((SDL_Scancode)i);
2329 if (sName==NULL) continue;
2330 if (sName[0]==0) continue;
2331 snprintf(id,4095,"%s##SNNewKey_%d",sName,i);
2332 if (ImGui::Selectable(id)) {
2333 bool alreadyThere=false;
2334 for (MappedInput& j: noteKeysRaw) {
2335 if (j.scan==i) {
2336 alreadyThere=true;
2337 break;
2338 }
2339 }
2340 if (alreadyThere) {
2341 showError(_("that key is bound already!"));
2342 } else {
2343 noteKeysRaw.push_back(MappedInput(i,0));
2344 settingsChanged=true;
2345 }
2346 }
2347 }
2348 ImGui::EndCombo();
2349 }
2350 }
2351 ImGui::TreePop();
2352 }
2353 if (ImGui::TreeNode(_("Pattern"))) {
2354 KEYBIND_CONFIG_BEGIN("keysPattern");
2355
2356 drawKeybindSettingsTableRow(GUI_ACTION_PAT_NOTE_UP);
2357 drawKeybindSettingsTableRow(GUI_ACTION_PAT_NOTE_DOWN);
2358 drawKeybindSettingsTableRow(GUI_ACTION_PAT_OCTAVE_UP);
2359 drawKeybindSettingsTableRow(GUI_ACTION_PAT_OCTAVE_DOWN);
2360 drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_UP);
2361 drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_DOWN);
2362 drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_UP_COARSE);
2363 drawKeybindSettingsTableRow(GUI_ACTION_PAT_VALUE_DOWN_COARSE);
2364 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECT_ALL);
2365 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CUT);
2366 drawKeybindSettingsTableRow(GUI_ACTION_PAT_COPY);
2367 drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE);
2368 drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_MIX);
2369 drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_MIX_BG);
2370 drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_FLOOD);
2371 drawKeybindSettingsTableRow(GUI_ACTION_PAT_PASTE_OVERFLOW);
2372 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UP);
2373 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_DOWN);
2374 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_LEFT);
2375 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_RIGHT);
2376 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UP_ONE);
2377 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_DOWN_ONE);
2378 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_LEFT_CHANNEL);
2379 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_RIGHT_CHANNEL);
2380 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_PREVIOUS_CHANNEL);
2381 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_NEXT_CHANNEL);
2382 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_BEGIN);
2383 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_END);
2384 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UP_COARSE);
2385 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_DOWN_COARSE);
2386 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_UP);
2387 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_DOWN);
2388 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_LEFT);
2389 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_RIGHT);
2390 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_UP_ONE);
2391 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_DOWN_ONE);
2392 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_BEGIN);
2393 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_END);
2394 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_UP_COARSE);
2395 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SELECTION_DOWN_COARSE);
2396 drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_UP);
2397 drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_DOWN);
2398 drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_LEFT_CHANNEL);
2399 drawKeybindSettingsTableRow(GUI_ACTION_PAT_MOVE_RIGHT_CHANNEL);
2400 drawKeybindSettingsTableRow(GUI_ACTION_PAT_DELETE);
2401 drawKeybindSettingsTableRow(GUI_ACTION_PAT_PULL_DELETE);
2402 drawKeybindSettingsTableRow(GUI_ACTION_PAT_INSERT);
2403 drawKeybindSettingsTableRow(GUI_ACTION_PAT_MUTE_CURSOR);
2404 drawKeybindSettingsTableRow(GUI_ACTION_PAT_SOLO_CURSOR);
2405 drawKeybindSettingsTableRow(GUI_ACTION_PAT_UNMUTE_ALL);
2406 drawKeybindSettingsTableRow(GUI_ACTION_PAT_NEXT_ORDER);
2407 drawKeybindSettingsTableRow(GUI_ACTION_PAT_PREV_ORDER);
2408 drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE);
2409 drawKeybindSettingsTableRow(GUI_ACTION_PAT_INCREASE_COLUMNS);
2410 drawKeybindSettingsTableRow(GUI_ACTION_PAT_DECREASE_COLUMNS);
2411 drawKeybindSettingsTableRow(GUI_ACTION_PAT_INTERPOLATE);
2412 drawKeybindSettingsTableRow(GUI_ACTION_PAT_FADE);
2413 drawKeybindSettingsTableRow(GUI_ACTION_PAT_INVERT_VALUES);
2414 drawKeybindSettingsTableRow(GUI_ACTION_PAT_FLIP_SELECTION);
2415 drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE_ROWS);
2416 drawKeybindSettingsTableRow(GUI_ACTION_PAT_EXPAND_ROWS);
2417 drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE_PAT);
2418 drawKeybindSettingsTableRow(GUI_ACTION_PAT_EXPAND_PAT);
2419 drawKeybindSettingsTableRow(GUI_ACTION_PAT_COLLAPSE_SONG);
2420 drawKeybindSettingsTableRow(GUI_ACTION_PAT_EXPAND_SONG);
2421 drawKeybindSettingsTableRow(GUI_ACTION_PAT_LATCH);
2422 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CLEAR_LATCH);
2423 drawKeybindSettingsTableRow(GUI_ACTION_PAT_ABSORB_INSTRUMENT);
2424 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_UNDO);
2425 drawKeybindSettingsTableRow(GUI_ACTION_PAT_CURSOR_REDO);
2426
2427 KEYBIND_CONFIG_END;
2428 ImGui::TreePop();
2429 }
2430 if (ImGui::TreeNode(_("Instrument list"))) {
2431 KEYBIND_CONFIG_BEGIN("keysInsList");
2432
2433 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_ADD);
2434 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DUPLICATE);
2435 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_OPEN);
2436 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_OPEN_REPLACE);
2437 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_SAVE);
2438 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_SAVE_DMP);
2439 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_MOVE_UP);
2440 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_MOVE_DOWN);
2441 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DELETE);
2442 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_EDIT);
2443 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_UP);
2444 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DOWN);
2445 drawKeybindSettingsTableRow(GUI_ACTION_INS_LIST_DIR_VIEW);
2446
2447 KEYBIND_CONFIG_END;
2448 ImGui::TreePop();
2449 }
2450 if (ImGui::TreeNode(_("Wavetable list"))) {
2451 KEYBIND_CONFIG_BEGIN("keysWaveList");
2452
2453 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_ADD);
2454 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DUPLICATE);
2455 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_OPEN);
2456 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_OPEN_REPLACE);
2457 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_SAVE);
2458 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_SAVE_DMW);
2459 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_SAVE_RAW);
2460 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_MOVE_UP);
2461 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_MOVE_DOWN);
2462 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DELETE);
2463 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_EDIT);
2464 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_UP);
2465 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DOWN);
2466 drawKeybindSettingsTableRow(GUI_ACTION_WAVE_LIST_DIR_VIEW);
2467
2468 KEYBIND_CONFIG_END;
2469 ImGui::TreePop();
2470 }
2471 if (ImGui::TreeNode(_("Sample list"))) {
2472 KEYBIND_CONFIG_BEGIN("keysSampleList");
2473
2474 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_ADD);
2475 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DUPLICATE);
2476 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_CREATE_WAVE);
2477 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN);
2478 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_REPLACE);
2479 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_RAW);
2480 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_OPEN_REPLACE_RAW);
2481 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_SAVE);
2482 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_SAVE_RAW);
2483 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MOVE_UP);
2484 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MOVE_DOWN);
2485 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DELETE);
2486 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_EDIT);
2487 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_UP);
2488 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DOWN);
2489 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_PREVIEW);
2490 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_STOP_PREVIEW);
2491 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_DIR_VIEW);
2492 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_LIST_MAKE_MAP);
2493
2494 KEYBIND_CONFIG_END;
2495 ImGui::TreePop();
2496 }
2497 if (ImGui::TreeNode(_("Orders"))) {
2498 KEYBIND_CONFIG_BEGIN("keysOrders");
2499
2500 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_UP);
2501 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DOWN);
2502 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_LEFT);
2503 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_RIGHT);
2504 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_INCREASE);
2505 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DECREASE);
2506 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_EDIT_MODE);
2507 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_LINK);
2508 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_ADD);
2509 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DUPLICATE);
2510 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DEEP_CLONE);
2511 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DUPLICATE_END);
2512 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_DEEP_CLONE_END);
2513 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_REMOVE);
2514 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_MOVE_UP);
2515 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_MOVE_DOWN);
2516 drawKeybindSettingsTableRow(GUI_ACTION_ORDERS_REPLAY);
2517
2518 KEYBIND_CONFIG_END;
2519 ImGui::TreePop();
2520 }
2521 if (ImGui::TreeNode(_("Sample editor"))) {
2522 KEYBIND_CONFIG_BEGIN("keysSampleEdit");
2523
2524 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SELECT);
2525 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_DRAW);
2526 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_CUT);
2527 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_COPY);
2528 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE);
2529 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE_REPLACE);
2530 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PASTE_MIX);
2531 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SELECT_ALL);
2532 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_RESIZE);
2533 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_RESAMPLE);
2534 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_AMPLIFY);
2535 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_NORMALIZE);
2536 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FADE_IN);
2537 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FADE_OUT);
2538 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_INSERT);
2539 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SILENCE);
2540 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_DELETE);
2541 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_TRIM);
2542 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_REVERSE);
2543 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_INVERT);
2544 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SIGN);
2545 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_FILTER);
2546 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_PREVIEW);
2547 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_STOP_PREVIEW);
2548 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_IN);
2549 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_OUT);
2550 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_ZOOM_AUTO);
2551 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_MAKE_INS);
2552 drawKeybindSettingsTableRow(GUI_ACTION_SAMPLE_SET_LOOP);
2553
2554 KEYBIND_CONFIG_END;
2555 ImGui::TreePop();
2556 }
2557 }
2558 ImGui::EndChild();
2559 END_SECTION;
2560 }
2561 CONFIG_SECTION(_("Interface")) {
2562 // SUBSECTION LAYOUT
2563 CONFIG_SUBSECTION(_("Layout"));
2564 ImGui::AlignTextToFramePadding();
2565 ImGui::Text(_("Workspace layout:"));
2566 ImGui::SameLine();
2567 if (ImGui::Button(_("Import"))) {
2568 openFileDialog(GUI_FILE_IMPORT_LAYOUT);
2569 }
2570 ImGui::SameLine();
2571 if (ImGui::Button(_("Export"))) {
2572 openFileDialog(GUI_FILE_EXPORT_LAYOUT);
2573 }
2574 ImGui::SameLine();
2575 if (ImGui::Button(_("Reset"))) {
2576 showWarning(_("Are you sure you want to reset the workspace layout?"),GUI_WARN_RESET_LAYOUT);
2577 }
2578
2579 bool allowEditDockingB=settings.allowEditDocking;
2580 if (ImGui::Checkbox(_("Allow docking editors"),&allowEditDockingB)) {
2581 settings.allowEditDocking=allowEditDockingB;
2582 settingsChanged=true;
2583 }
2584
2585 #ifndef IS_MOBILE
2586 bool saveWindowPosB=settings.saveWindowPos;
2587 if (ImGui::Checkbox(_("Remember window position"),&saveWindowPosB)) {
2588 settings.saveWindowPos=saveWindowPosB;
2589 settingsChanged=true;
2590 }
2591 if (ImGui::IsItemHovered()) {
2592 ImGui::SetTooltip(_("remembers the window's last position on start-up."));
2593 }
2594 #endif
2595
2596 bool moveWindowTitleB=settings.moveWindowTitle;
2597 if (ImGui::Checkbox(_("Only allow window movement when clicking on title bar"),&moveWindowTitleB)) {
2598 settings.moveWindowTitle=moveWindowTitleB;
2599 applyUISettings(false);
2600 settingsChanged=true;
2601 }
2602
2603 bool centerPopupB=settings.centerPopup;
2604 if (ImGui::Checkbox(_("Center pop-up windows"),&centerPopupB)) {
2605 settings.centerPopup=centerPopupB;
2606 settingsChanged=true;
2607 }
2608
2609 ImGui::Text(_("Play/edit controls layout:"));
2610 ImGui::Indent();
2611 if (ImGui::RadioButton(_("Classic##ecl0"),settings.controlLayout==0)) {
2612 settings.controlLayout=0;
2613 settingsChanged=true;
2614 }
2615 if (ImGui::RadioButton(_("Compact##ecl1"),settings.controlLayout==1)) {
2616 settings.controlLayout=1;
2617 settingsChanged=true;
2618 }
2619 if (ImGui::RadioButton(_("Compact (vertical)##ecl2"),settings.controlLayout==2)) {
2620 settings.controlLayout=2;
2621 settingsChanged=true;
2622 }
2623 if (ImGui::RadioButton(_("Split##ecl3"),settings.controlLayout==3)) {
2624 settings.controlLayout=3;
2625 settingsChanged=true;
2626 }
2627 ImGui::Unindent();
2628
2629 ImGui::Text(_("Position of buttons in Orders:"));
2630 ImGui::Indent();
2631 if (ImGui::RadioButton(_("Top##obp0"),settings.orderButtonPos==0)) {
2632 settings.orderButtonPos=0;
2633 settingsChanged=true;
2634 }
2635 if (ImGui::RadioButton(_("Left##obp1"),settings.orderButtonPos==1)) {
2636 settings.orderButtonPos=1;
2637 settingsChanged=true;
2638 }
2639 if (ImGui::RadioButton(_("Right##obp2"),settings.orderButtonPos==2)) {
2640 settings.orderButtonPos=2;
2641 settingsChanged=true;
2642 }
2643 ImGui::Unindent();
2644
2645 // SUBSECTION MOUSE
2646 CONFIG_SUBSECTION(_("Mouse"));
2647
2648 if (CWSliderFloat(_("Double-click time (seconds)"),&settings.doubleClickTime,0.02,1.0,"%.2f")) {
2649 if (settings.doubleClickTime<0.02) settings.doubleClickTime=0.02;
2650 if (settings.doubleClickTime>1.0) settings.doubleClickTime=1.0;
2651
2652 applyUISettings(false);
2653 settingsChanged=true;
2654 }
2655
2656 bool avoidRaisingPatternB=settings.avoidRaisingPattern;
2657 if (ImGui::Checkbox(_("Don't raise pattern editor on click"),&avoidRaisingPatternB)) {
2658 settings.avoidRaisingPattern=avoidRaisingPatternB;
2659 settingsChanged=true;
2660 }
2661
2662 bool insFocusesPatternB=settings.insFocusesPattern;
2663 if (ImGui::Checkbox(_("Focus pattern editor when selecting instrument"),&insFocusesPatternB)) {
2664 settings.insFocusesPattern=insFocusesPatternB;
2665 settingsChanged=true;
2666 }
2667
2668 bool draggableDataViewB=settings.draggableDataView;
2669 if (ImGui::Checkbox(_("Draggable instruments/samples/waves"),&draggableDataViewB)) {
2670 settings.draggableDataView=draggableDataViewB;
2671 settingsChanged=true;
2672 }
2673
2674 ImGui::Text(_("Note preview behavior:"));
2675 ImGui::Indent();
2676 if (ImGui::RadioButton(_("Never##npb0"),settings.notePreviewBehavior==0)) {
2677 settings.notePreviewBehavior=0;
2678 settingsChanged=true;
2679 }
2680 if (ImGui::RadioButton(_("When cursor is in Note column##npb1"),settings.notePreviewBehavior==1)) {
2681 settings.notePreviewBehavior=1;
2682 settingsChanged=true;
2683 }
2684 if (ImGui::RadioButton(_("When cursor is in Note column or not in edit mode##npb2"),settings.notePreviewBehavior==2)) {
2685 settings.notePreviewBehavior=2;
2686 settingsChanged=true;
2687 }
2688 if (ImGui::RadioButton(_("Always##npb3"),settings.notePreviewBehavior==3)) {
2689 settings.notePreviewBehavior=3;
2690 settingsChanged=true;
2691 }
2692 ImGui::Unindent();
2693
2694 ImGui::Text(_("Allow dragging selection:"));
2695 ImGui::Indent();
2696 if (ImGui::RadioButton(_("No##dms0"),settings.dragMovesSelection==0)) {
2697 settings.dragMovesSelection=0;
2698 settingsChanged=true;
2699 }
2700 if (ImGui::RadioButton(_("Yes##dms1"),settings.dragMovesSelection==1)) {
2701 settings.dragMovesSelection=1;
2702 settingsChanged=true;
2703 }
2704 if (ImGui::RadioButton(_("Yes (while holding Ctrl only)##dms2"),settings.dragMovesSelection==2)) {
2705 settings.dragMovesSelection=2;
2706 settingsChanged=true;
2707 }
2708 if (ImGui::RadioButton(_("Yes (copy)##dms3"),settings.dragMovesSelection==3)) {
2709 settings.dragMovesSelection=3;
2710 settingsChanged=true;
2711 }
2712 if (ImGui::RadioButton(_("Yes (while holding Ctrl only and copy)##dms4"),settings.dragMovesSelection==4)) {
2713 settings.dragMovesSelection=4;
2714 settingsChanged=true;
2715 }
2716 if (ImGui::RadioButton(_("Yes (holding Ctrl copies)##dms5"),settings.dragMovesSelection==5)) {
2717 settings.dragMovesSelection=5;
2718 settingsChanged=true;
2719 }
2720 ImGui::Unindent();
2721
2722 ImGui::Text(_("Toggle channel solo on:"));
2723 ImGui::Indent();
2724 if (ImGui::RadioButton(_("Right-click or double-click##soloA"),settings.soloAction==0)) {
2725 settings.soloAction=0;
2726 settingsChanged=true;
2727 }
2728 if (ImGui::RadioButton(_("Right-click##soloR"),settings.soloAction==1)) {
2729 settings.soloAction=1;
2730 settingsChanged=true;
2731 }
2732 if (ImGui::RadioButton(_("Double-click##soloD"),settings.soloAction==2)) {
2733 settings.soloAction=2;
2734 settingsChanged=true;
2735 }
2736 ImGui::Unindent();
2737
2738 ImGui::Text(_("Modifier for alternate wheel-scrolling (vertical/zoom/slider-input):"));
2739 ImGui::Indent();
2740 if (ImGui::RadioButton(_("Ctrl or Meta/Cmd##cwm1"),settings.ctrlWheelModifier==0)) {
2741 settings.ctrlWheelModifier=0;
2742 settingsChanged=true;
2743 }
2744 if (ImGui::RadioButton(_("Ctrl##cwm2"),settings.ctrlWheelModifier==1)) {
2745 settings.ctrlWheelModifier=1;
2746 settingsChanged=true;
2747 }
2748 if (ImGui::RadioButton(_("Meta/Cmd##cwm3"),settings.ctrlWheelModifier==2)) {
2749 settings.ctrlWheelModifier=2;
2750 settingsChanged=true;
2751 }
2752 // technically this key is called Option on mac, but we call it Alt in getKeyName(s)
2753 if (ImGui::RadioButton(_("Alt##cwm4"),settings.ctrlWheelModifier==3)) {
2754 settings.ctrlWheelModifier=3;
2755 settingsChanged=true;
2756 }
2757 ImGui::Unindent();
2758
2759 bool doubleClickColumnB=settings.doubleClickColumn;
2760 if (ImGui::Checkbox(_("Double click selects entire column"),&doubleClickColumnB)) {
2761 settings.doubleClickColumn=doubleClickColumnB;
2762 settingsChanged=true;
2763 }
2764
2765 // SUBSECTION CURSOR BEHAVIOR
2766 CONFIG_SUBSECTION(_("Cursor behavior"));
2767 bool insertBehaviorB=settings.insertBehavior;
2768 if (ImGui::Checkbox(_("Insert pushes entire channel row"),&insertBehaviorB)) {
2769 settings.insertBehavior=insertBehaviorB;
2770 settingsChanged=true;
2771 }
2772
2773 bool pullDeleteRowB=settings.pullDeleteRow;
2774 if (ImGui::Checkbox(_("Pull delete affects entire channel row"),&pullDeleteRowB)) {
2775 settings.pullDeleteRow=pullDeleteRowB;
2776 settingsChanged=true;
2777 }
2778
2779 bool pushNibbleB=settings.pushNibble;
2780 if (ImGui::Checkbox(_("Push value when overwriting instead of clearing it"),&pushNibbleB)) {
2781 settings.pushNibble=pushNibbleB;
2782 settingsChanged=true;
2783 }
2784
2785 bool inputRepeatB=settings.inputRepeat;
2786 if (ImGui::Checkbox(_("Keyboard note/value input repeat (hold key to input continuously)"),&inputRepeatB)) {
2787 settings.inputRepeat=inputRepeatB;
2788 settingsChanged=true;
2789 }
2790
2791 ImGui::Text(_("Effect input behavior:"));
2792 ImGui::Indent();
2793 if (ImGui::RadioButton(_("Move down##eicb0"),settings.effectCursorDir==0)) {
2794 settings.effectCursorDir=0;
2795 settingsChanged=true;
2796 }
2797 if (ImGui::RadioButton(_("Move to effect value (otherwise move down)##eicb1"),settings.effectCursorDir==1)) {
2798 settings.effectCursorDir=1;
2799 settingsChanged=true;
2800 }
2801 if (ImGui::RadioButton(_("Move to effect value/next effect and wrap around##eicb2"),settings.effectCursorDir==2)) {
2802 settings.effectCursorDir=2;
2803 settingsChanged=true;
2804 }
2805 ImGui::Unindent();
2806
2807 bool effectDeletionAltersValueB=settings.effectDeletionAltersValue;
2808 if (ImGui::Checkbox(_("Delete effect value when deleting effect"),&effectDeletionAltersValueB)) {
2809 settings.effectDeletionAltersValue=effectDeletionAltersValueB;
2810 settingsChanged=true;
2811 }
2812
2813 bool absorbInsInputB=settings.absorbInsInput;
2814 if (ImGui::Checkbox(_("Change current instrument when changing instrument column (absorb)"),&absorbInsInputB)) {
2815 settings.absorbInsInput=absorbInsInputB;
2816 settingsChanged=true;
2817 }
2818
2819 bool removeInsOffB=settings.removeInsOff;
2820 if (ImGui::Checkbox(_("Remove instrument value when inserting note off/release"),&removeInsOffB)) {
2821 settings.removeInsOff=removeInsOffB;
2822 settingsChanged=true;
2823 }
2824
2825 bool removeVolOffB=settings.removeVolOff;
2826 if (ImGui::Checkbox(_("Remove volume value when inserting note off/release"),&removeVolOffB)) {
2827 settings.removeVolOff=removeVolOffB;
2828 settingsChanged=true;
2829 }
2830
2831 // SUBSECTION CURSOR MOVEMENT
2832 CONFIG_SUBSECTION(_("Cursor movement"));
2833
2834 ImGui::Text(_("Wrap horizontally:"));
2835 ImGui::Indent();
2836 if (ImGui::RadioButton(_("No##wrapH0"),settings.wrapHorizontal==0)) {
2837 settings.wrapHorizontal=0;
2838 settingsChanged=true;
2839 }
2840 if (ImGui::RadioButton(_("Yes##wrapH1"),settings.wrapHorizontal==1)) {
2841 settings.wrapHorizontal=1;
2842 settingsChanged=true;
2843 }
2844 if (ImGui::RadioButton(_("Yes, and move to next/prev row##wrapH2"),settings.wrapHorizontal==2)) {
2845 settings.wrapHorizontal=2;
2846 settingsChanged=true;
2847 }
2848 ImGui::Unindent();
2849
2850 ImGui::Text(_("Wrap vertically:"));
2851 ImGui::Indent();
2852 if (ImGui::RadioButton(_("No##wrapV0"),settings.wrapVertical==0)) {
2853 settings.wrapVertical=0;
2854 settingsChanged=true;
2855 }
2856 if (ImGui::RadioButton(_("Yes##wrapV1"),settings.wrapVertical==1)) {
2857 settings.wrapVertical=1;
2858 settingsChanged=true;
2859 }
2860 if (ImGui::RadioButton(_("Yes, and move to next/prev pattern##wrapV2"),settings.wrapVertical==2)) {
2861 settings.wrapVertical=2;
2862 settingsChanged=true;
2863 }
2864 if (ImGui::RadioButton(_("Yes, and move to next/prev pattern (wrap around)##wrapV2"),settings.wrapVertical==3)) {
2865 settings.wrapVertical=3;
2866 settingsChanged=true;
2867 }
2868 ImGui::Unindent();
2869
2870 ImGui::Text(_("Cursor movement keys behavior:"));
2871 ImGui::Indent();
2872 if (ImGui::RadioButton(_("Move by one##cmk0"),settings.scrollStep==0)) {
2873 settings.scrollStep=0;
2874 settingsChanged=true;
2875 }
2876 if (ImGui::RadioButton(_("Move by Edit Step##cmk1"),settings.scrollStep==1)) {
2877 settings.scrollStep=1;
2878 settingsChanged=true;
2879 }
2880 ImGui::Unindent();
2881
2882 bool stepOnDeleteB=settings.stepOnDelete;
2883 if (ImGui::Checkbox(_("Move cursor by edit step on delete"),&stepOnDeleteB)) {
2884 settings.stepOnDelete=stepOnDeleteB;
2885 settingsChanged=true;
2886 }
2887
2888 bool stepOnInsertB=settings.stepOnInsert;
2889 if (ImGui::Checkbox(_("Move cursor by edit step on insert (push)"),&stepOnInsertB)) {
2890 settings.stepOnInsert=stepOnInsertB;
2891 settingsChanged=true;
2892 }
2893
2894 bool pullDeleteBehaviorB=settings.pullDeleteBehavior;
2895 if (ImGui::Checkbox(_("Move cursor up on backspace-delete"),&pullDeleteBehaviorB)) {
2896 settings.pullDeleteBehavior=pullDeleteBehaviorB;
2897 settingsChanged=true;
2898 }
2899
2900 bool cursorPastePosB=settings.cursorPastePos;
2901 if (ImGui::Checkbox(_("Move cursor to end of clipboard content when pasting"),&cursorPastePosB)) {
2902 settings.cursorPastePos=cursorPastePosB;
2903 settingsChanged=true;
2904 }
2905
2906 // SUBSECTION SCROLLING
2907 CONFIG_SUBSECTION(_("Scrolling"));
2908
2909 ImGui::Text(_("Change order when scrolling outside of pattern bounds:"));
2910 ImGui::Indent();
2911 if (ImGui::RadioButton(_("No##pscroll0"),settings.scrollChangesOrder==0)) {
2912 settings.scrollChangesOrder=0;
2913 settingsChanged=true;
2914 }
2915 if (ImGui::RadioButton(_("Yes##pscroll1"),settings.scrollChangesOrder==1)) {
2916 settings.scrollChangesOrder=1;
2917 settingsChanged=true;
2918 }
2919 if (ImGui::RadioButton(_("Yes, and wrap around song##pscroll2"),settings.scrollChangesOrder==2)) {
2920 settings.scrollChangesOrder=2;
2921 settingsChanged=true;
2922 }
2923 ImGui::Unindent();
2924
2925 bool cursorFollowsOrderB=settings.cursorFollowsOrder;
2926 if (ImGui::Checkbox(_("Cursor follows current order when moving it"),&cursorFollowsOrderB)) {
2927 settings.cursorFollowsOrder=cursorFollowsOrderB;
2928 settingsChanged=true;
2929 }
2930 if (ImGui::IsItemHovered()) {
2931 ImGui::SetTooltip(_("applies when playback is stopped."));
2932 }
2933
2934 bool cursorMoveNoScrollB=settings.cursorMoveNoScroll;
2935 if (ImGui::Checkbox(_("Don't scroll when moving cursor"),&cursorMoveNoScrollB)) {
2936 settings.cursorMoveNoScroll=cursorMoveNoScrollB;
2937 settingsChanged=true;
2938 }
2939
2940 ImGui::Text(_("Move cursor with scroll wheel:"));
2941 ImGui::Indent();
2942 if (ImGui::RadioButton(_("No##csw0"),settings.cursorFollowsWheel==0)) {
2943 settings.cursorFollowsWheel=0;
2944 settingsChanged=true;
2945 }
2946 if (ImGui::RadioButton(_("Yes##csw1"),settings.cursorFollowsWheel==1)) {
2947 settings.cursorFollowsWheel=1;
2948 settingsChanged=true;
2949 }
2950 if (ImGui::RadioButton(_("Inverted##csw2"),settings.cursorFollowsWheel==2)) {
2951 settings.cursorFollowsWheel=2;
2952 settingsChanged=true;
2953 }
2954 ImGui::Unindent();
2955
2956 if (settings.cursorFollowsWheel) {
2957 ImGui::Text(_("How many steps to move with each scroll wheel step?"));
2958 if (ImGui::RadioButton(_("One##cws0"),settings.cursorWheelStep==0)) {
2959 settings.cursorWheelStep=0;
2960 settingsChanged=true;
2961 }
2962 if (ImGui::RadioButton(_("Edit Step##cws1"),settings.cursorWheelStep==1)) {
2963 settings.cursorWheelStep=1;
2964 settingsChanged=true;
2965 }
2966 if (ImGui::RadioButton(_("Coarse Step##cws2"),settings.cursorWheelStep==2)) {
2967 settings.cursorWheelStep=2;
2968 settingsChanged=true;
2969 }
2970 }
2971
2972 // SUBSECTION ASSETS
2973 CONFIG_SUBSECTION(_("Assets"));
2974
2975 bool insTypeMenuB=settings.insTypeMenu;
2976 if (ImGui::Checkbox(_("Display instrument type menu when adding instrument"),&insTypeMenuB)) {
2977 settings.insTypeMenu=insTypeMenuB;
2978 settingsChanged=true;
2979 }
2980
2981 bool selectAssetOnLoadB=settings.selectAssetOnLoad;
2982 if (ImGui::Checkbox(_("Select asset after opening one"),&selectAssetOnLoadB)) {
2983 settings.selectAssetOnLoad=selectAssetOnLoadB;
2984 settingsChanged=true;
2985 }
2986
2987 END_SECTION;
2988 }
2989 CONFIG_SECTION(_("Appearance")) {
2990 // SUBSECTION INTERFACE
2991 CONFIG_SUBSECTION(_("Scaling"));
2992 bool dpiScaleAuto=(settings.dpiScale<0.5f);
2993 if (ImGui::Checkbox(_("Automatic UI scaling factor"),&dpiScaleAuto)) {
2994 if (dpiScaleAuto) {
2995 settings.dpiScale=0.0f;
2996 } else {
2997 settings.dpiScale=1.0f;
2998 }
2999 settingsChanged=true;
3000 }
3001 if (!dpiScaleAuto) {
3002 if (ImGui::SliderFloat(_("UI scaling factor"),&settings.dpiScale,1.0f,3.0f,"%.2fx")) {
3003 if (settings.dpiScale<0.5f) settings.dpiScale=0.5f;
3004 if (settings.dpiScale>3.0f) settings.dpiScale=3.0f;
3005 settingsChanged=true;
3006 } rightClickable
3007 }
3008
3009 if (ImGui::InputInt(_("Icon size"),&settings.iconSize,1,3)) {
3010 if (settings.iconSize<3) settings.iconSize=3;
3011 if (settings.iconSize>48) settings.iconSize=48;
3012 settingsChanged=true;
3013 }
3014
3015 // SUBSECTION TEXT
3016 CONFIG_SUBSECTION(_("Text"));
3017 if (ImGui::BeginTable("##Text",2)) {
3018 ImGui::TableSetupColumn("##Label",ImGuiTableColumnFlags_WidthFixed);
3019 ImGui::TableSetupColumn("##Combos",ImGuiTableColumnFlags_WidthStretch);
3020 #ifdef HAVE_FREETYPE
3021 ImGui::TableNextRow();
3022 ImGui::TableNextColumn();
3023 ImGui::AlignTextToFramePadding();
3024 ImGui::Text(_("Font renderer"));
3025 ImGui::TableNextColumn();
3026 if (ImGui::Combo("##FontBack",&settings.fontBackend,fontBackends,2)) settingsChanged=true;
3027 #else
3028 settings.fontBackend=0;
3029 #endif
3030
3031 ImGui::TableNextRow();
3032 ImGui::TableNextColumn();
3033 ImGui::AlignTextToFramePadding();
3034 ImGui::Text(_("Main font"));
3035 ImGui::TableNextColumn();
3036 if (ImGui::Combo("##MainFont",&settings.mainFont,LocalizedComboGetter,mainFonts,7)) settingsChanged=true;
3037 if (settings.mainFont==6) {
3038 ImGui::InputText("##MainFontPath",&settings.mainFontPath);
3039 ImGui::SameLine();
3040 if (ImGui::Button(ICON_FA_FOLDER "##MainFontLoad")) {
3041 openFileDialog(GUI_FILE_LOAD_MAIN_FONT);
3042 settingsChanged=true;
3043 }
3044 }
3045 if (ImGui::InputInt(_("Size##MainFontSize"),&settings.mainFontSize,1,3)) {
3046 if (settings.mainFontSize<3) settings.mainFontSize=3;
3047 if (settings.mainFontSize>96) settings.mainFontSize=96;
3048 settingsChanged=true;
3049 }
3050 ImGui::TableNextRow();
3051 ImGui::TableNextColumn();
3052 ImGui::AlignTextToFramePadding();
3053 ImGui::Text(_("Header font"));
3054 ImGui::TableNextColumn();
3055 if (ImGui::Combo("##HeadFont",&settings.headFont,LocalizedComboGetter,headFonts,7)) settingsChanged=true;
3056 if (settings.headFont==6) {
3057 ImGui::InputText("##HeadFontPath",&settings.headFontPath);
3058 ImGui::SameLine();
3059 if (ImGui::Button(ICON_FA_FOLDER "##HeadFontLoad")) {
3060 openFileDialog(GUI_FILE_LOAD_HEAD_FONT);
3061 settingsChanged=true;
3062 }
3063 }
3064 if (ImGui::InputInt(_("Size##HeadFontSize"),&settings.headFontSize,1,3)) {
3065 if (settings.headFontSize<3) settings.headFontSize=3;
3066 if (settings.headFontSize>96) settings.headFontSize=96;
3067 settingsChanged=true;
3068 }
3069 ImGui::TableNextRow();
3070 ImGui::TableNextColumn();
3071 ImGui::AlignTextToFramePadding();
3072 ImGui::Text(_("Pattern font"));
3073 ImGui::TableNextColumn();
3074 if (ImGui::Combo("##PatFont",&settings.patFont,LocalizedComboGetter,patFonts,7)) settingsChanged=true;
3075 if (settings.patFont==6) {
3076 ImGui::InputText("##PatFontPath",&settings.patFontPath);
3077 ImGui::SameLine();
3078 if (ImGui::Button(ICON_FA_FOLDER "##PatFontLoad")) {
3079 openFileDialog(GUI_FILE_LOAD_PAT_FONT);
3080 settingsChanged=true;
3081 }
3082 }
3083 if (ImGui::InputInt(_("Size##PatFontSize"),&settings.patFontSize,1,3)) {
3084 if (settings.patFontSize<3) settings.patFontSize=3;
3085 if (settings.patFontSize>96) settings.patFontSize=96;
3086 settingsChanged=true;
3087 }
3088 ImGui::EndTable();
3089 }
3090
3091 if (settings.fontBackend==1) {
3092 bool fontAntiAliasB=settings.fontAntiAlias;
3093 if (ImGui::Checkbox(_("Anti-aliased fonts"),&fontAntiAliasB)) {
3094 settings.fontAntiAlias=fontAntiAliasB;
3095 settingsChanged=true;
3096 }
3097
3098 bool fontBitmapB=settings.fontBitmap;
3099 if (ImGui::Checkbox(_("Support bitmap fonts"),&fontBitmapB)) {
3100 settings.fontBitmap=fontBitmapB;
3101 settingsChanged=true;
3102 }
3103
3104 ImGui::Text(_("Hinting:"));
3105 ImGui::Indent();
3106 if (ImGui::RadioButton(_("Off (soft)##fh0"),settings.fontHinting==0)) {
3107 settings.fontHinting=0;
3108 settingsChanged=true;
3109 }
3110 if (ImGui::RadioButton(_("Slight##fh1"),settings.fontHinting==1)) {
3111 settings.fontHinting=1;
3112 settingsChanged=true;
3113 }
3114 if (ImGui::RadioButton(_("Normal##fh2"),settings.fontHinting==2)) {
3115 settings.fontHinting=2;
3116 settingsChanged=true;
3117 }
3118 if (ImGui::RadioButton(_("Full (hard)##fh3"),settings.fontHinting==3)) {
3119 settings.fontHinting=3;
3120 settingsChanged=true;
3121 }
3122 ImGui::Unindent();
3123
3124 ImGui::Text(_("Auto-hinter:"));
3125 ImGui::Indent();
3126 if (ImGui::RadioButton(_("Disable##fah0"),settings.fontAutoHint==0)) {
3127 settings.fontAutoHint=0;
3128 settingsChanged=true;
3129 }
3130 if (ImGui::RadioButton(_("Enable##fah1"),settings.fontAutoHint==1)) {
3131 settings.fontAutoHint=1;
3132 settingsChanged=true;
3133 }
3134 if (ImGui::RadioButton(_("Force##fah2"),settings.fontAutoHint==2)) {
3135 settings.fontAutoHint=2;
3136 settingsChanged=true;
3137 }
3138 ImGui::Unindent();
3139 }
3140
3141 ImGui::Text(_("Oversample"));
3142
3143 ImGui::SameLine();
3144 if (ImGui::RadioButton(_("1×##fos1"),settings.fontOversample==1)) {
3145 settings.fontOversample=1;
3146 settingsChanged=true;
3147 }
3148 if (ImGui::IsItemHovered()) {
3149 ImGui::SetTooltip(_("saves video memory. reduces font rendering quality.\nuse for pixel/bitmap fonts."));
3150 }
3151 ImGui::SameLine();
3152 if (ImGui::RadioButton(_("2×##fos2"),settings.fontOversample==2)) {
3153 settings.fontOversample=2;
3154 settingsChanged=true;
3155 }
3156 if (ImGui::IsItemHovered()) {
3157 ImGui::SetTooltip(_("default."));
3158 }
3159 ImGui::SameLine();
3160 if (ImGui::RadioButton(_("3×##fos3"),settings.fontOversample==3)) {
3161 settings.fontOversample=3;
3162 settingsChanged=true;
3163 }
3164 if (ImGui::IsItemHovered()) {
3165 ImGui::SetTooltip(_("slightly better font rendering quality.\nuses more video memory."));
3166 }
3167
3168 bool loadFallbackB=settings.loadFallback;
3169 if (ImGui::Checkbox(_("Load fallback font"),&loadFallbackB)) {
3170 settings.loadFallback=loadFallbackB;
3171 settingsChanged=true;
3172 }
3173 if (ImGui::IsItemHovered()) {
3174 ImGui::SetTooltip(_("disable to save video memory."));
3175 }
3176
3177 bool loadFallbackPatB=settings.loadFallbackPat;
3178 if (ImGui::Checkbox(_("Load fallback font (pattern)"),&loadFallbackPatB)) {
3179 settings.loadFallbackPat=loadFallbackPatB;
3180 settingsChanged=true;
3181 }
3182 if (ImGui::IsItemHovered()) {
3183 ImGui::SetTooltip(_("disable to save video memory."));
3184 }
3185
3186 // SUBSECTION PROGRAM
3187 CONFIG_SUBSECTION(_("Program"));
3188 ImGui::Text(_("Title bar:"));
3189 ImGui::Indent();
3190 if (ImGui::RadioButton(_("Furnace##tbar0"),settings.titleBarInfo==0)) {
3191 settings.titleBarInfo=0;
3192 updateWindowTitle();
3193 settingsChanged=true;
3194 }
3195 if (ImGui::RadioButton(_("Song Name - Furnace##tbar1"),settings.titleBarInfo==1)) {
3196 settings.titleBarInfo=1;
3197 updateWindowTitle();
3198 settingsChanged=true;
3199 }
3200 if (ImGui::RadioButton(_("file_name.fur - Furnace##tbar2"),settings.titleBarInfo==2)) {
3201 settings.titleBarInfo=2;
3202 updateWindowTitle();
3203 settingsChanged=true;
3204 }
3205 if (ImGui::RadioButton(_("/path/to/file.fur - Furnace##tbar3"),settings.titleBarInfo==3)) {
3206 settings.titleBarInfo=3;
3207 updateWindowTitle();
3208 settingsChanged=true;
3209 }
3210 ImGui::Unindent();
3211
3212 bool titleBarSysB=settings.titleBarSys;
3213 if (ImGui::Checkbox(_("Display system name on title bar"),&titleBarSysB)) {
3214 settings.titleBarSys=titleBarSysB;
3215 updateWindowTitle();
3216 settingsChanged=true;
3217 }
3218
3219 bool noMultiSystemB=settings.noMultiSystem;
3220 if (ImGui::Checkbox(_("Display chip names instead of \"multi-system\" in title bar"),&noMultiSystemB)) {
3221 settings.noMultiSystem=noMultiSystemB;
3222 updateWindowTitle();
3223 settingsChanged=true;
3224 }
3225
3226 ImGui::Text(_("Status bar:"));
3227 ImGui::Indent();
3228 if (ImGui::RadioButton(_("Cursor details##sbar0"),settings.statusDisplay==0)) {
3229 settings.statusDisplay=0;
3230 settingsChanged=true;
3231 }
3232 if (ImGui::RadioButton(_("File path##sbar1"),settings.statusDisplay==1)) {
3233 settings.statusDisplay=1;
3234 settingsChanged=true;
3235 }
3236 if (ImGui::RadioButton(_("Cursor details or file path##sbar2"),settings.statusDisplay==2)) {
3237 settings.statusDisplay=2;
3238 settingsChanged=true;
3239 }
3240 if (ImGui::RadioButton(_("Nothing##sbar3"),settings.statusDisplay==3)) {
3241 settings.statusDisplay=3;
3242 settingsChanged=true;
3243 }
3244 ImGui::Unindent();
3245
3246 bool playbackTimeB=settings.playbackTime;
3247 if (ImGui::Checkbox(_("Display playback status when playing"),&playbackTimeB)) {
3248 settings.playbackTime=playbackTimeB;
3249 settingsChanged=true;
3250 }
3251
3252 ImGui::Text(_("Export options layout:"));
3253 ImGui::Indent();
3254 if (ImGui::RadioButton(_("Sub-menus in File menu##eol0"),settings.exportOptionsLayout==0)) {
3255 settings.exportOptionsLayout=0;
3256 settingsChanged=true;
3257 }
3258 if (ImGui::RadioButton(_("Modal window with tabs##eol1"),settings.exportOptionsLayout==1)) {
3259 settings.exportOptionsLayout=1;
3260 settingsChanged=true;
3261 }
3262 if (ImGui::RadioButton(_("Modal windows with options in File menu##eol2"),settings.exportOptionsLayout==2)) {
3263 settings.exportOptionsLayout=2;
3264 settingsChanged=true;
3265 }
3266 ImGui::Unindent();
3267
3268 bool capitalMenuBarB=settings.capitalMenuBar;
3269 if (ImGui::Checkbox(_("Capitalize menu bar"),&capitalMenuBarB)) {
3270 settings.capitalMenuBar=capitalMenuBarB;
3271 settingsChanged=true;
3272 }
3273
3274 bool classicChipOptionsB=settings.classicChipOptions;
3275 if (ImGui::Checkbox(_("Display add/configure/change/remove chip menus in File menu"),&classicChipOptionsB)) {
3276 settings.classicChipOptions=classicChipOptionsB;
3277 settingsChanged=true;
3278 }
3279
3280 // SUBSECTION ORDERS
3281 CONFIG_SUBSECTION(_("Orders"));
3282 // sorry. temporarily disabled until ImGui has a way to add separators in tables arbitrarily.
3283 /*bool sysSeparatorsB=settings.sysSeparators;
3284 if (ImGui::Checkbox(_("Add separators between systems in Orders"),&sysSeparatorsB)) {
3285 settings.sysSeparators=sysSeparatorsB;
3286 }*/
3287
3288 bool ordersCursorB=settings.ordersCursor;
3289 if (ImGui::Checkbox(_("Highlight channel at cursor in Orders"),&ordersCursorB)) {
3290 settings.ordersCursor=ordersCursorB;
3291 settingsChanged=true;
3292 }
3293
3294 ImGui::Text(_("Orders row number format:"));
3295 ImGui::Indent();
3296 if (ImGui::RadioButton(_("Decimal##orbD"),settings.orderRowsBase==0)) {
3297 settings.orderRowsBase=0;
3298 settingsChanged=true;
3299 }
3300 if (ImGui::RadioButton(_("Hexadecimal##orbH"),settings.orderRowsBase==1)) {
3301 settings.orderRowsBase=1;
3302 settingsChanged=true;
3303 }
3304 ImGui::Unindent();
3305
3306 // SUBSECTION PATTERN
3307 CONFIG_SUBSECTION(_("Pattern"));
3308 bool centerPatternB=settings.centerPattern;
3309 if (ImGui::Checkbox(_("Center pattern view"),&centerPatternB)) {
3310 settings.centerPattern=centerPatternB;
3311 settingsChanged=true;
3312 }
3313
3314 bool overflowHighlightB=settings.overflowHighlight;
3315 if (ImGui::Checkbox(_("Overflow pattern highlights"),&overflowHighlightB)) {
3316 settings.overflowHighlight=overflowHighlightB;
3317 settingsChanged=true;
3318 }
3319
3320 bool viewPrevPatternB=settings.viewPrevPattern;
3321 if (ImGui::Checkbox(_("Display previous/next pattern"),&viewPrevPatternB)) {
3322 settings.viewPrevPattern=viewPrevPatternB;
3323 settingsChanged=true;
3324 }
3325
3326 ImGui::Text(_("Pattern row number format:"));
3327 ImGui::Indent();
3328 if (ImGui::RadioButton(_("Decimal##prbD"),settings.patRowsBase==0)) {
3329 settings.patRowsBase=0;
3330 settingsChanged=true;
3331 }
3332 if (ImGui::RadioButton(_("Hexadecimal##prbH"),settings.patRowsBase==1)) {
3333 settings.patRowsBase=1;
3334 settingsChanged=true;
3335 }
3336 ImGui::Unindent();
3337
3338 ImGui::Text(_("Pattern view labels:"));
3339 ImGui::PushFont(patFont);
3340 if (ImGui::InputTextWithHint("##PVLOff","OFF",&settings.noteOffLabel)) settingsChanged=true;
3341 ImGui::PopFont();
3342 ImGui::SameLine();
3343 ImGui::Text(_("Note off (3-char)"));
3344 ImGui::PushFont(patFont);
3345 if (ImGui::InputTextWithHint("##PVLRel","===",&settings.noteRelLabel)) settingsChanged=true;
3346 ImGui::PopFont();
3347 ImGui::SameLine();
3348 ImGui::Text(_("Note release (3-char)"));
3349 ImGui::PushFont(patFont);
3350 if (ImGui::InputTextWithHint("##PVLMacroRel","REL",&settings.macroRelLabel)) settingsChanged=true;
3351 ImGui::PopFont();
3352 ImGui::SameLine();
3353 ImGui::Text(_("Macro release (3-char)"));
3354 ImGui::PushFont(patFont);
3355 if (ImGui::InputTextWithHint("##PVLE3","...",&settings.emptyLabel)) settingsChanged=true;
3356 ImGui::PopFont();
3357 ImGui::SameLine();
3358 ImGui::Text(_("Empty field (3-char)"));
3359 ImGui::PushFont(patFont);
3360 if (ImGui::InputTextWithHint("##PVLE2","..",&settings.emptyLabel2)) settingsChanged=true;
3361 ImGui::PopFont();
3362 ImGui::SameLine();
3363 ImGui::Text(_("Empty field (2-char)"));
3364
3365 ImGui::Text(_("Pattern view spacing after:"));
3366
3367 if (CWSliderInt(_("Note"),&settings.noteCellSpacing,0,32)) {
3368 if (settings.noteCellSpacing<0) settings.noteCellSpacing=0;
3369 if (settings.noteCellSpacing>32) settings.noteCellSpacing=32;
3370 settingsChanged=true;
3371 }
3372
3373 if (CWSliderInt(_("Instrument"),&settings.insCellSpacing,0,32)) {
3374 if (settings.insCellSpacing<0) settings.insCellSpacing=0;
3375 if (settings.insCellSpacing>32) settings.insCellSpacing=32;
3376 settingsChanged=true;
3377 }
3378
3379 if (CWSliderInt(_("Volume"),&settings.volCellSpacing,0,32)) {
3380 if (settings.volCellSpacing<0) settings.volCellSpacing=0;
3381 if (settings.volCellSpacing>32) settings.volCellSpacing=32;
3382 settingsChanged=true;
3383 }
3384
3385 if (CWSliderInt(_("Effect"),&settings.effectCellSpacing,0,32)) {
3386 if (settings.effectCellSpacing<0) settings.effectCellSpacing=0;
3387 if (settings.effectCellSpacing>32) settings.effectCellSpacing=32;
3388 settingsChanged=true;
3389 }
3390
3391 if (CWSliderInt(_("Effect value"),&settings.effectValCellSpacing,0,32)) {
3392 if (settings.effectValCellSpacing<0) settings.effectValCellSpacing=0;
3393 if (settings.effectValCellSpacing>32) settings.effectValCellSpacing=32;
3394 settingsChanged=true;
3395 }
3396
3397 bool oneDigitEffectsB=settings.oneDigitEffects;
3398 if (ImGui::Checkbox(_("Single-digit effects for 00-0F"),&oneDigitEffectsB)) {
3399 settings.oneDigitEffects=oneDigitEffectsB;
3400 settingsChanged=true;
3401 }
3402
3403 bool flatNotesB=settings.flatNotes;
3404 if (ImGui::Checkbox(_("Use flats instead of sharps"),&flatNotesB)) {
3405 settings.flatNotes=flatNotesB;
3406 settingsChanged=true;
3407 }
3408
3409 bool germanNotationB=settings.germanNotation;
3410 if (ImGui::Checkbox(_("Use German notation"),&germanNotationB)) {
3411 settings.germanNotation=germanNotationB;
3412 settingsChanged=true;
3413 }
3414
3415 // SUBSECTION CHANNEL
3416 CONFIG_SUBSECTION(_("Channel"));
3417
3418 ImGui::Text(_("Channel style:"));
3419 ImGui::Indent();
3420 if (ImGui::RadioButton(_("Classic##CHS0"),settings.channelStyle==0)) {
3421 settings.channelStyle=0;
3422 settingsChanged=true;
3423 }
3424 if (ImGui::RadioButton(_("Line##CHS1"),settings.channelStyle==1)) {
3425 settings.channelStyle=1;
3426 settingsChanged=true;
3427 }
3428 if (ImGui::RadioButton(_("Round##CHS2"),settings.channelStyle==2)) {
3429 settings.channelStyle=2;
3430 settingsChanged=true;
3431 }
3432 if (ImGui::RadioButton(_("Split button##CHS3"),settings.channelStyle==3)) {
3433 settings.channelStyle=3;
3434 settingsChanged=true;
3435 }
3436 if (ImGui::RadioButton(_("Square border##CH42"),settings.channelStyle==4)) {
3437 settings.channelStyle=4;
3438 settingsChanged=true;
3439 }
3440 if (ImGui::RadioButton(_("Round border##CHS5"),settings.channelStyle==5)) {
3441 settings.channelStyle=5;
3442 settingsChanged=true;
3443 }
3444 ImGui::Unindent();
3445
3446 ImGui::Text(_("Channel volume bar:"));
3447 ImGui::Indent();
3448 if (ImGui::RadioButton(_("None##CHV0"),settings.channelVolStyle==0)) {
3449 settings.channelVolStyle=0;
3450 settingsChanged=true;
3451 }
3452 if (ImGui::RadioButton(_("Simple##CHV1"),settings.channelVolStyle==1)) {
3453 settings.channelVolStyle=1;
3454 settingsChanged=true;
3455 }
3456 if (ImGui::RadioButton(_("Stereo##CHV2"),settings.channelVolStyle==2)) {
3457 settings.channelVolStyle=2;
3458 settingsChanged=true;
3459 }
3460 if (ImGui::RadioButton(_("Real##CHV3"),settings.channelVolStyle==3)) {
3461 settings.channelVolStyle=3;
3462 settingsChanged=true;
3463 }
3464 if (ImGui::RadioButton(_("Real (stereo)##CHV4"),settings.channelVolStyle==4)) {
3465 settings.channelVolStyle=4;
3466 settingsChanged=true;
3467 }
3468 ImGui::Unindent();
3469
3470 ImGui::Text(_("Channel feedback style:"));
3471 ImGui::Indent();
3472 if (ImGui::RadioButton(_("Off##CHF0"),settings.channelFeedbackStyle==0)) {
3473 settings.channelFeedbackStyle=0;
3474 settingsChanged=true;
3475 }
3476 if (ImGui::RadioButton(_("Note##CHF1"),settings.channelFeedbackStyle==1)) {
3477 settings.channelFeedbackStyle=1;
3478 settingsChanged=true;
3479 }
3480 if (ImGui::RadioButton(_("Volume##CHF2"),settings.channelFeedbackStyle==2)) {
3481 settings.channelFeedbackStyle=2;
3482 settingsChanged=true;
3483 }
3484 if (ImGui::RadioButton(_("Active##CHF3"),settings.channelFeedbackStyle==3)) {
3485 settings.channelFeedbackStyle=3;
3486 settingsChanged=true;
3487 }
3488 ImGui::Unindent();
3489
3490 ImGui::Text(_("Channel font:"));
3491 ImGui::Indent();
3492 if (ImGui::RadioButton(_("Regular##CHFont0"),settings.channelFont==0)) {
3493 settings.channelFont=0;
3494 settingsChanged=true;
3495 }
3496 if (ImGui::RadioButton(_("Monospace##CHFont1"),settings.channelFont==1)) {
3497 settings.channelFont=1;
3498 settingsChanged=true;
3499 }
3500 ImGui::Unindent();
3501
3502 bool channelTextCenterB=settings.channelTextCenter;
3503 if (ImGui::Checkbox(_("Center channel name"),&channelTextCenterB)) {
3504 settings.channelTextCenter=channelTextCenterB;
3505 settingsChanged=true;
3506 }
3507
3508 ImGui::Text(_("Channel colors:"));
3509 ImGui::Indent();
3510 if (ImGui::RadioButton(_("Single##CHC0"),settings.channelColors==0)) {
3511 settings.channelColors=0;
3512 settingsChanged=true;
3513 }
3514 if (ImGui::RadioButton(_("Channel type##CHC1"),settings.channelColors==1)) {
3515 settings.channelColors=1;
3516 settingsChanged=true;
3517 }
3518 if (ImGui::RadioButton(_("Instrument type##CHC2"),settings.channelColors==2)) {
3519 settings.channelColors=2;
3520 settingsChanged=true;
3521 }
3522 ImGui::Unindent();
3523
3524 ImGui::Text(_("Channel name colors:"));
3525 ImGui::Indent();
3526 if (ImGui::RadioButton(_("Single##CTC0"),settings.channelTextColors==0)) {
3527 settings.channelTextColors=0;
3528 settingsChanged=true;
3529 }
3530 if (ImGui::RadioButton(_("Channel type##CTC1"),settings.channelTextColors==1)) {
3531 settings.channelTextColors=1;
3532 settingsChanged=true;
3533 }
3534 if (ImGui::RadioButton(_("Instrument type##CTC2"),settings.channelTextColors==2)) {
3535 settings.channelTextColors=2;
3536 settingsChanged=true;
3537 }
3538 ImGui::Unindent();
3539
3540 // SUBSECTION ASSETS
3541 CONFIG_SUBSECTION(_("Assets"));
3542 bool unifiedDataViewB=settings.unifiedDataView;
3543 if (ImGui::Checkbox(_("Unified instrument/wavetable/sample list"),&unifiedDataViewB)) {
3544 settings.unifiedDataView=unifiedDataViewB;
3545 settingsChanged=true;
3546 }
3547 if (settings.unifiedDataView) {
3548 settings.horizontalDataView=0;
3549 }
3550
3551 ImGui::BeginDisabled(settings.unifiedDataView);
3552 bool horizontalDataViewB=settings.horizontalDataView;
3553 if (ImGui::Checkbox(_("Horizontal instrument/wavetable list"),&horizontalDataViewB)) {
3554 settings.horizontalDataView=horizontalDataViewB;
3555 settingsChanged=true;
3556 }
3557 ImGui::EndDisabled();
3558
3559 ImGui::Text(_("Instrument list icon style:"));
3560 ImGui::Indent();
3561 if (ImGui::RadioButton(_("None##iis0"),settings.insIconsStyle==0)) {
3562 settings.insIconsStyle=0;
3563 settingsChanged=true;
3564 }
3565 if (ImGui::RadioButton(_("Graphical icons##iis1"),settings.insIconsStyle==1)) {
3566 settings.insIconsStyle=1;
3567 settingsChanged=true;
3568 }
3569 if (ImGui::RadioButton(_("Letter icons##iis2"),settings.insIconsStyle==2)) {
3570 settings.insIconsStyle=2;
3571 settingsChanged=true;
3572 }
3573 ImGui::Unindent();
3574
3575 bool insEditColorizeB=settings.insEditColorize;
3576 if (ImGui::Checkbox(_("Colorize instrument editor using instrument type"),&insEditColorizeB)) {
3577 settings.insEditColorize=insEditColorizeB;
3578 settingsChanged=true;
3579 }
3580
3581 // SUBSECTION MACRO EDITOR
3582 CONFIG_SUBSECTION(_("Macro Editor"));
3583 ImGui::Text(_("Macro editor layout:"));
3584 ImGui::Indent();
3585 if (ImGui::RadioButton(_("Unified##mel0"),settings.macroLayout==0)) {
3586 settings.macroLayout=0;
3587 settingsChanged=true;
3588 }
3589 /*
3590 if (ImGui::RadioButton(_("Tabs##mel1"),settings.macroLayout==1)) {
3591 settings.macroLayout=1;
3592 settingsChanged=true;
3593 }
3594 */
3595 if (ImGui::RadioButton(_("Grid##mel2"),settings.macroLayout==2)) {
3596 settings.macroLayout=2;
3597 settingsChanged=true;
3598 }
3599 if (ImGui::RadioButton(_("Single (with list)##mel3"),settings.macroLayout==3)) {
3600 settings.macroLayout=3;
3601 settingsChanged=true;
3602 }
3603 /*
3604 if (ImGui::RadioButton(_("Single (combo box)##mel4"),settings.macroLayout==4)) {
3605 settings.macroLayout=4;
3606 settingsChanged=true;
3607 }
3608 */
3609 ImGui::Unindent();
3610
3611 bool oldMacroVSliderB=settings.oldMacroVSlider;
3612 if (ImGui::Checkbox(_("Use classic macro editor vertical slider"),&oldMacroVSliderB)) {
3613 settings.oldMacroVSlider=oldMacroVSliderB;
3614 settingsChanged=true;
3615 }
3616
3617 ImGui::BeginDisabled(settings.macroLayout==2);
3618 ImGui::Text(_("Macro step size/horizontal zoom:"));
3619 ImGui::Indent();
3620 if (ImGui::RadioButton(_("Manual"),settings.autoMacroStepSize==0)) {
3621 settings.autoMacroStepSize=0;
3622 settingsChanged=true;
3623 }
3624 if (ImGui::RadioButton(_("Automatic per macro"),settings.autoMacroStepSize==1)) {
3625 settings.autoMacroStepSize=1;
3626 settingsChanged=true;
3627 }
3628 if (ImGui::RadioButton(_("Automatic (use longest macro)"),settings.autoMacroStepSize==2)) {
3629 settings.autoMacroStepSize=2;
3630 settingsChanged=true;
3631 }
3632 ImGui::Unindent();
3633 ImGui::EndDisabled();
3634
3635 // SUBSECTION WAVE EDITOR
3636 CONFIG_SUBSECTION(_("Wave Editor"));
3637 bool waveLayoutB=settings.waveLayout;
3638 if (ImGui::Checkbox(_("Use compact wave editor"),&waveLayoutB)) {
3639 settings.waveLayout=waveLayoutB;
3640 settingsChanged=true;
3641 }
3642
3643 // SUBSECTION FM EDITOR
3644 CONFIG_SUBSECTION(_("FM Editor"));
3645 ImGui::Text(_("FM parameter names:"));
3646 ImGui::Indent();
3647 if (ImGui::RadioButton(_("Friendly##fmn0"),settings.fmNames==0)) {
3648 settings.fmNames=0;
3649 settingsChanged=true;
3650 }
3651 if (ImGui::RadioButton(_("Technical##fmn1"),settings.fmNames==1)) {
3652 settings.fmNames=1;
3653 settingsChanged=true;
3654 }
3655 if (ImGui::RadioButton(_("Technical (alternate)##fmn2"),settings.fmNames==2)) {
3656 settings.fmNames=2;
3657 settingsChanged=true;
3658 }
3659 ImGui::Unindent();
3660
3661 bool oplStandardWaveNamesB=settings.oplStandardWaveNames;
3662 if (ImGui::Checkbox(_("Use standard OPL waveform names"),&oplStandardWaveNamesB)) {
3663 settings.oplStandardWaveNames=oplStandardWaveNamesB;
3664 settingsChanged=true;
3665 }
3666
3667 ImGui::Text(_("FM parameter editor layout:"));
3668 ImGui::Indent();
3669 if (ImGui::RadioButton(_("Modern##fml0"),settings.fmLayout==0)) {
3670 settings.fmLayout=0;
3671 settingsChanged=true;
3672 }
3673 if (ImGui::RadioButton(_("Modern with more labels##fml7"),settings.fmLayout==7)) {
3674 settings.fmLayout=7;
3675 settingsChanged=true;
3676 }
3677 if (ImGui::RadioButton(_("Compact (2x2, classic)##fml1"),settings.fmLayout==1)) {
3678 settings.fmLayout=1;
3679 settingsChanged=true;
3680 }
3681 if (ImGui::RadioButton(_("Compact (1x4)##fml2"),settings.fmLayout==2)) {
3682 settings.fmLayout=2;
3683 settingsChanged=true;
3684 }
3685 if (ImGui::RadioButton(_("Compact (4x1)##fml3"),settings.fmLayout==3)) {
3686 settings.fmLayout=3;
3687 settingsChanged=true;
3688 }
3689 if (ImGui::RadioButton(_("Alternate (2x2)##fml4"),settings.fmLayout==4)) {
3690 settings.fmLayout=4;
3691 settingsChanged=true;
3692 }
3693 if (ImGui::RadioButton(_("Alternate (1x4)##fml5"),settings.fmLayout==5)) {
3694 settings.fmLayout=5;
3695 settingsChanged=true;
3696 }
3697 if (ImGui::RadioButton(_("Alternate (4x1)##fml5"),settings.fmLayout==6)) {
3698 settings.fmLayout=6;
3699 settingsChanged=true;
3700 }
3701 ImGui::Unindent();
3702
3703 ImGui::Text(_("Position of Sustain in FM editor:"));
3704 ImGui::Indent();
3705 if (ImGui::RadioButton(_("Between Decay and Sustain Rate##susp0"),settings.susPosition==0)) {
3706 settings.susPosition=0;
3707 settingsChanged=true;
3708 }
3709 if (ImGui::RadioButton(_("After Release Rate##susp1"),settings.susPosition==1)) {
3710 settings.susPosition=1;
3711 settingsChanged=true;
3712 }
3713 ImGui::BeginDisabled(settings.fmLayout!=0);
3714 if (ImGui::RadioButton(_("After Release Rate, after spacing##susp2"),settings.susPosition==2)) {
3715 settings.susPosition=2;
3716 settingsChanged=true;
3717 }
3718 if (ImGui::RadioButton(_("After TL##susp3"),settings.susPosition==3)) {
3719 settings.susPosition=3;
3720 settingsChanged=true;
3721 }
3722 ImGui::EndDisabled();
3723 ImGui::Unindent();
3724
3725 bool separateFMColorsB=settings.separateFMColors;
3726 if (ImGui::Checkbox(_("Use separate colors for carriers/modulators in FM editor"),&separateFMColorsB)) {
3727 settings.separateFMColors=separateFMColorsB;
3728 settingsChanged=true;
3729 }
3730
3731 bool unsignedDetuneB=settings.unsignedDetune;
3732 if (ImGui::Checkbox(_("Unsigned FM detune values"),&unsignedDetuneB)) {
3733 settings.unsignedDetune=unsignedDetuneB;
3734 settingsChanged=true;
3735 }
3736
3737 // SUBSECTION MEMORY COMPOSITION
3738 CONFIG_SUBSECTION(_("Memory Composition"));
3739 ImGui::Text(_("Chip memory usage unit:"));
3740 ImGui::Indent();
3741 if (ImGui::RadioButton(_("Bytes##MUU0"),settings.memUsageUnit==0)) {
3742 settings.memUsageUnit=0;
3743 settingsChanged=true;
3744 }
3745 if (ImGui::RadioButton(_("Kilobytes##MUU1"),settings.memUsageUnit==1)) {
3746 settings.memUsageUnit=1;
3747 settingsChanged=true;
3748 }
3749 ImGui::Unindent();
3750
3751 // SUBSECTION OSCILLOSCOPE
3752 CONFIG_SUBSECTION(_("Oscilloscope"));
3753 bool oscRoundedCornersB=settings.oscRoundedCorners;
3754 if (ImGui::Checkbox(_("Rounded corners"),&oscRoundedCornersB)) {
3755 settings.oscRoundedCorners=oscRoundedCornersB;
3756 settingsChanged=true;
3757 }
3758
3759 bool oscBorderB=settings.oscBorder;
3760 if (ImGui::Checkbox(_("Border"),&oscBorderB)) {
3761 settings.oscBorder=oscBorderB;
3762 settingsChanged=true;
3763 }
3764
3765 bool oscMonoB=settings.oscMono;
3766 if (ImGui::Checkbox(_("Mono"),&oscMonoB)) {
3767 settings.oscMono=oscMonoB;
3768 settingsChanged=true;
3769 }
3770
3771 bool oscAntiAliasB=settings.oscAntiAlias;
3772 if (ImGui::Checkbox(_("Anti-aliased"),&oscAntiAliasB)) {
3773 settings.oscAntiAlias=oscAntiAliasB;
3774 settingsChanged=true;
3775 }
3776
3777 bool oscTakesEntireWindowB=settings.oscTakesEntireWindow;
3778 if (ImGui::Checkbox(_("Fill entire window"),&oscTakesEntireWindowB)) {
3779 settings.oscTakesEntireWindow=oscTakesEntireWindowB;
3780 settingsChanged=true;
3781 }
3782
3783 bool oscEscapesBoundaryB=settings.oscEscapesBoundary;
3784 if (ImGui::Checkbox(_("Waveform goes out of bounds"),&oscEscapesBoundaryB)) {
3785 settings.oscEscapesBoundary=oscEscapesBoundaryB;
3786 settingsChanged=true;
3787 }
3788
3789 if (ImGui::SliderFloat(_("Line size"),&settings.oscLineSize,0.25f,16.0f,"%.1f")) {
3790 if (settings.oscLineSize<0.25f) settings.oscLineSize=0.25f;
3791 if (settings.oscLineSize>16.0f) settings.oscLineSize=16.0f;
3792 settingsChanged=true;
3793 } rightClickable
3794
3795 pushWarningColor(settings.chanOscThreads>cpuCores,settings.chanOscThreads>(cpuCores*2));
3796 if (ImGui::InputInt(_("Per-channel oscilloscope threads"),&settings.chanOscThreads)) {
3797 if (settings.chanOscThreads<0) settings.chanOscThreads=0;
3798 if (settings.chanOscThreads>(cpuCores*3)) settings.chanOscThreads=cpuCores*3;
3799 if (settings.chanOscThreads>256) settings.chanOscThreads=256;
3800 settingsChanged=true;
3801 }
3802 if (settings.chanOscThreads>=(cpuCores*3)) {
3803 if (ImGui::IsItemHovered()) {
3804 ImGui::SetTooltip(_("you're being silly, aren't you? that's enough."));
3805 }
3806 } else if (settings.chanOscThreads>(cpuCores*2)) {
3807 if (ImGui::IsItemHovered()) {
3808 ImGui::SetTooltip(_("what are you doing? stop!"));
3809 }
3810 } else if (settings.chanOscThreads>cpuCores) {
3811 if (ImGui::IsItemHovered()) {
3812 ImGui::SetTooltip(_("it is a bad idea to set this number higher than your CPU core count (%d)!"),cpuCores);
3813 }
3814 }
3815 popWarningColor();
3816
3817 ImGui::Text(_("Oscilloscope rendering engine:"));
3818 ImGui::Indent();
3819 if (ImGui::RadioButton(_("ImGui line plot"),settings.shaderOsc==0)) {
3820 settings.shaderOsc=0;
3821 settingsChanged=true;
3822 }
3823 if (ImGui::IsItemHovered()) {
3824 ImGui::SetTooltip(_("render using Dear ImGui's built-in line drawing functions."));
3825 }
3826 if (ImGui::RadioButton(_("GLSL (if available)"),settings.shaderOsc==1)) {
3827 settings.shaderOsc=1;
3828 settingsChanged=true;
3829 }
3830 if (ImGui::IsItemHovered()) {
3831 #ifdef USE_GLES
3832 ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL ES 2.0 render backend."));
3833 #else
3834 ImGui::SetTooltip(_("render using shaders that run on the graphics card.\nonly available in OpenGL 3.0 render backend."));
3835 #endif
3836 }
3837 ImGui::Unindent();
3838
3839 // SUBSECTION SONG COMMENTS
3840 CONFIG_SUBSECTION(_("Song Comments"));
3841 bool songNotesWrapB=settings.songNotesWrap;
3842 if (ImGui::Checkbox(_("Wrap text"), &songNotesWrapB)) {
3843 settings.songNotesWrap=songNotesWrapB;
3844 settingsChanged=true;
3845 }
3846 settings.songNotesWrap=false;
3847 if (ImGui::IsItemHovered()) {
3848 ImGui::SetTooltip(_("Sorry, but, can you leave me alone?\nThere's plenty of other settings here for you to mess with."));
3849 }
3850
3851 // SUBSECTION WINDOWS
3852 CONFIG_SUBSECTION(_("Windows"));
3853 bool roundedWindowsB=settings.roundedWindows;
3854 if (ImGui::Checkbox(_("Rounded window corners"),&roundedWindowsB)) {
3855 settings.roundedWindows=roundedWindowsB;
3856 settingsChanged=true;
3857 }
3858
3859 bool roundedButtonsB=settings.roundedButtons;
3860 if (ImGui::Checkbox(_("Rounded buttons"),&roundedButtonsB)) {
3861 settings.roundedButtons=roundedButtonsB;
3862 settingsChanged=true;
3863 }
3864
3865 bool roundedMenusB=settings.roundedMenus;
3866 if (ImGui::Checkbox(_("Rounded menu corners"),&roundedMenusB)) {
3867 settings.roundedMenus=roundedMenusB;
3868 settingsChanged=true;
3869 }
3870
3871 bool roundedTabsB=settings.roundedTabs;
3872 if (ImGui::Checkbox(_("Rounded tabs"),&roundedTabsB)) {
3873 settings.roundedTabs=roundedTabsB;
3874 settingsChanged=true;
3875 }
3876
3877 bool roundedScrollbarsB=settings.roundedScrollbars;
3878 if (ImGui::Checkbox(_("Rounded scrollbars"),&roundedScrollbarsB)) {
3879 settings.roundedScrollbars=roundedScrollbarsB;
3880 settingsChanged=true;
3881 }
3882
3883 bool frameBordersB=settings.frameBorders;
3884 if (ImGui::Checkbox(_("Borders around widgets"),&frameBordersB)) {
3885 settings.frameBorders=frameBordersB;
3886 settingsChanged=true;
3887 }
3888
3889 END_SECTION;
3890 }
3891 CONFIG_SECTION(_("Color")) {
3892 // SUBSECTION COLOR SCHEME
3893 CONFIG_SUBSECTION(_("Color scheme"));
3894 if (ImGui::Button(_("Import"))) {
3895 openFileDialog(GUI_FILE_IMPORT_COLORS);
3896 }
3897 ImGui::SameLine();
3898 if (ImGui::Button(_("Export"))) {
3899 openFileDialog(GUI_FILE_EXPORT_COLORS);
3900 }
3901 ImGui::SameLine();
3902 if (ImGui::Button(_("Reset defaults"))) {
3903 showWarning(_("Are you sure you want to reset the color scheme?"),GUI_WARN_RESET_COLORS);
3904 }
3905 bool basicColorsB=!settings.basicColors;
3906 if (ImGui::Checkbox(_("Guru mode"),&basicColorsB)) {
3907 settings.basicColors=!basicColorsB;
3908 applyUISettings(false);
3909 settingsChanged=true;
3910 }
3911 if (settings.basicColors) {
3912 if (ImGui::TreeNode(_("Interface"))) {
3913 if (ImGui::SliderInt(_("Frame shading"),&settings.guiColorsShading,0,100,"%d%%")) {
3914 if (settings.guiColorsShading<0) settings.guiColorsShading=0;
3915 if (settings.guiColorsShading>100) settings.guiColorsShading=100;
3916 applyUISettings(false);
3917 settingsChanged=true;
3918 }
3919 ImGui::Text(_("Color scheme type:"));
3920 ImGui::Indent();
3921 if (ImGui::RadioButton(_("Dark##gcb0"),settings.guiColorsBase==0)) {
3922 settings.guiColorsBase=0;
3923 applyUISettings(false);
3924 settingsChanged=true;
3925 }
3926 if (ImGui::RadioButton(_("Light##gcb1"),settings.guiColorsBase==1)) {
3927 settings.guiColorsBase=1;
3928 applyUISettings(false);
3929 settingsChanged=true;
3930 }
3931 ImGui::Unindent();
3932
3933 ImGui::Text(_("Accent colors:"));
3934 ImGui::Indent();
3935 UI_COLOR_CONFIG(GUI_COLOR_ACCENT_PRIMARY,_("Primary"));
3936 UI_COLOR_CONFIG(GUI_COLOR_ACCENT_SECONDARY,_("Secondary"));
3937 ImGui::Unindent();
3938
3939 ImGui::TreePop();
3940 }
3941 } else {
3942 if (ImGui::TreeNode(_("Interface"))) {
3943 if (ImGui::SliderInt(_("Frame shading"),&settings.guiColorsShading,0,100,"%d%%")) {
3944 if (settings.guiColorsShading<0) settings.guiColorsShading=0;
3945 if (settings.guiColorsShading>100) settings.guiColorsShading=100;
3946 applyUISettings(false);
3947 settingsChanged=true;
3948 }
3949
3950 UI_COLOR_CONFIG(GUI_COLOR_BUTTON,_("Button"));
3951 UI_COLOR_CONFIG(GUI_COLOR_BUTTON_HOVER,_("Button (hovered)"));
3952 UI_COLOR_CONFIG(GUI_COLOR_BUTTON_ACTIVE,_("Button (active)"));
3953 UI_COLOR_CONFIG(GUI_COLOR_TAB,_("Tab"));
3954 UI_COLOR_CONFIG(GUI_COLOR_TAB_HOVER,_("Tab (hovered)"));
3955 UI_COLOR_CONFIG(GUI_COLOR_TAB_ACTIVE,_("Tab (active)"));
3956 UI_COLOR_CONFIG(GUI_COLOR_TAB_SELECTED_OVERLINE,_("Tab (active overline)"));
3957 UI_COLOR_CONFIG(GUI_COLOR_TAB_UNFOCUSED,_("Tab (dimmed)"));
3958 UI_COLOR_CONFIG(GUI_COLOR_TAB_UNFOCUSED_ACTIVE,_("Tab (dimmed and active)"));
3959 UI_COLOR_CONFIG(GUI_COLOR_TAB_DIMMED_SELECTED_OVERLINE,_("Tab (dimmed and active overline)"));
3960 UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER,_("ImGui header"));
3961 UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER_HOVER,_("ImGui header (hovered)"));
3962 UI_COLOR_CONFIG(GUI_COLOR_IMGUI_HEADER_ACTIVE,_("ImGui header (active)"));
3963 UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP,_("Resize grip"));
3964 UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP_HOVER,_("Resize grip (hovered)"));
3965 UI_COLOR_CONFIG(GUI_COLOR_RESIZE_GRIP_ACTIVE,_("Resize grip (active)"));
3966 UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND,_("Widget background"));
3967 UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND_HOVER,_("Widget background (hovered)"));
3968 UI_COLOR_CONFIG(GUI_COLOR_WIDGET_BACKGROUND_ACTIVE,_("Widget background (active)"));
3969 UI_COLOR_CONFIG(GUI_COLOR_SLIDER_GRAB,_("Slider grab"));
3970 UI_COLOR_CONFIG(GUI_COLOR_SLIDER_GRAB_ACTIVE,_("Slider grab (active)"));
3971 UI_COLOR_CONFIG(GUI_COLOR_TITLE_BACKGROUND_ACTIVE,_("Title background (active)"));
3972 UI_COLOR_CONFIG(GUI_COLOR_CHECK_MARK,_("Checkbox/radio button mark"));
3973 UI_COLOR_CONFIG(GUI_COLOR_TEXT_LINK,_("Text link"));
3974 UI_COLOR_CONFIG(GUI_COLOR_TEXT_SELECTION,_("Text selection"));
3975 UI_COLOR_CONFIG(GUI_COLOR_TREE_LINES,_("Tree lines"));
3976 UI_COLOR_CONFIG(GUI_COLOR_PLOT_LINES,_("Line plot"));
3977 UI_COLOR_CONFIG(GUI_COLOR_PLOT_LINES_HOVER,_("Line plot (hovered)"));
3978 UI_COLOR_CONFIG(GUI_COLOR_PLOT_HISTOGRAM,_("Histogram plot"));
3979 UI_COLOR_CONFIG(GUI_COLOR_PLOT_HISTOGRAM_HOVER,_("Histogram plot (hovered)"));
3980 UI_COLOR_CONFIG(GUI_COLOR_TABLE_ROW_EVEN,_("Table row (even)"));
3981 UI_COLOR_CONFIG(GUI_COLOR_TABLE_ROW_ODD,_("Table row (odd)"));
3982
3983 ImGui::TreePop();
3984 }
3985 }
3986 if (ImGui::TreeNode(_("Interface (other)"))) {
3987 UI_COLOR_CONFIG(GUI_COLOR_BACKGROUND,_("Background"));
3988 UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND,_("Window background"));
3989 UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND_CHILD,_("Sub-window background"));
3990 UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND_POPUP,_("Pop-up background"));
3991 UI_COLOR_CONFIG(GUI_COLOR_MODAL_BACKDROP,_("Modal backdrop"));
3992 UI_COLOR_CONFIG(GUI_COLOR_HEADER,_("Header"));
3993 UI_COLOR_CONFIG(GUI_COLOR_TEXT,_("Text"));
3994 UI_COLOR_CONFIG(GUI_COLOR_TEXT_DISABLED,_("Text (disabled)"));
3995 UI_COLOR_CONFIG(GUI_COLOR_TITLE_INACTIVE,_("Title bar (inactive)"));
3996 UI_COLOR_CONFIG(GUI_COLOR_TITLE_COLLAPSED,_("Title bar (collapsed)"));
3997 UI_COLOR_CONFIG(GUI_COLOR_MENU_BAR,_("Menu bar"));
3998 UI_COLOR_CONFIG(GUI_COLOR_BORDER,_("Border"));
3999 UI_COLOR_CONFIG(GUI_COLOR_BORDER_SHADOW,_("Border shadow"));
4000 UI_COLOR_CONFIG(GUI_COLOR_SCROLL,_("Scroll bar"));
4001 UI_COLOR_CONFIG(GUI_COLOR_SCROLL_HOVER,_("Scroll bar (hovered)"));
4002 UI_COLOR_CONFIG(GUI_COLOR_SCROLL_ACTIVE,_("Scroll bar (clicked)"));
4003 UI_COLOR_CONFIG(GUI_COLOR_SCROLL_BACKGROUND,_("Scroll bar background"));
4004 UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR,_("Separator"));
4005 UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR_HOVER,_("Separator (hover)"));
4006 UI_COLOR_CONFIG(GUI_COLOR_SEPARATOR_ACTIVE,_("Separator (active)"));
4007 UI_COLOR_CONFIG(GUI_COLOR_DOCKING_PREVIEW,_("Docking preview"));
4008 UI_COLOR_CONFIG(GUI_COLOR_DOCKING_EMPTY,_("Docking empty"));
4009 UI_COLOR_CONFIG(GUI_COLOR_TABLE_HEADER,_("Table header"));
4010 UI_COLOR_CONFIG(GUI_COLOR_TABLE_BORDER_HARD,_("Table border (hard)"));
4011 UI_COLOR_CONFIG(GUI_COLOR_TABLE_BORDER_SOFT,_("Table border (soft)"));
4012 UI_COLOR_CONFIG(GUI_COLOR_DRAG_DROP_TARGET,_("Drag and drop target"));
4013 UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_HIGHLIGHT,_("Window switcher (highlight)"));
4014 UI_COLOR_CONFIG(GUI_COLOR_NAV_WIN_BACKDROP,_("Window switcher backdrop"));
4015 UI_COLOR_CONFIG(GUI_COLOR_INPUT_TEXT_CURSOR,_("Text input cursor"));
4016 ImGui::TreePop();
4017 }
4018 if (ImGui::TreeNode(_("Miscellaneous"))) {
4019 UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_ON,_("Toggle on"));
4020 UI_COLOR_CONFIG(GUI_COLOR_TOGGLE_OFF,_("Toggle off"));
4021 UI_COLOR_CONFIG(GUI_COLOR_PLAYBACK_STAT,_("Playback status"));
4022 UI_COLOR_CONFIG(GUI_COLOR_DESTRUCTIVE,_("Destructive hint"));
4023 UI_COLOR_CONFIG(GUI_COLOR_WARNING,_("Warning hint"));
4024 UI_COLOR_CONFIG(GUI_COLOR_ERROR,_("Error hint"));
4025 ImGui::TreePop();
4026 }
4027 if (ImGui::TreeNode(_("File Picker (built-in)"))) {
4028 UI_COLOR_CONFIG(GUI_COLOR_FILE_DIR,_("Directory"));
4029 UI_COLOR_CONFIG(GUI_COLOR_FILE_SONG_NATIVE,_("Song (native)"));
4030 UI_COLOR_CONFIG(GUI_COLOR_FILE_SONG_IMPORT,_("Song (import)"));
4031 UI_COLOR_CONFIG(GUI_COLOR_FILE_INSTR,_("Instrument"));
4032 UI_COLOR_CONFIG(GUI_COLOR_FILE_AUDIO,_("Audio"));
4033 UI_COLOR_CONFIG(GUI_COLOR_FILE_WAVE,_("Wavetable"));
4034 UI_COLOR_CONFIG(GUI_COLOR_FILE_VGM,_("VGM"));
4035 UI_COLOR_CONFIG(GUI_COLOR_FILE_ZSM,_("ZSM"));
4036 UI_COLOR_CONFIG(GUI_COLOR_FILE_FONT,_("Font"));
4037 UI_COLOR_CONFIG(GUI_COLOR_FILE_OTHER,_("Other"));
4038 ImGui::TreePop();
4039 }
4040 if (ImGui::TreeNode(_("Oscilloscope"))) {
4041 UI_COLOR_CONFIG(GUI_COLOR_OSC_BORDER,_("Border"));
4042 UI_COLOR_CONFIG(GUI_COLOR_OSC_BG1,_("Background (top-left)"));
4043 UI_COLOR_CONFIG(GUI_COLOR_OSC_BG2,_("Background (top-right)"));
4044 UI_COLOR_CONFIG(GUI_COLOR_OSC_BG3,_("Background (bottom-left)"));
4045 UI_COLOR_CONFIG(GUI_COLOR_OSC_BG4,_("Background (bottom-right)"));
4046 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE,_("Waveform"));
4047 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_PEAK,_("Waveform (clip)"));
4048 UI_COLOR_CONFIG(GUI_COLOR_OSC_REF,_("Reference"));
4049 UI_COLOR_CONFIG(GUI_COLOR_OSC_GUIDE,_("Guide"));
4050
4051 if (ImGui::TreeNode(_("Wave (non-mono)"))) {
4052 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH0,_("Waveform (1)"));
4053 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH1,_("Waveform (2)"));
4054 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH2,_("Waveform (3)"));
4055 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH3,_("Waveform (4)"));
4056 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH4,_("Waveform (5)"));
4057 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH5,_("Waveform (6)"));
4058 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH6,_("Waveform (7)"));
4059 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH7,_("Waveform (8)"));
4060 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH8,_("Waveform (9)"));
4061 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH9,_("Waveform (10)"));
4062 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH10,_("Waveform (11)"));
4063 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH11,_("Waveform (12)"));
4064 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH12,_("Waveform (13)"));
4065 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH13,_("Waveform (14)"));
4066 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH14,_("Waveform (15)"));
4067 UI_COLOR_CONFIG(GUI_COLOR_OSC_WAVE_CH15,_("Waveform (16)"));
4068 ImGui::TreePop();
4069 }
4070 ImGui::TreePop();
4071 }
4072 if (ImGui::TreeNode(_("Volume Meter"))) {
4073 UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_LOW,_("Low"));
4074 UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_HIGH,_("High"));
4075 UI_COLOR_CONFIG(GUI_COLOR_VOLMETER_PEAK,_("Clip"));
4076 ImGui::TreePop();
4077 }
4078 if (ImGui::TreeNode(_("Orders"))) {
4079 UI_COLOR_CONFIG(GUI_COLOR_ORDER_ROW_INDEX,_("Order number"));
4080 UI_COLOR_CONFIG(GUI_COLOR_ORDER_ACTIVE,_("Playing order background"));
4081 UI_COLOR_CONFIG(GUI_COLOR_SONG_LOOP,_("Song loop"));
4082 UI_COLOR_CONFIG(GUI_COLOR_ORDER_SELECTED,_("Selected order"));
4083 UI_COLOR_CONFIG(GUI_COLOR_ORDER_SIMILAR,_("Similar patterns"));
4084 UI_COLOR_CONFIG(GUI_COLOR_ORDER_INACTIVE,_("Inactive patterns"));
4085 ImGui::TreePop();
4086 }
4087 if (ImGui::TreeNode(_("Envelope View"))) {
4088 UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE,_("Envelope"));
4089 UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_SUS_GUIDE,_("Sustain guide"));
4090 UI_COLOR_CONFIG(GUI_COLOR_FM_ENVELOPE_RELEASE,_("Release"));
4091
4092 ImGui::TreePop();
4093 }
4094 if (ImGui::TreeNode(_("FM Editor"))) {
4095 UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_BG,_("Algorithm background"));
4096 UI_COLOR_CONFIG(GUI_COLOR_FM_ALG_LINE,_("Algorithm lines"));
4097 UI_COLOR_CONFIG(GUI_COLOR_FM_MOD,_("Modulator"));
4098 UI_COLOR_CONFIG(GUI_COLOR_FM_CAR,_("Carrier"));
4099
4100 UI_COLOR_CONFIG(GUI_COLOR_FM_SSG,_("SSG-EG"));
4101 UI_COLOR_CONFIG(GUI_COLOR_FM_WAVE,_("Waveform"));
4102
4103 ImGui::TextWrapped(_("(the following colors only apply when \"Use separate colors for carriers/modulators in FM editor\" is on!)"));
4104
4105 UI_COLOR_CONFIG(GUI_COLOR_FM_PRIMARY_MOD,_("Mod. accent (primary)"));
4106 UI_COLOR_CONFIG(GUI_COLOR_FM_SECONDARY_MOD,_("Mod. accent (secondary)"));
4107 UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_MOD,_("Mod. border"));
4108 UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_SHADOW_MOD,_("Mod. border shadow"));
4109
4110 UI_COLOR_CONFIG(GUI_COLOR_FM_PRIMARY_CAR,_("Car. accent (primary)"));
4111 UI_COLOR_CONFIG(GUI_COLOR_FM_SECONDARY_CAR,_("Car. accent (secondary)"));
4112 UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_CAR,_("Car. border"));
4113 UI_COLOR_CONFIG(GUI_COLOR_FM_BORDER_SHADOW_CAR,_("Car. border shadow"));
4114
4115 ImGui::TreePop();
4116 }
4117 if (ImGui::TreeNode(_("Macro Editor"))) {
4118 UI_COLOR_CONFIG(GUI_COLOR_MACRO_VOLUME,_("Volume"));
4119 UI_COLOR_CONFIG(GUI_COLOR_MACRO_PITCH,_("Pitch"));
4120 UI_COLOR_CONFIG(GUI_COLOR_MACRO_WAVE,_("Wave"));
4121 UI_COLOR_CONFIG(GUI_COLOR_MACRO_NOISE,_("Noise"));
4122 UI_COLOR_CONFIG(GUI_COLOR_MACRO_FILTER,_("Filter"));
4123 UI_COLOR_CONFIG(GUI_COLOR_MACRO_ENVELOPE,_("Envelope"));
4124 UI_COLOR_CONFIG(GUI_COLOR_MACRO_GLOBAL,_("Global Parameter"));
4125 UI_COLOR_CONFIG(GUI_COLOR_MACRO_OTHER,_("Other"));
4126 UI_COLOR_CONFIG(GUI_COLOR_MACRO_HIGHLIGHT,_("Step Highlight"));
4127 ImGui::TreePop();
4128 }
4129 if (ImGui::TreeNode(_("Instrument Types"))) {
4130 UI_COLOR_CONFIG(GUI_COLOR_INSTR_FM,_("FM (OPN)"));
4131 UI_COLOR_CONFIG(GUI_COLOR_INSTR_STD,_("SN76489/Sega PSG"));
4132 UI_COLOR_CONFIG(GUI_COLOR_INSTR_T6W28,_("T6W28"));
4133 UI_COLOR_CONFIG(GUI_COLOR_INSTR_GB,_("Game Boy"));
4134 UI_COLOR_CONFIG(GUI_COLOR_INSTR_C64,_("C64"));
4135 UI_COLOR_CONFIG(GUI_COLOR_INSTR_AMIGA,_("Amiga/Generic Sample"));
4136 UI_COLOR_CONFIG(GUI_COLOR_INSTR_PCE,_("PC Engine"));
4137 UI_COLOR_CONFIG(GUI_COLOR_INSTR_AY,_("AY-3-8910/SSG"));
4138 UI_COLOR_CONFIG(GUI_COLOR_INSTR_AY8930,_("AY8930"));
4139 UI_COLOR_CONFIG(GUI_COLOR_INSTR_TIA,_("TIA"));
4140 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SAA1099,_("SAA1099"));
4141 UI_COLOR_CONFIG(GUI_COLOR_INSTR_VIC,_("VIC"));
4142 UI_COLOR_CONFIG(GUI_COLOR_INSTR_PET,_("PET"));
4143 UI_COLOR_CONFIG(GUI_COLOR_INSTR_VRC6,_("VRC6"));
4144 UI_COLOR_CONFIG(GUI_COLOR_INSTR_VRC6_SAW,_("VRC6 (saw)"));
4145 UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPLL,_("FM (OPLL)"));
4146 UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPL,_("FM (OPL)"));
4147 UI_COLOR_CONFIG(GUI_COLOR_INSTR_FDS,_("FDS"));
4148 UI_COLOR_CONFIG(GUI_COLOR_INSTR_VBOY,_("Virtual Boy"));
4149 UI_COLOR_CONFIG(GUI_COLOR_INSTR_N163,_("Namco 163"));
4150 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SCC,_("Konami SCC"));
4151 UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPZ,_("FM (OPZ)"));
4152 UI_COLOR_CONFIG(GUI_COLOR_INSTR_POKEY,_("POKEY"));
4153 UI_COLOR_CONFIG(GUI_COLOR_INSTR_BEEPER,_("PC Beeper"));
4154 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SWAN,_("WonderSwan"));
4155 UI_COLOR_CONFIG(GUI_COLOR_INSTR_MIKEY,_("Lynx"));
4156 UI_COLOR_CONFIG(GUI_COLOR_INSTR_VERA,_("VERA"));
4157 UI_COLOR_CONFIG(GUI_COLOR_INSTR_X1_010,_("X1-010"));
4158 UI_COLOR_CONFIG(GUI_COLOR_INSTR_ES5506,_("ES5506"));
4159 UI_COLOR_CONFIG(GUI_COLOR_INSTR_MULTIPCM,_("MultiPCM"));
4160 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SNES,_("SNES"));
4161 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SU,_("Sound Unit"));
4162 UI_COLOR_CONFIG(GUI_COLOR_INSTR_NAMCO,_("Namco WSG"));
4163 UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPL_DRUMS,_("FM (OPL Drums)"));
4164 UI_COLOR_CONFIG(GUI_COLOR_INSTR_OPM,_("FM (OPM)"));
4165 UI_COLOR_CONFIG(GUI_COLOR_INSTR_NES,_("NES"));
4166 UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM6258,_("MSM6258"));
4167 UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM6295,_("MSM6295"));
4168 UI_COLOR_CONFIG(GUI_COLOR_INSTR_ADPCMA,_("ADPCM-A"));
4169 UI_COLOR_CONFIG(GUI_COLOR_INSTR_ADPCMB,_("ADPCM-B"));
4170 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SEGAPCM,_("Sega PCM"));
4171 UI_COLOR_CONFIG(GUI_COLOR_INSTR_QSOUND,_("QSound"));
4172 UI_COLOR_CONFIG(GUI_COLOR_INSTR_YMZ280B,_("YMZ280B"));
4173 UI_COLOR_CONFIG(GUI_COLOR_INSTR_RF5C68,_("RF5C68"));
4174 UI_COLOR_CONFIG(GUI_COLOR_INSTR_MSM5232,_("MSM5232"));
4175 UI_COLOR_CONFIG(GUI_COLOR_INSTR_K007232,_("K007232"));
4176 UI_COLOR_CONFIG(GUI_COLOR_INSTR_GA20,_("GA20"));
4177 UI_COLOR_CONFIG(GUI_COLOR_INSTR_POKEMINI,_("Pokémon Mini"));
4178 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SM8521,_("SM8521"));
4179 UI_COLOR_CONFIG(GUI_COLOR_INSTR_PV1000,_("PV-1000"));
4180 UI_COLOR_CONFIG(GUI_COLOR_INSTR_K053260,_("K053260"));
4181 UI_COLOR_CONFIG(GUI_COLOR_INSTR_TED,_("TED"));
4182 UI_COLOR_CONFIG(GUI_COLOR_INSTR_C140,_("C140"));
4183 UI_COLOR_CONFIG(GUI_COLOR_INSTR_C219,_("C219"));
4184 UI_COLOR_CONFIG(GUI_COLOR_INSTR_ESFM,_("ESFM"));
4185 UI_COLOR_CONFIG(GUI_COLOR_INSTR_POWERNOISE,_("PowerNoise (noise)"));
4186 UI_COLOR_CONFIG(GUI_COLOR_INSTR_POWERNOISE_SLOPE,_("PowerNoise (slope)"));
4187 UI_COLOR_CONFIG(GUI_COLOR_INSTR_DAVE,_("Dave"));
4188 UI_COLOR_CONFIG(GUI_COLOR_INSTR_NDS,_("Nintendo DS"));
4189 UI_COLOR_CONFIG(GUI_COLOR_INSTR_GBA_DMA,_("GBA DMA"));
4190 UI_COLOR_CONFIG(GUI_COLOR_INSTR_GBA_MINMOD,_("GBA MinMod"));
4191 UI_COLOR_CONFIG(GUI_COLOR_INSTR_BIFURCATOR,_("Bifurcator"));
4192 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SID2,_("SID2"));
4193 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SUPERVISION,_("Supervision"));
4194 UI_COLOR_CONFIG(GUI_COLOR_INSTR_UPD1771C,_("μPD1771C"));
4195 UI_COLOR_CONFIG(GUI_COLOR_INSTR_SID3,_("SID3"));
4196 UI_COLOR_CONFIG(GUI_COLOR_INSTR_UNKNOWN,_("Other/Unknown"));
4197 ImGui::TreePop();
4198 }
4199 if (ImGui::TreeNode(_("Channel"))) {
4200 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_BG,_("Single color (background)"));
4201 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FG,_("Single color (text)"));
4202 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_FM,_("FM"));
4203 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PULSE,_("Pulse"));
4204 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_NOISE,_("Noise"));
4205 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_PCM,_("PCM"));
4206 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_WAVE,_("Wave"));
4207 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_OP,_("FM operator"));
4208 UI_COLOR_CONFIG(GUI_COLOR_CHANNEL_MUTED,_("Muted"));
4209 ImGui::TreePop();
4210 }
4211 if (ImGui::TreeNode(_("Pattern"))) {
4212 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_PLAY_HEAD,_("Playhead"));
4213 UI_COLOR_CONFIG(GUI_COLOR_EDITING,_("Editing"));
4214 UI_COLOR_CONFIG(GUI_COLOR_EDITING_CLONE,_("Editing (will clone)"));
4215 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR,_("Cursor"));
4216 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_HOVER,_("Cursor (hovered)"));
4217 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_CURSOR_ACTIVE,_("Cursor (clicked)"));
4218 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION,_("Selection"));
4219 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION_HOVER,_("Selection (hovered)"));
4220 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_SELECTION_ACTIVE,_("Selection (clicked)"));
4221 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_1,_("Highlight 1"));
4222 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_HI_2,_("Highlight 2"));
4223 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX,_("Row number"));
4224 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI1,_("Row number (highlight 1)"));
4225 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ROW_INDEX_HI2,_("Row number (highlight 2)"));
4226 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE,_("Note"));
4227 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI1,_("Note (highlight 1)"));
4228 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_ACTIVE_HI2,_("Note (highlight 2)"));
4229 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE,_("Blank"));
4230 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI1,_("Blank (highlight 1)"));
4231 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INACTIVE_HI2,_("Blank (highlight 2)"));
4232 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS,_("Instrument"));
4233 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_WARN,_("Instrument (invalid type)"));
4234 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_INS_ERROR,_("Instrument (out of range)"));
4235 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_MIN,_("Volume (0%)"));
4236 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_HALF,_("Volume (50%)"));
4237 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_VOLUME_MAX,_("Volume (100%)"));
4238 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_INVALID,_("Invalid effect"));
4239 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_PITCH,_("Pitch effect"));
4240 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_VOLUME,_("Volume effect"));
4241 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_PANNING,_("Panning effect"));
4242 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SONG,_("Song effect"));
4243 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_TIME,_("Time effect"));
4244 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SPEED,_("Speed effect"));
4245 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY,_("Primary specific effect"));
4246 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY,_("Secondary specific effect"));
4247 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_EFFECT_MISC,_("Miscellaneous"));
4248 UI_COLOR_CONFIG(GUI_COLOR_EE_VALUE,_("External command output"));
4249 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_OFF,_("Status: off/disabled"));
4250 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_REL,_("Status: off + macro rel"));
4251 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_REL_ON,_("Status: on + macro rel"));
4252 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ON,_("Status: on"));
4253 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_VOLUME,_("Status: volume"));
4254 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_PITCH,_("Status: pitch"));
4255 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_PANNING,_("Status: panning"));
4256 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SYS1,_("Status: chip (primary)"));
4257 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SYS2,_("Status: chip (secondary)"));
4258 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MIXING,_("Status: mixing"));
4259 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DSP,_("Status: DSP effect"));
4260 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_NOTE,_("Status: note altering"));
4261 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC1,_("Status: misc color 1"));
4262 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC2,_("Status: misc color 2"));
4263 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_MISC3,_("Status: misc color 3"));
4264 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ATTACK,_("Status: attack"));
4265 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DECAY,_("Status: decay"));
4266 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_SUSTAIN,_("Status: sustain"));
4267 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_RELEASE,_("Status: release"));
4268 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_LINEAR,_("Status: decrease linear"));
4269 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DEC_EXP,_("Status: decrease exp"));
4270 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_INC,_("Status: increase"));
4271 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_BENT,_("Status: bent"));
4272 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_DIRECT,_("Status: direct"));
4273 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_WARNING,_("Status: warning"));
4274 UI_COLOR_CONFIG(GUI_COLOR_PATTERN_STATUS_ERROR,_("Status: error"));
4275 ImGui::TreePop();
4276 }
4277 if (ImGui::TreeNode(_("Sample Editor"))) {
4278 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_BG,_("Background"));
4279 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_FG,_("Waveform"));
4280 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_TIME_BG,_("Time background"));
4281 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_TIME_FG,_("Time text"));
4282 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP,_("Loop region"));
4283 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CENTER,_("Center guide"));
4284 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_GRID,_("Grid"));
4285 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL,_("Selection"));
4286 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_SEL_POINT,_("Selection points"));
4287 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE,_("Preview needle"));
4288 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_NEEDLE_PLAYING,_("Playing needles"));
4289 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP_POINT,_("Loop markers"));
4290 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_LOOP_HINT,_("Valid loop position hints"));
4291 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_DISABLED,_("Chip select: disabled"));
4292 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_ENABLED,_("Chip select: enabled"));
4293 UI_COLOR_CONFIG(GUI_COLOR_SAMPLE_CHIP_WARNING,_("Chip select: enabled (failure)"));
4294 ImGui::TreePop();
4295 }
4296 if (ImGui::TreeNode(_("Pattern Manager"))) {
4297 UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_NULL,_("Unallocated"));
4298 UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_UNUSED,_("Unused"));
4299 UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_USED,_("Used"));
4300 UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_OVERUSED,_("Overused"));
4301 UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_EXTREMELY_OVERUSED,_("Really overused"));
4302 UI_COLOR_CONFIG(GUI_COLOR_PAT_MANAGER_COMBO_BREAKER,_("Combo Breaker"));
4303 ImGui::TreePop();
4304 }
4305 if (ImGui::TreeNode(_("Piano"))) {
4306 UI_COLOR_CONFIG(GUI_COLOR_PIANO_BACKGROUND,_("Background"));
4307 UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP,_("Upper key"));
4308 UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP_HIT,_("Upper key (feedback)"));
4309 UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_TOP_ACTIVE,_("Upper key (pressed)"));
4310 UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM,_("Lower key"));
4311 UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM_HIT,_("Lower key (feedback)"));
4312 UI_COLOR_CONFIG(GUI_COLOR_PIANO_KEY_BOTTOM_ACTIVE,_("Lower key (pressed)"));
4313 ImGui::TreePop();
4314 }
4315 if (ImGui::TreeNode(_("Clock"))) {
4316 UI_COLOR_CONFIG(GUI_COLOR_CLOCK_TEXT,_("Clock text"));
4317 UI_COLOR_CONFIG(GUI_COLOR_CLOCK_BEAT_LOW,_("Beat (off)"));
4318 UI_COLOR_CONFIG(GUI_COLOR_CLOCK_BEAT_HIGH,_("Beat (on)"));
4319
4320 ImGui::TreePop();
4321 }
4322 if (ImGui::TreeNode(_("Patchbay"))) {
4323 UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORTSET,_("PortSet"));
4324 UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORT,_("Port"));
4325 UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_PORT_HIDDEN,_("Port (hidden/unavailable)"));
4326 UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_CONNECTION,_("Connection (selected)"));
4327 UI_COLOR_CONFIG(GUI_COLOR_PATCHBAY_CONNECTION_BG,_("Connection (other)"));
4328
4329 ImGui::TreePop();
4330 }
4331 if (ImGui::TreeNode(_("Memory Composition"))) {
4332 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BG,_("Background"));
4333 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_DATA,_("Waveform data"));
4334 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_FREE,_("Unknown"));
4335 //UI_COLOR_CONFIG(GUI_COLOR_MEMORY_PADDING,_(""));
4336 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_RESERVED,_("Reserved"));
4337 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE,_("Sample"));
4338 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT1,_("Sample (alternate 1)"));
4339 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT2,_("Sample (alternate 2)"));
4340 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_SAMPLE_ALT3,_("Sample (alternate 3)"));
4341 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_RAM,_("Wave RAM"));
4342 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_WAVE_STATIC,_("Wavetable (static)"));
4343 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_ECHO,_("Echo buffer"));
4344 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_N163_LOAD,_("Namco 163 load pos"));
4345 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_N163_PLAY,_("Namco 163 play pos"));
4346 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK0,_("Sample (bank 0)"));
4347 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK1,_("Sample (bank 1)"));
4348 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK2,_("Sample (bank 2)"));
4349 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK3,_("Sample (bank 3)"));
4350 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK4,_("Sample (bank 4)"));
4351 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK5,_("Sample (bank 5)"));
4352 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK6,_("Sample (bank 6)"));
4353 UI_COLOR_CONFIG(GUI_COLOR_MEMORY_BANK7,_("Sample (bank 7)"));
4354
4355 ImGui::TreePop();
4356 }
4357 if (ImGui::TreeNode(_("Log Viewer"))) {
4358 UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_ERROR,_("Log level: Error"));
4359 UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_WARNING,_("Log level: Warning"));
4360 UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_INFO,_("Log level: Info"));
4361 UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_DEBUG,_("Log level: Debug"));
4362 UI_COLOR_CONFIG(GUI_COLOR_LOGLEVEL_TRACE,_("Log level: Trace/Verbose"));
4363 ImGui::TreePop();
4364 }
4365 END_SECTION;
4366 }
4367 CONFIG_SECTION(_("Backup")) {
4368 // SUBSECTION SETTINGS
4369 CONFIG_SUBSECTION(_("Configuration"));
4370
4371 bool backupEnableB=settings.backupEnable;
4372 if (ImGui::Checkbox(_("Enable backup system"),&backupEnableB)) {
4373 settings.backupEnable=backupEnableB;
4374 settingsChanged=true;
4375 }
4376
4377 if (ImGui::InputInt(_("Interval (in seconds)"),&settings.backupInterval)) {
4378 if (settings.backupInterval<10) settings.backupInterval=10;
4379 if (settings.backupInterval>86400) settings.backupInterval=86400;
4380 }
4381
4382 if (ImGui::InputInt(_("Backups per file"),&settings.backupMaxCopies)) {
4383 if (settings.backupMaxCopies<1) settings.backupMaxCopies=1;
4384 if (settings.backupMaxCopies>100) settings.backupMaxCopies=100;
4385 }
4386
4387 // SUBSECTION SETTINGS
4388 CONFIG_SUBSECTION(_("Backup Management"));
4389 bool purgeDateChanged=false;
4390
4391 ImGui::AlignTextToFramePadding();
4392 ImGui::Text(_("Purge before:"));
4393 ImGui::SameLine();
4394 ImGui::SetNextItemWidth(60.0f*dpiScale);
4395 if (ImGui::InputInt("##PYear",&purgeYear,0,0)) purgeDateChanged=true;
4396 ImGui::SameLine();
4397 ImGui::SetNextItemWidth(40.0f*dpiScale);
4398 if (ImGui::InputInt("##PMonth",&purgeMonth,0,0)) purgeDateChanged=true;
4399 ImGui::SameLine();
4400 ImGui::SetNextItemWidth(40.0f*dpiScale);
4401 if (ImGui::InputInt("##PDay",&purgeDay,0,0)) purgeDateChanged=true;
4402
4403 if (purgeDateChanged) {
4404 // check month/day validity
4405 time_t thisMakesNoSense=time(NULL);
4406 bool tmFailed=false;
4407 struct tm curTime;
4408 #ifdef _WIN32
4409 struct tm* tempTM=localtime(&thisMakesNoSense);
4410 if (tempTM==NULL) {
4411 memset(&curTime,0,sizeof(struct tm));
4412 tmFailed=true;
4413 } else {
4414 memcpy(&curTime,tempTM,sizeof(struct tm));
4415 }
4416 #else
4417 if (localtime_r(&thisMakesNoSense,&curTime)==NULL) {
4418 memset(&curTime,0,sizeof(struct tm));
4419 tmFailed=true;
4420 }
4421 #endif
4422
4423 // don't allow dates in the future
4424 if (!tmFailed) {
4425 int curYear=curTime.tm_year+1900;
4426 int curMonth=curTime.tm_mon+1;
4427 int curDay=curTime.tm_mday;
4428
4429 if (purgeYear<1) purgeYear=1;
4430 if (purgeYear>curYear) purgeYear=curYear;
4431
4432 if (purgeYear==curYear) {
4433 if (purgeMonth>curMonth) purgeMonth=curMonth;
4434
4435 if (purgeMonth==curMonth) {
4436 if (purgeDay>curDay) purgeDay=curDay;
4437 }
4438 }
4439 }
4440
4441 // general checks
4442 if (purgeYear<1) purgeYear=1;
4443 if (purgeMonth<1) purgeMonth=1;
4444 if (purgeMonth>12) purgeMonth=12;
4445 if (purgeDay<1) purgeDay=1;
4446
4447 // 1752 calendar alignment
4448 if (purgeYear==1752 && purgeMonth==9) {
4449 if (purgeDay>2 && purgeDay<14) purgeDay=2;
4450 }
4451 if (purgeMonth==2) {
4452 // leap year
4453 if ((purgeYear&3)==0 && ((purgeYear%100)!=0 || (purgeYear%400)==0)) {
4454 if (purgeDay>29) purgeDay=29;
4455 } else {
4456 if (purgeDay>28) purgeDay=28;
4457 }
4458 } else if (purgeMonth==1 || purgeMonth==3 || purgeMonth==5 || purgeMonth==7 || purgeMonth==8 || purgeMonth==10 || purgeMonth==12) {
4459 if (purgeDay>31) purgeDay=31;
4460 } else {
4461 if (purgeDay>30) purgeDay=30;
4462 }
4463 }
4464
4465 ImGui::SameLine();
4466 if (ImGui::Button(_("Go##PDate"))) {
4467 purgeBackups(purgeYear,purgeMonth,purgeDay);
4468 }
4469
4470 backupEntryLock.lock();
4471 ImGui::AlignTextToFramePadding();
4472 if (totalBackupSize>=(1ULL<<50ULL)) {
4473 ImGui::Text(_("%" PRIu64 "PB used"),totalBackupSize>>50);
4474 } else if (totalBackupSize>=(1ULL<<40ULL)) {
4475 ImGui::Text(_("%" PRIu64 "TB used"),totalBackupSize>>40);
4476 } else if (totalBackupSize>=(1ULL<<30ULL)) {
4477 ImGui::Text(_("%" PRIu64 "GB used"),totalBackupSize>>30);
4478 } else if (totalBackupSize>=(1ULL<<20ULL)) {
4479 ImGui::Text(_("%" PRIu64 "MB used"),totalBackupSize>>20);
4480 } else if (totalBackupSize>=(1ULL<<10ULL)) {
4481 ImGui::Text(_("%" PRIu64 "KB used"),totalBackupSize>>10);
4482 } else {
4483 ImGui::Text(_("%" PRIu64 " bytes used"),totalBackupSize);
4484 }
4485
4486 ImGui::SameLine();
4487
4488 if (ImGui::Button(_("Refresh"))) {
4489 refreshBackups=true;
4490 }
4491 ImGui::SameLine();
4492 if (ImGui::Button(_("Delete all"))) {
4493 purgeBackups(0,0,0);
4494 }
4495
4496 if (ImGui::BeginTable("BackupList",3,ImGuiTableFlags_ScrollY|ImGuiTableFlags_Borders)) {
4497 ImGui::TableSetupColumn(_("Name"),ImGuiTableColumnFlags_WidthStretch,0.6f);
4498 ImGui::TableSetupColumn(_("Size"),ImGuiTableColumnFlags_WidthStretch,0.15f);
4499 ImGui::TableSetupColumn(_("Latest"),ImGuiTableColumnFlags_WidthStretch,0.25f);
4500
4501 ImGui::TableHeadersRow();
4502
4503 for (FurnaceGUIBackupEntry& i: backupEntries) {
4504 ImGui::TableNextRow();
4505 ImGui::TableNextColumn();
4506 ImGui::TextUnformatted(i.name.c_str());
4507 ImGui::TableNextColumn();
4508 if (i.size>=(1ULL<<50ULL)) {
4509 ImGui::Text(_("%" PRIu64 "P"),i.size>>50);
4510 } else if (i.size>=(1ULL<<40ULL)) {
4511 ImGui::Text(_("%" PRIu64 "T"),i.size>>40);
4512 } else if (i.size>=(1ULL<<30ULL)) {
4513 ImGui::Text(_("%" PRIu64 "G"),i.size>>30);
4514 } else if (i.size>=(1ULL<<20ULL)) {
4515 ImGui::Text(_("%" PRIu64 "M"),i.size>>20);
4516 } else if (i.size>=(1ULL<<10ULL)) {
4517 ImGui::Text(_("%" PRIu64 "K"),i.size>>10);
4518 } else {
4519 ImGui::Text(_("%" PRIu64 ""),i.size);
4520 }
4521 ImGui::TableNextColumn();
4522 ImGui::Text("%d-%02d-%02d",i.lastEntryTime.tm_year+1900,i.lastEntryTime.tm_mon+1,i.lastEntryTime.tm_mday);
4523 }
4524
4525 ImGui::EndTable();
4526 }
4527 backupEntryLock.unlock();
4528 if (refreshBackups) {
4529 refreshBackups=false;
4530 if (backupEntryTask.valid()) backupEntryTask.get();
4531 backupEntryTask=std::async(std::launch::async,[this]() -> bool {
4532 backupEntryLock.lock();
4533 backupEntries.clear();
4534 totalBackupSize=0;
4535 backupEntryLock.unlock();
4536
4537 #ifdef _WIN32
4538 String findPath=backupPath+String(DIR_SEPARATOR_STR)+String("*.fur");
4539 WString findPathW=utf8To16(findPath.c_str());
4540 WIN32_FIND_DATAW next;
4541 HANDLE backDir=FindFirstFileW(findPathW.c_str(),&next);
4542 if (backDir!=INVALID_HANDLE_VALUE) {
4543 do {
4544 FurnaceGUIBackupEntry nextEntry;
4545 String cFileNameU=utf16To8(next.cFileName);
4546 if (!splitBackupName(cFileNameU.c_str(),nextEntry.name,nextEntry.lastEntryTime)) continue;
4547
4548 nextEntry.size=(((uint64_t)next.nFileSizeHigh)<<32)|next.nFileSizeLow;
4549
4550 backupEntryLock.lock();
4551 backupEntries.push_back(nextEntry);
4552 totalBackupSize+=nextEntry.size;
4553 backupEntryLock.unlock();
4554 } while (FindNextFileW(backDir,&next)!=0);
4555 FindClose(backDir);
4556 }
4557 #else
4558 DIR* backDir=opendir(backupPath.c_str());
4559 if (backDir==NULL) {
4560 logW("could not open backups dir!");
4561 return false;
4562 }
4563 while (true) {
4564 FurnaceGUIBackupEntry nextEntry;
4565 struct stat nextStat;
4566 struct dirent* next=readdir(backDir);
4567 if (next==NULL) break;
4568 if (strcmp(next->d_name,".")==0) continue;
4569 if (strcmp(next->d_name,"..")==0) continue;
4570 if (!splitBackupName(next->d_name,nextEntry.name,nextEntry.lastEntryTime)) continue;
4571
4572 String nextPath=backupPath+DIR_SEPARATOR_STR+next->d_name;
4573
4574 if (stat(nextPath.c_str(),&nextStat)>=0) {
4575 nextEntry.size=nextStat.st_size;
4576 }
4577
4578 backupEntryLock.lock();
4579 backupEntries.push_back(nextEntry);
4580 totalBackupSize+=nextEntry.size;
4581 backupEntryLock.unlock();
4582 }
4583 closedir(backDir);
4584 #endif
4585
4586 // sort and merge
4587 backupEntryLock.lock();
4588 std::sort(backupEntries.begin(),backupEntries.end(),[](const FurnaceGUIBackupEntry& a, const FurnaceGUIBackupEntry& b) -> bool {
4589 int sc=strcmp(a.name.c_str(),b.name.c_str());
4590 if (sc==0) {
4591 if (a.lastEntryTime.tm_year==b.lastEntryTime.tm_year) {
4592 if (a.lastEntryTime.tm_mon==b.lastEntryTime.tm_mon) {
4593 if (a.lastEntryTime.tm_mday==b.lastEntryTime.tm_mday) {
4594 if (a.lastEntryTime.tm_hour==b.lastEntryTime.tm_hour) {
4595 if (a.lastEntryTime.tm_min==b.lastEntryTime.tm_min) {
4596 return (a.lastEntryTime.tm_sec<b.lastEntryTime.tm_sec);
4597 } else {
4598 return (a.lastEntryTime.tm_min<b.lastEntryTime.tm_min);
4599 }
4600 } else {
4601 return (a.lastEntryTime.tm_hour<b.lastEntryTime.tm_hour);
4602 }
4603 } else {
4604 return (a.lastEntryTime.tm_mday<b.lastEntryTime.tm_mday);
4605 }
4606 } else {
4607 return (a.lastEntryTime.tm_mon<b.lastEntryTime.tm_mon);
4608 }
4609 } else {
4610 return (a.lastEntryTime.tm_year<b.lastEntryTime.tm_year);
4611 }
4612 }
4613
4614 return sc<0;
4615 });
4616 for (size_t i=1; i<backupEntries.size(); i++) {
4617 FurnaceGUIBackupEntry& prevEntry=backupEntries[i-1];
4618 FurnaceGUIBackupEntry& thisEntry=backupEntries[i];
4619
4620 if (thisEntry.name==prevEntry.name) {
4621 prevEntry.size+=thisEntry.size;
4622 backupEntries.erase(backupEntries.begin()+i);
4623 i--;
4624 }
4625 }
4626 backupEntryLock.unlock();
4627 return true;
4628 });
4629 }
4630
4631 END_SECTION;
4632 }
4633 if (nonLatchNibble) {
4634 // ok, so you decided to read the code.
4635 // these are the cheat codes:
4636 // "Debug" - toggles mobile UI
4637 // "Nice Amiga cover of the song!" - enables hidden systems (YMU759/Dummy)
4638 // "42 63" - enables all instrument types
4639 // "4-bit FDS" - enables partial pitch linearity option
4640 // "Power of the Chip" - enables options for multi-threaded audio
4641 // "btcdbcb" - use modern UI padding
4642 // "????" - enables stuff
4643 CONFIG_SECTION(_("Cheat Codes")) {
4644 // SUBSECTION ENTER CODE:
4645 CONFIG_SUBSECTION(_("Enter code:"));
4646 ImGui::InputText("##CheatCode",&mmlString[31]);
4647 if (ImGui::Button(_("Submit"))) {
4648 unsigned int checker=0x11111111;
4649 unsigned int checker1=0;
4650 int index=0;
4651 mmlString[30]=_("invalid code");
4652
4653 for (char& i: mmlString[31]) {
4654 checker^=((unsigned int)i)<<index;
4655 checker1+=i;
4656 checker=(checker>>1|(((checker)^(checker>>2)^(checker>>3)^(checker>>5))&1)<<31);
4657 checker1<<=1;
4658 index=(index+1)&31;
4659 }
4660 if (checker==0x90888b65 && checker1==0x1482) {
4661 mmlString[30]=_("toggled alternate UI");
4662 toggleMobileUI(!mobileUI);
4663 }
4664 if (checker==0x5a42a113 && checker1==0xe4ef451e) {
4665 mmlString[30]=_(":smile: :star_struck: :sunglasses: :ok_hand:");
4666 settings.hiddenSystems=!settings.hiddenSystems;
4667 }
4668 if (checker==0x3affa803 && checker1==0x37db2520) {
4669 mmlString[30]=_("now cutting FM chip costs");
4670 settings.mswEnabled=!settings.mswEnabled;
4671 }
4672 if (checker==0xe888896b && checker1==0xbde) {
4673 mmlString[30]=_("enabled all instrument types");
4674 settings.displayAllInsTypes=!settings.displayAllInsTypes;
4675 }
4676 if (checker==0x3f88abcc && checker1==0xf4a6) {
4677 mmlString[30]=_("OK, if I bring your Partial pitch linearity will you stop bothering me?");
4678 settings.displayPartial=1;
4679 }
4680 if (checker==0x94222d83 && checker1==0x6600) {
4681 mmlString[30]=_("enabled \"comfortable\" mode");
4682 ImGuiStyle& sty=ImGui::GetStyle();
4683 sty.FramePadding=ImVec2(20.0f*dpiScale,20.0f*dpiScale);
4684 sty.ItemSpacing=ImVec2(10.0f*dpiScale,10.0f*dpiScale);
4685 sty.ItemInnerSpacing=ImVec2(10.0f*dpiScale,10.0f*dpiScale);
4686 settingsOpen=false;
4687 }
4688
4689 mmlString[31]="";
4690 }
4691 ImGui::Text("%s",mmlString[30].c_str());
4692
4693 END_SECTION;
4694 }
4695 }
4696 ImGui::EndTabBar();
4697 }
4698 ImGui::Separator();
4699 if (ImGui::Button(_("OK##SettingsOK"))) {
4700 settingsOpen=false;
4701 willCommit=true;
4702 settingsChanged=false;
4703 }
4704 ImGui::SameLine();
4705 if (ImGui::Button(_("Cancel##SettingsCancel"))) {
4706 settingsOpen=false;
4707 audioEngineChanged=false;
4708 syncSettings();
4709 settingsChanged=false;
4710 }
4711 ImGui::SameLine();
4712 ImGui::BeginDisabled(!settingsChanged);
4713 if (ImGui::Button(_("Apply##SettingsApply"))) {
4714 settingsOpen=true;
4715 willCommit=true;
4716 settingsChanged=false;
4717 }
4718 ImGui::EndDisabled();
4719 }
4720 if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_SETTINGS;
4721 ImGui::End();
4722 }
4723
4724 void FurnaceGUI::drawKeybindSettingsTableRow(FurnaceGUIActions actionIdx) {
4725 ImGui::TableNextRow();
4726 ImGui::TableNextColumn();
4727 ImGui::AlignTextToFramePadding();
4728 ImGui::TextUnformatted(guiActions[actionIdx].friendlyName);
4729 ImGui::TableNextColumn();
4730 ImGui::PushID(actionIdx);
4731 for (size_t i=0; i<actionKeys[actionIdx].size()+1; i++) {
4732 ImGui::PushID(i);
4733 if (i>0) ImGui::SameLine();
4734 bool isPending=bindSetPending && bindSetTarget==actionIdx && bindSetTargetIdx==(int)i;
4735 if (i<actionKeys[actionIdx].size()) {
4736 if (ImGui::Button(isPending?_N("Press key..."):getKeyName(actionKeys[actionIdx][i]).c_str())) {
4737 promptKey(actionIdx,i);
4738 settingsChanged=true;
4739 }
4740 bool rightClicked=ImGui::IsItemClicked(ImGuiMouseButton_Right);
4741 if (!rightClicked) {
4742 ImGui::SameLine(0.0f, 1.0f);
4743 }
4744 if (rightClicked || ImGui::Button(ICON_FA_TIMES)) {
4745 actionKeys[actionIdx].erase(actionKeys[actionIdx].begin()+i);
4746 if (isPending) {
4747 bindSetActive=false;
4748 bindSetPending=false;
4749 }
4750 parseKeybinds();
4751 }
4752 } else {
4753 if (ImGui::Button(isPending?_N("Press key..."):"+")) {
4754 promptKey(actionIdx,i);
4755 settingsChanged=true;
4756 }
4757 }
4758 ImGui::PopID(); // i
4759 }
4760 ImGui::PopID(); // action
4761 }
4762
4763 #define clampSetting(x,minV,maxV) \
4764 if (x<minV) { \
4765 x=minV; \
4766 } \
4767 if (x>maxV) { \
4768 x=maxV; \
4769 }
4770
4771 void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
4772 if (groups&GUI_SETTINGS_GENERAL) {
4773 settings.renderDriver=conf.getString("renderDriver","");
4774 settings.noDMFCompat=conf.getInt("noDMFCompat",0);
4775
4776 settings.dpiScale=conf.getFloat("dpiScale",0.0f);
4777
4778 settings.initialSysName=conf.getString("initialSysName","");
4779
4780 // initial system
4781 String initialSys2=conf.getString("initialSys2","");
4782 bool oldVol=conf.getInt("configVersion",DIV_ENGINE_VERSION)<135;
4783 if (initialSys2.empty()) {
4784 initialSys2=e->decodeSysDesc(conf.getString("initialSys",""));
4785 oldVol=false;
4786 }
4787 settings.initialSys.clear();
4788 settings.initialSys.loadFromBase64(initialSys2.c_str());
4789 if (settings.initialSys.getInt("id0",0)==0) {
4790 settings.initialSys.clear();
4791 settings.initialSys.set("id0",e->systemToFileFur(DIV_SYSTEM_YM2612));
4792 settings.initialSys.set("vol0",1.0f);
4793 settings.initialSys.set("pan0",0.0f);
4794 settings.initialSys.set("fr0",0.0f);
4795 settings.initialSys.set("flags0","");
4796 settings.initialSys.set("id1",e->systemToFileFur(DIV_SYSTEM_SMS));
4797 settings.initialSys.set("vol1",0.5f);
4798 settings.initialSys.set("pan1",0);
4799 settings.initialSys.set("fr1",0);
4800 settings.initialSys.set("flags1","");
4801 } else {
4802 if (oldVol) {
4803 for (int i=0; settings.initialSys.getInt(fmt::sprintf("id%d",i),0); i++) {
4804 float newVol=settings.initialSys.getInt(fmt::sprintf("vol%d",i),64);
4805 float newPan=settings.initialSys.getInt(fmt::sprintf("pan%d",i),0);
4806 newVol/=64.0f;
4807 newPan/=127.0f;
4808 settings.initialSys.set(fmt::sprintf("vol%d",i),newVol);
4809 settings.initialSys.set(fmt::sprintf("pan%d",i),newPan);
4810 }
4811 conf.set("initialSys2",settings.initialSys.toBase64());
4812 conf.set("configVersion",DIV_ENGINE_VERSION);
4813 }
4814 }
4815
4816 settings.noThreadedInput=conf.getInt("noThreadedInput",0);
4817 settings.powerSave=conf.getInt("powerSave",POWER_SAVE_DEFAULT);
4818 settings.eventDelay=conf.getInt("eventDelay",0);
4819
4820 settings.renderBackend=conf.getString("renderBackend",GUI_BACKEND_DEFAULT_NAME);
4821 settings.renderClearPos=conf.getInt("renderClearPos",0);
4822
4823 settings.glRedSize=conf.getInt("glRedSize",8);
4824 settings.glGreenSize=conf.getInt("glGreenSize",8);
4825 settings.glBlueSize=conf.getInt("glBlueSize",8);
4826 settings.glAlphaSize=conf.getInt("glAlphaSize",0);
4827 settings.glDepthSize=conf.getInt("glDepthSize",24);
4828 settings.glSetBS=conf.getInt("glSetBS",0);
4829 settings.glStencilSize=conf.getInt("glStencilSize",0);
4830 settings.glBufferSize=conf.getInt("glBufferSize",32);
4831 settings.glDoubleBuffer=conf.getInt("glDoubleBuffer",1);
4832
4833 settings.vsync=conf.getInt("vsync",1);
4834 settings.frameRateLimit=conf.getInt("frameRateLimit",100);
4835 settings.displayRenderTime=conf.getInt("displayRenderTime",0);
4836
4837 settings.chanOscThreads=conf.getInt("chanOscThreads",0);
4838 settings.renderPoolThreads=conf.getInt("renderPoolThreads",0);
4839 settings.shaderOsc=conf.getInt("shaderOsc",0);
4840 settings.writeInsNames=conf.getInt("writeInsNames",0);
4841 settings.readInsNames=conf.getInt("readInsNames",1);
4842 settings.defaultAuthorName=conf.getString("defaultAuthorName","");
4843
4844 settings.hiddenSystems=conf.getInt("hiddenSystems",0);
4845 settings.mswEnabled=conf.getInt("mswEnabled",0);
4846 settings.allowEditDocking=conf.getInt("allowEditDocking",1);
4847 #ifndef FLATPAK_WORKAROUNDS
4848 settings.sysFileDialog=conf.getInt("sysFileDialog",SYS_FILE_DIALOG_DEFAULT);
4849 #endif
4850 settings.displayAllInsTypes=conf.getInt("displayAllInsTypes",0);
4851 settings.displayPartial=conf.getInt("displayPartial",0);
4852
4853 settings.blankIns=conf.getInt("blankIns",0);
4854
4855 settings.saveWindowPos=conf.getInt("saveWindowPos",1);
4856
4857 settings.saveUnusedPatterns=conf.getInt("saveUnusedPatterns",0);
4858 settings.maxRecentFile=conf.getInt("maxRecentFile",10);
4859
4860 settings.persistFadeOut=conf.getInt("persistFadeOut",1);
4861 settings.exportLoops=conf.getInt("exportLoops",0);
4862 settings.exportFadeOut=conf.getDouble("exportFadeOut",0.0);
4863
4864 settings.doubleClickTime=conf.getFloat("doubleClickTime",0.3f);
4865 settings.disableFadeIn=conf.getInt("disableFadeIn",0);
4866 settings.alwaysPlayIntro=conf.getInt("alwaysPlayIntro",0);
4867 settings.iCannotWait=conf.getInt("iCannotWait",0);
4868 settings.noMaximizeWorkaround=conf.getInt("noMaximizeWorkaround",0);
4869
4870 settings.compress=conf.getInt("compress",1);
4871 settings.newPatternFormat=conf.getInt("newPatternFormat",1);
4872 settings.newSongBehavior=conf.getInt("newSongBehavior",0);
4873 settings.playOnLoad=conf.getInt("playOnLoad",0);
4874 settings.centerPopup=conf.getInt("centerPopup",1);
4875
4876 settings.vibrationStrength=conf.getFloat("vibrationStrength",0.5f);
4877 settings.vibrationLength=conf.getInt("vibrationLength",20);
4878
4879 settings.s3mOPL3=conf.getInt("s3mOPL3",1);
4880
4881 settings.backupEnable=conf.getInt("backupEnable",1);
4882 settings.backupInterval=conf.getInt("backupInterval",30);
4883 settings.backupMaxCopies=conf.getInt("backupMaxCopies",5);
4884
4885 settings.autoFillSave=conf.getInt("autoFillSave",0);
4886
4887 settings.locale=conf.getString("locale","");
4888
4889 settings.backgroundPlay=conf.getInt("backgroundPlay",0);
4890 }
4891
4892 if (groups&GUI_SETTINGS_AUDIO) {
4893 settings.audioEngine=(conf.getString("audioEngine","SDL")=="SDL")?1:0;
4894 if (conf.getString("audioEngine","SDL")=="JACK") {
4895 settings.audioEngine=DIV_AUDIO_JACK;
4896 } else if (conf.getString("audioEngine","SDL")=="PortAudio") {
4897 settings.audioEngine=DIV_AUDIO_PORTAUDIO;
4898 } else {
4899 settings.audioEngine=DIV_AUDIO_SDL;
4900 }
4901 settings.audioDevice=conf.getString("audioDevice","");
4902 settings.sdlAudioDriver=conf.getString("sdlAudioDriver","");
4903 settings.audioQuality=conf.getInt("audioQuality",0);
4904 settings.audioHiPass=conf.getInt("audioHiPass",1);
4905 settings.audioBufSize=conf.getInt("audioBufSize",1024);
4906 settings.audioRate=conf.getInt("audioRate",44100);
4907 settings.audioChans=conf.getInt("audioChans",2);
4908
4909 settings.lowLatency=conf.getInt("lowLatency",0);
4910
4911 settings.metroVol=conf.getInt("metroVol",100);
4912 settings.sampleVol=conf.getInt("sampleVol",50);
4913
4914 settings.wasapiEx=conf.getInt("wasapiEx",0);
4915
4916 settings.clampSamples=conf.getInt("clampSamples",0);
4917 settings.forceMono=conf.getInt("forceMono",0);
4918 }
4919
4920 if (groups&GUI_SETTINGS_MIDI) {
4921 settings.midiInDevice=conf.getString("midiInDevice","");
4922 settings.midiOutDevice=conf.getString("midiOutDevice","");
4923 settings.midiOutClock=conf.getInt("midiOutClock",0);
4924 settings.midiOutTime=conf.getInt("midiOutTime",0);
4925 settings.midiOutProgramChange=conf.getInt("midiOutProgramChange",0);
4926 settings.midiOutMode=conf.getInt("midiOutMode",1);
4927 settings.midiOutTimeRate=conf.getInt("midiOutTimeRate",0);
4928 }
4929
4930 if (groups&GUI_SETTINGS_KEYBOARD) {
4931 // keybinds
4932 for (int i=0; i<GUI_ACTION_MAX; i++) {
4933 if (guiActions[i].isNotABind()) continue;
4934
4935 // use { -1 } as a fallback to let us know there was an issue
4936 actionKeys[i]=conf.getIntList(String("keybind_GUI_ACTION_")+String(guiActions[i].name),{-1});
4937 if (actionKeys[i].size()==1 && actionKeys[i][0]==-1) {
4938 actionKeys[i]=guiActions[i].defaultBind;
4939 } else {
4940 for (size_t j=0; j<actionKeys[i].size(); j++) {
4941 if (actionKeys[i][j]==-1) {
4942 actionKeys[i].erase(actionKeys[i].begin()+j);
4943 }
4944 }
4945 }
4946 }
4947
4948 decodeKeyMap(noteKeys,conf.getString("noteKeys",DEFAULT_NOTE_KEYS));
4949 decompileNoteKeys();
4950 }
4951
4952 if (groups&GUI_SETTINGS_BEHAVIOR) {
4953 settings.soloAction=conf.getInt("soloAction",0);
4954 settings.ctrlWheelModifier=conf.getInt("ctrlWheelModifier",0);
4955 settings.pullDeleteBehavior=conf.getInt("pullDeleteBehavior",1);
4956 settings.wrapHorizontal=conf.getInt("wrapHorizontal",0);
4957 settings.wrapVertical=conf.getInt("wrapVertical",0);
4958
4959 settings.stepOnDelete=conf.getInt("stepOnDelete",0);
4960 settings.scrollStep=conf.getInt("scrollStep",0);
4961 settings.avoidRaisingPattern=conf.getInt("avoidRaisingPattern",0);
4962 settings.insFocusesPattern=conf.getInt("insFocusesPattern",1);
4963 settings.stepOnInsert=conf.getInt("stepOnInsert",0);
4964 settings.effectCursorDir=conf.getInt("effectCursorDir",1);
4965 settings.cursorPastePos=conf.getInt("cursorPastePos",1);
4966
4967 settings.effectDeletionAltersValue=conf.getInt("effectDeletionAltersValue",1);
4968
4969 settings.pushNibble=conf.getInt("pushNibble",0);
4970 settings.scrollChangesOrder=conf.getInt("scrollChangesOrder",0);
4971 settings.cursorMoveNoScroll=conf.getInt("cursorMoveNoScroll",0);
4972
4973 settings.notePreviewBehavior=conf.getInt("notePreviewBehavior",1);
4974
4975 settings.absorbInsInput=conf.getInt("absorbInsInput",0);
4976
4977 settings.moveWindowTitle=conf.getInt("moveWindowTitle",1);
4978
4979 settings.doubleClickColumn=conf.getInt("doubleClickColumn",1);
4980 settings.dragMovesSelection=conf.getInt("dragMovesSelection",2);
4981 settings.draggableDataView=conf.getInt("draggableDataView",1);
4982
4983 settings.cursorFollowsOrder=conf.getInt("cursorFollowsOrder",1);
4984
4985 settings.insertBehavior=conf.getInt("insertBehavior",1);
4986 settings.pullDeleteRow=conf.getInt("pullDeleteRow",1);
4987 settings.cursorFollowsWheel=conf.getInt("cursorFollowsWheel",0);
4988 settings.cursorWheelStep=conf.getInt("cursorWheelStep",0);
4989 settings.removeInsOff=conf.getInt("removeInsOff",0);
4990 settings.removeVolOff=conf.getInt("removeVolOff",0);
4991 settings.insTypeMenu=conf.getInt("insTypeMenu",1);
4992
4993 settings.selectAssetOnLoad=conf.getInt("selectAssetOnLoad",1);
4994
4995 settings.inputRepeat=conf.getInt("inputRepeat",1);
4996 }
4997
4998 if (groups&GUI_SETTINGS_FONT) {
4999 settings.mainFontSize=conf.getInt("mainFontSize",GUI_FONT_SIZE_DEFAULT);
5000 settings.headFontSize=conf.getInt("headFontSize",27);
5001 settings.patFontSize=conf.getInt("patFontSize",GUI_FONT_SIZE_DEFAULT);
5002 settings.iconSize=conf.getInt("iconSize",GUI_ICON_SIZE_DEFAULT);
5003
5004 settings.mainFont=conf.getInt("mainFont",GUI_MAIN_FONT_DEFAULT);
5005 settings.headFont=conf.getInt("headFont",0);
5006 settings.patFont=conf.getInt("patFont",GUI_PAT_FONT_DEFAULT);
5007 settings.mainFontPath=conf.getString("mainFontPath","");
5008 settings.headFontPath=conf.getString("headFontPath","");
5009 settings.patFontPath=conf.getString("patFontPath","");
5010
5011 settings.loadFallback=conf.getInt("loadFallback",1);
5012 settings.loadFallbackPat=conf.getInt("loadFallbackPat",1);
5013
5014 settings.fontBackend=conf.getInt("fontBackend",FONT_BACKEND_DEFAULT);
5015 settings.fontHinting=conf.getInt("fontHinting",GUI_FONT_HINTING_DEFAULT);
5016 settings.fontBitmap=conf.getInt("fontBitmap",0);
5017 settings.fontAutoHint=conf.getInt("fontAutoHint",1);
5018 settings.fontAntiAlias=conf.getInt("fontAntiAlias",GUI_FONT_ANTIALIAS_DEFAULT);
5019 settings.fontOversample=conf.getInt("fontOversample",GUI_OVERSAMPLE_DEFAULT);
5020 }
5021
5022 if (groups&GUI_SETTINGS_APPEARANCE) {
5023 settings.oscRoundedCorners=conf.getInt("oscRoundedCorners",GUI_DECORATIONS_DEFAULT);
5024 settings.oscTakesEntireWindow=conf.getInt("oscTakesEntireWindow",0);
5025 settings.oscBorder=conf.getInt("oscBorder",1);
5026 settings.oscEscapesBoundary=conf.getInt("oscEscapesBoundary",0);
5027 settings.oscMono=conf.getInt("oscMono",1);
5028 settings.oscAntiAlias=conf.getInt("oscAntiAlias",1);
5029 settings.oscLineSize=conf.getFloat("oscLineSize",1.0f);
5030
5031 settings.songNotesWrap=conf.getInt("songNotesWrap", 0);
5032
5033 settings.channelColors=conf.getInt("channelColors",1);
5034 settings.channelTextColors=conf.getInt("channelTextColors",0);
5035 settings.channelStyle=conf.getInt("channelStyle",1);
5036 settings.channelVolStyle=conf.getInt("channelVolStyle",0);
5037 settings.channelFeedbackStyle=conf.getInt("channelFeedbackStyle",1);
5038 settings.channelFont=conf.getInt("channelFont",1);
5039 settings.channelTextCenter=conf.getInt("channelTextCenter",1);
5040
5041 settings.roundedWindows=conf.getInt("roundedWindows",GUI_DECORATIONS_DEFAULT);
5042 settings.roundedButtons=conf.getInt("roundedButtons",GUI_DECORATIONS_DEFAULT);
5043 settings.roundedMenus=conf.getInt("roundedMenus",0);
5044 settings.roundedTabs=conf.getInt("roundedTabs",GUI_DECORATIONS_DEFAULT);
5045 settings.roundedScrollbars=conf.getInt("roundedScrollbars",GUI_DECORATIONS_DEFAULT);
5046
5047 settings.separateFMColors=conf.getInt("separateFMColors",0);
5048 settings.insEditColorize=conf.getInt("insEditColorize",0);
5049
5050 settings.chipNames=conf.getInt("chipNames",0);
5051 settings.overflowHighlight=conf.getInt("overflowHighlight",0);
5052 settings.flatNotes=conf.getInt("flatNotes",0);
5053 settings.germanNotation=conf.getInt("germanNotation",0);
5054
5055 settings.frameBorders=conf.getInt("frameBorders",0);
5056
5057 settings.noteOffLabel=conf.getString("noteOffLabel","OFF");
5058 settings.noteRelLabel=conf.getString("noteRelLabel","===");
5059 settings.macroRelLabel=conf.getString("macroRelLabel","REL");
5060 settings.emptyLabel=conf.getString("emptyLabel","...");
5061 settings.emptyLabel2=conf.getString("emptyLabel2","..");
5062
5063 settings.noteCellSpacing=conf.getInt("noteCellSpacing",0);
5064 settings.insCellSpacing=conf.getInt("insCellSpacing",0);
5065 settings.volCellSpacing=conf.getInt("volCellSpacing",0);
5066 settings.effectCellSpacing=conf.getInt("effectCellSpacing",0);
5067 settings.effectValCellSpacing=conf.getInt("effectValCellSpacing",0);
5068
5069 settings.patRowsBase=conf.getInt("patRowsBase",0);
5070 settings.orderRowsBase=conf.getInt("orderRowsBase",1);
5071 settings.fmNames=conf.getInt("fmNames",0);
5072 settings.statusDisplay=conf.getInt("statusDisplay",0);
5073 settings.playbackTime=conf.getInt("playbackTime",1);
5074 settings.viewPrevPattern=conf.getInt("viewPrevPattern",1);
5075 settings.susPosition=conf.getInt("susPosition",0);
5076
5077 settings.titleBarInfo=conf.getInt("titleBarInfo",1);
5078 settings.titleBarSys=conf.getInt("titleBarSys",1);
5079
5080 settings.oplStandardWaveNames=conf.getInt("oplStandardWaveNames",0);
5081
5082 settings.horizontalDataView=conf.getInt("horizontalDataView",0);
5083 settings.noMultiSystem=conf.getInt("noMultiSystem",0);
5084 settings.oldMacroVSlider=conf.getInt("oldMacroVSlider",0);
5085 settings.unsignedDetune=conf.getInt("unsignedDetune",0);
5086 settings.centerPattern=conf.getInt("centerPattern",0);
5087 settings.ordersCursor=conf.getInt("ordersCursor",1);
5088 settings.oneDigitEffects=conf.getInt("oneDigitEffects",0);
5089 settings.orderButtonPos=conf.getInt("orderButtonPos",2);
5090 settings.memUsageUnit=conf.getInt("memUsageUnit",1);
5091 settings.capitalMenuBar=conf.getInt("capitalMenuBar",0);
5092 settings.insIconsStyle=conf.getInt("insIconsStyle",1);
5093 settings.sysSeparators=conf.getInt("sysSeparators",1);
5094
5095 settings.autoMacroStepSize=conf.getInt("autoMacroStepSize",0);
5096 }
5097
5098 if (groups&GUI_SETTINGS_LAYOUTS) {
5099 settings.fmLayout=conf.getInt("fmLayout",4);
5100 settings.sampleLayout=conf.getInt("sampleLayout",0);
5101 settings.waveLayout=conf.getInt("waveLayout",0);
5102 settings.exportOptionsLayout=conf.getInt("exportOptionsLayout",1);
5103 settings.unifiedDataView=conf.getInt("unifiedDataView",0);
5104 settings.macroLayout=conf.getInt("macroLayout",0);
5105 settings.controlLayout=conf.getInt("controlLayout",3);
5106 settings.classicChipOptions=conf.getInt("classicChipOptions",0);
5107 }
5108
5109 if (groups&GUI_SETTINGS_COLOR) {
5110 settings.guiColorsBase=conf.getInt("guiColorsBase",0);
5111 settings.guiColorsShading=conf.getInt("guiColorsShading",0);
5112 settings.basicColors=conf.getInt("basicColors",1);
5113
5114 // colors
5115 for (int i=0; i<GUI_COLOR_MAX; i++) {
5116 uiColors[i]=ImGui::ColorConvertU32ToFloat4(conf.getInt(guiColors[i].name,guiColors[i].defaultColor));
5117 }
5118 }
5119
5120 if (groups&GUI_SETTINGS_EMULATION) {
5121 settings.arcadeCore=conf.getInt("arcadeCore",0);
5122 settings.ym2612Core=conf.getInt("ym2612Core",0);
5123 settings.snCore=conf.getInt("snCore",0);
5124 settings.nesCore=conf.getInt("nesCore",0);
5125 settings.fdsCore=conf.getInt("fdsCore",0);
5126 settings.c64Core=conf.getInt("c64Core",0);
5127 settings.pokeyCore=conf.getInt("pokeyCore",1);
5128 settings.opn1Core=conf.getInt("opn1Core",1);
5129 settings.opnaCore=conf.getInt("opnaCore",1);
5130 settings.opnbCore=conf.getInt("opnbCore",1);
5131 settings.opl2Core=conf.getInt("opl2Core",0);
5132 settings.opl3Core=conf.getInt("opl3Core",0);
5133 settings.opl4Core=conf.getInt("opl4Core",0);
5134 settings.esfmCore=conf.getInt("esfmCore",0);
5135 settings.opllCore=conf.getInt("opllCore",0);
5136 settings.ayCore=conf.getInt("ayCore",0);
5137 settings.swanCore=conf.getInt("swanCore",0);
5138
5139 settings.dsidQuality=conf.getInt("dsidQuality",3);
5140 settings.gbQuality=conf.getInt("gbQuality",3);
5141 settings.pnQuality=conf.getInt("pnQuality",3);
5142 settings.saaQuality=conf.getInt("saaQuality",3);
5143
5144 settings.arcadeCoreRender=conf.getInt("arcadeCoreRender",1);
5145 settings.ym2612CoreRender=conf.getInt("ym2612CoreRender",0);
5146 settings.snCoreRender=conf.getInt("snCoreRender",0);
5147 settings.nesCoreRender=conf.getInt("nesCoreRender",0);
5148 settings.fdsCoreRender=conf.getInt("fdsCoreRender",1);
5149 settings.c64CoreRender=conf.getInt("c64CoreRender",1);
5150 settings.pokeyCoreRender=conf.getInt("pokeyCoreRender",1);
5151 settings.opn1CoreRender=conf.getInt("opn1CoreRender",1);
5152 settings.opnaCoreRender=conf.getInt("opnaCoreRender",1);
5153 settings.opnbCoreRender=conf.getInt("opnbCoreRender",1);
5154 settings.opl2CoreRender=conf.getInt("opl2CoreRender",0);
5155 settings.opl3CoreRender=conf.getInt("opl3CoreRender",0);
5156 settings.opl4CoreRender=conf.getInt("opl4CoreRender",0);
5157 settings.esfmCoreRender=conf.getInt("esfmCoreRender",0);
5158 settings.opllCoreRender=conf.getInt("opllCoreRender",0);
5159 settings.ayCoreRender=conf.getInt("ayCoreRender",0);
5160 settings.swanCoreRender=conf.getInt("swanCoreRender",0);
5161
5162 settings.dsidQualityRender=conf.getInt("dsidQualityRender",3);
5163 settings.gbQualityRender=conf.getInt("gbQualityRender",3);
5164 settings.pnQualityRender=conf.getInt("pnQualityRender",3);
5165 settings.saaQualityRender=conf.getInt("saaQualityRender",3);
5166
5167 settings.pcSpeakerOutMethod=conf.getInt("pcSpeakerOutMethod",0);
5168
5169 settings.yrw801Path=conf.getString("yrw801Path","");
5170 settings.tg100Path=conf.getString("tg100Path","");
5171 settings.mu5Path=conf.getString("mu5Path","");
5172 }
5173
5174 clampSetting(settings.mainFontSize,2,96);
5175 clampSetting(settings.headFontSize,2,96);
5176 clampSetting(settings.patFontSize,2,96);
5177 clampSetting(settings.iconSize,2,48);
5178 clampSetting(settings.audioEngine,0,2);
5179 clampSetting(settings.audioQuality,0,1);
5180 clampSetting(settings.audioHiPass,0,1);
5181 clampSetting(settings.audioBufSize,32,4096);
5182 clampSetting(settings.audioRate,8000,384000);
5183 clampSetting(settings.audioChans,1,16);
5184 clampSetting(settings.arcadeCore,0,1);
5185 clampSetting(settings.ym2612Core,0,2);
5186 clampSetting(settings.snCore,0,1);
5187 clampSetting(settings.nesCore,0,1);
5188 clampSetting(settings.fdsCore,0,1);
5189 clampSetting(settings.c64Core,0,2);
5190 clampSetting(settings.pokeyCore,0,1);
5191 clampSetting(settings.opn1Core,0,2);
5192 clampSetting(settings.opnaCore,0,2);
5193 clampSetting(settings.opnbCore,0,2);
5194 clampSetting(settings.opl2Core,0,2);
5195 clampSetting(settings.opl3Core,0,2);
5196 clampSetting(settings.opl4Core,0,1);
5197 clampSetting(settings.esfmCore,0,1);
5198 clampSetting(settings.opllCore,0,1);
5199 clampSetting(settings.ayCore,0,1);
5200 clampSetting(settings.swanCore,0,1);
5201 clampSetting(settings.dsidQuality,0,5);
5202 clampSetting(settings.gbQuality,0,5);
5203 clampSetting(settings.pnQuality,0,5);
5204 clampSetting(settings.saaQuality,0,5);
5205 clampSetting(settings.arcadeCoreRender,0,1);
5206 clampSetting(settings.ym2612CoreRender,0,2);
5207 clampSetting(settings.snCoreRender,0,1);
5208 clampSetting(settings.nesCoreRender,0,1);
5209 clampSetting(settings.fdsCoreRender,0,1);
5210 clampSetting(settings.c64CoreRender,0,2);
5211 clampSetting(settings.pokeyCoreRender,0,1);
5212 clampSetting(settings.opn1CoreRender,0,2);
5213 clampSetting(settings.opnaCoreRender,0,2);
5214 clampSetting(settings.opnbCoreRender,0,2);
5215 clampSetting(settings.opl2CoreRender,0,2);
5216 clampSetting(settings.opl3CoreRender,0,2);
5217 clampSetting(settings.opl4CoreRender,0,1);
5218 clampSetting(settings.esfmCoreRender,0,1);
5219 clampSetting(settings.opllCoreRender,0,1);
5220 clampSetting(settings.ayCoreRender,0,1);
5221 clampSetting(settings.swanCoreRender,0,1);
5222 clampSetting(settings.dsidQualityRender,0,5);
5223 clampSetting(settings.gbQualityRender,0,5);
5224 clampSetting(settings.pnQualityRender,0,5);
5225 clampSetting(settings.saaQualityRender,0,5);
5226 clampSetting(settings.pcSpeakerOutMethod,0,4);
5227 clampSetting(settings.mainFont,0,6);
5228 clampSetting(settings.patFont,0,6);
5229 clampSetting(settings.patRowsBase,0,1);
5230 clampSetting(settings.orderRowsBase,0,1);
5231 clampSetting(settings.soloAction,0,2);
5232 clampSetting(settings.ctrlWheelModifier,0,3);
5233 clampSetting(settings.pullDeleteBehavior,0,1);
5234 clampSetting(settings.wrapHorizontal,0,2);
5235 clampSetting(settings.wrapVertical,0,3);
5236 clampSetting(settings.fmNames,0,2);
5237 clampSetting(settings.allowEditDocking,0,1);
5238 clampSetting(settings.chipNames,0,1);
5239 clampSetting(settings.overflowHighlight,0,1);
5240 clampSetting(settings.flatNotes,0,1);
5241 clampSetting(settings.germanNotation,0,1);
5242 clampSetting(settings.stepOnDelete,0,1);
5243 clampSetting(settings.scrollStep,0,1);
5244 clampSetting(settings.sysSeparators,0,1);
5245 clampSetting(settings.forceMono,0,1);
5246 clampSetting(settings.controlLayout,0,3);
5247 clampSetting(settings.statusDisplay,0,3);
5248 clampSetting(settings.dpiScale,0.0f,4.0f);
5249 clampSetting(settings.viewPrevPattern,0,1);
5250 clampSetting(settings.guiColorsBase,0,1);
5251 clampSetting(settings.guiColorsShading,0,100);
5252 clampSetting(settings.avoidRaisingPattern,0,1);
5253 clampSetting(settings.insFocusesPattern,0,1);
5254 clampSetting(settings.stepOnInsert,0,1);
5255 clampSetting(settings.unifiedDataView,0,1);
5256 #ifndef FLATPAK_WORKAROUNDS
5257 clampSetting(settings.sysFileDialog,0,1);
5258 #endif
5259 clampSetting(settings.roundedWindows,0,1);
5260 clampSetting(settings.roundedButtons,0,1);
5261 clampSetting(settings.roundedMenus,0,1);
5262 clampSetting(settings.roundedTabs,0,1);
5263 clampSetting(settings.roundedScrollbars,0,1);
5264 clampSetting(settings.loadFallback,0,1);
5265 clampSetting(settings.loadFallbackPat,0,1);
5266 clampSetting(settings.fmLayout,0,7);
5267 clampSetting(settings.susPosition,0,3);
5268 clampSetting(settings.effectCursorDir,0,2);
5269 clampSetting(settings.cursorPastePos,0,1);
5270 clampSetting(settings.titleBarInfo,0,3);
5271 clampSetting(settings.titleBarSys,0,1);
5272 clampSetting(settings.frameBorders,0,1);
5273 clampSetting(settings.effectDeletionAltersValue,0,1);
5274 clampSetting(settings.sampleLayout,0,1);
5275 clampSetting(settings.waveLayout,0,1);
5276 clampSetting(settings.separateFMColors,0,1);
5277 clampSetting(settings.insEditColorize,0,1);
5278 clampSetting(settings.metroVol,0,200);
5279 clampSetting(settings.sampleVol,0,100);
5280 clampSetting(settings.pushNibble,0,1);
5281 clampSetting(settings.scrollChangesOrder,0,2);
5282 clampSetting(settings.oplStandardWaveNames,0,1);
5283 clampSetting(settings.cursorMoveNoScroll,0,1);
5284 clampSetting(settings.lowLatency,0,1);
5285 clampSetting(settings.notePreviewBehavior,0,3);
5286 clampSetting(settings.powerSave,0,1);
5287 clampSetting(settings.absorbInsInput,0,1);
5288 clampSetting(settings.eventDelay,0,1);
5289 clampSetting(settings.moveWindowTitle,0,1);
5290 clampSetting(settings.hiddenSystems,0,1);
5291 clampSetting(settings.mswEnabled,0,1);
5292 clampSetting(settings.horizontalDataView,0,1);
5293 clampSetting(settings.noMultiSystem,0,1);
5294 clampSetting(settings.oldMacroVSlider,0,1);
5295 clampSetting(settings.displayAllInsTypes,0,1);
5296 clampSetting(settings.displayPartial,0,1);
5297 clampSetting(settings.noteCellSpacing,0,32);
5298 clampSetting(settings.insCellSpacing,0,32);
5299 clampSetting(settings.volCellSpacing,0,32);
5300 clampSetting(settings.effectCellSpacing,0,32);
5301 clampSetting(settings.effectValCellSpacing,0,32);
5302 clampSetting(settings.doubleClickColumn,0,1);
5303 clampSetting(settings.blankIns,0,1);
5304 clampSetting(settings.dragMovesSelection,0,5);
5305 clampSetting(settings.draggableDataView,0,1);
5306 clampSetting(settings.unsignedDetune,0,1);
5307 clampSetting(settings.noThreadedInput,0,1);
5308 clampSetting(settings.saveWindowPos,0,1);
5309 clampSetting(settings.clampSamples,0,1);
5310 clampSetting(settings.saveUnusedPatterns,0,1);
5311 clampSetting(settings.channelColors,0,2);
5312 clampSetting(settings.channelTextColors,0,2);
5313 clampSetting(settings.channelStyle,0,5);
5314 clampSetting(settings.channelVolStyle,0,4);
5315 clampSetting(settings.channelFeedbackStyle,0,3);
5316 clampSetting(settings.channelFont,0,1);
5317 clampSetting(settings.channelTextCenter,0,1);
5318 clampSetting(settings.maxRecentFile,0,30);
5319 clampSetting(settings.midiOutClock,0,1);
5320 clampSetting(settings.midiOutTime,0,1);
5321 clampSetting(settings.midiOutProgramChange,0,1);
5322 clampSetting(settings.midiOutMode,0,2);
5323 clampSetting(settings.midiOutTimeRate,0,4);
5324 clampSetting(settings.centerPattern,0,1);
5325 clampSetting(settings.ordersCursor,0,1);
5326 clampSetting(settings.persistFadeOut,0,1);
5327 clampSetting(settings.macroLayout,0,4);
5328 clampSetting(settings.doubleClickTime,0.02,1.0);
5329 clampSetting(settings.oneDigitEffects,0,1);
5330 clampSetting(settings.disableFadeIn,0,1);
5331 clampSetting(settings.alwaysPlayIntro,0,3);
5332 clampSetting(settings.cursorFollowsOrder,0,1);
5333 clampSetting(settings.iCannotWait,0,1);
5334 clampSetting(settings.orderButtonPos,0,2);
5335 clampSetting(settings.compress,0,1);
5336 clampSetting(settings.newPatternFormat,0,1);
5337 clampSetting(settings.renderClearPos,0,1);
5338 clampSetting(settings.insertBehavior,0,1);
5339 clampSetting(settings.pullDeleteRow,0,1);
5340 clampSetting(settings.newSongBehavior,0,1);
5341 clampSetting(settings.memUsageUnit,0,1);
5342 clampSetting(settings.cursorFollowsWheel,0,2);
5343 clampSetting(settings.noDMFCompat,0,1);
5344 clampSetting(settings.removeInsOff,0,1);
5345 clampSetting(settings.removeVolOff,0,1);
5346 clampSetting(settings.playOnLoad,0,2);
5347 clampSetting(settings.insTypeMenu,0,1);
5348 clampSetting(settings.capitalMenuBar,0,1);
5349 clampSetting(settings.centerPopup,0,1);
5350 clampSetting(settings.insIconsStyle,0,2);
5351 clampSetting(settings.classicChipOptions,0,1);
5352 clampSetting(settings.exportOptionsLayout,0,2);
5353 clampSetting(settings.wasapiEx,0,1);
5354 clampSetting(settings.chanOscThreads,0,256);
5355 clampSetting(settings.renderPoolThreads,0,DIV_MAX_CHIPS);
5356 clampSetting(settings.writeInsNames,0,1);
5357 clampSetting(settings.readInsNames,0,1);
5358 clampSetting(settings.fontBackend,0,1);
5359 clampSetting(settings.fontHinting,0,3);
5360 clampSetting(settings.fontBitmap,0,1);
5361 clampSetting(settings.fontAutoHint,0,2);
5362 clampSetting(settings.fontAntiAlias,0,1);
5363 clampSetting(settings.fontOversample,1,3);
5364 clampSetting(settings.selectAssetOnLoad,0,1);
5365 clampSetting(settings.basicColors,0,1);
5366 clampSetting(settings.playbackTime,0,1);
5367 clampSetting(settings.shaderOsc,0,1);
5368 clampSetting(settings.oscLineSize,0.25f,16.0f);
5369 clampSetting(settings.songNotesWrap, 0, 1);
5370 clampSetting(settings.cursorWheelStep,0,2);
5371 clampSetting(settings.vsync,0,4);
5372 clampSetting(settings.frameRateLimit,0,1000);
5373 clampSetting(settings.displayRenderTime,0,1);
5374 clampSetting(settings.vibrationStrength,0.0f,1.0f);
5375 clampSetting(settings.vibrationLength,10,500);
5376 clampSetting(settings.inputRepeat,0,1);
5377 clampSetting(settings.glRedSize,0,32);
5378 clampSetting(settings.glGreenSize,0,32);
5379 clampSetting(settings.glBlueSize,0,32);
5380 clampSetting(settings.glAlphaSize,0,32);
5381 clampSetting(settings.glDepthSize,0,128);
5382 clampSetting(settings.glSetBS,0,1);
5383 clampSetting(settings.glStencilSize,0,32);
5384 clampSetting(settings.glBufferSize,0,128);
5385 clampSetting(settings.glDoubleBuffer,0,1);
5386 clampSetting(settings.backupEnable,0,1);
5387 clampSetting(settings.backupInterval,10,86400);
5388 clampSetting(settings.backupMaxCopies,1,100);
5389 clampSetting(settings.autoFillSave,0,1);
5390 clampSetting(settings.autoMacroStepSize,0,2);
5391 clampSetting(settings.s3mOPL3,0,1);
5392 clampSetting(settings.backgroundPlay,0,1);
5393 clampSetting(settings.noMaximizeWorkaround,0,1);
5394
5395 if (settings.exportLoops<0.0) settings.exportLoops=0.0;
5396 if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
5397 }
5398
5399 void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
5400 // general
5401 if (groups&GUI_SETTINGS_GENERAL) {
5402 conf.set("renderDriver",settings.renderDriver);
5403 conf.set("noDMFCompat",settings.noDMFCompat);
5404
5405 conf.set("dpiScale",settings.dpiScale);
5406
5407 conf.set("initialSys2",settings.initialSys.toBase64());
5408 conf.set("initialSysName",settings.initialSysName);
5409
5410 conf.set("noThreadedInput",settings.noThreadedInput);
5411 conf.set("powerSave",settings.powerSave);
5412 conf.set("eventDelay",settings.eventDelay);
5413
5414 conf.set("renderBackend",settings.renderBackend);
5415 conf.set("renderClearPos",settings.renderClearPos);
5416
5417 conf.set("glRedSize",settings.glRedSize);
5418 conf.set("glGreenSize",settings.glGreenSize);
5419 conf.set("glBlueSize",settings.glBlueSize);
5420 conf.set("glAlphaSize",settings.glAlphaSize);
5421 conf.set("glDepthSize",settings.glDepthSize);
5422 conf.set("glSetBS",settings.glSetBS);
5423 conf.set("glStencilSize",settings.glStencilSize);
5424 conf.set("glBufferSize",settings.glBufferSize);
5425 conf.set("glDoubleBuffer",settings.glDoubleBuffer);
5426
5427 conf.set("vsync",settings.vsync);
5428 conf.set("frameRateLimit",settings.frameRateLimit);
5429 conf.set("displayRenderTime",settings.displayRenderTime);
5430
5431 conf.set("chanOscThreads",settings.chanOscThreads);
5432 conf.set("renderPoolThreads",settings.renderPoolThreads);
5433 conf.set("shaderOsc",settings.shaderOsc);
5434 conf.set("writeInsNames",settings.writeInsNames);
5435 conf.set("readInsNames",settings.readInsNames);
5436 conf.set("defaultAuthorName",settings.defaultAuthorName);
5437
5438 conf.set("hiddenSystems",settings.hiddenSystems);
5439 conf.set("mswEnabled",settings.mswEnabled);
5440 conf.set("allowEditDocking",settings.allowEditDocking);
5441 #ifndef FLATPAK_WORKAROUNDS
5442 conf.set("sysFileDialog",settings.sysFileDialog);
5443 #endif
5444 conf.set("displayAllInsTypes",settings.displayAllInsTypes);
5445 conf.set("displayPartial",settings.displayPartial);
5446
5447 conf.set("blankIns",settings.blankIns);
5448
5449 conf.set("saveWindowPos",settings.saveWindowPos);
5450
5451 conf.set("saveUnusedPatterns",settings.saveUnusedPatterns);
5452 conf.set("maxRecentFile",settings.maxRecentFile);
5453
5454 conf.set("persistFadeOut",settings.persistFadeOut);
5455 conf.set("exportLoops",settings.exportLoops);
5456 conf.set("exportFadeOut",settings.exportFadeOut);
5457
5458 conf.set("doubleClickTime",settings.doubleClickTime);
5459 conf.set("disableFadeIn",settings.disableFadeIn);
5460 conf.set("alwaysPlayIntro",settings.alwaysPlayIntro);
5461 conf.set("iCannotWait",settings.iCannotWait);
5462 conf.set("noMaximizeWorkaround",settings.noMaximizeWorkaround);
5463
5464 conf.set("compress",settings.compress);
5465 conf.set("newPatternFormat",settings.newPatternFormat);
5466 conf.set("newSongBehavior",settings.newSongBehavior);
5467 conf.set("playOnLoad",settings.playOnLoad);
5468 conf.set("centerPopup",settings.centerPopup);
5469
5470 conf.set("vibrationStrength",settings.vibrationStrength);
5471 conf.set("vibrationLength",settings.vibrationLength);
5472
5473 conf.set("s3mOPL3",settings.s3mOPL3);
5474
5475 conf.set("backupEnable",settings.backupEnable);
5476 conf.set("backupInterval",settings.backupInterval);
5477 conf.set("backupMaxCopies",settings.backupMaxCopies);
5478
5479 conf.set("autoFillSave",settings.autoFillSave);
5480
5481 conf.set("locale",settings.locale);
5482
5483 conf.set("backgroundPlay",settings.backgroundPlay);
5484 }
5485
5486 // audio
5487 if (groups&GUI_SETTINGS_AUDIO) {
5488 conf.set("audioEngine",String(audioBackends[settings.audioEngine]));
5489 conf.set("audioDevice",settings.audioDevice);
5490 conf.set("sdlAudioDriver",settings.sdlAudioDriver);
5491 conf.set("audioQuality",settings.audioQuality);
5492 conf.set("audioHiPass",settings.audioHiPass);
5493 conf.set("audioBufSize",settings.audioBufSize);
5494 conf.set("audioRate",settings.audioRate);
5495 conf.set("audioChans",settings.audioChans);
5496
5497 conf.set("lowLatency",settings.lowLatency);
5498
5499 conf.set("metroVol",settings.metroVol);
5500 conf.set("sampleVol",settings.sampleVol);
5501
5502 conf.set("wasapiEx",settings.wasapiEx);
5503
5504 conf.set("clampSamples",settings.clampSamples);
5505 conf.set("forceMono",settings.forceMono);
5506 }
5507
5508 // MIDI
5509 if (groups&GUI_SETTINGS_MIDI) {
5510 conf.set("midiInDevice",settings.midiInDevice);
5511 conf.set("midiOutDevice",settings.midiOutDevice);
5512 conf.set("midiOutClock",settings.midiOutClock);
5513 conf.set("midiOutTime",settings.midiOutTime);
5514 conf.set("midiOutProgramChange",settings.midiOutProgramChange);
5515 conf.set("midiOutMode",settings.midiOutMode);
5516 conf.set("midiOutTimeRate",settings.midiOutTimeRate);
5517 }
5518
5519 // keyboard
5520 if (groups&GUI_SETTINGS_KEYBOARD) {
5521 // keybinds
5522 for (int i=0; i<GUI_ACTION_MAX; i++) {
5523 if (guiActions[i].isNotABind()) continue;
5524 conf.set(String("keybind_GUI_ACTION_")+String(guiActions[i].name),actionKeys[i]);
5525 }
5526
5527 compileNoteKeys();
5528 conf.set("noteKeys",encodeKeyMap(noteKeys));
5529 }
5530
5531 // behavior
5532 if (groups&GUI_SETTINGS_BEHAVIOR) {
5533 conf.set("soloAction",settings.soloAction);
5534 conf.set("ctrlWheelModifier",settings.ctrlWheelModifier);
5535 conf.set("pullDeleteBehavior",settings.pullDeleteBehavior);
5536 conf.set("wrapHorizontal",settings.wrapHorizontal);
5537 conf.set("wrapVertical",settings.wrapVertical);
5538
5539 conf.set("stepOnDelete",settings.stepOnDelete);
5540 conf.set("scrollStep",settings.scrollStep);
5541 conf.set("avoidRaisingPattern",settings.avoidRaisingPattern);
5542 conf.set("insFocusesPattern",settings.insFocusesPattern);
5543 conf.set("stepOnInsert",settings.stepOnInsert);
5544 conf.set("effectCursorDir",settings.effectCursorDir);
5545 conf.set("cursorPastePos",settings.cursorPastePos);
5546
5547 conf.set("effectDeletionAltersValue",settings.effectDeletionAltersValue);
5548
5549 conf.set("pushNibble",settings.pushNibble);
5550 conf.set("scrollChangesOrder",settings.scrollChangesOrder);
5551 conf.set("cursorMoveNoScroll",settings.cursorMoveNoScroll);
5552
5553 conf.set("notePreviewBehavior",settings.notePreviewBehavior);
5554
5555 conf.set("absorbInsInput",settings.absorbInsInput);
5556
5557 conf.set("moveWindowTitle",settings.moveWindowTitle);
5558
5559 conf.set("doubleClickColumn",settings.doubleClickColumn);
5560 conf.set("dragMovesSelection",settings.dragMovesSelection);
5561 conf.set("draggableDataView",settings.draggableDataView);
5562
5563 conf.set("cursorFollowsOrder",settings.cursorFollowsOrder);
5564
5565 conf.set("insertBehavior",settings.insertBehavior);
5566 conf.set("pullDeleteRow",settings.pullDeleteRow);
5567 conf.set("cursorFollowsWheel",settings.cursorFollowsWheel);
5568 conf.set("cursorWheelStep",settings.cursorWheelStep);
5569 conf.set("removeInsOff",settings.removeInsOff);
5570 conf.set("removeVolOff",settings.removeVolOff);
5571 conf.set("insTypeMenu",settings.insTypeMenu);
5572
5573 conf.set("selectAssetOnLoad",settings.selectAssetOnLoad);
5574
5575 conf.set("inputRepeat",settings.inputRepeat);
5576 }
5577
5578 // font
5579 if (groups&GUI_SETTINGS_FONT) {
5580 conf.set("mainFontSize",settings.mainFontSize);
5581 conf.set("headFontSize",settings.headFontSize);
5582 conf.set("patFontSize",settings.patFontSize);
5583 conf.set("iconSize",settings.iconSize);
5584
5585 conf.set("mainFont",settings.mainFont);
5586 conf.set("headFont",settings.headFont);
5587 conf.set("patFont",settings.patFont);
5588 conf.set("mainFontPath",settings.mainFontPath);
5589 conf.set("headFontPath",settings.headFontPath);
5590 conf.set("patFontPath",settings.patFontPath);
5591
5592 conf.set("loadFallback",settings.loadFallback);
5593 conf.set("loadFallbackPat",settings.loadFallbackPat);
5594
5595 conf.set("fontBackend",settings.fontBackend);
5596 conf.set("fontHinting",settings.fontHinting);
5597 conf.set("fontBitmap",settings.fontBitmap);
5598 conf.set("fontAutoHint",settings.fontAutoHint);
5599 conf.set("fontAntiAlias",settings.fontAntiAlias);
5600 conf.set("fontOversample",settings.fontOversample);
5601 }
5602
5603 // appearance
5604 if (groups&GUI_SETTINGS_APPEARANCE) {
5605 conf.set("oscRoundedCorners",settings.oscRoundedCorners);
5606 conf.set("oscTakesEntireWindow",settings.oscTakesEntireWindow);
5607 conf.set("oscBorder",settings.oscBorder);
5608 conf.set("oscEscapesBoundary",settings.oscEscapesBoundary);
5609 conf.set("oscMono",settings.oscMono);
5610 conf.set("oscAntiAlias",settings.oscAntiAlias);
5611 conf.set("oscLineSize",settings.oscLineSize);
5612
5613 conf.set("songNotesWrap",settings.songNotesWrap);
5614
5615 conf.set("channelColors",settings.channelColors);
5616 conf.set("channelTextColors",settings.channelTextColors);
5617 conf.set("channelStyle",settings.channelStyle);
5618 conf.set("channelVolStyle",settings.channelVolStyle);
5619 conf.set("channelFeedbackStyle",settings.channelFeedbackStyle);
5620 conf.set("channelFont",settings.channelFont);
5621 conf.set("channelTextCenter",settings.channelTextCenter);
5622
5623 conf.set("roundedWindows",settings.roundedWindows);
5624 conf.set("roundedButtons",settings.roundedButtons);
5625 conf.set("roundedMenus",settings.roundedMenus);
5626 conf.set("roundedTabs",settings.roundedTabs);
5627 conf.set("roundedScrollbars",settings.roundedScrollbars);
5628
5629 conf.set("separateFMColors",settings.separateFMColors);
5630 conf.set("insEditColorize",settings.insEditColorize);
5631
5632 conf.set("chipNames",settings.chipNames);
5633 conf.set("overflowHighlight",settings.overflowHighlight);
5634 conf.set("flatNotes",settings.flatNotes);
5635 conf.set("germanNotation",settings.germanNotation);
5636
5637 conf.set("frameBorders",settings.frameBorders);
5638
5639 conf.set("noteOffLabel",settings.noteOffLabel);
5640 conf.set("noteRelLabel",settings.noteRelLabel);
5641 conf.set("macroRelLabel",settings.macroRelLabel);
5642 conf.set("emptyLabel",settings.emptyLabel);
5643 conf.set("emptyLabel2",settings.emptyLabel2);
5644
5645 conf.set("noteCellSpacing",settings.noteCellSpacing);
5646 conf.set("insCellSpacing",settings.insCellSpacing);
5647 conf.set("volCellSpacing",settings.volCellSpacing);
5648 conf.set("effectCellSpacing",settings.effectCellSpacing);
5649 conf.set("effectValCellSpacing",settings.effectValCellSpacing);
5650
5651 conf.set("patRowsBase",settings.patRowsBase);
5652 conf.set("orderRowsBase",settings.orderRowsBase);
5653 conf.set("fmNames",settings.fmNames);
5654 conf.set("statusDisplay",settings.statusDisplay);
5655 conf.set("playbackTime",settings.playbackTime);
5656 conf.set("viewPrevPattern",settings.viewPrevPattern);
5657 conf.set("susPosition",settings.susPosition);
5658
5659 conf.set("titleBarInfo",settings.titleBarInfo);
5660 conf.set("titleBarSys",settings.titleBarSys);
5661
5662 conf.set("oplStandardWaveNames",settings.oplStandardWaveNames);
5663
5664 conf.set("horizontalDataView",settings.horizontalDataView);
5665 conf.set("noMultiSystem",settings.noMultiSystem);
5666 conf.set("oldMacroVSlider",settings.oldMacroVSlider);
5667 conf.set("unsignedDetune",settings.unsignedDetune);
5668 conf.set("centerPattern",settings.centerPattern);
5669 conf.set("ordersCursor",settings.ordersCursor);
5670 conf.set("oneDigitEffects",settings.oneDigitEffects);
5671 conf.set("orderButtonPos",settings.orderButtonPos);
5672 conf.set("memUsageUnit",settings.memUsageUnit);
5673 conf.set("capitalMenuBar",settings.capitalMenuBar);
5674 conf.set("insIconsStyle",settings.insIconsStyle);
5675 conf.set("sysSeparators",settings.sysSeparators);
5676 conf.set("autoMacroStepSize",settings.autoMacroStepSize);
5677 }
5678
5679 // layout
5680 if (groups&GUI_SETTINGS_LAYOUTS) {
5681 conf.set("fmLayout",settings.fmLayout);
5682 conf.set("sampleLayout",settings.sampleLayout);
5683 conf.set("waveLayout",settings.waveLayout);
5684 conf.set("exportOptionsLayout",settings.exportOptionsLayout);
5685 conf.set("unifiedDataView",settings.unifiedDataView);
5686 conf.set("macroLayout",settings.macroLayout);
5687 conf.set("controlLayout",settings.controlLayout);
5688 conf.set("classicChipOptions",settings.classicChipOptions);
5689 }
5690
5691 // color
5692 if (groups&GUI_SETTINGS_COLOR) {
5693 conf.set("guiColorsBase",settings.guiColorsBase);
5694 conf.set("guiColorsShading",settings.guiColorsShading);
5695 conf.set("basicColors",settings.basicColors);
5696
5697 // colors
5698 for (int i=0; i<GUI_COLOR_MAX; i++) {
5699 conf.set(guiColors[i].name,(int)ImGui::ColorConvertFloat4ToU32(uiColors[i]));
5700 }
5701 }
5702
5703 // emulation
5704 if (groups&GUI_SETTINGS_EMULATION) {
5705 conf.set("arcadeCore",settings.arcadeCore);
5706 conf.set("ym2612Core",settings.ym2612Core);
5707 conf.set("snCore",settings.snCore);
5708 conf.set("nesCore",settings.nesCore);
5709 conf.set("fdsCore",settings.fdsCore);
5710 conf.set("c64Core",settings.c64Core);
5711 conf.set("pokeyCore",settings.pokeyCore);
5712 conf.set("opn1Core",settings.opn1Core);
5713 conf.set("opnaCore",settings.opnaCore);
5714 conf.set("opnbCore",settings.opnbCore);
5715 conf.set("opl2Core",settings.opl2Core);
5716 conf.set("opl3Core",settings.opl3Core);
5717 conf.set("opl4Core",settings.opl4Core);
5718 conf.set("esfmCore",settings.esfmCore);
5719 conf.set("opllCore",settings.opllCore);
5720 conf.set("ayCore",settings.ayCore);
5721 conf.set("swanCore",settings.swanCore);
5722
5723 conf.set("dsidQuality",settings.dsidQuality);
5724 conf.set("gbQuality",settings.gbQuality);
5725 conf.set("pnQuality",settings.pnQuality);
5726 conf.set("saaQuality",settings.saaQuality);
5727
5728 conf.set("arcadeCoreRender",settings.arcadeCoreRender);
5729 conf.set("ym2612CoreRender",settings.ym2612CoreRender);
5730 conf.set("snCoreRender",settings.snCoreRender);
5731 conf.set("nesCoreRender",settings.nesCoreRender);
5732 conf.set("fdsCoreRender",settings.fdsCoreRender);
5733 conf.set("c64CoreRender",settings.c64CoreRender);
5734 conf.set("pokeyCoreRender",settings.pokeyCoreRender);
5735 conf.set("opn1CoreRender",settings.opn1CoreRender);
5736 conf.set("opnaCoreRender",settings.opnaCoreRender);
5737 conf.set("opnbCoreRender",settings.opnbCoreRender);
5738 conf.set("opl2CoreRender",settings.opl2CoreRender);
5739 conf.set("opl3CoreRender",settings.opl3CoreRender);
5740 conf.set("opl4CoreRender",settings.opl4CoreRender);
5741 conf.set("esfmCoreRender",settings.esfmCoreRender);
5742 conf.set("opllCoreRender",settings.opllCoreRender);
5743 conf.set("ayCoreRender",settings.ayCoreRender);
5744 conf.set("swanCoreRender",settings.swanCoreRender);
5745
5746 conf.set("dsidQualityRender",settings.dsidQualityRender);
5747 conf.set("gbQualityRender",settings.gbQualityRender);
5748 conf.set("pnQualityRender",settings.pnQualityRender);
5749 conf.set("saaQualityRender",settings.saaQualityRender);
5750
5751 conf.set("pcSpeakerOutMethod",settings.pcSpeakerOutMethod);
5752
5753 conf.set("yrw801Path",settings.yrw801Path);
5754 conf.set("tg100Path",settings.tg100Path);
5755 conf.set("mu5Path",settings.mu5Path);
5756 }
5757 }
5758
5759 void FurnaceGUI::syncSettings() {
5760 readConfig(e->getConfObject());
5761
5762 parseKeybinds();
5763
5764 midiMap.read(e->getConfigPath()+DIR_SEPARATOR_STR+"midiIn_"+stripName(settings.midiInDevice)+".cfg");
5765 midiMap.compile();
5766
5767 e->setMidiDirect(midiMap.directChannel);
5768 e->setMidiDirectProgram(midiMap.directChannel && midiMap.directProgram);
5769 e->setMidiVolExp(midiMap.volExp);
5770 e->setMetronomeVol(((float)settings.metroVol)/100.0f);
5771 e->setSamplePreviewVol(((float)settings.sampleVol)/100.0f);
5772
5773 if (rend!=NULL) {
5774 rend->setSwapInterval(settings.vsync);
5775 }
5776
5777 backupTimer=settings.backupInterval;
5778 }
5779
5780 void FurnaceGUI::commitSettings() {
5781 bool sampleROMsChanged=settings.yrw801Path!=e->getConfString("yrw801Path","") ||
5782 settings.tg100Path!=e->getConfString("tg100Path","") ||
5783 settings.mu5Path!=e->getConfString("mu5Path","");
5784
5785 bool coresChanged=(
5786 settings.arcadeCore!=e->getConfInt("arcadeCore",0) ||
5787 settings.ym2612Core!=e->getConfInt("ym2612Core",0) ||
5788 settings.snCore!=e->getConfInt("snCore",0) ||
5789 settings.nesCore!=e->getConfInt("nesCore",0) ||
5790 settings.fdsCore!=e->getConfInt("fdsCore",0) ||
5791 settings.c64Core!=e->getConfInt("c64Core",0) ||
5792 settings.pokeyCore!=e->getConfInt("pokeyCore",1) ||
5793 settings.opn1Core!=e->getConfInt("opn1Core",1) ||
5794 settings.opnaCore!=e->getConfInt("opnaCore",1) ||
5795 settings.opnbCore!=e->getConfInt("opnbCore",1) ||
5796 settings.opl2Core!=e->getConfInt("opl2Core",0) ||
5797 settings.opl3Core!=e->getConfInt("opl3Core",0) ||
5798 settings.opl4Core!=e->getConfInt("opl4Core",0) ||
5799 settings.esfmCore!=e->getConfInt("esfmCore",0) ||
5800 settings.opllCore!=e->getConfInt("opllCore",0) ||
5801 settings.ayCore!=e->getConfInt("ayCore",0) ||
5802 settings.swanCore!=e->getConfInt("swanCore",0) ||
5803 settings.dsidQuality!=e->getConfInt("dsidQuality",3) ||
5804 settings.gbQuality!=e->getConfInt("gbQuality",3) ||
5805 settings.pnQuality!=e->getConfInt("pnQuality",3) ||
5806 settings.saaQuality!=e->getConfInt("saaQuality",3) ||
5807 settings.audioQuality!=e->getConfInt("audioQuality",0) ||
5808 settings.audioHiPass!=e->getConfInt("audioHiPass",1)
5809 );
5810
5811 writeConfig(e->getConfObject());
5812
5813 parseKeybinds();
5814
5815 midiMap.compile();
5816 midiMap.write(e->getConfigPath()+DIR_SEPARATOR_STR+"midiIn_"+stripName(settings.midiInDevice)+".cfg");
5817
5818 e->saveConf();
5819
5820 while (!recentFile.empty() && (int)recentFile.size()>settings.maxRecentFile) {
5821 recentFile.pop_back();
5822 }
5823
5824 if (sampleROMsChanged) {
5825 if (e->loadSampleROMs()) {
5826 showError(e->getLastError());
5827 }
5828 }
5829
5830 if (!e->switchMaster(coresChanged)) {
5831 showError(_("could not initialize audio!"));
5832 }
5833
5834 ImGui::GetIO().Fonts->Clear();
5835
5836 applyUISettings();
5837
5838 audioEngineChanged=false;
5839 }
5840
5841 bool FurnaceGUI::importColors(String path) {
5842 DivConfig c;
5843 if (!c.loadFromFile(path.c_str(),false,false)) {
5844 logW("error while opening color file for import: %s",strerror(errno));
5845 return false;
5846 }
5847
5848 readConfig(c,GUI_SETTINGS_COLOR);
5849
5850 applyUISettings(false);
5851 return true;
5852 }
5853
5854 bool FurnaceGUI::exportColors(String path) {
5855 DivConfig c;
5856
5857 c.set("configVersion",DIV_ENGINE_VERSION);
5858 writeConfig(c,GUI_SETTINGS_COLOR);
5859
5860 FILE* f=ps_fopen(path.c_str(),"wb");
5861 if (f==NULL) {
5862 logW("error while opening color file for export: %s",strerror(errno));
5863 return false;
5864 }
5865
5866 String result=c.toString();
5867
5868 if (fwrite(result.c_str(),1,result.size(),f)!=result.size()) {
5869 logW("couldn't write color file entirely.");
5870 }
5871
5872 fclose(f);
5873 return true;
5874 }
5875
5876 bool FurnaceGUI::importKeybinds(String path) {
5877 DivConfig c;
5878 if (!c.loadFromFile(path.c_str(),false,false)) {
5879 logW("error while opening keybind file for import: %s",strerror(errno));
5880 return false;
5881 }
5882 resetKeybinds();
5883 if (c.has("configVersion")) {
5884 // new
5885 readConfig(c,GUI_SETTINGS_KEYBOARD);
5886 } else {
5887 // unoptimal
5888 for (auto& key: c.configMap()) {
5889 for (int i=0; i<GUI_ACTION_MAX; i++) {
5890 try {
5891 if (key.first==guiActions[i].name) {
5892 // old versions didn't support multi-bind
5893 actionKeys[i].clear();
5894 actionKeys[i].push_back(std::stoi(key.second));
5895 break;
5896 }
5897 } catch (std::out_of_range& e) {
5898 break;
5899 } catch (std::invalid_argument& e) {
5900 break;
5901 }
5902 }
5903 }
5904 }
5905 return true;
5906 }
5907
5908 bool FurnaceGUI::exportKeybinds(String path) {
5909 DivConfig c;
5910
5911 c.set("configVersion",DIV_ENGINE_VERSION);
5912 writeConfig(c,GUI_SETTINGS_KEYBOARD);
5913
5914 FILE* f=ps_fopen(path.c_str(),"wb");
5915 if (f==NULL) {
5916 logW("error while opening keybind file for export: %s",strerror(errno));
5917 return false;
5918 }
5919
5920 String result=c.toString();
5921
5922 if (fwrite(result.c_str(),1,result.size(),f)!=result.size()) {
5923 logW("couldn't write keybind file entirely.");
5924 }
5925
5926 fclose(f);
5927 return true;
5928 }
5929
5930 bool FurnaceGUI::importLayout(String path) {
5931 if (mobileUI) {
5932 logW("but you are on the mobile UI!");
5933 return false;
5934 }
5935 FILE* f=ps_fopen(path.c_str(),"rb");
5936 if (f==NULL) {
5937 logW("error while opening keybind file for import: %s",strerror(errno));
5938 return false;
5939 }
5940 if (fseek(f,0,SEEK_END)<0) {
5941 fclose(f);
5942 return false;
5943 }
5944 ssize_t len=ftell(f);
5945 if (len==(SIZE_MAX>>1)) {
5946 fclose(f);
5947 return false;
5948 }
5949 if (len<1) {
5950 if (len==0) {
5951 logE("that file is empty!");
5952 lastError=_("file is empty");
5953 } else {
5954 perror("tell error");
5955 }
5956 fclose(f);
5957 return false;
5958 }
5959 if (fseek(f,0,SEEK_SET)<0) {
5960 perror("size error");
5961 lastError=fmt::sprintf(_("on get size: %s"),strerror(errno));
5962 fclose(f);
5963 return false;
5964 }
5965 pendingLayoutImport=new unsigned char[len];
5966 if (fread(pendingLayoutImport,1,(size_t)len,f)!=(size_t)len) {
5967 perror("read error");
5968 lastError=fmt::sprintf(_("on read: %s"),strerror(errno));
5969 fclose(f);
5970 delete[] pendingLayoutImport;
5971 return false;
5972 }
5973 fclose(f);
5974
5975 pendingLayoutImportLen=len;
5976 return true;
5977 }
5978
5979 bool FurnaceGUI::exportLayout(String path) {
5980 if (mobileUI) {
5981 logW("but you are on the mobile UI!");
5982 return false;
5983 }
5984 FILE* f=ps_fopen(path.c_str(),"wb");
5985 if (f==NULL) {
5986 logW("error while opening layout file for export: %s",strerror(errno));
5987 return false;
5988 }
5989 size_t dataSize=0;
5990 const char* data=ImGui::SaveIniSettingsToMemory(&dataSize);
5991 if (fwrite(data,1,dataSize,f)!=dataSize) {
5992 logW("error while exporting layout: %s",strerror(errno));
5993 }
5994 fclose(f);
5995 return true;
5996 }
5997
5998 bool FurnaceGUI::importConfig(String path) {
5999 DivConfig prevConf=e->getConfObject();
6000 DivConfig& conf=e->getConfObject();
6001 conf.clear();
6002 if (!conf.loadFromFile(path.c_str(),false,false)) {
6003 showError(fmt::sprintf(_("error while loading config! (%s)"),strerror(errno)));
6004 conf=prevConf;
6005 return false;
6006 }
6007 syncState();
6008 syncSettings();
6009 willCommit=true;
6010
6011 recentFile.clear();
6012 for (int i=0; i<settings.maxRecentFile; i++) {
6013 String r=e->getConfString(fmt::sprintf("recentFile%d",i),"");
6014 if (!r.empty()) {
6015 recentFile.push_back(r);
6016 }
6017 }
6018 return true;
6019 }
6020
6021 bool FurnaceGUI::exportConfig(String path) {
6022 DivConfig exConf=e->getConfObject();
6023 writeConfig(exConf,GUI_SETTINGS_ALL);
6024 commitState(exConf);
6025
6026 FILE* f=ps_fopen(path.c_str(),"wb");
6027 if (f==NULL) {
6028 logW("error while exporting config: %s",strerror(errno));
6029 return false;
6030 }
6031
6032 String result=exConf.toString();
6033
6034 if (fwrite(result.c_str(),1,result.size(),f)!=result.size()) {
6035 logW("couldn't write config entirely.");
6036 }
6037
6038 fclose(f);
6039 return true;
6040 }
6041
6042 void FurnaceGUI::resetColors() {
6043 for (int i=0; i<GUI_COLOR_MAX; i++) {
6044 uiColors[i]=ImGui::ColorConvertU32ToFloat4(guiColors[i].defaultColor);
6045 }
6046 }
6047
6048 void FurnaceGUI::resetKeybinds() {
6049 for (int i=0; i<GUI_ACTION_MAX; i++) {
6050 if (guiActions[i].defaultBind.empty()) continue;
6051 actionKeys[i]=guiActions[i].defaultBind;
6052 }
6053 decodeKeyMap(noteKeys,DEFAULT_NOTE_KEYS);
6054 decompileNoteKeys();
6055 parseKeybinds();
6056 }
6057
6058 void FurnaceGUI::assignActionMap(std::map<int,int>& actionMap, int first, int last) {
6059 actionMap.clear();
6060 for (int i=first; i<=last; i++) {
6061 for (int key: actionKeys[i]) {
6062 if (key&FURK_MASK) {
6063 actionMap[key]=i;
6064 }
6065 }
6066 }
6067 }
6068
6069
6070 void FurnaceGUI::parseKeybinds() {
6071 assignActionMap(actionMapGlobal, GUI_ACTION_GLOBAL_MIN+1, GUI_ACTION_GLOBAL_MAX-1);
6072 assignActionMap(actionMapPat, GUI_ACTION_PAT_MIN+1, GUI_ACTION_PAT_MAX-1);
6073 assignActionMap(actionMapInsList, GUI_ACTION_INS_LIST_MIN+1, GUI_ACTION_INS_LIST_MAX-1);
6074 assignActionMap(actionMapWaveList, GUI_ACTION_WAVE_LIST_MIN+1, GUI_ACTION_WAVE_LIST_MAX-1);
6075 assignActionMap(actionMapSampleList, GUI_ACTION_SAMPLE_LIST_MIN+1, GUI_ACTION_SAMPLE_LIST_MAX-1);
6076 assignActionMap(actionMapSample, GUI_ACTION_SAMPLE_MIN+1, GUI_ACTION_SAMPLE_MAX-1);
6077 assignActionMap(actionMapOrders, GUI_ACTION_ORDERS_MIN+1, GUI_ACTION_ORDERS_MAX-1);
6078 }
6079
6080 void FurnaceGUI::pushAccentColors(const ImVec4& one, const ImVec4& two, const ImVec4& border, const ImVec4& borderShadow) {
6081 float hue, sat, val;
6082
6083 ImVec4 primaryActive=one;
6084 ImVec4 primaryHover, primary;
6085 primaryHover.w=primaryActive.w;
6086 primary.w=primaryActive.w;
6087 ImGui::ColorConvertRGBtoHSV(primaryActive.x,primaryActive.y,primaryActive.z,hue,sat,val);
6088 if (settings.guiColorsBase) {
6089 primary=primaryActive;
6090 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.9,primaryHover.x,primaryHover.y,primaryHover.z);
6091 ImGui::ColorConvertHSVtoRGB(hue,sat,val*0.5,primaryActive.x,primaryActive.y,primaryActive.z);
6092 } else {
6093 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.5,primaryHover.x,primaryHover.y,primaryHover.z);
6094 ImGui::ColorConvertHSVtoRGB(hue,sat*0.8,val*0.35,primary.x,primary.y,primary.z);
6095 }
6096
6097 ImVec4 secondaryActive=two;
6098 ImVec4 secondaryHover, secondary, secondarySemiActive;
6099 secondarySemiActive.w=secondaryActive.w;
6100 secondaryHover.w=secondaryActive.w;
6101 secondary.w=secondaryActive.w;
6102 ImGui::ColorConvertRGBtoHSV(secondaryActive.x,secondaryActive.y,secondaryActive.z,hue,sat,val);
6103 if (settings.guiColorsBase) {
6104 secondary=secondaryActive;
6105 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.7,secondarySemiActive.x,secondarySemiActive.y,secondarySemiActive.z);
6106 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.9,secondaryHover.x,secondaryHover.y,secondaryHover.z);
6107 ImGui::ColorConvertHSVtoRGB(hue,sat,val*0.5,secondaryActive.x,secondaryActive.y,secondaryActive.z);
6108 } else {
6109 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.75,secondarySemiActive.x,secondarySemiActive.y,secondarySemiActive.z);
6110 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.5,secondaryHover.x,secondaryHover.y,secondaryHover.z);
6111 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.25,secondary.x,secondary.y,secondary.z);
6112 }
6113
6114 ImGui::PushStyleColor(ImGuiCol_Button,primary);
6115 ImGui::PushStyleColor(ImGuiCol_ButtonHovered,primaryHover);
6116 ImGui::PushStyleColor(ImGuiCol_ButtonActive,primaryActive);
6117 ImGui::PushStyleColor(ImGuiCol_Tab,primary);
6118 ImGui::PushStyleColor(ImGuiCol_TabHovered,secondaryHover);
6119 ImGui::PushStyleColor(ImGuiCol_TabActive,secondarySemiActive);
6120 ImGui::PushStyleColor(ImGuiCol_TabUnfocused,primary);
6121 ImGui::PushStyleColor(ImGuiCol_TabUnfocusedActive,primaryHover);
6122 ImGui::PushStyleColor(ImGuiCol_Header,secondary);
6123 ImGui::PushStyleColor(ImGuiCol_HeaderHovered,secondaryHover);
6124 ImGui::PushStyleColor(ImGuiCol_HeaderActive,secondaryActive);
6125 ImGui::PushStyleColor(ImGuiCol_ResizeGrip,secondary);
6126 ImGui::PushStyleColor(ImGuiCol_ResizeGripHovered,secondaryHover);
6127 ImGui::PushStyleColor(ImGuiCol_ResizeGripActive,secondaryActive);
6128 ImGui::PushStyleColor(ImGuiCol_FrameBg,secondary);
6129 ImGui::PushStyleColor(ImGuiCol_FrameBgHovered,secondaryHover);
6130 ImGui::PushStyleColor(ImGuiCol_FrameBgActive,secondaryActive);
6131 ImGui::PushStyleColor(ImGuiCol_SliderGrab,primaryActive);
6132 ImGui::PushStyleColor(ImGuiCol_SliderGrabActive,primaryActive);
6133 ImGui::PushStyleColor(ImGuiCol_TitleBgActive,primary);
6134 ImGui::PushStyleColor(ImGuiCol_CheckMark,primaryActive);
6135 ImGui::PushStyleColor(ImGuiCol_TextSelectedBg,secondaryHover);
6136 ImGui::PushStyleColor(ImGuiCol_Border,border);
6137 ImGui::PushStyleColor(ImGuiCol_BorderShadow,borderShadow);
6138 }
6139
6140 void FurnaceGUI::popAccentColors() {
6141 ImGui::PopStyleColor(24);
6142 }
6143
6144 void FurnaceGUI::pushDestColor() {
6145 pushAccentColors(uiColors[GUI_COLOR_DESTRUCTIVE],uiColors[GUI_COLOR_DESTRUCTIVE],uiColors[GUI_COLOR_DESTRUCTIVE],ImVec4(0.0f,0.0f,0.0f,0.0f));
6146 }
6147
6148 void FurnaceGUI::popDestColor() {
6149 popAccentColors();
6150 }
6151
6152 void FurnaceGUI::pushWarningColor(bool warnCond, bool errorCond) {
6153 if (warnColorPushed) {
6154 logE("warnColorPushed");
6155 abort();
6156 }
6157 if (errorCond) {
6158 pushAccentColors(uiColors[GUI_COLOR_ERROR],uiColors[GUI_COLOR_ERROR],uiColors[GUI_COLOR_ERROR],ImVec4(0.0f,0.0f,0.0f,0.0f));
6159 warnColorPushed=true;
6160 } else if (warnCond) {
6161 pushAccentColors(uiColors[GUI_COLOR_WARNING],uiColors[GUI_COLOR_WARNING],uiColors[GUI_COLOR_WARNING],ImVec4(0.0f,0.0f,0.0f,0.0f));
6162 warnColorPushed=true;
6163 }
6164 }
6165
6166 void FurnaceGUI::popWarningColor() {
6167 if (warnColorPushed) {
6168 popAccentColors();
6169 warnColorPushed=false;
6170 }
6171 }
6172
6173 #define IGFD_FileStyleByExtension IGFD_FileStyleByExtention
6174
6175 #ifdef _WIN32
6176 #define SYSTEM_FONT_PATH_1 "C:\\Windows\\Fonts\\segoeui.ttf"
6177 #define SYSTEM_FONT_PATH_2 "C:\\Windows\\Fonts\\tahoma.ttf"
6178 #define SYSTEM_FONT_PATH_3 "C:\\Windows\\Fonts\\micross.ttf"
6179 #define SYSTEM_HEAD_FONT_PATH_1 "C:\\Windows\\Fonts\\segoeui.ttf"
6180 #define SYSTEM_HEAD_FONT_PATH_2 "C:\\Windows\\Fonts\\tahoma.ttf"
6181 #define SYSTEM_HEAD_FONT_PATH_3 "C:\\Windows\\Fonts\\micross.ttf"
6182 #define SYSTEM_PAT_FONT_PATH_1 "C:\\Windows\\Fonts\\consola.ttf"
6183 #define SYSTEM_PAT_FONT_PATH_2 "C:\\Windows\\Fonts\\cour.ttf"
6184 // GOOD LUCK WITH THIS ONE - UNTESTED
6185 #define SYSTEM_PAT_FONT_PATH_3 "C:\\Windows\\Fonts\\vgasys.fon"
6186 #elif defined(__APPLE__)
6187 #define SYSTEM_FONT_PATH_1 "/System/Library/Fonts/SFAANS.ttf"
6188 #define SYSTEM_FONT_PATH_2 "/System/Library/Fonts/Helvetica.ttc"
6189 #define SYSTEM_FONT_PATH_3 "/System/Library/Fonts/Helvetica.dfont"
6190 #define SYSTEM_HEAD_FONT_PATH_1 "/System/Library/Fonts/SFAANS.ttf"
6191 #define SYSTEM_HEAD_FONT_PATH_2 "/System/Library/Fonts/Helvetica.ttc"
6192 #define SYSTEM_HEAD_FONT_PATH_3 "/System/Library/Fonts/Helvetica.dfont"
6193 #define SYSTEM_PAT_FONT_PATH_1 "/System/Library/Fonts/SFNSMono.ttf"
6194 #define SYSTEM_PAT_FONT_PATH_2 "/System/Library/Fonts/Courier New.ttf"
6195 #define SYSTEM_PAT_FONT_PATH_3 "/System/Library/Fonts/Courier New.ttf"
6196 #elif defined(ANDROID)
6197 #define SYSTEM_FONT_PATH_1 "/system/fonts/Roboto-Regular.ttf"
6198 #define SYSTEM_FONT_PATH_2 "/system/fonts/DroidSans.ttf"
6199 #define SYSTEM_FONT_PATH_3 "/system/fonts/DroidSans.ttf"
6200 // ???
6201 #define SYSTEM_HEAD_FONT_PATH_1 "/system/fonts/Roboto-Regular.ttf"
6202 #define SYSTEM_HEAD_FONT_PATH_2 "/system/fonts/DroidSans.ttf"
6203 #define SYSTEM_HEAD_FONT_PATH_3 "/system/fonts/DroidSans.ttf"
6204 #define SYSTEM_PAT_FONT_PATH_1 "/system/fonts/RobotoMono-Regular.ttf"
6205 #define SYSTEM_PAT_FONT_PATH_2 "/system/fonts/DroidSansMono.ttf"
6206 #define SYSTEM_PAT_FONT_PATH_3 "/system/fonts/CutiveMono.ttf"
6207 #else
6208 #define SYSTEM_FONT_PATH_1 "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
6209 #define SYSTEM_FONT_PATH_2 "/usr/share/fonts/TTF/DejaVuSans.ttf"
6210 #define SYSTEM_FONT_PATH_3 "/usr/share/fonts/ubuntu/Ubuntu-R.ttf"
6211 #define SYSTEM_HEAD_FONT_PATH_1 "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
6212 #define SYSTEM_HEAD_FONT_PATH_2 "/usr/share/fonts/TTF/DejaVuSans.ttf"
6213 #define SYSTEM_HEAD_FONT_PATH_3 "/usr/share/fonts/ubuntu/Ubuntu-R.ttf"
6214 #define SYSTEM_PAT_FONT_PATH_1 "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
6215 #define SYSTEM_PAT_FONT_PATH_2 "/usr/share/fonts/TTF/DejaVuSansMono.ttf"
6216 #define SYSTEM_PAT_FONT_PATH_3 "/usr/share/fonts/ubuntu/UbuntuMono-R.ttf"
6217 #endif
6218
6219 void setupLabel(const char* lStr, char* label, int len) {
6220 memset(label,0,32);
6221 for (int i=0, p=0; i<len; i++) {
6222 signed char cl;
6223 if (lStr[p]==0) {
6224 strncat(label," ",32);
6225 } else {
6226 decodeUTF8((const unsigned char*)&lStr[p],cl);
6227 memcpy(label+p,lStr+p,cl);
6228 p+=cl;
6229 }
6230 }
6231 }
6232
6233 void FurnaceGUI::decompileNoteKeys() {
6234 noteKeysRaw.clear();
6235 for (std::map<int,int>::value_type& i: noteKeys) {
6236 std::vector<MappedInput>::iterator j;
6237 for (j=noteKeysRaw.begin(); j!=noteKeysRaw.end(); j++) {
6238 if (j->val>i.second) {
6239 break;
6240 }
6241 }
6242 noteKeysRaw.insert(j,MappedInput(i.first,i.second));
6243 }
6244 }
6245
6246 void FurnaceGUI::compileNoteKeys() {
6247 noteKeys.clear();
6248 for (MappedInput& i: noteKeysRaw) {
6249 noteKeys[i.scan]=i.val;
6250 }
6251 decompileNoteKeys();
6252 }
6253
6254 void FurnaceGUI::applyUISettings(bool updateFonts) {
6255 ImGuiStyle sty;
6256 if (settings.guiColorsBase) {
6257 ImGui::StyleColorsLight(&sty);
6258 } else {
6259 ImGui::StyleColorsDark(&sty);
6260 }
6261
6262 if (dpiScale<0.1) dpiScale=0.1;
6263
6264 setupLabel(settings.noteOffLabel.c_str(),noteOffLabel,3);
6265 setupLabel(settings.noteRelLabel.c_str(),noteRelLabel,3);
6266 setupLabel(settings.macroRelLabel.c_str(),macroRelLabel,3);
6267 setupLabel(settings.emptyLabel.c_str(),emptyLabel,3);
6268 setupLabel(settings.emptyLabel2.c_str(),emptyLabel2,2);
6269
6270 if (updateFonts) {
6271 // get scale factor
6272 const char* videoBackend=SDL_GetCurrentVideoDriver();
6273 if (settings.dpiScale>=0.5f) {
6274 logD("setting UI scale factor from config (%f).",settings.dpiScale);
6275 dpiScale=settings.dpiScale;
6276 } else {
6277 logD("auto-detecting UI scale factor.");
6278 dpiScale=getScaleFactor(videoBackend,sdlWin);
6279 logD("scale factor: %f",dpiScale);
6280 if (dpiScale<0.1f) {
6281 logW("scale what?");
6282 dpiScale=1.0f;
6283 }
6284 }
6285 }
6286
6287 if (updateFonts) {
6288 // chan osc work pool
6289 if (chanOscWorkPool!=NULL) {
6290 delete chanOscWorkPool;
6291 chanOscWorkPool=NULL;
6292 }
6293 }
6294
6295 for (int i=0; i<64; i++) {
6296 ImVec4 col1=uiColors[GUI_COLOR_PATTERN_VOLUME_MIN];
6297 ImVec4 col2=uiColors[GUI_COLOR_PATTERN_VOLUME_HALF];
6298 ImVec4 col3=uiColors[GUI_COLOR_PATTERN_VOLUME_MAX];
6299 volColors[i]=ImVec4(col1.x+((col2.x-col1.x)*float(i)/64.0f),
6300 col1.y+((col2.y-col1.y)*float(i)/64.0f),
6301 col1.z+((col2.z-col1.z)*float(i)/64.0f),
6302 1.0f);
6303 volColors[i+64]=ImVec4(col2.x+((col3.x-col2.x)*float(i)/64.0f),
6304 col2.y+((col3.y-col2.y)*float(i)/64.0f),
6305 col2.z+((col3.z-col2.z)*float(i)/64.0f),
6306 1.0f);
6307 }
6308
6309 float hue, sat, val;
6310
6311 ImVec4 primaryActive=uiColors[GUI_COLOR_ACCENT_PRIMARY];
6312 ImVec4 primaryHover, primary;
6313 primaryHover.w=primaryActive.w;
6314 primary.w=primaryActive.w;
6315 ImGui::ColorConvertRGBtoHSV(primaryActive.x,primaryActive.y,primaryActive.z,hue,sat,val);
6316 if (settings.guiColorsBase) {
6317 primary=primaryActive;
6318 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.9,primaryHover.x,primaryHover.y,primaryHover.z);
6319 ImGui::ColorConvertHSVtoRGB(hue,sat,val*0.5,primaryActive.x,primaryActive.y,primaryActive.z);
6320 } else {
6321 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.5,primaryHover.x,primaryHover.y,primaryHover.z);
6322 ImGui::ColorConvertHSVtoRGB(hue,sat*0.8,val*0.35,primary.x,primary.y,primary.z);
6323 }
6324
6325 ImVec4 secondaryActive=uiColors[GUI_COLOR_ACCENT_SECONDARY];
6326 ImVec4 secondaryHoverActual, secondaryHover, secondary, secondarySemiActive;
6327 secondarySemiActive.w=secondaryActive.w;
6328 secondaryHover.w=secondaryActive.w;
6329 secondary.w=secondaryActive.w;
6330 ImGui::ColorConvertRGBtoHSV(secondaryActive.x,secondaryActive.y,secondaryActive.z,hue,sat,val);
6331 if (settings.guiColorsBase) {
6332 secondary=secondaryActive;
6333 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.7,secondarySemiActive.x,secondarySemiActive.y,secondarySemiActive.z);
6334 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.9,secondaryHover.x,secondaryHover.y,secondaryHover.z);
6335 ImGui::ColorConvertHSVtoRGB(hue,sat,val*0.5,secondaryActive.x,secondaryActive.y,secondaryActive.z);
6336 } else {
6337 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.75,secondarySemiActive.x,secondarySemiActive.y,secondarySemiActive.z);
6338 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.5,secondaryHover.x,secondaryHover.y,secondaryHover.z);
6339 ImGui::ColorConvertHSVtoRGB(hue,sat*0.9,val*0.25,secondary.x,secondary.y,secondary.z);
6340 }
6341
6342 secondaryHoverActual=secondaryHover;
6343
6344 // TODO: improve
6345 if (mobileUI) { // disable all hovered colors
6346 primaryHover=primary;
6347 secondaryHover=secondary;
6348 }
6349
6350 sty.Colors[ImGuiCol_WindowBg]=uiColors[GUI_COLOR_FRAME_BACKGROUND];
6351 sty.Colors[ImGuiCol_ChildBg]=uiColors[GUI_COLOR_FRAME_BACKGROUND_CHILD];
6352 sty.Colors[ImGuiCol_PopupBg]=uiColors[GUI_COLOR_FRAME_BACKGROUND_POPUP];
6353 sty.Colors[ImGuiCol_TitleBg]=uiColors[GUI_COLOR_TITLE_INACTIVE];
6354 sty.Colors[ImGuiCol_TitleBgCollapsed]=uiColors[GUI_COLOR_TITLE_COLLAPSED];
6355 sty.Colors[ImGuiCol_MenuBarBg]=uiColors[GUI_COLOR_MENU_BAR];
6356 sty.Colors[ImGuiCol_ModalWindowDimBg]=uiColors[GUI_COLOR_MODAL_BACKDROP];
6357 sty.Colors[ImGuiCol_ScrollbarBg]=uiColors[GUI_COLOR_SCROLL_BACKGROUND];
6358 sty.Colors[ImGuiCol_ScrollbarGrab]=uiColors[GUI_COLOR_SCROLL];
6359 sty.Colors[ImGuiCol_ScrollbarGrabHovered]=uiColors[GUI_COLOR_SCROLL_HOVER];
6360 sty.Colors[ImGuiCol_ScrollbarGrabActive]=uiColors[GUI_COLOR_SCROLL_ACTIVE];
6361 sty.Colors[ImGuiCol_Separator]=uiColors[GUI_COLOR_SEPARATOR];
6362 sty.Colors[ImGuiCol_SeparatorHovered]=uiColors[GUI_COLOR_SEPARATOR_HOVER];
6363 sty.Colors[ImGuiCol_SeparatorActive]=uiColors[GUI_COLOR_SEPARATOR_ACTIVE];
6364 sty.Colors[ImGuiCol_DockingPreview]=uiColors[GUI_COLOR_DOCKING_PREVIEW];
6365 sty.Colors[ImGuiCol_DockingEmptyBg]=uiColors[GUI_COLOR_DOCKING_EMPTY];
6366 sty.Colors[ImGuiCol_TableHeaderBg]=uiColors[GUI_COLOR_TABLE_HEADER];
6367 sty.Colors[ImGuiCol_TableBorderStrong]=uiColors[GUI_COLOR_TABLE_BORDER_HARD];
6368 sty.Colors[ImGuiCol_TableBorderLight]=uiColors[GUI_COLOR_TABLE_BORDER_SOFT];
6369 sty.Colors[ImGuiCol_DragDropTarget]=uiColors[GUI_COLOR_DRAG_DROP_TARGET];
6370 sty.Colors[ImGuiCol_NavCursor]=uiColors[GUI_COLOR_NAV_HIGHLIGHT];
6371 sty.Colors[ImGuiCol_NavWindowingHighlight]=uiColors[GUI_COLOR_NAV_WIN_HIGHLIGHT];
6372 sty.Colors[ImGuiCol_NavWindowingDimBg]=uiColors[GUI_COLOR_NAV_WIN_BACKDROP];
6373 sty.Colors[ImGuiCol_Text]=uiColors[GUI_COLOR_TEXT];
6374 sty.Colors[ImGuiCol_TextDisabled]=uiColors[GUI_COLOR_TEXT_DISABLED];
6375
6376 // new stuff
6377 sty.Colors[ImGuiCol_InputTextCursor]=uiColors[GUI_COLOR_INPUT_TEXT_CURSOR];
6378
6379 if (settings.basicColors) {
6380 sty.Colors[ImGuiCol_Button]=primary;
6381 sty.Colors[ImGuiCol_ButtonHovered]=primaryHover;
6382 sty.Colors[ImGuiCol_ButtonActive]=primaryActive;
6383 sty.Colors[ImGuiCol_Tab]=primary;
6384 sty.Colors[ImGuiCol_TabHovered]=secondaryHover;
6385 sty.Colors[ImGuiCol_TabSelected]=secondarySemiActive;
6386 sty.Colors[ImGuiCol_TabSelectedOverline]=secondaryActive;
6387 sty.Colors[ImGuiCol_TabDimmed]=primary;
6388 sty.Colors[ImGuiCol_TabDimmedSelected]=primaryHover;
6389 sty.Colors[ImGuiCol_TabDimmedSelectedOverline]=primaryActive;
6390 sty.Colors[ImGuiCol_Header]=secondary;
6391 sty.Colors[ImGuiCol_HeaderHovered]=secondaryHover;
6392 sty.Colors[ImGuiCol_HeaderActive]=secondaryActive;
6393 sty.Colors[ImGuiCol_ResizeGrip]=secondary;
6394 sty.Colors[ImGuiCol_ResizeGripHovered]=secondaryHover;
6395 sty.Colors[ImGuiCol_ResizeGripActive]=secondaryActive;
6396 sty.Colors[ImGuiCol_FrameBg]=secondary;
6397 sty.Colors[ImGuiCol_FrameBgHovered]=secondaryHover;
6398 sty.Colors[ImGuiCol_FrameBgActive]=secondaryActive;
6399 sty.Colors[ImGuiCol_SliderGrab]=primaryActive;
6400 sty.Colors[ImGuiCol_SliderGrabActive]=primaryActive;
6401 sty.Colors[ImGuiCol_TitleBgActive]=primary;
6402 sty.Colors[ImGuiCol_CheckMark]=primaryActive;
6403 sty.Colors[ImGuiCol_TextLink]=secondaryActive;
6404 sty.Colors[ImGuiCol_TextSelectedBg]=secondaryHoverActual;
6405 sty.Colors[ImGuiCol_TreeLines]=uiColors[GUI_COLOR_BORDER];
6406 sty.Colors[ImGuiCol_PlotHistogram]=uiColors[GUI_COLOR_MACRO_OTHER];
6407 sty.Colors[ImGuiCol_PlotHistogramHovered]=uiColors[GUI_COLOR_MACRO_OTHER];
6408 } else {
6409 sty.Colors[ImGuiCol_Button]=uiColors[GUI_COLOR_BUTTON];
6410 sty.Colors[ImGuiCol_ButtonHovered]=uiColors[GUI_COLOR_BUTTON_HOVER];
6411 sty.Colors[ImGuiCol_ButtonActive]=uiColors[GUI_COLOR_BUTTON_ACTIVE];
6412 sty.Colors[ImGuiCol_Tab]=uiColors[GUI_COLOR_TAB];
6413 sty.Colors[ImGuiCol_TabHovered]=uiColors[GUI_COLOR_TAB_HOVER];
6414 sty.Colors[ImGuiCol_TabSelected]=uiColors[GUI_COLOR_TAB_ACTIVE];
6415 sty.Colors[ImGuiCol_TabSelectedOverline]=uiColors[GUI_COLOR_TAB_SELECTED_OVERLINE];
6416 sty.Colors[ImGuiCol_TabDimmed]=uiColors[GUI_COLOR_TAB_UNFOCUSED];
6417 sty.Colors[ImGuiCol_TabDimmedSelected]=uiColors[GUI_COLOR_TAB_UNFOCUSED_ACTIVE];
6418 sty.Colors[ImGuiCol_TabDimmedSelectedOverline]=uiColors[GUI_COLOR_TAB_DIMMED_SELECTED_OVERLINE];
6419 sty.Colors[ImGuiCol_Header]=uiColors[GUI_COLOR_IMGUI_HEADER];
6420 sty.Colors[ImGuiCol_HeaderHovered]=uiColors[GUI_COLOR_IMGUI_HEADER_HOVER];
6421 sty.Colors[ImGuiCol_HeaderActive]=uiColors[GUI_COLOR_IMGUI_HEADER_ACTIVE];
6422 sty.Colors[ImGuiCol_ResizeGrip]=uiColors[GUI_COLOR_RESIZE_GRIP];
6423 sty.Colors[ImGuiCol_ResizeGripHovered]=uiColors[GUI_COLOR_RESIZE_GRIP_HOVER];
6424 sty.Colors[ImGuiCol_ResizeGripActive]=uiColors[GUI_COLOR_RESIZE_GRIP_ACTIVE];
6425 sty.Colors[ImGuiCol_FrameBg]=uiColors[GUI_COLOR_WIDGET_BACKGROUND];
6426 sty.Colors[ImGuiCol_FrameBgHovered]=uiColors[GUI_COLOR_WIDGET_BACKGROUND_HOVER];
6427 sty.Colors[ImGuiCol_FrameBgActive]=uiColors[GUI_COLOR_WIDGET_BACKGROUND_ACTIVE];
6428 sty.Colors[ImGuiCol_SliderGrab]=uiColors[GUI_COLOR_SLIDER_GRAB];
6429 sty.Colors[ImGuiCol_SliderGrabActive]=uiColors[GUI_COLOR_SLIDER_GRAB_ACTIVE];
6430 sty.Colors[ImGuiCol_TitleBgActive]=uiColors[GUI_COLOR_TITLE_BACKGROUND_ACTIVE];
6431 sty.Colors[ImGuiCol_CheckMark]=uiColors[GUI_COLOR_CHECK_MARK];
6432 sty.Colors[ImGuiCol_TextLink]=uiColors[GUI_COLOR_TEXT_LINK];
6433 sty.Colors[ImGuiCol_TextSelectedBg]=uiColors[GUI_COLOR_TEXT_SELECTION];
6434 sty.Colors[ImGuiCol_TreeLines]=uiColors[GUI_COLOR_TREE_LINES];
6435 sty.Colors[ImGuiCol_PlotLines]=uiColors[GUI_COLOR_PLOT_LINES];
6436 sty.Colors[ImGuiCol_PlotLinesHovered]=uiColors[GUI_COLOR_PLOT_LINES_HOVER];
6437 sty.Colors[ImGuiCol_PlotHistogram]=uiColors[GUI_COLOR_PLOT_HISTOGRAM];
6438 sty.Colors[ImGuiCol_PlotHistogramHovered]=uiColors[GUI_COLOR_PLOT_HISTOGRAM_HOVER];
6439 sty.Colors[ImGuiCol_TableRowBg]=uiColors[GUI_COLOR_TABLE_ROW_EVEN];
6440 sty.Colors[ImGuiCol_TableRowBgAlt]=uiColors[GUI_COLOR_TABLE_ROW_ODD];
6441 }
6442 sty.Colors[ImGuiCol_Border]=uiColors[GUI_COLOR_BORDER];
6443 sty.Colors[ImGuiCol_BorderShadow]=uiColors[GUI_COLOR_BORDER_SHADOW];
6444
6445 if (settings.roundedWindows) sty.WindowRounding=8.0f;
6446 if (settings.roundedButtons) {
6447 sty.FrameRounding=6.0f;
6448 sty.GrabRounding=6.0f;
6449 }
6450 if (settings.roundedMenus) sty.PopupRounding=8.0f;
6451 if (settings.roundedTabs) {
6452 sty.TabRounding=4.0f;
6453 } else {
6454 sty.TabRounding=0.0f;
6455 }
6456 if (settings.roundedScrollbars) {
6457 sty.ScrollbarRounding=9.0f;
6458 } else {
6459 sty.ScrollbarRounding=0.0f;
6460 }
6461
6462 if (settings.frameBorders) {
6463 sty.FrameBorderSize=1.0f;
6464 } else {
6465 sty.FrameBorderSize=0.0f;
6466 }
6467
6468 if (settings.guiColorsShading>0) {
6469 sty.FrameShading=(float)settings.guiColorsShading/100.0f;
6470 }
6471
6472 if (safeMode || renderBackend==GUI_BACKEND_SOFTWARE) {
6473 sty.WindowRounding=0.0f;
6474 sty.FrameRounding=0.0f;
6475 sty.GrabRounding=0.0f;
6476 sty.FrameShading=0.0f;
6477 sty.TabRounding=0.0f;
6478 sty.ScrollbarRounding=0.0f;
6479 sty.ChildRounding=0.0f;
6480 sty.PopupRounding=0.0f;
6481 sty.AntiAliasedLines=false;
6482 sty.AntiAliasedLinesUseTex=false;
6483 sty.AntiAliasedFill=false;
6484 }
6485
6486 if (mobileUI) {
6487 sty.FramePadding=ImVec2(8.0f,6.0f);
6488 }
6489
6490 sty.ScaleAllSizes(dpiScale);
6491
6492 ImGui::GetStyle()=sty;
6493
6494 updateSampleTex=true;
6495
6496 ImGui::GetIO().ConfigInputTrickleEventQueue=settings.eventDelay;
6497 ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly=settings.moveWindowTitle;
6498 ImGui::GetIO().ConfigInertialScrollToleranceSqr=pow(dpiScale*4.0f,2.0f);
6499 ImGui::GetIO().MouseDoubleClickTime=settings.doubleClickTime;
6500 ImGui::GetIO().ScrollTextSpacing=8.0*dpiScale;
6501 ImGui::GetIO().ScrollTextSpeed=60.0*dpiScale;
6502
6503 for (int i=0; i<256; i++) {
6504 ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH];
6505 pitchGrad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
6506 }
6507 for (int i=0; i<256; i++) {
6508 ImVec4& base=uiColors[GUI_COLOR_PATTERN_ACTIVE];
6509 noteGrad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
6510 }
6511 for (int i=0; i<256; i++) {
6512 ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_PANNING];
6513 panGrad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
6514 }
6515 for (int i=0; i<256; i++) {
6516 ImVec4& base=uiColors[GUI_COLOR_PATTERN_INS];
6517 insGrad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
6518 }
6519 for (int i=0; i<256; i++) {
6520 ImVec4& base=volColors[i/2];
6521 volGrad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
6522 }
6523 for (int i=0; i<256; i++) {
6524 ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_SYS_PRIMARY];
6525 sysCmd1Grad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
6526 }
6527 for (int i=0; i<256; i++) {
6528 ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_SYS_SECONDARY];
6529 sysCmd2Grad[i]=ImGui::GetColorU32(ImVec4(base.x,base.y,base.z,((float)i/255.0f)*base.w));
6530 }
6531
6532 if (updateFonts && !safeMode) {
6533 // prepare
6534 #ifdef HAVE_FREETYPE
6535 if (settings.fontBackend==1) {
6536 ImGui::GetIO().Fonts->SetFontLoader(ImGuiFreeType::GetFontLoader());
6537 ImGui::GetIO().Fonts->FontLoaderFlags&=~(
6538 ImGuiFreeTypeLoaderFlags_NoHinting|
6539 ImGuiFreeTypeLoaderFlags_NoAutoHint|
6540 ImGuiFreeTypeLoaderFlags_ForceAutoHint|
6541 ImGuiFreeTypeLoaderFlags_LightHinting|
6542 ImGuiFreeTypeLoaderFlags_MonoHinting|
6543 ImGuiFreeTypeLoaderFlags_Bold|
6544 ImGuiFreeTypeLoaderFlags_Oblique|
6545 ImGuiFreeTypeLoaderFlags_Monochrome|
6546 ImGuiFreeTypeLoaderFlags_LoadColor|
6547 ImGuiFreeTypeLoaderFlags_Bitmap
6548 );
6549
6550 if (!settings.fontAntiAlias) ImGui::GetIO().Fonts->FontLoaderFlags|=ImGuiFreeTypeLoaderFlags_Monochrome;
6551 if (settings.fontBitmap) ImGui::GetIO().Fonts->FontLoaderFlags|=ImGuiFreeTypeLoaderFlags_Bitmap;
6552
6553 switch (settings.fontHinting) {
6554 case 0: // off
6555 ImGui::GetIO().Fonts->FontLoaderFlags|=ImGuiFreeTypeLoaderFlags_NoHinting;
6556 break;
6557 case 1: // slight
6558 ImGui::GetIO().Fonts->FontLoaderFlags|=ImGuiFreeTypeLoaderFlags_LightHinting;
6559 break;
6560 case 2: // normal
6561 break;
6562 case 3: // full
6563 ImGui::GetIO().Fonts->FontLoaderFlags|=ImGuiFreeTypeLoaderFlags_MonoHinting;
6564 break;
6565 }
6566
6567 switch (settings.fontAutoHint) {
6568 case 0: // off
6569 ImGui::GetIO().Fonts->FontLoaderFlags|=ImGuiFreeTypeLoaderFlags_NoAutoHint;
6570 break;
6571 case 1: // on
6572 break;
6573 case 2: // force
6574 ImGui::GetIO().Fonts->FontLoaderFlags|=ImGuiFreeTypeLoaderFlags_ForceAutoHint;
6575 break;
6576 }
6577 } else {
6578 ImGui::GetIO().Fonts->SetFontLoader(ImFontAtlasGetFontLoaderForStbTruetype());
6579 }
6580 #endif
6581
6582 ImFontConfig fontConf;
6583 ImFontConfig fontConfP;
6584 ImFontConfig fontConfB;
6585 ImFontConfig fontConfH;
6586
6587 fontConf.OversampleV=1;
6588 fontConf.OversampleH=settings.fontOversample;
6589 fontConfP.OversampleV=1;
6590 fontConfP.OversampleH=settings.fontOversample;
6591 fontConfB.OversampleV=1;
6592 fontConfB.OversampleH=1;
6593 fontConfH.OversampleV=1;
6594 fontConfH.OversampleH=1;
6595
6596 if (safeMode || renderBackend==GUI_BACKEND_SOFTWARE) {
6597 fontConf.OversampleV=1;
6598 fontConf.OversampleH=1;
6599 fontConfP.OversampleV=1;
6600 fontConfP.OversampleH=1;
6601 fontConfB.OversampleV=1;
6602 fontConfB.OversampleH=1;
6603 fontConfH.OversampleV=1;
6604 fontConfH.OversampleH=1;
6605 }
6606
6607 //fontConf.RasterizerMultiply=1.5;
6608 //fontConfP.RasterizerMultiply=1.5;
6609
6610 if (settings.mainFont<0 || settings.mainFont>6) settings.mainFont=0;
6611 if (settings.headFont<0 || settings.headFont>6) settings.headFont=0;
6612 if (settings.patFont<0 || settings.patFont>6) settings.patFont=0;
6613
6614 if (settings.mainFont==6 && settings.mainFontPath.empty()) {
6615 logW("UI font path is empty! reverting to default font");
6616 settings.mainFont=GUI_MAIN_FONT_DEFAULT;
6617 }
6618 if (settings.headFont==6 && settings.headFontPath.empty()) {
6619 logW("header font path is empty! reverting to default font");
6620 settings.headFont=0;
6621 }
6622 if (settings.patFont==6 && settings.patFontPath.empty()) {
6623 logW("pattern font path is empty! reverting to default font");
6624 settings.patFont=GUI_PAT_FONT_DEFAULT;
6625 }
6626
6627 ImFontConfig fc1;
6628 fc1.MergeMode=true;
6629 // save memory
6630 fc1.OversampleH=1;
6631 fc1.OversampleV=1;
6632
6633 if (settings.mainFont==6) { // custom font
6634 if ((mainFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(settings.mainFontPath.c_str(),MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fontConf))==NULL) {
6635 logW("could not load UI font! reverting to default font");
6636 settings.mainFont=GUI_MAIN_FONT_DEFAULT;
6637 if ((mainFont=addFontZlib(builtinFont[settings.mainFont],builtinFontLen[settings.mainFont],MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fontConf))==NULL) {
6638 logE("could not load UI font! falling back to Proggy Clean.");
6639 mainFont=ImGui::GetIO().Fonts->AddFontDefault();
6640 }
6641 }
6642 } else if (settings.mainFont==5) { // system font
6643 if ((mainFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_FONT_PATH_1,MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fontConf))==NULL) {
6644 if ((mainFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_FONT_PATH_2,MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fontConf))==NULL) {
6645 if ((mainFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_FONT_PATH_3,MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fontConf))==NULL) {
6646 logW("could not load UI font! reverting to default font");
6647 settings.mainFont=GUI_MAIN_FONT_DEFAULT;
6648 if ((mainFont=addFontZlib(builtinFont[settings.mainFont],builtinFontLen[settings.mainFont],MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fontConf))==NULL) {
6649 logE("could not load UI font! falling back to Proggy Clean.");
6650 mainFont=ImGui::GetIO().Fonts->AddFontDefault();
6651 }
6652 }
6653 }
6654 }
6655 } else {
6656 if ((mainFont=addFontZlib(builtinFont[settings.mainFont],builtinFontLen[settings.mainFont],MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fontConf))==NULL) {
6657 logE("could not load UI font! falling back to Proggy Clean.");
6658 mainFont=ImGui::GetIO().Fonts->AddFontDefault();
6659 }
6660 }
6661
6662 // four fallback fonts
6663 if (settings.loadFallback) {
6664 mainFont=addFontZlib(font_plexSans_compressed_data,font_plexSans_compressed_size,MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fc1);
6665 mainFont=addFontZlib(font_plexSansJP_compressed_data,font_plexSansJP_compressed_size,MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fc1);
6666 mainFont=addFontZlib(font_plexSansKR_compressed_data,font_plexSansKR_compressed_size,MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fc1);
6667 mainFont=addFontZlib(font_unifont_compressed_data,font_unifont_compressed_size,MAX(1,e->getConfInt("mainFontSize",18)*dpiScale),&fc1);
6668 }
6669
6670 ImFontConfig fc;
6671 fc.MergeMode=true;
6672 fc.OversampleH=1;
6673 fc.OversampleV=1;
6674 fc.PixelSnapH=true;
6675 fc.GlyphMinAdvanceX=e->getConfInt("iconSize",16)*dpiScale;
6676 if ((iconFont=addFontZlib(iconFont_compressed_data,iconFont_compressed_size,MAX(1,e->getConfInt("iconSize",16)*dpiScale),&fc))==NULL) {
6677 logE("could not load icon font!");
6678 }
6679
6680 if ((furIconFont=addFontZlib(furIcons_compressed_data,furIcons_compressed_size,MAX(1,e->getConfInt("iconSize",16)*dpiScale),&fc))==NULL) {
6681 logE("could not load Furnace icons font!");
6682 }
6683
6684 if (settings.mainFontSize==settings.patFontSize && settings.patFont<5 && builtinFontM[settings.patFont]==builtinFont[settings.mainFont]) {
6685 logD("using main font for pat font.");
6686 patFont=mainFont;
6687 } else {
6688 if (settings.patFont==6) { // custom font
6689 if ((patFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(settings.patFontPath.c_str(),MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fontConfP))==NULL) {
6690 logW("could not load pattern font! reverting to default font");
6691 settings.patFont=GUI_PAT_FONT_DEFAULT;
6692 if ((patFont=addFontZlib(builtinFontM[settings.patFont],builtinFontMLen[settings.patFont],MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fontConfP))==NULL) {
6693 logE("could not load pattern font! falling back to Proggy Clean.");
6694 patFont=ImGui::GetIO().Fonts->AddFontDefault();
6695 }
6696 }
6697 } else if (settings.patFont==5) { // system font
6698 if ((patFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_PAT_FONT_PATH_1,MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fontConfP))==NULL) {
6699 if ((patFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_PAT_FONT_PATH_2,MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fontConfP))==NULL) {
6700 if ((patFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_PAT_FONT_PATH_3,MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fontConfP))==NULL) {
6701 logW("could not load pattern font! reverting to default font");
6702 settings.patFont=GUI_PAT_FONT_DEFAULT;
6703 if ((patFont=addFontZlib(builtinFontM[settings.patFont],builtinFontMLen[settings.patFont],MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fontConfP))==NULL) {
6704 logE("could not load pattern font! falling back to Proggy Clean.");
6705 patFont=ImGui::GetIO().Fonts->AddFontDefault();
6706 }
6707 }
6708 }
6709 }
6710 } else {
6711 if ((patFont=addFontZlib(builtinFontM[settings.patFont],builtinFontMLen[settings.patFont],MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fontConfP))==NULL) {
6712 logE("could not load pattern font!");
6713 patFont=ImGui::GetIO().Fonts->AddFontDefault();
6714 }
6715 }
6716 }
6717
6718 // four fallback fonts
6719 if (settings.loadFallbackPat && (
6720 localeRequiresJapanese ||
6721 localeRequiresChinese ||
6722 localeRequiresChineseTrad ||
6723 localeRequiresKorean)) {
6724 patFont=addFontZlib(font_plexMono_compressed_data,font_plexMono_compressed_size,MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fc1);
6725 patFont=addFontZlib(font_plexSansJP_compressed_data,font_plexSansJP_compressed_size,MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fc1);
6726 patFont=addFontZlib(font_plexSansKR_compressed_data,font_plexSansKR_compressed_size,MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fc1);
6727 patFont=addFontZlib(font_unifont_compressed_data,font_unifont_compressed_size,MAX(1,e->getConfInt("patFontSize",18)*dpiScale),&fc1);
6728 }
6729
6730 if ((bigFont=addFontZlib(font_plexSans_compressed_data,font_plexSans_compressed_size,MAX(1,40*dpiScale),&fontConfB))==NULL) {
6731 logE("could not load big UI font!");
6732 }
6733 fontConfB.MergeMode=true;
6734 if ((bigFont=addFontZlib(font_plexSansJP_compressed_data,font_plexSansJP_compressed_size,MAX(1,40*dpiScale),&fontConfB))==NULL) {
6735 logE("could not load big UI font (japanese)!");
6736 }
6737 if ((bigFont=addFontZlib(font_plexSansKR_compressed_data,font_plexSansKR_compressed_size,MAX(1,40*dpiScale),&fontConfB))==NULL) {
6738 logE("could not load big UI font (korean)!");
6739 }
6740 if ((bigFont=addFontZlib(font_unifont_compressed_data,font_unifont_compressed_size,MAX(1,40*dpiScale),&fontConfB))==NULL) {
6741 logE("could not load big UI font (fallback)!");
6742 }
6743
6744 if (settings.mainFontSize==settings.headFontSize && settings.headFont<5 && builtinFont[settings.headFont]==builtinFont[settings.mainFont]) {
6745 logD("using main font for header font.");
6746 headFont=mainFont;
6747 } else {
6748 if (settings.headFont==6) { // custom font
6749 if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(settings.headFontPath.c_str(),MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fontConfH))==NULL) {
6750 logW("could not load header font! reverting to default font");
6751 settings.headFont=0;
6752 if ((headFont=addFontZlib(builtinFont[settings.headFont],builtinFontLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fontConfH))==NULL) {
6753 logE("could not load header font! falling back to IBM Plex Sans.");
6754 headFont=ImGui::GetIO().Fonts->AddFontDefault();
6755 }
6756 }
6757 } else if (settings.headFont==5) { // system font
6758 if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_1,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fontConfH))==NULL) {
6759 if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_2,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fontConfH))==NULL) {
6760 if ((headFont=ImGui::GetIO().Fonts->AddFontFromFileTTF(SYSTEM_HEAD_FONT_PATH_3,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fontConfH))==NULL) {
6761 logW("could not load header font! reverting to default font");
6762 settings.headFont=0;
6763 if ((headFont=addFontZlib(builtinFont[settings.headFont],builtinFontLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fontConfH))==NULL) {
6764 logE("could not load header font! falling back to fallback. wahahaha, get it? fallback.");
6765 headFont=ImGui::GetIO().Fonts->AddFontDefault();
6766 }
6767 }
6768 }
6769 }
6770 } else {
6771 if ((headFont=addFontZlib(builtinFont[settings.headFont],builtinFontLen[settings.headFont],MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fontConfH))==NULL) {
6772 logE("could not load header font!");
6773 headFont=ImGui::GetIO().Fonts->AddFontDefault();
6774 }
6775 }
6776 }
6777
6778 // four fallback fonts
6779 if (settings.loadFallback) {
6780 headFont=addFontZlib(font_plexSans_compressed_data,font_plexSans_compressed_size,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fc1);
6781 headFont=addFontZlib(font_plexSansJP_compressed_data,font_plexSansJP_compressed_size,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fc1);
6782 headFont=addFontZlib(font_plexSansKR_compressed_data,font_plexSansKR_compressed_size,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fc1);
6783 headFont=addFontZlib(font_unifont_compressed_data,font_unifont_compressed_size,MAX(1,e->getConfInt("headFontSize",27)*dpiScale),&fc1);
6784 }
6785
6786 mainFont->FallbackChar='?';
6787 mainFont->EllipsisChar='.';
6788 //mainFont->EllipsisCharCount=3;
6789 } else if (updateFonts) {
6790 // safe mode
6791 mainFont=ImGui::GetIO().Fonts->AddFontDefault();
6792 patFont=mainFont;
6793 bigFont=mainFont;
6794 headFont=mainFont;
6795
6796 mainFont->FallbackChar='?';
6797 mainFont->EllipsisChar='.';
6798 //mainFont->EllipsisCharCount=3;
6799 }
6800
6801 ImGuiFileDialog::Instance()->okButtonString=_("OK");
6802 ImGuiFileDialog::Instance()->cancelButtonString=_("Cancel");
6803 ImGuiFileDialog::Instance()->searchString=_("Search");
6804 ImGuiFileDialog::Instance()->dirEntryString=_("[Dir]");
6805 ImGuiFileDialog::Instance()->linkEntryString=_("[Link]");
6806 ImGuiFileDialog::Instance()->fileEntryString=_("[File]");
6807 ImGuiFileDialog::Instance()->fileNameString=_("Name:");
6808 ImGuiFileDialog::Instance()->dirNameString=_("Path:");
6809 ImGuiFileDialog::Instance()->buttonResetSearchString=_("Reset search");
6810 ImGuiFileDialog::Instance()->buttonDriveString=_("Drives");
6811 ImGuiFileDialog::Instance()->buttonEditPathString=_("Edit path\nYou can also right click on path buttons");
6812 ImGuiFileDialog::Instance()->buttonResetPathString=_("Go to home directory");
6813 ImGuiFileDialog::Instance()->buttonParentDirString=_("Go to parent directory");
6814 ImGuiFileDialog::Instance()->buttonCreateDirString=_("Create Directory");
6815 ImGuiFileDialog::Instance()->tableHeaderFileNameString=_("File name");
6816 ImGuiFileDialog::Instance()->tableHeaderFileTypeString=_("Type");
6817 ImGuiFileDialog::Instance()->tableHeaderFileSizeString=_("Size");
6818 ImGuiFileDialog::Instance()->tableHeaderFileDateString=_("Date");
6819 ImGuiFileDialog::Instance()->OverWriteDialogTitleString=_("Warning");
6820 ImGuiFileDialog::Instance()->OverWriteDialogMessageString=_("The file you selected already exists! Would you like to overwrite it?");
6821 ImGuiFileDialog::Instance()->OverWriteDialogConfirmButtonString=_("Yes");
6822 ImGuiFileDialog::Instance()->OverWriteDialogCancelButtonString=_("No");
6823 ImGuiFileDialog::Instance()->DateTimeFormat=_("%Y/%m/%d %H:%M");
6824
6825 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeDir,"",uiColors[GUI_COLOR_FILE_DIR],ICON_FA_FOLDER_O);
6826 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeFile,"",uiColors[GUI_COLOR_FILE_OTHER],ICON_FA_FILE_O);
6827 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fur",uiColors[GUI_COLOR_FILE_SONG_NATIVE],ICON_FA_FILE);
6828 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fui",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6829 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fuw",uiColors[GUI_COLOR_FILE_WAVE],ICON_FA_FILE);
6830 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".dmp",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6831 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".dmw",uiColors[GUI_COLOR_FILE_WAVE],ICON_FA_FILE);
6832 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".wav",uiColors[GUI_COLOR_FILE_AUDIO],ICON_FA_FILE_AUDIO_O);
6833 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".dmc",uiColors[GUI_COLOR_FILE_AUDIO],ICON_FA_FILE_AUDIO_O);
6834 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".brr",uiColors[GUI_COLOR_FILE_AUDIO],ICON_FA_FILE_AUDIO_O);
6835 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".vgm",uiColors[GUI_COLOR_FILE_VGM],ICON_FA_FILE_AUDIO_O);
6836 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".zsm",uiColors[GUI_COLOR_FILE_ZSM],ICON_FA_FILE_AUDIO_O);
6837 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ttf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
6838 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".otf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
6839 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ttc",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
6840 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".dfont",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
6841 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fon",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
6842 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".pcf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
6843 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".psf",uiColors[GUI_COLOR_FILE_FONT],ICON_FA_FONT);
6844
6845 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".dmf",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6846 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".mod",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6847 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".s3m",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6848 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".xm",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6849 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".it",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6850 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fc13",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6851 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fc14",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6852 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fc",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6853 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".smod",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6854 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ftm",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6855 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".0cc",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6856 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".dnm",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6857 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".eft",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6858
6859 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fub",uiColors[GUI_COLOR_FILE_SONG_IMPORT],ICON_FA_FILE);
6860
6861 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".tfi",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6862 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".vgi",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6863 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".s3i",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6864 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".sbi",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6865 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".opli",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6866 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".opni",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6867 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".y12",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6868 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".bnk",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6869 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6870 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".bti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6871 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ff",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6872 ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".opm",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE);
6873
6874 if (updateFonts) {
6875 if (fileDialog!=NULL) delete fileDialog;
6876 #ifdef FLATPAK_WORKAROUNDS
6877 fileDialog=new FurnaceGUIFileDialog(false);
6878 #else
6879 fileDialog=new FurnaceGUIFileDialog(settings.sysFileDialog);
6880 #endif
6881
6882 fileDialog->mobileUI=mobileUI;
6883 }
6884 }