Skip to main content

par_term/
ui_constants.rs

1//! Named constants for UI layout dimensions.
2//!
3//! Centralising these values makes future DPI scaling and theming easier.
4//! Only UI layout constants (dimensions, sizes, spacing) belong here.
5//! Animation speeds, colour values, and algorithm parameters live elsewhere.
6
7// ---------------------------------------------------------------------------
8// Clipboard History UI  (src/clipboard_history_ui.rs)
9// ---------------------------------------------------------------------------
10
11/// Default / initial width of the Clipboard History window.
12pub const CLIPBOARD_WINDOW_DEFAULT_WIDTH: f32 = 400.0;
13/// Default / initial height of the Clipboard History window.
14pub const CLIPBOARD_WINDOW_DEFAULT_HEIGHT: f32 = 250.0;
15/// Maximum height allowed for the Clipboard History window.
16pub const CLIPBOARD_WINDOW_MAX_HEIGHT: f32 = 350.0;
17
18// ---------------------------------------------------------------------------
19// Command History UI  (src/command_history_ui.rs)
20// ---------------------------------------------------------------------------
21
22/// Default / initial width of the Command History Search window.
23pub const CMD_HISTORY_WINDOW_DEFAULT_WIDTH: f32 = 500.0;
24/// Default / initial height of the Command History Search window.
25pub const CMD_HISTORY_WINDOW_DEFAULT_HEIGHT: f32 = 350.0;
26/// Maximum height allowed for the Command History Search window.
27pub const CMD_HISTORY_WINDOW_MAX_HEIGHT: f32 = 450.0;
28
29// ---------------------------------------------------------------------------
30// Paste Special UI  (src/paste_special_ui.rs)
31// ---------------------------------------------------------------------------
32
33/// Default / initial width of the Paste Special window.
34pub const PASTE_SPECIAL_WINDOW_DEFAULT_WIDTH: f32 = 500.0;
35/// Default / initial height of the Paste Special window.
36pub const PASTE_SPECIAL_WINDOW_DEFAULT_HEIGHT: f32 = 400.0;
37/// Maximum height of the transformation list scroll area inside Paste Special.
38pub const PASTE_SPECIAL_TRANSFORMS_MAX_HEIGHT: f32 = 250.0;
39
40// ---------------------------------------------------------------------------
41// SSH Quick Connect UI  (src/ssh_connect_ui.rs)
42// ---------------------------------------------------------------------------
43
44/// Minimum width for the SSH Quick Connect dialog.
45pub const SSH_CONNECT_DIALOG_MIN_WIDTH: f32 = 350.0;
46/// Maximum width for the SSH Quick Connect dialog.
47pub const SSH_CONNECT_DIALOG_MAX_WIDTH: f32 = 500.0;
48/// Minimum height for the SSH Quick Connect dialog.
49pub const SSH_CONNECT_DIALOG_MIN_HEIGHT: f32 = 300.0;
50/// Maximum height for the SSH Quick Connect dialog.
51pub const SSH_CONNECT_DIALOG_MAX_HEIGHT: f32 = 500.0;
52/// Inner margin of the SSH Quick Connect frame.
53pub const SSH_CONNECT_INNER_MARGIN: f32 = 16.0;
54/// Height of each host row button in the SSH Quick Connect list.
55pub const SSH_CONNECT_HOST_ROW_HEIGHT: f32 = 28.0;
56/// Height of the search bar in the SSH Quick Connect dialog.
57pub const SSH_CONNECT_SEARCH_BAR_HEIGHT: f32 = 24.0;
58/// Space reserved below the host list for the cancel/hint bar.
59pub const SSH_CONNECT_LIST_BOTTOM_RESERVE: f32 = 100.0;
60
61// ---------------------------------------------------------------------------
62// Profile Modal UI  (par-term-settings-ui/src/profile_modal_ui/)
63// ---------------------------------------------------------------------------
64
65/// Width of the Profile management modal dialog.
66pub const PROFILE_MODAL_WIDTH: f32 = 550.0;
67/// Height of the Profile management modal dialog.
68pub const PROFILE_MODAL_HEIGHT: f32 = 580.0;
69/// Width of the SSH port text-edit field inside the profile form.
70pub const PROFILE_SSH_PORT_FIELD_WIDTH: f32 = 60.0;
71/// Maximum height of the icon picker scroll area in the profile form.
72pub const PROFILE_ICON_PICKER_MAX_HEIGHT: f32 = 300.0;
73/// Minimum width of the icon picker panel.
74pub const PROFILE_ICON_PICKER_MIN_WIDTH: f32 = 280.0;
75
76// ---------------------------------------------------------------------------
77// Help UI  (src/help_ui.rs)
78// ---------------------------------------------------------------------------
79
80/// Default width of the Help window.
81pub const HELP_WINDOW_DEFAULT_WIDTH: f32 = 550.0;
82/// Default height of the Help window.
83pub const HELP_WINDOW_DEFAULT_HEIGHT: f32 = 600.0;
84
85// ---------------------------------------------------------------------------
86// Shader Install UI  (src/shader_install_ui.rs)
87// ---------------------------------------------------------------------------
88
89/// Default width of the Shader Pack Available dialog.
90pub const SHADER_INSTALL_DIALOG_WIDTH: f32 = 450.0;
91/// Inner margin of the Shader Install dialog frame.
92pub const SHADER_INSTALL_INNER_MARGIN: f32 = 20.0;
93/// Uniform width of action buttons (Yes/Never/Later/OK) in Shader Install.
94pub const SHADER_INSTALL_BUTTON_WIDTH: f32 = 120.0;
95/// Height of action buttons in the Shader Install dialog.
96pub const SHADER_INSTALL_BUTTON_HEIGHT: f32 = 32.0;
97
98// ---------------------------------------------------------------------------
99// Integrations / Update UI  (src/integrations_ui.rs)
100// ---------------------------------------------------------------------------
101
102/// Default width of the Integrations / update dialog.
103pub const INTEGRATIONS_DIALOG_WIDTH: f32 = 500.0;
104/// Inner margin of the Integrations dialog frame.
105pub const INTEGRATIONS_INNER_MARGIN: f32 = 24.0;
106/// Base width for action buttons in the Integrations dialog.
107pub const INTEGRATIONS_BUTTON_WIDTH: f32 = 130.0;
108/// Height of action buttons in the Integrations dialog.
109pub const INTEGRATIONS_BUTTON_HEIGHT: f32 = 32.0;
110/// Width of the dismiss "OK" button in the Integrations dialog.
111pub const INTEGRATIONS_OK_BUTTON_WIDTH: f32 = 120.0;
112
113// ---------------------------------------------------------------------------
114// tmux Session Picker UI  (src/tmux_session_picker_ui.rs)
115// ---------------------------------------------------------------------------
116
117/// Default width of the tmux Session Picker window.
118pub const TMUX_PICKER_WINDOW_DEFAULT_WIDTH: f32 = 400.0;
119/// Default height of the tmux Session Picker window.
120pub const TMUX_PICKER_WINDOW_DEFAULT_HEIGHT: f32 = 350.0;
121/// Maximum height of the session list scroll area in the tmux Picker.
122pub const TMUX_PICKER_LIST_MAX_HEIGHT: f32 = 200.0;
123
124// ---------------------------------------------------------------------------
125// File Transfers overlay  (src/app/file_transfers.rs)
126// ---------------------------------------------------------------------------
127
128/// Minimum width of the File Transfers overlay window.
129pub const FILE_TRANSFERS_MIN_WIDTH: f32 = 250.0;
130/// Anchor offset (negative = from right/bottom edge) for the File Transfers window.
131pub const FILE_TRANSFERS_ANCHOR_OFFSET: f32 = 10.0;
132
133// ---------------------------------------------------------------------------
134// Tab Bar UI  (src/tab_bar_ui/mod.rs)
135// ---------------------------------------------------------------------------
136
137/// Horizontal spacing between tabs.
138pub const TAB_SPACING: f32 = 4.0;
139/// Left padding before the first tab in the horizontal tab bar.
140pub const TAB_LEFT_PADDING: f32 = 2.0;
141/// Width of each scroll navigation button.
142pub const TAB_SCROLL_BTN_WIDTH: f32 = 24.0;
143/// Width of the "new tab" (+) button (without chevron).
144pub const TAB_NEW_BTN_BASE_WIDTH: f32 = 28.0;
145/// Corner rounding radius for horizontal tab tiles.
146pub const TAB_ROUNDING: f32 = 4.0;
147/// Shrink margin applied to a tab rect before drawing (horizontal, vertical).
148pub const TAB_DRAW_SHRINK_X: f32 = 2.0;
149pub const TAB_DRAW_SHRINK_Y: f32 = 1.0;
150/// Horizontal content padding inside each tab (left+right, top+bottom).
151pub const TAB_CONTENT_PAD_X: f32 = 8.0;
152pub const TAB_CONTENT_PAD_Y: f32 = 2.0;
153/// Width of the active-tab indicator bar (left edge vertical stripe).
154pub const TAB_ACTIVE_INDICATOR_WIDTH: f32 = 3.0;
155/// Size (width and height) of the close button in the horizontal tab bar.
156pub const TAB_CLOSE_BTN_SIZE_H: f32 = 16.0;
157/// Margin between the close button and the right edge of the tab.
158pub const TAB_CLOSE_BTN_MARGIN: f32 = 4.0;
159/// Size (width and height) of the close button in the vertical tab bar.
160pub const TAB_CLOSE_BTN_SIZE_V: f32 = 20.0;
161/// Width reserved for the hotkey label (e.g. "⌘1") in the vertical tab bar.
162pub const TAB_HOTKEY_LABEL_WIDTH: f32 = 26.0;
163/// Padding between content and edges in the vertical tab context menu.
164pub const TAB_CONTEXT_PADDING: f32 = 12.0;
165/// Width of the drop-zone diamond indicator drawn during tab drag.
166pub const TAB_DROP_DIAMOND_SIZE: f32 = 4.0;
167/// Minimum width of the "New Tab" profile picker window.
168pub const TAB_NEW_PROFILE_MENU_WIDTH: f32 = 200.0;
169/// Anchor offset for the "New Tab" profile picker window.
170pub const TAB_NEW_PROFILE_MENU_OFFSET_X: f32 = -4.0;
171pub const TAB_NEW_PROFILE_MENU_OFFSET_Y: f32 = 4.0;
172/// Minimum width of the tab context menu.
173pub const TAB_CONTEXT_MENU_MIN_WIDTH: f32 = 160.0;
174/// Height of each item row in the tab context menu.
175pub const TAB_CONTEXT_MENU_ITEM_HEIGHT: f32 = 24.0;
176/// Width of the rename text-edit inside the tab context menu.
177pub const TAB_RENAME_EDIT_WIDTH: f32 = 140.0;
178/// Width of the hex colour edit inside the tab context menu.
179pub const TAB_COLOR_HEX_EDIT_WIDTH: f32 = 60.0;
180/// Minimum width of the icon picker panel inside the tab context menu.
181pub const TAB_ICON_PICKER_MIN_WIDTH: f32 = 280.0;
182/// Maximum height of the icon picker scroll area inside the tab context menu.
183pub const TAB_ICON_PICKER_MAX_HEIGHT: f32 = 300.0;
184/// Size of icon glyphs rendered inside the icon picker.
185pub const TAB_ICON_PICKER_GLYPH_SIZE: f32 = 16.0;
186/// Size of the colour-swatch buttons in the tab context menu.
187pub const TAB_COLOR_SWATCH_SIZE: f32 = 18.0;
188/// Corner radius of colour-swatch buttons in the tab context menu.
189pub const TAB_COLOR_SWATCH_ROUNDING: f32 = 2.0;
190
191// ---------------------------------------------------------------------------
192// AI Inspector Panel  (src/ai_inspector/panel.rs)
193// ---------------------------------------------------------------------------
194
195/// Minimum width of the AI Inspector panel.
196pub const AI_PANEL_MIN_WIDTH: f32 = 200.0;
197/// Maximum width of the AI Inspector panel as a fraction of the viewport width.
198pub const AI_PANEL_MAX_WIDTH_RATIO: f32 = 0.5;
199/// Width of the resize drag handle for the AI Inspector panel.
200pub const AI_PANEL_RESIZE_HANDLE_WIDTH: f32 = 8.0;
201/// Inner margin of the AI Inspector panel frame.
202pub const AI_PANEL_INNER_MARGIN: f32 = 8.0;
203/// Margin subtracted from panel width to obtain inner content width
204/// (accounts for 8 px margins each side + 1 px border stroke each side).
205pub const AI_PANEL_INNER_INSET: f32 = 18.0;
206/// Margin subtracted from viewport height to obtain inner panel height.
207pub const AI_PANEL_HEIGHT_INSET: f32 = 18.0;
208/// Minimum height of the command-capture scroll area inside the AI panel.
209pub const AI_PANEL_CMD_SCROLL_MIN_HEIGHT: f32 = 100.0;
210/// Maximum height of the command-capture scroll area inside the AI panel.
211pub const AI_PANEL_CMD_SCROLL_MAX_HEIGHT: f32 = 300.0;
212/// Minimum height of the chat message scroll area.
213pub const AI_PANEL_CHAT_MIN_HEIGHT: f32 = 50.0;
214/// Base height of the chat input row (single line).
215pub const AI_PANEL_CHAT_INPUT_BASE_HEIGHT: f32 = 20.0;
216/// Per-additional-line height increment in the chat input.
217pub const AI_PANEL_CHAT_INPUT_LINE_HEIGHT: f32 = 14.0;
218/// Corner rounding for message / card frames in the AI Inspector.
219pub const AI_PANEL_CARD_ROUNDING: f32 = 4.0;
220
221// ---------------------------------------------------------------------------
222// Confirmation Dialogs  (close_confirmation_ui, quit_confirmation_ui)
223// ---------------------------------------------------------------------------
224
225/// Title font size for confirmation dialog headings.
226pub const CONFIRM_DIALOG_TITLE_SIZE: f32 = 18.0;
227/// Body command-label font size in the close-confirmation dialog.
228pub const CONFIRM_DIALOG_CMD_SIZE: f32 = 14.0;
229
230// ---------------------------------------------------------------------------
231// FPS Overlay  (src/app/window_state/render_pipeline.rs)
232// ---------------------------------------------------------------------------
233
234/// Horizontal anchor offset of the FPS overlay (negative = from right edge).
235pub const FPS_OVERLAY_OFFSET_X: f32 = -30.0;
236/// Vertical anchor offset of the FPS overlay (from top edge).
237pub const FPS_OVERLAY_OFFSET_Y: f32 = 10.0;
238/// Corner rounding of the FPS overlay background frame.
239pub const FPS_OVERLAY_ROUNDING: f32 = 4.0;
240
241// ---------------------------------------------------------------------------
242// Mouse / interaction thresholds
243// ---------------------------------------------------------------------------
244
245/// Minimum squared pixel distance a mouse must travel from press position before
246/// a click-and-hold is treated as a drag selection. Prevents accidental selections
247/// from trackpad tap-to-click jitter.
248///
249/// Note: compared against `dx*dx + dy*dy` (squared distance) to avoid a sqrt.
250pub const DRAG_THRESHOLD_PX: f64 = 8.0;
251
252/// Maximum pixel distance a click-and-release may travel while still being
253/// considered a plain click (vs. a drag). Used by the clipboard-image click
254/// guard to decide whether to restore the clipboard after a release.
255///
256/// Note: compared against `dx*dx + dy*dy` (squared distance) to avoid a sqrt.
257pub const CLICK_RESTORE_THRESHOLD_PX: f64 = 6.0;
258
259/// Hit-test radius (in physical pixels) for scrollbar mark tooltips.
260/// Mouse must be within this many pixels of a mark's centre to show the tooltip.
261pub const SCROLLBAR_MARK_HIT_RADIUS_PX: f32 = 8.0;
262
263// ---------------------------------------------------------------------------
264// Profile Drawer UI  (src/profile_drawer_ui.rs)
265// ---------------------------------------------------------------------------
266
267/// Minimum width of the profile drawer side panel.
268pub const PROFILE_DRAWER_MIN_WIDTH: f32 = 180.0;
269/// Maximum width of the profile drawer side panel.
270pub const PROFILE_DRAWER_MAX_WIDTH: f32 = 400.0;
271
272// ---------------------------------------------------------------------------
273// Animation / timing
274// ---------------------------------------------------------------------------
275
276/// Duration of the visual-bell screen flash in milliseconds.
277/// Shared by the pane, tab, and render-pipeline flash logic.
278pub const VISUAL_BELL_FLASH_DURATION_MS: u128 = 150;