diff --git a/apps/text_editor.cpp b/apps/text_editor.cpp index 81247f7..977f301 100644 --- a/apps/text_editor.cpp +++ b/apps/text_editor.cpp @@ -315,6 +315,8 @@ void ProcessApplicationMessage(EsMessage *message) { EsInstanceOpenComplete(message, true); } + + EsHeapFree(file); } else if (message->type == ES_MSG_INSTANCE_SAVE) { Instance *instance = message->instanceSave.instance; size_t byteCount; diff --git a/desktop/api.cpp b/desktop/api.cpp index f8c11ad..89491ba 100644 --- a/desktop/api.cpp +++ b/desktop/api.cpp @@ -815,6 +815,7 @@ EsMessage *EsMessageReceive() { gui.allWindows.Free(); calculator.Free(); HashTableFree(&gui.keyboardShortcutNames, false); + MemoryLeakDetectorCheckpoint(&heap); EsPrint("ES_MSG_APPLICATION_EXIT - Heap allocation count: %d (%d from malloc).\n", heap.allocationsCount, mallocCount); #endif EsProcessTerminateCurrent(); diff --git a/desktop/gui.cpp b/desktop/gui.cpp index 8370558..6df3452 100644 --- a/desktop/gui.cpp +++ b/desktop/gui.cpp @@ -6101,7 +6101,7 @@ void AccessKeyModeEnter(EsWindow *window) { } if (!gui.accessKeys.hintStyle) { - gui.accessKeys.hintStyle = GetStyle(MakeStyleKey(ES_STYLE_ACCESS_KEY_HINT, 0), false); + gui.accessKeys.hintStyle = GetStyle(MakeStyleKey(ES_STYLE_ACCESS_KEY_HINT, 0), true); } gui.accessKeyMode = true; diff --git a/res/Themes/Theme.dat b/res/Themes/Theme.dat index c97eece..6e5fee0 100644 Binary files a/res/Themes/Theme.dat and b/res/Themes/Theme.dat differ diff --git a/util/config_editor.c b/util/config_editor.c index dd7a892..57eb6c0 100644 --- a/util/config_editor.c +++ b/util/config_editor.c @@ -31,33 +31,47 @@ int OptionTableMessage(UIElement *element, UIMessage message, int di, void *dp) } else { return snprintf(m->buffer, m->bufferBytes, "%s", option->id); } - } else if (message == UI_MSG_CLICKED) { + } else if (message == UI_MSG_CLICKED || (message == UI_MSG_RIGHT_UP && element->window->hovered == element)) { + bool reset = message == UI_MSG_RIGHT_UP; int index = UITableHitTest((UITable *) element, element->window->cursorX, element->window->cursorY); if (index != -1) { Option *option = options + index; if (option->type == OPTION_TYPE_BOOL) { - bool okay = true; + if (reset) { + option->state = option->defaultState; + } else { + bool okay = true; - if (option->warning && !option->state.b) { - if (UIDialogShow(element->window, 0, "Warning:\n%s\n%f%b%b", option->warning, "Enable", "Cancel")[0] == 'C') { - okay = false; + if (option->warning && !option->state.b) { + if (UIDialogShow(element->window, 0, "Warning:\n%s\n%f%b%b", option->warning, "Enable", "Cancel")[0] == 'C') { + okay = false; + } + } + + if (okay) { + option->state.b = !option->state.b; + option->useDefaultState = false; } } - - if (okay) { - option->state.b = !option->state.b; + } else if (option->type == OPTION_TYPE_STRING) { + if (reset) { + free(option->state.s); + option->state.s = option->defaultState.s ? strdup(option->defaultState.s) : NULL; + } else { + UIDialogShow(element->window, 0, "New value: \n%t\n%f%b", &option->state.s, "OK"); option->useDefaultState = false; } - } else if (option->type == OPTION_TYPE_STRING) { - UIDialogShow(element->window, 0, "New value: \n%t\n%f%b", &option->state.s, "OK"); - option->useDefaultState = false; } else { // TODO. option->useDefaultState = false; } + if (reset) { + option->useDefaultState = true; + } + UITableResizeColumns(optionTable); UIElementRefresh(element); UILabelSetContent(unsavedChangedLabel, "You have unsaved changes!", -1); @@ -106,15 +120,16 @@ int main(int argc, char **argv) { LoadOptions(); UIInitialise(); - window = UIWindowCreate(0, 0, "Config Editor", 0, 0); + ui.theme = _uiThemeClassic; + window = UIWindowCreate(0, 0, "Config Editor", 1024, 768); UIPanel *panel = UIPanelCreate(&window->e, UI_PANEL_EXPAND); - UIPanel *toolbar = UIPanelCreate(&panel->e, UI_PANEL_SMALL_SPACING | UI_PANEL_WHITE | UI_PANEL_HORIZONTAL); + UIPanel *toolbar = UIPanelCreate(&panel->e, UI_PANEL_SMALL_SPACING | UI_PANEL_GRAY | UI_PANEL_HORIZONTAL); UIButtonCreate(&toolbar->e, 0, "Save", -1)->invoke = ActionSave; UIWindowRegisterShortcut(window, (UIShortcut) { .code = UI_KEYCODE_LETTER('S'), .ctrl = true, .invoke = ActionSave }); UIButtonCreate(&toolbar->e, 0, "Defaults", -1)->invoke = ActionDefaults; UISpacerCreate(&toolbar->e, 0, 10, 0); - UILabelCreate(&toolbar->e, 0, "Click an option to modify it. (Changes are local.)", -1); + UILabelCreate(&toolbar->e, 0, "Left click an option to modify it. Right click to reset. (Changes are local.)", -1); optionTable = UITableCreate(&panel->e, UI_ELEMENT_V_FILL, "Option\tValue\tModified"); optionTable->e.messageUser = OptionTableMessage;