editor: explorador de arquivos (tinyblocks-editor-files) para Abrir/Salvar
Nova library privada do bundle do editor (dlopen + hot reload) com um diálogo modal no lugar da barra de caminho: locais, trilha clicável, lista filtrada por extensão, campo de nome e confirmação ao substituir. - start_path() abre o explorador em todos os modos (projeto, exportar, imagem, código, .so); sem o módulo volta para a barra de caminho. - O switch do Enter virou path_commit(), usado pelos dois caminhos. - Estado em ed->fdlg para sobreviver à recarga do módulo. - Empacotado no AppImage; 6 cenários novos no harness headless. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
adf5d2cd12
commit
f0abc7593a
13 files changed
+1286
-46
No files matched your search
@@ -36,13 +36,16 @@
|
||||
/* Tabelas vivas (preenchidas aqui, usadas pelo editor) */
|
||||
TbEdImageApi tb_ed_img;
|
||||
TbEdWidgetsApi tb_ed_w;
|
||||
TbEdFilesApi tb_ed_files;
|
||||
|
||||
/* Ordem = dependencia: widgets e a base (a imagem usa as primitivas dela) */
|
||||
static const char* s_mod_name[2] = { "tinyblocks-editor-widgets",
|
||||
"tinyblocks-editor-image" };
|
||||
static const char* s_mod_file[2] = { "libtinyblocks-editor-widgets.so",
|
||||
"libtinyblocks-editor-image.so" };
|
||||
static const int s_mod_n = 2;
|
||||
static const char* s_mod_name[3] = { "tinyblocks-editor-widgets",
|
||||
"tinyblocks-editor-image",
|
||||
"tinyblocks-editor-files" };
|
||||
static const char* s_mod_file[3] = { "libtinyblocks-editor-widgets.so",
|
||||
"libtinyblocks-editor-image.so",
|
||||
"libtinyblocks-editor-files.so" };
|
||||
static const int s_mod_n = 3;
|
||||
|
||||
static char s_dir[512] = "";
|
||||
|
||||
@@ -138,6 +141,22 @@ static bool resolve_image(void) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* Resolve as funcoes do explorador de arquivos */
|
||||
static bool resolve_files(void) {
|
||||
TbEdFilesApi a;
|
||||
memset(&a, 0, sizeof(a));
|
||||
sym_fn(&a.open, "tinyblocks-editor-files", "tb_editor_files_open");
|
||||
sym_fn(&a.close, "tinyblocks-editor-files", "tb_editor_files_close");
|
||||
sym_fn(&a.view, "tinyblocks-editor-files", "tb_editor_files_view");
|
||||
sym_fn(&a.click, "tinyblocks-editor-files", "tb_editor_files_click");
|
||||
sym_fn(&a.key, "tinyblocks-editor-files", "tb_editor_files_key");
|
||||
sym_fn(&a.text, "tinyblocks-editor-files", "tb_editor_files_text");
|
||||
sym_fn(&a.scroll, "tinyblocks-editor-files", "tb_editor_files_scroll");
|
||||
bool ok = a.open && a.close && a.view && a.click && a.key && a.text && a.scroll;
|
||||
if (ok) tb_ed_files = a;
|
||||
return ok;
|
||||
}
|
||||
|
||||
/* -- carga --------------------------------------------------------------- */
|
||||
|
||||
bool tb_ed_modules_load(Ed* ed) {
|
||||
@@ -161,7 +180,7 @@ bool tb_ed_modules_load(Ed* ed) {
|
||||
ed->mods.list[ed->mods.n].ok = 1;
|
||||
ed->mods.n++;
|
||||
}
|
||||
bool ok = resolve_widgets() && resolve_image();
|
||||
bool ok = resolve_widgets() && resolve_image() && resolve_files();
|
||||
ed->mods.loaded = ok;
|
||||
if (ok) {
|
||||
snprintf(ed->mods.info, sizeof(ed->mods.info),
|
||||
@@ -174,6 +193,7 @@ void tb_ed_modules_clear(void) {
|
||||
tb_api_code_unload_all();
|
||||
memset(&tb_ed_img, 0, sizeof(tb_ed_img));
|
||||
memset(&tb_ed_w, 0, sizeof(tb_ed_w));
|
||||
memset(&tb_ed_files, 0, sizeof(tb_ed_files));
|
||||
}
|
||||
|
||||
bool tb_ed_modules_check(Ed* ed) {
|
||||
@@ -199,7 +219,7 @@ bool tb_ed_modules_check(Ed* ed) {
|
||||
ed->mods.list[ed->mods.n].ok = 1;
|
||||
ed->mods.n++;
|
||||
}
|
||||
bool ok = resolve_widgets() && resolve_image();
|
||||
bool ok = resolve_widgets() && resolve_image() && resolve_files();
|
||||
ed->mods.loaded = ok;
|
||||
ed->mods.reloads++;
|
||||
snprintf(ed->mods.info, sizeof(ed->mods.info), "Editor recarregado (%d)%s",
|
||||
|
||||
Reference in new issue
Block a user