@@ -6,7 +6,7 @@ use garfield::core::{ |
| 6 | 6 | trash_files, restore_from_trash, |
| 7 | 7 | }; |
| 8 | 8 | use garfield::ui::pane::SplitDirection; |
| 9 | | -use garfield::ui::{AddressBar, AppPickerDialog, AppPickerResult, Breadcrumb, ConfirmDialog, ConflictAction, ConflictDialog, ContextMenu, ContextMenuAction, ContextType, DialogResult, HelpModal, InputDialog, InputResult, Pane, ProgressDialog, Sidebar, StatusBar, TabBar, TabInfo, Toolbar, ToolbarAction, ViewMode, TAB_BAR_HEIGHT, TOOLBAR_HEIGHT}; |
| 9 | +use garfield::ui::{AddressBar, AppPickerDialog, AppPickerResult, Breadcrumb, ConfirmDialog, ConflictAction, ConflictDialog, ContextMenu, ContextMenuAction, ContextType, DialogResult, HelpModal, IconSize, InputDialog, InputResult, Pane, ProgressDialog, Sidebar, StatusBar, TabBar, TabInfo, Toolbar, ToolbarAction, ViewMode, TAB_BAR_HEIGHT, TOOLBAR_HEIGHT}; |
| 10 | 10 | use anyhow::Result; |
| 11 | 11 | use gartk_core::{InputEvent, Key, MouseButton, Point, Rect, Theme}; |
| 12 | 12 | use gartk_render::{Renderer, TextStyle}; |
@@ -844,6 +844,12 @@ impl App { |
| 844 | 844 | |
| 845 | 845 | /// Handle mouse scroll. Returns true if a redraw is needed. |
| 846 | 846 | fn handle_scroll(&mut self, pos: Point, _delta_x: i32, delta_y: i32) -> bool { |
| 847 | + // Help modal captures all scroll events when visible |
| 848 | + if self.help_modal.is_visible() { |
| 849 | + self.help_modal.on_scroll(delta_y); |
| 850 | + return true; |
| 851 | + } |
| 852 | + |
| 847 | 853 | // Check if scroll is over the content area (not sidebar, toolbar, etc.) |
| 848 | 854 | if let Some(pane) = self.focused_pane_mut() { |
| 849 | 855 | if let Some(tab) = pane.active_tab_mut() { |
@@ -1052,12 +1058,23 @@ impl App { |
| 1052 | 1058 | return; |
| 1053 | 1059 | } |
| 1054 | 1060 | Key::Char('+') | Key::Char('=') => { |
| 1055 | | - // Cycle icon size in grid view |
| 1061 | + // Increase icon size in grid view |
| 1062 | + if let Some(pane) = self.focused_pane_mut() { |
| 1063 | + if let Some(tab) = pane.active_tab_mut() { |
| 1064 | + tab.increase_icon_size(); |
| 1065 | + } |
| 1066 | + } |
| 1067 | + self.sync_toolbar_icon_size(); |
| 1068 | + return; |
| 1069 | + } |
| 1070 | + Key::Char('-') | Key::Char('_') => { |
| 1071 | + // Decrease icon size in grid view |
| 1056 | 1072 | if let Some(pane) = self.focused_pane_mut() { |
| 1057 | 1073 | if let Some(tab) = pane.active_tab_mut() { |
| 1058 | | - tab.cycle_icon_size(); |
| 1074 | + tab.decrease_icon_size(); |
| 1059 | 1075 | } |
| 1060 | 1076 | } |
| 1077 | + self.sync_toolbar_icon_size(); |
| 1061 | 1078 | return; |
| 1062 | 1079 | } |
| 1063 | 1080 | Key::Char('t') | Key::Char('T') => { |
@@ -1313,6 +1330,8 @@ impl App { |
| 1313 | 1330 | |
| 1314 | 1331 | self.sync_tab_bar(); |
| 1315 | 1332 | self.sync_breadcrumb(); |
| 1333 | + self.sync_toolbar_view(); |
| 1334 | + self.sync_toolbar_icon_size(); |
| 1316 | 1335 | self.update_status_bar(); |
| 1317 | 1336 | } |
| 1318 | 1337 | |
@@ -1399,6 +1418,7 @@ impl App { |
| 1399 | 1418 | self.sync_tab_bar(); |
| 1400 | 1419 | self.sync_breadcrumb(); |
| 1401 | 1420 | self.sync_toolbar_view(); |
| 1421 | + self.sync_toolbar_icon_size(); |
| 1402 | 1422 | self.update_status_bar(); |
| 1403 | 1423 | } |
| 1404 | 1424 | } |
@@ -1409,6 +1429,8 @@ impl App { |
| 1409 | 1429 | self.focused_pane_id = new_id; |
| 1410 | 1430 | self.sync_tab_bar(); |
| 1411 | 1431 | self.sync_breadcrumb(); |
| 1432 | + self.sync_toolbar_view(); |
| 1433 | + self.sync_toolbar_icon_size(); |
| 1412 | 1434 | self.update_status_bar(); |
| 1413 | 1435 | } |
| 1414 | 1436 | } |
@@ -1419,6 +1441,8 @@ impl App { |
| 1419 | 1441 | self.focused_pane_id = new_id; |
| 1420 | 1442 | self.sync_tab_bar(); |
| 1421 | 1443 | self.sync_breadcrumb(); |
| 1444 | + self.sync_toolbar_view(); |
| 1445 | + self.sync_toolbar_icon_size(); |
| 1422 | 1446 | self.update_status_bar(); |
| 1423 | 1447 | } |
| 1424 | 1448 | } |
@@ -1429,6 +1453,8 @@ impl App { |
| 1429 | 1453 | self.focused_pane_id = new_id; |
| 1430 | 1454 | self.sync_tab_bar(); |
| 1431 | 1455 | self.sync_breadcrumb(); |
| 1456 | + self.sync_toolbar_view(); |
| 1457 | + self.sync_toolbar_icon_size(); |
| 1432 | 1458 | self.update_status_bar(); |
| 1433 | 1459 | } |
| 1434 | 1460 | } |
@@ -1439,6 +1465,8 @@ impl App { |
| 1439 | 1465 | self.focused_pane_id = new_id; |
| 1440 | 1466 | self.sync_tab_bar(); |
| 1441 | 1467 | self.sync_breadcrumb(); |
| 1468 | + self.sync_toolbar_view(); |
| 1469 | + self.sync_toolbar_icon_size(); |
| 1442 | 1470 | self.update_status_bar(); |
| 1443 | 1471 | } |
| 1444 | 1472 | } |
@@ -2530,6 +2558,7 @@ impl App { |
| 2530 | 2558 | } |
| 2531 | 2559 | self.status_bar.set_view_mode(mode.name()); |
| 2532 | 2560 | self.sync_toolbar_view(); |
| 2561 | + self.sync_toolbar_icon_size(); |
| 2533 | 2562 | self.update_status_bar(); |
| 2534 | 2563 | } |
| 2535 | 2564 | |
@@ -2551,7 +2580,20 @@ impl App { |
| 2551 | 2580 | ToolbarAction::Paste => self.paste(), |
| 2552 | 2581 | ToolbarAction::Trash => self.trash_selected(), |
| 2553 | 2582 | ToolbarAction::NewFolder => self.create_new_folder(), |
| 2583 | + ToolbarAction::IconSizeSmall => self.set_icon_size(IconSize::Small), |
| 2584 | + ToolbarAction::IconSizeMedium => self.set_icon_size(IconSize::Medium), |
| 2585 | + ToolbarAction::IconSizeLarge => self.set_icon_size(IconSize::Large), |
| 2586 | + } |
| 2587 | + } |
| 2588 | + |
| 2589 | + /// Set icon size for the active tab's grid view. |
| 2590 | + fn set_icon_size(&mut self, size: IconSize) { |
| 2591 | + if let Some(pane) = self.focused_pane_mut() { |
| 2592 | + if let Some(tab) = pane.active_tab_mut() { |
| 2593 | + tab.set_icon_size(size); |
| 2594 | + } |
| 2554 | 2595 | } |
| 2596 | + self.sync_toolbar_icon_size(); |
| 2555 | 2597 | } |
| 2556 | 2598 | |
| 2557 | 2599 | /// Sync toolbar active view with current tab's view mode. |
@@ -2568,6 +2610,20 @@ impl App { |
| 2568 | 2610 | } |
| 2569 | 2611 | } |
| 2570 | 2612 | |
| 2613 | + /// Sync toolbar icon size with current tab's grid view icon size. |
| 2614 | + fn sync_toolbar_icon_size(&mut self) { |
| 2615 | + if let Some(pane) = self.focused_pane() { |
| 2616 | + if let Some(tab) = pane.active_tab() { |
| 2617 | + let action = match tab.icon_size() { |
| 2618 | + IconSize::Small => ToolbarAction::IconSizeSmall, |
| 2619 | + IconSize::Medium => ToolbarAction::IconSizeMedium, |
| 2620 | + IconSize::Large => ToolbarAction::IconSizeLarge, |
| 2621 | + }; |
| 2622 | + self.toolbar.set_active_icon_size(action); |
| 2623 | + } |
| 2624 | + } |
| 2625 | + } |
| 2626 | + |
| 2571 | 2627 | // === Sync helpers === |
| 2572 | 2628 | |
| 2573 | 2629 | /// Sync tab bar with focused pane's tabs. |