feat: system settings stored as applets in virtual folder
This commit is contained in:
@@ -202,9 +202,10 @@ void filemanager_draw_header(Canvas& c, FileManagerState* fm, Color toolbar_colo
|
||||
|
||||
// Action buttons: Copy, Cut, Paste, Rename, New Folder, Delete
|
||||
bool has_sel = fm->selected >= 0 && fm->selected < fm->entry_count
|
||||
&& !fm->at_drives_root && !fm->at_apps_view
|
||||
&& fm->entry_types[fm->selected] != 3;
|
||||
bool has_clip = fm->clipboard_has_data && !fm->at_drives_root && !fm->at_apps_view;
|
||||
&& !filemanager_is_computer_view(fm) && !filemanager_is_virtual_view(fm)
|
||||
&& fm->entry_types[fm->selected] != FM_ENTRY_DRIVE;
|
||||
bool has_clip = fm->clipboard_has_data && !filemanager_is_computer_view(fm)
|
||||
&& !filemanager_is_virtual_view(fm);
|
||||
Color dim_bg = Color::from_rgb(0xF0, 0xF0, 0xF0);
|
||||
|
||||
// Icon toolbar buttons: Copy, Cut, Paste, Rename, New Folder, Delete
|
||||
@@ -214,7 +215,8 @@ void filemanager_draw_header(Canvas& c, FileManagerState* fm, Color toolbar_colo
|
||||
{ 188, ds ? &ds->icon_cut : nullptr, has_sel },
|
||||
{ 216, ds ? &ds->icon_paste : nullptr, has_clip },
|
||||
{ 244, ds ? &ds->icon_rename : nullptr, has_sel },
|
||||
{ 272, ds ? &ds->icon_folder_new : nullptr, !fm->at_drives_root && !fm->at_apps_view },
|
||||
{ 272, ds ? &ds->icon_folder_new : nullptr,
|
||||
!filemanager_is_computer_view(fm) && !filemanager_is_virtual_view(fm) },
|
||||
{ 300, ds ? &ds->icon_delete : nullptr, has_sel },
|
||||
};
|
||||
|
||||
@@ -252,8 +254,8 @@ void filemanager_draw_header(Canvas& c, FileManagerState* fm, Color toolbar_colo
|
||||
} else {
|
||||
c.fill_rect(0, pathbar_y, c.w, FM_PATHBAR_H, Color::from_rgb(0xF0, 0xF0, 0xF0));
|
||||
const char* pathbar_text = fm->current_path;
|
||||
if (fm->at_drives_root) pathbar_text = "Computer";
|
||||
else if (fm->at_apps_view) pathbar_text = "Apps";
|
||||
if (filemanager_is_computer_view(fm)) pathbar_text = "Computer";
|
||||
else if (filemanager_is_virtual_view(fm)) pathbar_text = filemanager_virtual_view_label(fm->virtual_view);
|
||||
c.text(8, pathbar_y + 4, pathbar_text, colors::TEXT_COLOR);
|
||||
}
|
||||
|
||||
@@ -313,22 +315,27 @@ void filemanager_on_draw(Window* win, Framebuffer& fb) {
|
||||
int icon_y = cell_y + FM_GRID_PAD;
|
||||
// Check for special folder icon (type 7 in Computer, or type 1 dir with matching name)
|
||||
int sfi = -1;
|
||||
if (fm->entry_types[i] == 7) sfi = fm->drive_indices[i];
|
||||
else if (ds && fm->entry_types[i] == 1) sfi = special_folder_index(fm->entry_names[i]);
|
||||
if (fm->entry_types[i] == FM_ENTRY_SPECIAL_DIR) sfi = fm->drive_indices[i];
|
||||
else if (ds && fm->entry_types[i] == FM_ENTRY_DIR) sfi = special_folder_index(fm->entry_names[i]);
|
||||
|
||||
if (sfi >= 0 && ds && ds->icon_special_folder_lg[sfi].pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_special_folder_lg[sfi]);
|
||||
} else if (fm->entry_types[i] == 6 && i < fm->app_icon_count && fm->app_icons_lg[i].pixels) {
|
||||
c.icon(icon_x, icon_y, fm->app_icons_lg[i]);
|
||||
} else if (ds && fm->entry_types[i] == 5 && ds->icon_apps_lg.pixels) {
|
||||
} else if (fm->entry_types[i] == FM_ENTRY_VIRTUAL_APP
|
||||
&& i < fm->virtual_entry_count
|
||||
&& fm->virtual_entries[i].icon_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, fm->virtual_entries[i].icon_lg);
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_SYSTEM_TOOLS_ROOT
|
||||
&& ds->icon_system_tools_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_system_tools_lg);
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_APPS_ROOT && ds->icon_apps_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_apps_lg);
|
||||
} else if (ds && fm->entry_types[i] == 4 && ds->icon_home_folder_lg.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_HOME && ds->icon_home_folder_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_home_folder_lg);
|
||||
} else if (ds && fm->entry_types[i] == 3 && ds->icon_drive_lg.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_DRIVE && ds->icon_drive_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_drive_lg);
|
||||
} else if (ds && fm->entry_types[i] == 1 && ds->icon_folder_lg.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_DIR && ds->icon_folder_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_folder_lg);
|
||||
} else if (ds && fm->entry_types[i] == 2 && ds->icon_exec_lg.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_EXEC && ds->icon_exec_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_exec_lg);
|
||||
} else if (ds && ds->icon_file_lg.pixels) {
|
||||
c.icon(icon_x, icon_y, ds->icon_file_lg);
|
||||
@@ -438,23 +445,28 @@ void filemanager_on_draw(Window* win, Framebuffer& fb) {
|
||||
int ico_y = iy + (FM_ITEM_H - 16) / 2;
|
||||
// Check for special folder icon
|
||||
int sfi_sm = -1;
|
||||
if (fm->entry_types[i] == 7) sfi_sm = fm->drive_indices[i];
|
||||
else if (ds && fm->entry_types[i] == 1) sfi_sm = special_folder_index(fm->entry_names[i]);
|
||||
if (fm->entry_types[i] == FM_ENTRY_SPECIAL_DIR) sfi_sm = fm->drive_indices[i];
|
||||
else if (ds && fm->entry_types[i] == FM_ENTRY_DIR) sfi_sm = special_folder_index(fm->entry_names[i]);
|
||||
|
||||
if (ico_y < list_y) { /* clipped by header repaint */ }
|
||||
else if (sfi_sm >= 0 && ds && ds->icon_special_folder[sfi_sm].pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_special_folder[sfi_sm]);
|
||||
} else if (fm->entry_types[i] == 6 && i < fm->app_icon_count && fm->app_icons_sm[i].pixels) {
|
||||
c.icon(ico_x, ico_y, fm->app_icons_sm[i]);
|
||||
} else if (ds && fm->entry_types[i] == 5 && ds->icon_apps.pixels) {
|
||||
} else if (fm->entry_types[i] == FM_ENTRY_VIRTUAL_APP
|
||||
&& i < fm->virtual_entry_count
|
||||
&& fm->virtual_entries[i].icon_sm.pixels) {
|
||||
c.icon(ico_x, ico_y, fm->virtual_entries[i].icon_sm);
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_SYSTEM_TOOLS_ROOT
|
||||
&& ds->icon_system_tools.pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_system_tools);
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_APPS_ROOT && ds->icon_apps.pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_apps);
|
||||
} else if (ds && fm->entry_types[i] == 4 && ds->icon_home_folder.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_HOME && ds->icon_home_folder.pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_home_folder);
|
||||
} else if (ds && fm->entry_types[i] == 3 && ds->icon_drive.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_DRIVE && ds->icon_drive.pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_drive);
|
||||
} else if (ds && fm->entry_types[i] == 1 && ds->icon_folder.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_DIR && ds->icon_folder.pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_folder);
|
||||
} else if (ds && fm->entry_types[i] == 2 && ds->icon_exec.pixels) {
|
||||
} else if (ds && fm->entry_types[i] == FM_ENTRY_EXEC && ds->icon_exec.pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_exec);
|
||||
} else if (ds && ds->icon_file.pixels) {
|
||||
c.icon(ico_x, ico_y, ds->icon_file);
|
||||
@@ -525,12 +537,13 @@ void filemanager_on_draw(Window* win, Framebuffer& fb) {
|
||||
// Type
|
||||
if (type_col_x > 160 && ty >= list_y && ty + fm_sfh <= c.h) {
|
||||
const char* type_str = "File";
|
||||
if (fm->entry_types[i] == 6) type_str = "App";
|
||||
else if (fm->entry_types[i] == 5) type_str = "Apps";
|
||||
else if (fm->entry_types[i] == 4) type_str = "Home";
|
||||
else if (fm->entry_types[i] == 3) type_str = "Drive";
|
||||
else if (fm->entry_types[i] == 1) type_str = "Dir";
|
||||
else if (fm->entry_types[i] == 2) type_str = "Exec";
|
||||
if (fm->entry_types[i] == FM_ENTRY_VIRTUAL_APP) type_str = "App";
|
||||
else if (fm->entry_types[i] == FM_ENTRY_APPS_ROOT) type_str = "Apps";
|
||||
else if (fm->entry_types[i] == FM_ENTRY_SYSTEM_TOOLS_ROOT) type_str = "System";
|
||||
else if (fm->entry_types[i] == FM_ENTRY_HOME) type_str = "Home";
|
||||
else if (fm->entry_types[i] == FM_ENTRY_DRIVE) type_str = "Drive";
|
||||
else if (fm->entry_types[i] == FM_ENTRY_DIR) type_str = "Dir";
|
||||
else if (fm->entry_types[i] == FM_ENTRY_EXEC) type_str = "Exec";
|
||||
c.text(type_col_x, ty, type_str, dim);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user