feat: add common dialogs, i.e. open/save dialog

This commit is contained in:
2026-04-01 23:45:28 +02:00
parent be787529ea
commit 90ad9f038d
15 changed files with 2164 additions and 79 deletions
+7 -6
View File
@@ -5,14 +5,15 @@
*/
#include "wordprocessor.hpp"
#include <gui/dialogs.hpp>
static void wp_open_pathbar_for_open(WordProcessorState* wp) {
wp->show_pathbar = !wp->show_pathbar;
wp->pathbar_save_mode = false;
if (wp->show_pathbar) {
montauk::strncpy(wp->pathbar_text, wp->filepath, 255);
wp->pathbar_len = montauk::slen(wp->pathbar_text);
wp->pathbar_cursor = wp->pathbar_len;
char path[256] = {};
char msg[160] = {};
if (dialogs::open_file("Open Document", wp->filepath, path, sizeof(path), msg, sizeof(msg))) {
wp_load_file(wp, path);
} else if (msg[0]) {
wp_start_pathbar(wp, false, wp->filepath);
}
}