Skip to content

Commit 2967030

Browse files
committed
p0.31
1 parent e5cd83a commit 2967030

16 files changed

Lines changed: 59 additions & 33 deletions

File tree

assets/svg/folder-opened.svg

Lines changed: 3 additions & 2 deletions
Loading

assets/svg/folder.svg

Lines changed: 3 additions & 2 deletions
Loading

otty/src/components/primitive/menu_item.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use iced::widget::button::Status as ButtonStatus;
22
use iced::widget::{button, text};
33
use iced::{Element, Length, alignment};
44

5+
use crate::layout::BUTTON_SIZE_COMPACT;
56
use crate::theme::{IcedColorPalette, ThemeProps};
67

7-
const MENU_ITEM_HEIGHT: f32 = 24.0;
8+
const MENU_ITEM_HEIGHT: f32 = BUTTON_SIZE_COMPACT;
89
const MENU_ITEM_FONT_SIZE: f32 = 13.0;
910
const MENU_ITEM_HORIZONTAL_PADDING: f32 = 10.0;
1011
const MENU_ITEM_VERTICAL_PADDING: f32 = 1.0;

otty/src/layout.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ use crate::app::view::HEADER_SEPARATOR_HEIGHT;
44
use crate::widgets::chrome::view::action_bar::ACTION_BAR_HEIGHT;
55
use crate::widgets::tabs::view::tab_bar::TAB_BAR_HEIGHT;
66

7-
// TODO:
7+
/// Shared compact control size used by dense toolbars and menus.
8+
pub(crate) const BUTTON_SIZE_COMPACT: f32 = 24.0;
9+
/// Shared regular control size used by form actions.
10+
pub(crate) const BUTTON_SIZE_REGULAR: f32 = 28.0;
11+
/// Shared large control size used by sidebar rail actions.
12+
pub(crate) const BUTTON_SIZE_RAIL: f32 = 44.0;
13+
814
pub(crate) fn screen_size_from_window(window_size: Size) -> Size {
915
let height =
1016
(window_size.height - ACTION_BAR_HEIGHT - HEADER_SEPARATOR_HEIGHT)

otty/src/state.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use iced::Size;
22

3-
/// Tab bar height for pane grid calculations.
4-
const TAB_BAR_HEIGHT: f32 = 25.0;
5-
63
/// Window and screen geometry state.
74
#[derive(Default)]
85
pub(crate) struct State {

otty/src/view.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::components::primitive::{
77
menu_item, resize_grips, sidebar_workspace_panel,
88
};
99
use crate::geometry::{anchor_position, menu_height_for_items};
10+
use crate::layout::BUTTON_SIZE_COMPACT;
1011
use crate::style::menu_panel_style;
1112
use crate::theme::ThemeProps;
1213
use crate::widgets::chrome::ChromeEvent;
@@ -33,13 +34,14 @@ use crate::widgets::terminal_workspace::view::{
3334
};
3435

3536
pub(crate) const HEADER_SEPARATOR_HEIGHT: f32 = 1.0;
37+
const SIDEBAR_SEPARATOR_WIDTH: f32 = 0.5;
3638
const SEPARATOR_ALPHA: f32 = 0.3;
3739
const PANE_GRID_SPACING: f32 = 1.0;
3840
const PANE_GRID_RESIZE_GRAB: f32 = 8.0;
3941

4042
// Add menu overlay constants
4143
const ADD_MENU_WIDTH: f32 = 220.0;
42-
const ADD_MENU_ITEM_HEIGHT: f32 = 24.0;
44+
const ADD_MENU_ITEM_HEIGHT: f32 = BUTTON_SIZE_COMPACT;
4345
const ADD_MENU_VERTICAL_PADDING: f32 = 16.0;
4446
const ADD_MENU_MARGIN: f32 = 6.0;
4547
const ADD_MENU_CONTAINER_PADDING_X: f32 = 8.0;
@@ -191,6 +193,16 @@ fn view_sidebar_layout<'a>(
191193
.map(|event| AppEvent::Sidebar(SidebarEvent::Intent(event)));
192194

193195
let palette = theme_props.theme.iced_palette();
196+
let mut sidebar_separator_color = palette.dim_white;
197+
sidebar_separator_color.a = SEPARATOR_ALPHA;
198+
199+
let sidebar_separator = container(Space::new())
200+
.width(Length::Fixed(SIDEBAR_SEPARATOR_WIDTH))
201+
.height(Length::Fill)
202+
.style(move |_| iced::widget::container::Style {
203+
background: Some(sidebar_separator_color.into()),
204+
..Default::default()
205+
});
194206

195207
let sidebar_pane_grid =
196208
PaneGrid::new(app.widgets.sidebar.panes(), move |_pane, pane_kind, _| {
@@ -240,7 +252,7 @@ fn view_sidebar_layout<'a>(
240252
}
241253
});
242254

243-
row![menu_rail, sidebar_pane_grid]
255+
row![menu_rail, sidebar_separator, sidebar_pane_grid]
244256
.width(Length::Fill)
245257
.height(Length::Fill)
246258
.into()

otty/src/widgets/chrome/view/action_bar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use crate::components::primitive::icon_button::{
88
};
99
use crate::fonts::FontsConfig;
1010
use crate::icons::{LOGO_SMALL, WINDOW_CLOSE, WINDOW_FULLSCREEN, WINDOW_TRAY};
11+
use crate::layout::BUTTON_SIZE_COMPACT;
1112
use crate::theme::{StyleOverrides, ThemeProps};
1213

1314
pub(crate) const ACTION_BAR_HEIGHT: f32 = 30.0;
1415
const ACTION_BAR_TITLE_SCALE: f32 = 0.9;
15-
const ACTION_BAR_CONTROL_BUTTON_SIZE: f32 = 24.0;
1616
const ACTION_BAR_CONTROL_ICON_SIZE: f32 = 18.0;
1717
const ACTION_BAR_LOGO_ICON_SIZE: f32 = 18.0;
1818
const ACTION_BAR_HORIZONTAL_PADDING: f32 = 12.0;
@@ -132,7 +132,7 @@ fn icon_button<'a>(
132132
let props = IconButtonProps {
133133
icon,
134134
theme,
135-
size: ACTION_BAR_CONTROL_BUTTON_SIZE,
135+
size: BUTTON_SIZE_COMPACT,
136136
icon_size: ACTION_BAR_CONTROL_ICON_SIZE,
137137
variant,
138138
};

otty/src/widgets/explorer/view/sidebar_tree.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ use iced::{Element, Length, Padding, alignment};
44
use otty_ui_tree::{TreeRowContext, TreeView};
55

66
use crate::icons::{FILE, FOLDER, FOLDER_OPENED};
7+
use crate::layout::BUTTON_SIZE_COMPACT;
78
use crate::style::{thin_scroll_style, tree_row_style};
89
use crate::theme::{IcedColorPalette, ThemeProps};
910
use crate::widgets::explorer::event::ExplorerIntent;
1011
use crate::widgets::explorer::model::{ExplorerTreeViewModel, FileNode};
1112

12-
const HEADER_HEIGHT: f32 = 25.0;
13+
const HEADER_HEIGHT: f32 = BUTTON_SIZE_COMPACT;
1314
const HEADER_PADDING_X: f32 = 10.0;
1415
const HEADER_FONT_SIZE: f32 = 12.0;
1516

@@ -85,7 +86,7 @@ fn explorer_tree<'a>(
8586
vm: &ExplorerTreeViewModel<'a>,
8687
palette: &'a IcedColorPalette,
8788
) -> Element<'a, ExplorerIntent, iced::Theme, iced::Renderer> {
88-
let icon_color = palette.dim_foreground;
89+
let icon_color = palette.foreground;
8990
let tree_view = TreeView::new(vm.tree, move |context| {
9091
render_entry(context, icon_color)
9192
})

otty/src/widgets/quick_launch/view/context_menu.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use iced::{Element, Length, Size, Theme};
33

44
use crate::components::primitive::menu_item;
55
use crate::geometry::anchor_position;
6+
use crate::layout::BUTTON_SIZE_COMPACT;
67
use crate::style::menu_panel_style;
78
use crate::theme::ThemeProps;
89
use crate::widgets::quick_launch::event::QuickLaunchIntent;
@@ -12,7 +13,7 @@ use crate::widgets::quick_launch::model::{
1213
use crate::widgets::quick_launch::state::ContextMenuState;
1314

1415
const MENU_WIDTH: f32 = 220.0;
15-
const MENU_ITEM_HEIGHT: f32 = 24.0;
16+
const MENU_ITEM_HEIGHT: f32 = BUTTON_SIZE_COMPACT;
1617
const MENU_VERTICAL_PADDING: f32 = 16.0;
1718
const MENU_MARGIN: f32 = 6.0;
1819
const MENU_CONTAINER_PADDING: f32 = 8.0;

otty/src/widgets/quick_launch/view/sidebar_panel.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ use crate::components::primitive::icon_button::{
66
self, IconButtonProps, IconButtonVariant,
77
};
88
use crate::icons;
9+
use crate::layout::BUTTON_SIZE_COMPACT;
910
use crate::theme::ThemeProps;
1011
use crate::widgets::quick_launch::event::QuickLaunchIntent;
1112
use crate::widgets::quick_launch::model::QuickLaunchTreeViewModel;
1213

13-
const HEADER_HEIGHT: f32 = 25.0;
14+
const HEADER_HEIGHT: f32 = BUTTON_SIZE_COMPACT;
1415
const TITLE_SIZE: f32 = 13.0;
1516
const HEADER_PADDING_H: f32 = 10.0;
1617
const ADD_BUTTON_ICON_SIZE: f32 = 18.0;

0 commit comments

Comments
 (0)