From 95ebf25b445e5ad4b009f5cc4884180f910e15ef Mon Sep 17 00:00:00 2001 From: luboslenco Date: Mon, 19 Jan 2026 13:18:52 +0100 Subject: [PATCH] Improve mini browser --- paint/sources/tab_browser.ts | 61 +++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/paint/sources/tab_browser.ts b/paint/sources/tab_browser.ts index 76a85c6e..6593957a 100644 --- a/paint/sources/tab_browser.ts +++ b/paint/sources/tab_browser.ts @@ -62,9 +62,20 @@ function tab_browser_draw(htab: ui_handle_t) { } } else { - // Up, Refresh - let row: f32[] = [ 1 / 4, 3 / 4 ]; + // Menu, Up, Refresh + let row: f32[] = [ 0.5 / 4, 0.5 / 4, 3 / 4 ]; ui_row(row); + + if (ui_icon_button("", icon_t.MENU)) { + ui_menu_draw(function() { + if (ui_menu_button(tr("Cloud"), "", icon_t.CLOUD)) { + tab_browser_go_to_cloud(); + } + if (ui_menu_button(tr("Disk"), "", icon_t.STORAGE)) { + tab_browser_go_to_disk(); + } + }); + } } // Previous folder @@ -234,28 +245,11 @@ function tab_browser_draw(htab: ui_handle_t) { ui._w = bookmarks_w; if (ui_icon_button(tr("Cloud"), icon_t.CLOUD, ui_align_t.LEFT)) { - tab_browser_hpath.text = "cloud"; + tab_browser_go_to_cloud(); } if (ui_icon_button(tr("Disk"), icon_t.STORAGE, ui_align_t.LEFT)) { - /// if arm_android - ui_menu_draw(function() { - if (ui_menu_button(tr("Download"), "", icon_t.FOLDER)) { - tab_browser_hpath.text = ui_files_default_path; - } - if (ui_menu_button(tr("Pictures"), "", icon_t.FOLDER)) { - tab_browser_hpath.text = "/storage/emulated/0/Pictures"; - } - if (ui_menu_button(tr("Camera"), "", icon_t.FOLDER)) { - tab_browser_hpath.text = "/storage/emulated/0/DCIM/Camera"; - } - if (ui_menu_button(tr("Projects"), "", icon_t.FOLDER)) { - tab_browser_hpath.text = iron_internal_save_path(); - } - }); - /// else - tab_browser_hpath.text = ui_files_default_path; - /// end + tab_browser_go_to_disk(); } for (let i: i32 = 0; i < config_raw.bookmarks.length; ++i) { @@ -286,3 +280,28 @@ function tab_browser_draw(htab: ui_handle_t) { } } } + +function tab_browser_go_to_cloud() { + tab_browser_hpath.text = "cloud"; +} + +function tab_browser_go_to_disk() { + /// if arm_android + ui_menu_draw(function() { + if (ui_menu_button(tr("Download"), "", icon_t.FOLDER)) { + tab_browser_hpath.text = ui_files_default_path; + } + if (ui_menu_button(tr("Pictures"), "", icon_t.FOLDER)) { + tab_browser_hpath.text = "/storage/emulated/0/Pictures"; + } + if (ui_menu_button(tr("Camera"), "", icon_t.FOLDER)) { + tab_browser_hpath.text = "/storage/emulated/0/DCIM/Camera"; + } + if (ui_menu_button(tr("Projects"), "", icon_t.FOLDER)) { + tab_browser_hpath.text = iron_internal_save_path(); + } + }); + /// else + tab_browser_hpath.text = ui_files_default_path; + /// end +}