file manager
git clone https://git.lucas.co/cce-files.git
Remove settings page and associated mechanisms
src/main.rs | 79 --------------------------------
src/pages/mod.rs | 7 +--
src/pages/settings.rs | 123 --------------------------------------------------
3 files changed, 1 insertion(+), 208 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 111f10b..585be07 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -43,7 +43,6 @@ struct FilesystemApp {
current_page: Page,
browse: pages::browse::BrowseState,
network: pages::network::NetworkState,
- settings: pages::settings::SettingsState,
preview: pages::preview::PreviewState,
// Command-line chooser options
@@ -150,7 +149,6 @@ impl FilesystemApp {
self.browse.breadcrumb.clear_children(&mut self.ui_context); self.browse.breadcrumb.set_parent(None, &mut self.ui_context);
self.network.breadcrumb.clear_children(&mut self.ui_context); self.network.breadcrumb.set_parent(None, &mut self.ui_context);
self.network.graph.clear_children(&mut self.ui_context); self.network.graph.set_parent(None, &mut self.ui_context);
- self.settings.color_selector.clear_children(&mut self.ui_context); self.settings.color_selector.set_parent(None, &mut self.ui_context);
if let Some((_, textbox)) = &mut self.open_with_dialog {
textbox.clear_children(&mut self.ui_context);
textbox.set_parent(None, &mut self.ui_context);
@@ -192,9 +190,6 @@ impl FilesystemApp {
link_parent_child(&mut self.root_window, &mut self.network.breadcrumb, &mut self.ui_context);
link_parent_child(&mut self.root_window, &mut self.network.graph, &mut self.ui_context);
}
- Page::Settings => {
- link_parent_child(&mut self.root_window, &mut self.settings.color_selector, &mut self.ui_context);
- }
}
if let Some((_, textbox)) = &mut self.open_with_dialog {
@@ -251,23 +246,6 @@ impl FilesystemApp {
pc.texts.extend(network_pc.texts);
pc.buttons.extend(network_pc.buttons);
}
- Page::Settings => {
- let settings_pc = pages::settings::view(&mut self.settings, browse_x, content_y, usable_w, content_h, &mut self.ui_context);
-
- pc.rects.extend(settings_pc.rects);
- pc.texts.extend(settings_pc.texts);
- pc.buttons.extend(settings_pc.buttons);
-
- // Sync color selector changes back to global node color
- let col = self.settings.color_selector.color;
- let r_f = col[0] as f32 / 255.0;
- let g_f = col[1] as f32 / 255.0;
- let b_f = col[2] as f32 / 255.0;
- let linear_col = cce_ui::color::to_linear([r_f, g_f, b_f, 1.0]);
- if cce_ui::color::node_color() != linear_col {
- cce_ui::color::set_node_color(linear_col);
- }
- }
}
// Draw bottom selection bar if select_mode is enabled
@@ -546,7 +524,6 @@ impl Application for FilesystemApp {
current_page: Page::Browse,
browse,
network: pages::network::NetworkState::default(),
- settings: pages::settings::SettingsState::default(),
preview: pages::preview::PreviewState::default(),
select_mode,
select_directory,
@@ -829,19 +806,6 @@ impl Application for FilesystemApp {
*needs_rebuild = true;
self.needs_rebuild = true;
}
-
- if self.current_page == Page::Settings {
- if self.settings.color_selector.tick(dt, &mut self.ui_context) {
- let col = self.settings.color_selector.color;
- let r_f = col[0] as f32 / 255.0;
- let g_f = col[1] as f32 / 255.0;
- let b_f = col[2] as f32 / 255.0;
- let linear_col = cce_ui::color::to_linear([r_f, g_f, b_f, 1.0]);
- cce_ui::color::set_node_color(linear_col);
- *needs_rebuild = true;
- self.needs_rebuild = true;
- }
- }
}
fn view(&mut self, _quads: &mut Vec<(f32, f32, f32, f32, [f32; 4])>, size: LogicalSize, scale: f64) {
@@ -945,10 +909,6 @@ impl Application for FilesystemApp {
changed = true;
}
}
- } else if self.current_page == Page::Settings {
- if self.settings.color_selector.cursor_moved(pos.x, pos.y, &mut self.ui_context) {
- changed = true;
- }
}
// Always check if buttons hover state changed
@@ -1297,29 +1257,6 @@ impl Application for FilesystemApp {
}
}
- if changed {
- *needs_rebuild = true;
- self.needs_rebuild = true;
- }
- } else if self.current_page == Page::Settings {
- if self.settings.color_selector.mouse_input(button, state, pos.x, pos.y, &mut self.ui_context) {
- if self.settings.color_selector.take_click() {
- let col = self.settings.color_selector.color;
- let r_f = col[0] as f32 / 255.0;
- let g_f = col[1] as f32 / 255.0;
- let b_f = col[2] as f32 / 255.0;
- let linear_col = cce_ui::color::to_linear([r_f, g_f, b_f, 1.0]);
- cce_ui::color::set_node_color(linear_col);
- }
- changed = true;
- }
- // If user clicked outside color selector focus area, unfocus it
- if state == ElementState::Pressed && !self.settings.color_selector.hit_test(pos.x, pos.y, &self.ui_context) {
- self.settings.color_selector.unfocus();
- self.ui_context.clear_focus();
- changed = true;
- }
-
if changed {
*needs_rebuild = true;
self.needs_rebuild = true;
@@ -1442,22 +1379,6 @@ impl Application for FilesystemApp {
}
}
- if self.current_page == Page::Settings && self.settings.color_selector.editing {
- if self.settings.color_selector.keyboard_input(event, &mut self.ui_context) {
- *needs_rebuild = true;
- self.needs_rebuild = true;
- if !self.settings.color_selector.editing {
- let col = self.settings.color_selector.color;
- let r_f = col[0] as f32 / 255.0;
- let g_f = col[1] as f32 / 255.0;
- let b_f = col[2] as f32 / 255.0;
- let linear_col = cce_ui::color::to_linear([r_f, g_f, b_f, 1.0]);
- cce_ui::color::set_node_color(linear_col);
- }
- return None;
- }
- }
-
// If the search textbox is focused, forward key inputs to it
if self.current_page == Page::Browse && self.browse.search_box.editing {
if self.browse.search_box.keyboard_input(event, &mut self.ui_context) {
diff --git a/src/pages/mod.rs b/src/pages/mod.rs
index 059e4df..b3d36a7 100644
--- a/src/pages/mod.rs
+++ b/src/pages/mod.rs
@@ -1,7 +1,6 @@
pub mod browse;
pub mod preview;
pub mod network;
-pub mod settings;
use cce_ui::layout::RenderTarget;
@@ -9,21 +8,18 @@ use cce_ui::layout::RenderTarget;
pub enum Page {
Browse,
Network,
- Settings,
}
impl Page {
- pub const ALL: [Page; 3] = [
+ pub const ALL: [Page; 2] = [
Page::Browse,
Page::Network,
- Page::Settings,
];
pub fn label(self) -> &'static str {
match self {
Page::Browse => "Browse",
Page::Network => "Network",
- Page::Settings => "Settings",
}
}
@@ -31,7 +27,6 @@ impl Page {
match self {
Page::Browse => "📁",
Page::Network => "🌐",
- Page::Settings => "⚙",
}
}
}
diff --git a/src/pages/settings.rs b/src/pages/settings.rs
deleted file mode 100644
index b9dcfa8..0000000
--- a/src/pages/settings.rs
+++ /dev/null
@@ -1,123 +0,0 @@
-use crate::pages::PageContent;
-use cce_ui::widget::{ColorSelector, Element};
-use cce_ui::layout::SectionContext;
-
-// ── Data ────────────────────────────────────────────────────────────
-
-pub struct SettingsState {
- pub color_selector: ColorSelector,
-}
-
-impl Default for SettingsState {
- fn default() -> Self {
- let col = cce_ui::color::node_color();
- let col_u8 = [
- (col[0] * 255.0) as u8,
- (col[1] * 255.0) as u8,
- (col[2] * 255.0) as u8,
- ];
- Self {
- color_selector: ColorSelector::new(col_u8).with_label("Node Color"),
- }
- }
-}
-
-// ── Keybindings Structs & Data ──────────────────────────────────────
-
-struct Binding {
- keys: &'static str,
- action: &'static str,
-}
-
-struct SectionData {
- title: &'static str,
- icon: &'static str,
- bindings: &'static [Binding],
-}
-
-const SECTIONS: &[SectionData] = &[
- SectionData {
- title: "Navigation",
- icon: "🧭",
- bindings: &[
- Binding { keys: "j / Down", action: "Move down" },
- Binding { keys: "k / Up", action: "Move up" },
- Binding { keys: "h / Backspace", action: "Go to parent directory" },
- Binding { keys: "l / Enter", action: "Open directory" },
- Binding { keys: ".", action: "Toggle hidden files" },
- Binding { keys: "Ctrl + F", action: "Focus search" },
- ],
- },
- SectionData {
- title: "Browse",
- icon: "📁",
- bindings: &[
- Binding { keys: "Click", action: "Select file or directory" },
- Binding { keys: "Double-click", action: "Open directory" },
- Binding { keys: "Search", action: "Filter files by name" },
- Binding { keys: "Delete", action: "Delete selected file or directory" },
- ],
- },
- SectionData {
- title: "Info",
- icon: "ℹ",
- bindings: &[
- Binding { keys: "Select", action: "View file details in info panel" },
- Binding { keys: "Open dir button", action: "Navigate into selected directory" },
- ],
- },
- SectionData {
- title: "General",
- icon: "⚡",
- bindings: &[
- Binding { keys: "Ctrl + 1-3", action: "Switch page" },
- ],
- },
-];
-
-// ── View ────────────────────────────────────────────────────────────
-
-pub fn view(state: &mut SettingsState, cx: f32, cy: f32, cw: f32, _ch: f32, ctx: &mut cce_ui::context::UiContext) -> PageContent {
- let mut pc = PageContent::new();
- let accent = [0.36, 0.56, 0.38, 1.0];
- let text_fg = [0.83, 0.83, 0.83, 1.0];
- let text_dim = [0.53, 0.53, 0.60, 1.0];
-
- pc.text("Settings", cx + 12.0, cy + 12.0, 18.0, accent);
-
- let cs_w = (cw - 24.0).min(300.0);
- let cs_h = 42.0;
- let cs_y = cy + 48.0;
-
- state.color_selector.set_row_rect(cx + 12.0, cs_w);
- cce_ui::layout::render_widget(&mut pc, &mut state.color_selector, cx + 12.0, cs_y, cs_w, cs_h, ctx);
-
- let y = cs_y + cs_h + 32.0;
-
- // Keyboard Shortcuts Section
- let mut sec_keys = SectionContext::new(&mut pc, cx, y, cw, "Keyboard Shortcuts", false, false);
- sec_keys.spacing(8.0);
-
- for (i, section) in SECTIONS.iter().enumerate() {
- // Section Header
- let header_str = format!("{} {}", section.icon, section.title);
- sec_keys.text(&header_str, 12.0, 0.0, 13.0, text_fg);
- sec_keys.spacing(20.0);
-
- for b in section.bindings {
- sec_keys.text(b.keys, 12.0, 0.0, 11.0, accent);
- sec_keys.text(b.action, 160.0, 0.0, 11.0, text_dim);
- sec_keys.spacing(16.0);
- }
-
- if i < SECTIONS.len() - 1 {
- sec_keys.spacing(8.0);
- sec_keys.separator();
- sec_keys.spacing(12.0);
- }
- }
-
- sec_keys.finish();
-
- pc
-}