From 3aae55948c7d97f54e425d43744992732823b8ff Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Tue, 11 Feb 2020 15:03:15 +0100 Subject: work --- src/mo_edit.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'src/mo_edit.c') diff --git a/src/mo_edit.c b/src/mo_edit.c index d9505f0..b481b9f 100644 --- a/src/mo_edit.c +++ b/src/mo_edit.c @@ -43,6 +43,9 @@ array tb_translation_list; #include "save.h" #include "save.c" +#include "settings.h" +#include "settings.c" + scroll_state term_scroll; scroll_state lang_scroll; scroll_state trans_scroll; @@ -233,6 +236,22 @@ void remove_language_from_project(s32 language_id) language *l = array_at(¤t_project->languages, i); if (l->id == language_id) { + char fullpath[MAX_INPUT_LENGTH]; + fullpath[0] = 0; + string_appendn(fullpath, project_path, MAX_INPUT_LENGTH); +#ifdef OS_WIN + string_appendn(fullpath, "\\", MAX_INPUT_LENGTH); +#endif +#ifdef OS_LINUX + string_appendn(fullpath, "/", MAX_INPUT_LENGTH); +#endif + string_appendn(fullpath, l->name, MAX_INPUT_LENGTH); + string_appendn(fullpath, ".mo", MAX_INPUT_LENGTH); + if (platform_file_exists(fullpath)) + { + platform_delete_file(fullpath); + } + array_remove_at(¤t_project->languages, i); textbox_state *st = array_at(&tb_translation_list, i); mem_free(st->buffer); @@ -380,13 +399,6 @@ int main(int argc, char **argv) { platform_init(argc, argv); - bool is_command_line_run = (argc > 1); - if (is_command_line_run) - { - //handle_command_line_arguments(argc, argv); - return 0; - } - char config_path_buffer[PATH_MAX]; get_config_save_location(config_path_buffer); @@ -404,7 +416,7 @@ int main(int argc, char **argv) platform_window window = platform_open_window("mo-edit", window_w, window_h, 0, 0, 800, 600); main_window = &window; - //settings_page_create(); + settings_page_create(); load_available_localizations(); set_locale("en"); @@ -441,11 +453,11 @@ int main(int argc, char **argv) load_config(&config); while(window.is_open) { - u64 last_stamp = platform_get_time(TIME_FULL, TIME_US); + u64 last_stamp = platform_get_time(TIME_FULL, TIME_US); platform_handle_events(&window, &mouse, &keyboard); platform_set_cursor(&window, CURSOR_DEFAULT); - //settings_page_update_render(); + settings_page_update_render(); platform_window_make_current(&window); @@ -519,11 +531,17 @@ int main(int argc, char **argv) window.is_open = false; } } + if (ui_push_menu(localize("options"))) + { + if (ui_push_menu_item(localize("settings"), "")) + { + settings_page_show(); + } + } } ui_end_menu_bar(); ui_push_separator(); - global_ui_context.layout.width = 300; ui_push_vertical_dragbar(); @@ -875,7 +893,7 @@ int main(int argc, char **argv) } } - //settings_page_hide_without_save(); + settings_page_hide_without_save(); // write config file if (!string_equals(project_path, "")) -- cgit v1.2.3-70-g09d2