Lagrange [release]
App: Fixed restoring the user's font settings
[1mdiff --git a/src/app.c b/src/app.c[m
[1mindex 25a48ff3..3ddc81b8 100644[m
[1m--- a/src/app.c[m
[1m+++ b/src/app.c[m
[36m@@ -2770,6 +2770,43 @@[m [mstatic iBool handleNonWindowRelatedCommand_App_(iApp *d, const char *cmd) {[m
d->prefs.customFrame = arg_Command(cmd);[m
return iTrue;[m
}[m
[32m+[m[32m else if (equal_Command(cmd, "font.set")) {[m
[32m+[m[32m if (!isFrozen && get_MainWindow()) {[m
[32m+[m[32m setFreezeDraw_MainWindow(get_MainWindow(), iTrue);[m
[32m+[m[32m }[m
[32m+[m[32m struct {[m
[32m+[m[32m const char *label;[m
[32m+[m[32m enum iPrefsString ps;[m
[32m+[m[32m int fontId;[m
[32m+[m[32m } params[] = {[m
[32m+[m[32m { "ui", uiFont_PrefsString, default_FontId },[m
[32m+[m[32m { "mono", monospaceFont_PrefsString, monospace_FontId },[m
[32m+[m[32m { "heading", headingFont_PrefsString, documentHeading_FontId },[m
[32m+[m[32m { "body", bodyFont_PrefsString, documentBody_FontId },[m
[32m+[m[32m { "monodoc", monospaceDocumentFont_PrefsString, documentMonospace_FontId },[m
[32m+[m[32m };[m
[32m+[m[32m iBool wasChanged = iFalse;[m
[32m+[m[32m iForIndices(i, params) {[m
[32m+[m[32m if (hasLabel_Command(cmd, params[i].label)) {[m
[32m+[m[32m iString *ps = &d->prefs.strings[params[i].ps];[m
[32m+[m[32m const iString *newFont = string_Command(cmd, params[i].label);[m
[32m+[m[32m if (!equal_String(ps, newFont)) {[m
[32m+[m[32m set_String(ps, newFont);[m
[32m+[m[32m wasChanged = iTrue;[m
[32m+[m[32m }[m
[32m+[m[32m }[m
[32m+[m[32m }[m
[32m+[m[32m if (wasChanged) {[m
[32m+[m[32m if (isFinishedLaunching_App() && get_MainWindow()) { /* there's a reset when launch is finished */[m
[32m+[m[32m resetFonts_Text(text_Window(get_MainWindow()));[m
[32m+[m[32m }[m
[32m+[m[32m postCommand_App("font.changed");[m
[32m+[m[32m }[m
[32m+[m[32m if (!isFrozen) {[m
[32m+[m[32m postCommand_App("window.unfreeze");[m
[32m+[m[32m }[m
[32m+[m[32m return iTrue;[m
[32m+[m[32m }[m
else if (equal_Command(cmd, "prefs.retaintabs.changed")) {[m
d->prefs.retainTabs = arg_Command(cmd);[m
return iTrue;[m
[36m@@ -3363,43 +3400,6 @@[m [miBool handleCommand_App(const char *cmd) {[m
utf8_String(src));[m
return iTrue;[m
}[m
[31m- else if (equal_Command(cmd, "font.set")) {[m
[31m- if (!isFrozen) {[m
[31m- setFreezeDraw_MainWindow(get_MainWindow(), iTrue);[m
[31m- }[m
[31m- struct {[m
[31m- const char *label;[m
[31m- enum iPrefsString ps;[m
[31m- int fontId;[m
[31m- } params[] = {[m
[31m- { "ui", uiFont_PrefsString, default_FontId },[m
[31m- { "mono", monospaceFont_PrefsString, monospace_FontId },[m
[31m- { "heading", headingFont_PrefsString, documentHeading_FontId },[m
[31m- { "body", bodyFont_PrefsString, documentBody_FontId },[m
[31m- { "monodoc", monospaceDocumentFont_PrefsString, documentMonospace_FontId },[m
[31m- };[m
[31m- iBool wasChanged = iFalse;[m
[31m- iForIndices(i, params) {[m
[31m- if (hasLabel_Command(cmd, params[i].label)) {[m
[31m- iString *ps = &d->prefs.strings[params[i].ps];[m
[31m- const iString *newFont = string_Command(cmd, params[i].label);[m
[31m- if (!equal_String(ps, newFont)) {[m
[31m- set_String(ps, newFont);[m
[31m- wasChanged = iTrue;[m
[31m- }[m
[31m- }[m
[31m- }[m
[31m- if (wasChanged) {[m
[31m- if (isFinishedLaunching_App()) { /* there's a reset when launch is finished */[m
[31m- resetFonts_Text(text_Window(get_MainWindow()));[m
[31m- }[m
[31m- postCommand_App("font.changed");[m
[31m- }[m
[31m- if (!isFrozen) {[m
[31m- postCommand_App("window.unfreeze");[m
[31m- }[m
[31m- return iTrue;[m
[31m- }[m
else if (equal_Command(cmd, "zoom.set")) {[m
if (!isFrozen) {[m
setFreezeDraw_MainWindow(get_MainWindow(), iTrue); /* no intermediate draws before docs updated */[m