diff --git a/configurator/src/app.rs b/configurator/src/app.rs index c165d924..c7521e39 100644 --- a/configurator/src/app.rs +++ b/configurator/src/app.rs @@ -14,10 +14,10 @@ use wayscriber::config::Config; use crate::messages::Message; use crate::models::{ - BoardModeOption, ColorMode, ColorQuadInput, ColorTripletInput, ConfigDraft, FontStyleOption, - FontWeightOption, NamedColorOption, OverrideOption, QuadField, SessionCompressionOption, - SessionStorageModeOption, StatusPositionOption, TabId, TextField, ToggleField, - ToolbarLayoutModeOption, ToolbarOverrideField, TripletField, UiTabId, + BoardModeOption, ColorMode, ColorQuadInput, ColorTripletInput, ConfigDraft, EraserModeOption, + FontStyleOption, FontWeightOption, NamedColorOption, OverrideOption, QuadField, + SessionCompressionOption, SessionStorageModeOption, StatusPositionOption, TabId, TextField, + ToggleField, ToolbarLayoutModeOption, ToolbarOverrideField, TripletField, UiTabId, }; pub fn run() -> iced::Result { @@ -271,6 +271,11 @@ impl Application for ConfiguratorApp { } self.refresh_dirty_flag(); } + Message::EraserModeChanged(option) => { + self.status = StatusMessage::idle(); + self.draft.drawing_default_eraser_mode = option; + self.refresh_dirty_flag(); + } Message::StatusPositionChanged(option) => { self.status = StatusMessage::idle(); self.draft.ui_status_position = option; @@ -428,12 +433,14 @@ impl ConfiguratorApp { let content: Element<'_, Message> = match self.active_tab { TabId::Drawing => self.drawing_tab(), TabId::Arrow => self.arrow_tab(), + TabId::History => self.history_tab(), TabId::Performance => self.performance_tab(), TabId::Ui => self.ui_tab(), TabId::Board => self.board_tab(), TabId::Capture => self.capture_tab(), TabId::Session => self.session_tab(), TabId::Keybindings => self.keybindings_tab(), + TabId::Tablet => self.tablet_tab(), }; let legend = self.defaults_legend(); @@ -585,6 +592,12 @@ impl ConfiguratorApp { ] .spacing(8); + let eraser_mode_pick = pick_list( + EraserModeOption::list(), + Some(self.draft.drawing_default_eraser_mode), + Message::EraserModeChanged, + ); + let column = column![ text("Drawing Defaults").size(20), color_block, @@ -603,6 +616,55 @@ impl ConfiguratorApp { ) ] .spacing(12), + row![ + labeled_input( + "Eraser size (px)", + &self.draft.drawing_default_eraser_size, + &self.defaults.drawing_default_eraser_size, + TextField::DrawingEraserSize, + ), + labeled_control( + "Eraser mode", + eraser_mode_pick.width(Length::Fill).into(), + self.defaults + .drawing_default_eraser_mode + .label() + .to_string(), + self.draft.drawing_default_eraser_mode + != self.defaults.drawing_default_eraser_mode, + ) + ] + .spacing(12), + row![ + labeled_input( + "Marker opacity (0.05-0.9)", + &self.draft.drawing_marker_opacity, + &self.defaults.drawing_marker_opacity, + TextField::DrawingMarkerOpacity, + ), + labeled_input( + "Undo stack limit", + &self.draft.drawing_undo_stack_limit, + &self.defaults.drawing_undo_stack_limit, + TextField::DrawingUndoStackLimit, + ) + ] + .spacing(12), + row![ + labeled_input( + "Hit-test tolerance (px)", + &self.draft.drawing_hit_test_tolerance, + &self.defaults.drawing_hit_test_tolerance, + TextField::DrawingHitTestTolerance, + ), + labeled_input( + "Hit-test threshold", + &self.draft.drawing_hit_test_linear_threshold, + &self.defaults.drawing_hit_test_linear_threshold, + TextField::DrawingHitTestThreshold, + ) + ] + .spacing(12), row![ labeled_input( "Font family", @@ -672,6 +734,12 @@ impl ConfiguratorApp { self.draft.drawing_text_background_enabled, self.defaults.drawing_text_background_enabled, ToggleField::DrawingTextBackground, + ), + toggle_row( + "Start shapes filled", + self.draft.drawing_default_fill_enabled, + self.defaults.drawing_default_fill_enabled, + ToggleField::DrawingFillEnabled, ) ] .spacing(12) @@ -711,6 +779,67 @@ impl ConfiguratorApp { .into() } + fn history_tab(&self) -> Element<'_, Message> { + scrollable( + column![ + text("History").size(20), + row![ + labeled_input( + "Undo all delay (ms)", + &self.draft.history_undo_all_delay_ms, + &self.defaults.history_undo_all_delay_ms, + TextField::HistoryUndoAllDelayMs, + ), + labeled_input( + "Redo all delay (ms)", + &self.draft.history_redo_all_delay_ms, + &self.defaults.history_redo_all_delay_ms, + TextField::HistoryRedoAllDelayMs, + ) + ] + .spacing(12), + toggle_row( + "Enable custom undo/redo section", + self.draft.history_custom_section_enabled, + self.defaults.history_custom_section_enabled, + ToggleField::HistoryCustomSectionEnabled, + ), + row![ + labeled_input( + "Custom undo delay (ms)", + &self.draft.history_custom_undo_delay_ms, + &self.defaults.history_custom_undo_delay_ms, + TextField::HistoryCustomUndoDelayMs, + ), + labeled_input( + "Custom redo delay (ms)", + &self.draft.history_custom_redo_delay_ms, + &self.defaults.history_custom_redo_delay_ms, + TextField::HistoryCustomRedoDelayMs, + ) + ] + .spacing(12), + row![ + labeled_input( + "Custom undo steps", + &self.draft.history_custom_undo_steps, + &self.defaults.history_custom_undo_steps, + TextField::HistoryCustomUndoSteps, + ), + labeled_input( + "Custom redo steps", + &self.draft.history_custom_redo_steps, + &self.defaults.history_custom_redo_steps, + TextField::HistoryCustomRedoSteps, + ) + ] + .spacing(12), + ] + .spacing(12), + ) + .into() + } + fn performance_tab(&self) -> Element<'_, Message> { let buffer_pick = pick_list( vec![2u32, 3, 4], @@ -776,7 +905,30 @@ impl ConfiguratorApp { UiTabId::ClickHighlight => self.ui_click_highlight_tab(), }; - column![text("UI Settings").size(20), tab_bar, content] + let general = column![ + text("General UI").size(18), + labeled_input( + "Preferred output (xdg fallback)", + &self.draft.ui_preferred_output, + &self.defaults.ui_preferred_output, + TextField::UiPreferredOutput, + ), + toggle_row( + "Use fullscreen xdg fallback", + self.draft.ui_xdg_fullscreen, + self.defaults.ui_xdg_fullscreen, + ToggleField::UiXdgFullscreen, + ), + toggle_row( + "Enable context menu", + self.draft.ui_context_menu_enabled, + self.defaults.ui_context_menu_enabled, + ToggleField::UiContextMenuEnabled, + ) + ] + .spacing(12); + + column![text("UI Settings").size(20), general, tab_bar, content] .spacing(12) .into() } @@ -805,6 +957,30 @@ impl ConfiguratorApp { self.defaults.ui_toolbar_layout_mode.label().to_string(), self.draft.ui_toolbar_layout_mode != self.defaults.ui_toolbar_layout_mode, ), + toggle_row( + "Pin top toolbar", + self.draft.ui_toolbar_top_pinned, + self.defaults.ui_toolbar_top_pinned, + ToggleField::UiToolbarTopPinned, + ), + toggle_row( + "Pin side toolbar", + self.draft.ui_toolbar_side_pinned, + self.defaults.ui_toolbar_side_pinned, + ToggleField::UiToolbarSidePinned, + ), + toggle_row( + "Use icon-only buttons", + self.draft.ui_toolbar_use_icons, + self.defaults.ui_toolbar_use_icons, + ToggleField::UiToolbarUseIcons, + ), + toggle_row( + "Show extended colors", + self.draft.ui_toolbar_show_more_colors, + self.defaults.ui_toolbar_show_more_colors, + ToggleField::UiToolbarShowMoreColors, + ), toggle_row( "Show presets", self.draft.ui_toolbar_show_presets, @@ -841,12 +1017,36 @@ impl ConfiguratorApp { self.defaults.ui_toolbar_show_settings_section, ToggleField::UiToolbarShowSettingsSection, ), + toggle_row( + "Show delay sliders", + self.draft.ui_toolbar_show_delay_sliders, + self.defaults.ui_toolbar_show_delay_sliders, + ToggleField::UiToolbarShowDelaySliders, + ), + toggle_row( + "Show marker opacity controls", + self.draft.ui_toolbar_show_marker_opacity_section, + self.defaults.ui_toolbar_show_marker_opacity_section, + ToggleField::UiToolbarShowMarkerOpacitySection, + ), + toggle_row( + "Show tool preview bubble", + self.draft.ui_toolbar_show_tool_preview, + self.defaults.ui_toolbar_show_tool_preview, + ToggleField::UiToolbarShowToolPreview, + ), toggle_row( "Show preset action toasts", self.draft.ui_toolbar_show_preset_toasts, self.defaults.ui_toolbar_show_preset_toasts, ToggleField::UiToolbarPresetToasts, ), + toggle_row( + "Force inline toolbars", + self.draft.ui_toolbar_force_inline, + self.defaults.ui_toolbar_force_inline, + ToggleField::UiToolbarForceInline, + ), text("Mode overrides").size(16), row![text("Edit mode:"), override_mode_pick] .spacing(12) @@ -873,6 +1073,37 @@ impl ConfiguratorApp { ToolbarOverrideField::ShowSettingsSection, overrides.show_settings_section, ), + text("Placement offsets").size(16), + row![ + labeled_input( + "Top offset X", + &self.draft.ui_toolbar_top_offset, + &self.defaults.ui_toolbar_top_offset, + TextField::ToolbarTopOffset, + ), + labeled_input( + "Top offset Y", + &self.draft.ui_toolbar_top_offset_y, + &self.defaults.ui_toolbar_top_offset_y, + TextField::ToolbarTopOffsetY, + ) + ] + .spacing(12), + row![ + labeled_input( + "Side offset Y", + &self.draft.ui_toolbar_side_offset, + &self.defaults.ui_toolbar_side_offset, + TextField::ToolbarSideOffset, + ), + labeled_input( + "Side offset X", + &self.draft.ui_toolbar_side_offset_x, + &self.defaults.ui_toolbar_side_offset_x, + TextField::ToolbarSideOffsetX, + ) + ] + .spacing(12), ] .spacing(12); @@ -1189,6 +1420,12 @@ impl ConfiguratorApp { self.defaults.session_persist_blackboard, ToggleField::SessionPersistBlackboard, ), + toggle_row( + "Persist undo/redo history", + self.draft.session_persist_history, + self.defaults.session_persist_history, + ToggleField::SessionPersistHistory, + ), toggle_row( "Restore tool state on startup", self.draft.session_restore_tool_state, @@ -1232,6 +1469,12 @@ impl ConfiguratorApp { &self.defaults.session_max_shapes_per_frame, TextField::SessionMaxShapesPerFrame, )) + .push(labeled_input( + "Max persisted undo depth (blank = runtime limit)", + &self.draft.session_max_persisted_undo_depth, + &self.defaults.session_max_persisted_undo_depth, + TextField::SessionMaxPersistedUndoDepth, + )) .push(labeled_input( "Max file size (MB)", &self.draft.session_max_file_size_mb, @@ -1254,6 +1497,43 @@ impl ConfiguratorApp { scrollable(column).into() } + fn tablet_tab(&self) -> Element<'_, Message> { + scrollable( + column![ + text("Tablet / Stylus").size(20), + toggle_row( + "Enable tablet input", + self.draft.tablet_enabled, + self.defaults.tablet_enabled, + ToggleField::TabletEnabled, + ), + toggle_row( + "Enable pressure-to-thickness", + self.draft.tablet_pressure_enabled, + self.defaults.tablet_pressure_enabled, + ToggleField::TabletPressureEnabled, + ), + row![ + labeled_input( + "Min thickness", + &self.draft.tablet_min_thickness, + &self.defaults.tablet_min_thickness, + TextField::TabletMinThickness, + ), + labeled_input( + "Max thickness", + &self.draft.tablet_max_thickness, + &self.defaults.tablet_max_thickness, + TextField::TabletMaxThickness, + ) + ] + .spacing(12), + ] + .spacing(12), + ) + .into() + } + fn keybindings_tab(&self) -> Element<'_, Message> { let mut column = Column::new() .spacing(8) diff --git a/configurator/src/messages.rs b/configurator/src/messages.rs index 0aa569a8..b6f7b1ef 100644 --- a/configurator/src/messages.rs +++ b/configurator/src/messages.rs @@ -4,8 +4,8 @@ use std::sync::Arc; use wayscriber::config::Config; use crate::models::{ - BoardModeOption, ColorMode, FontStyleOption, FontWeightOption, KeybindingField, - NamedColorOption, OverrideOption, QuadField, SessionCompressionOption, + BoardModeOption, ColorMode, EraserModeOption, FontStyleOption, FontWeightOption, + KeybindingField, NamedColorOption, OverrideOption, QuadField, SessionCompressionOption, SessionStorageModeOption, StatusPositionOption, TabId, TextField, ToggleField, ToolbarLayoutModeOption, ToolbarOverrideField, TripletField, UiTabId, }; @@ -25,6 +25,7 @@ pub enum Message { QuadChanged(QuadField, usize, String), ColorModeChanged(ColorMode), NamedColorSelected(NamedColorOption), + EraserModeChanged(EraserModeOption), StatusPositionChanged(StatusPositionOption), ToolbarLayoutModeChanged(ToolbarLayoutModeOption), ToolbarOverrideModeChanged(ToolbarLayoutModeOption), diff --git a/configurator/src/models/config.rs b/configurator/src/models/config.rs index 581ec66b..0f2af7e4 100644 --- a/configurator/src/models/config.rs +++ b/configurator/src/models/config.rs @@ -3,8 +3,8 @@ use wayscriber::config::{Config, PresetSlotsConfig, ToolbarModeOverride, Toolbar use super::color::{ColorInput, ColorQuadInput, ColorTripletInput}; use super::error::FormError; use super::fields::{ - BoardModeOption, FontStyleOption, FontWeightOption, OverrideOption, QuadField, - SessionCompressionOption, SessionStorageModeOption, StatusPositionOption, TextField, + BoardModeOption, EraserModeOption, FontStyleOption, FontWeightOption, OverrideOption, + QuadField, SessionCompressionOption, SessionStorageModeOption, StatusPositionOption, TextField, ToggleField, ToolbarLayoutModeOption, ToolbarOverrideField, TripletField, }; use super::keybindings::KeybindingsDraft; @@ -14,11 +14,18 @@ use super::util::{format_float, parse_f64}; pub struct ConfigDraft { pub drawing_color: ColorInput, pub drawing_default_thickness: String, + pub drawing_default_eraser_size: String, + pub drawing_default_eraser_mode: EraserModeOption, pub drawing_default_font_size: String, + pub drawing_marker_opacity: String, + pub drawing_hit_test_tolerance: String, + pub drawing_hit_test_linear_threshold: String, + pub drawing_undo_stack_limit: String, pub drawing_font_family: String, pub drawing_font_weight: String, pub drawing_font_style: String, pub drawing_text_background_enabled: bool, + pub drawing_default_fill_enabled: bool, pub drawing_font_style_option: FontStyleOption, pub drawing_font_weight_option: FontWeightOption, @@ -26,12 +33,27 @@ pub struct ConfigDraft { pub arrow_angle: String, pub arrow_head_at_end: bool, + pub history_undo_all_delay_ms: String, + pub history_redo_all_delay_ms: String, + pub history_custom_section_enabled: bool, + pub history_custom_undo_delay_ms: String, + pub history_custom_redo_delay_ms: String, + pub history_custom_undo_steps: String, + pub history_custom_redo_steps: String, + pub performance_buffer_count: u32, pub performance_enable_vsync: bool, pub performance_ui_animation_fps: String, pub ui_show_status_bar: bool, pub ui_show_frozen_badge: bool, + pub ui_context_menu_enabled: bool, + pub ui_preferred_output: String, + pub ui_xdg_fullscreen: bool, + pub ui_toolbar_top_pinned: bool, + pub ui_toolbar_side_pinned: bool, + pub ui_toolbar_use_icons: bool, + pub ui_toolbar_show_more_colors: bool, pub ui_toolbar_show_preset_toasts: bool, pub ui_toolbar_layout_mode: ToolbarLayoutModeOption, pub ui_toolbar_show_presets: bool, @@ -40,6 +62,14 @@ pub struct ConfigDraft { pub ui_toolbar_show_step_section: bool, pub ui_toolbar_show_text_controls: bool, pub ui_toolbar_show_settings_section: bool, + pub ui_toolbar_show_delay_sliders: bool, + pub ui_toolbar_show_marker_opacity_section: bool, + pub ui_toolbar_show_tool_preview: bool, + pub ui_toolbar_force_inline: bool, + pub ui_toolbar_top_offset: String, + pub ui_toolbar_top_offset_y: String, + pub ui_toolbar_side_offset: String, + pub ui_toolbar_side_offset_x: String, pub ui_toolbar_mode_overrides: ToolbarModeOverridesDraft, pub ui_status_position: StatusPositionOption, pub status_font_size: String, @@ -82,6 +112,7 @@ pub struct ConfigDraft { pub session_persist_transparent: bool, pub session_persist_whiteboard: bool, pub session_persist_blackboard: bool, + pub session_persist_history: bool, pub session_restore_tool_state: bool, pub session_per_output: bool, pub session_storage_mode: SessionStorageModeOption, @@ -90,8 +121,14 @@ pub struct ConfigDraft { pub session_max_file_size_mb: String, pub session_compression: SessionCompressionOption, pub session_auto_compress_threshold_kb: String, + pub session_max_persisted_undo_depth: String, pub session_backup_retention: String, + pub tablet_enabled: bool, + pub tablet_pressure_enabled: bool, + pub tablet_min_thickness: String, + pub tablet_max_thickness: String, + pub presets: PresetSlotsConfig, pub keybindings: KeybindingsDraft, @@ -191,11 +228,20 @@ impl ConfigDraft { Self { drawing_color: ColorInput::from_color(&config.drawing.default_color), drawing_default_thickness: format_float(config.drawing.default_thickness), + drawing_default_eraser_size: format_float(config.drawing.default_eraser_size), + drawing_default_eraser_mode: EraserModeOption::from_mode( + config.drawing.default_eraser_mode, + ), drawing_default_font_size: format_float(config.drawing.default_font_size), + drawing_marker_opacity: format_float(config.drawing.marker_opacity), + drawing_hit_test_tolerance: format_float(config.drawing.hit_test_tolerance), + drawing_hit_test_linear_threshold: config.drawing.hit_test_linear_threshold.to_string(), + drawing_undo_stack_limit: config.drawing.undo_stack_limit.to_string(), drawing_font_family: config.drawing.font_family.clone(), drawing_font_weight: weight_value, drawing_font_style: style_value, drawing_text_background_enabled: config.drawing.text_background_enabled, + drawing_default_fill_enabled: config.drawing.default_fill_enabled, drawing_font_style_option: style_option, drawing_font_weight_option: weight_option, @@ -203,12 +249,27 @@ impl ConfigDraft { arrow_angle: format_float(config.arrow.angle_degrees), arrow_head_at_end: config.arrow.head_at_end, + history_undo_all_delay_ms: config.history.undo_all_delay_ms.to_string(), + history_redo_all_delay_ms: config.history.redo_all_delay_ms.to_string(), + history_custom_section_enabled: config.history.custom_section_enabled, + history_custom_undo_delay_ms: config.history.custom_undo_delay_ms.to_string(), + history_custom_redo_delay_ms: config.history.custom_redo_delay_ms.to_string(), + history_custom_undo_steps: config.history.custom_undo_steps.to_string(), + history_custom_redo_steps: config.history.custom_redo_steps.to_string(), + performance_buffer_count: config.performance.buffer_count, performance_enable_vsync: config.performance.enable_vsync, performance_ui_animation_fps: config.performance.ui_animation_fps.to_string(), ui_show_status_bar: config.ui.show_status_bar, ui_show_frozen_badge: config.ui.show_frozen_badge, + ui_context_menu_enabled: config.ui.context_menu.enabled, + ui_preferred_output: config.ui.preferred_output.clone().unwrap_or_default(), + ui_xdg_fullscreen: config.ui.xdg_fullscreen, + ui_toolbar_top_pinned: config.ui.toolbar.top_pinned, + ui_toolbar_side_pinned: config.ui.toolbar.side_pinned, + ui_toolbar_use_icons: config.ui.toolbar.use_icons, + ui_toolbar_show_more_colors: config.ui.toolbar.show_more_colors, ui_toolbar_show_preset_toasts: config.ui.toolbar.show_preset_toasts, ui_toolbar_layout_mode: ToolbarLayoutModeOption::from_mode( config.ui.toolbar.layout_mode, @@ -219,6 +280,14 @@ impl ConfigDraft { ui_toolbar_show_step_section: config.ui.toolbar.show_step_section, ui_toolbar_show_text_controls: config.ui.toolbar.show_text_controls, ui_toolbar_show_settings_section: config.ui.toolbar.show_settings_section, + ui_toolbar_show_delay_sliders: config.ui.toolbar.show_delay_sliders, + ui_toolbar_show_marker_opacity_section: config.ui.toolbar.show_marker_opacity_section, + ui_toolbar_show_tool_preview: config.ui.toolbar.show_tool_preview, + ui_toolbar_force_inline: config.ui.toolbar.force_inline, + ui_toolbar_top_offset: format_float(config.ui.toolbar.top_offset), + ui_toolbar_top_offset_y: format_float(config.ui.toolbar.top_offset_y), + ui_toolbar_side_offset: format_float(config.ui.toolbar.side_offset), + ui_toolbar_side_offset_x: format_float(config.ui.toolbar.side_offset_x), ui_toolbar_mode_overrides: ToolbarModeOverridesDraft::from_config( &config.ui.toolbar.mode_overrides, ), @@ -270,6 +339,7 @@ impl ConfigDraft { session_persist_transparent: config.session.persist_transparent, session_persist_whiteboard: config.session.persist_whiteboard, session_persist_blackboard: config.session.persist_blackboard, + session_persist_history: config.session.persist_history, session_restore_tool_state: config.session.restore_tool_state, session_per_output: config.session.per_output, session_storage_mode: SessionStorageModeOption::from_mode( @@ -285,8 +355,18 @@ impl ConfigDraft { .session .auto_compress_threshold_kb .to_string(), + session_max_persisted_undo_depth: config + .session + .max_persisted_undo_depth + .map(|value| value.to_string()) + .unwrap_or_default(), session_backup_retention: config.session.backup_retention.to_string(), + tablet_enabled: config.tablet.enabled, + tablet_pressure_enabled: config.tablet.pressure_enabled, + tablet_min_thickness: format_float(config.tablet.min_thickness), + tablet_max_thickness: format_float(config.tablet.max_thickness), + presets: config.presets.clone(), keybindings: KeybindingsDraft::from_config(&config.keybindings), @@ -307,16 +387,48 @@ impl ConfigDraft { &mut errors, |value| config.drawing.default_thickness = value, ); + parse_field( + &self.drawing_default_eraser_size, + "drawing.default_eraser_size", + &mut errors, + |value| config.drawing.default_eraser_size = value, + ); + config.drawing.default_eraser_mode = self.drawing_default_eraser_mode.to_mode(); parse_field( &self.drawing_default_font_size, "drawing.default_font_size", &mut errors, |value| config.drawing.default_font_size = value, ); + parse_field( + &self.drawing_marker_opacity, + "drawing.marker_opacity", + &mut errors, + |value| config.drawing.marker_opacity = value, + ); config.drawing.font_family = self.drawing_font_family.clone(); config.drawing.font_weight = self.drawing_font_weight.clone(); config.drawing.font_style = self.drawing_font_style.clone(); config.drawing.text_background_enabled = self.drawing_text_background_enabled; + config.drawing.default_fill_enabled = self.drawing_default_fill_enabled; + parse_field( + &self.drawing_hit_test_tolerance, + "drawing.hit_test_tolerance", + &mut errors, + |value| config.drawing.hit_test_tolerance = value, + ); + parse_usize_field( + &self.drawing_hit_test_linear_threshold, + "drawing.hit_test_linear_threshold", + &mut errors, + |value| config.drawing.hit_test_linear_threshold = value, + ); + parse_usize_field( + &self.drawing_undo_stack_limit, + "drawing.undo_stack_limit", + &mut errors, + |value| config.drawing.undo_stack_limit = value, + ); parse_field(&self.arrow_length, "arrow.length", &mut errors, |value| { config.arrow.length = value @@ -329,6 +441,44 @@ impl ConfigDraft { ); config.arrow.head_at_end = self.arrow_head_at_end; + parse_u64_field( + &self.history_undo_all_delay_ms, + "history.undo_all_delay_ms", + &mut errors, + |value| config.history.undo_all_delay_ms = value, + ); + parse_u64_field( + &self.history_redo_all_delay_ms, + "history.redo_all_delay_ms", + &mut errors, + |value| config.history.redo_all_delay_ms = value, + ); + config.history.custom_section_enabled = self.history_custom_section_enabled; + parse_u64_field( + &self.history_custom_undo_delay_ms, + "history.custom_undo_delay_ms", + &mut errors, + |value| config.history.custom_undo_delay_ms = value, + ); + parse_u64_field( + &self.history_custom_redo_delay_ms, + "history.custom_redo_delay_ms", + &mut errors, + |value| config.history.custom_redo_delay_ms = value, + ); + parse_usize_field( + &self.history_custom_undo_steps, + "history.custom_undo_steps", + &mut errors, + |value| config.history.custom_undo_steps = value, + ); + parse_usize_field( + &self.history_custom_redo_steps, + "history.custom_redo_steps", + &mut errors, + |value| config.history.custom_redo_steps = value, + ); + config.performance.buffer_count = self.performance_buffer_count; config.performance.enable_vsync = self.performance_enable_vsync; parse_u32_field( @@ -340,6 +490,18 @@ impl ConfigDraft { config.ui.show_status_bar = self.ui_show_status_bar; config.ui.show_frozen_badge = self.ui_show_frozen_badge; + config.ui.context_menu.enabled = self.ui_context_menu_enabled; + let preferred_output = self.ui_preferred_output.trim(); + config.ui.preferred_output = if preferred_output.is_empty() { + None + } else { + Some(preferred_output.to_string()) + }; + config.ui.xdg_fullscreen = self.ui_xdg_fullscreen; + config.ui.toolbar.top_pinned = self.ui_toolbar_top_pinned; + config.ui.toolbar.side_pinned = self.ui_toolbar_side_pinned; + config.ui.toolbar.use_icons = self.ui_toolbar_use_icons; + config.ui.toolbar.show_more_colors = self.ui_toolbar_show_more_colors; config.ui.toolbar.show_preset_toasts = self.ui_toolbar_show_preset_toasts; config.ui.toolbar.layout_mode = self.ui_toolbar_layout_mode.to_mode(); config.ui.toolbar.mode_overrides = self.ui_toolbar_mode_overrides.to_config(); @@ -349,6 +511,34 @@ impl ConfigDraft { config.ui.toolbar.show_step_section = self.ui_toolbar_show_step_section; config.ui.toolbar.show_text_controls = self.ui_toolbar_show_text_controls; config.ui.toolbar.show_settings_section = self.ui_toolbar_show_settings_section; + config.ui.toolbar.show_delay_sliders = self.ui_toolbar_show_delay_sliders; + config.ui.toolbar.show_marker_opacity_section = self.ui_toolbar_show_marker_opacity_section; + config.ui.toolbar.show_tool_preview = self.ui_toolbar_show_tool_preview; + config.ui.toolbar.force_inline = self.ui_toolbar_force_inline; + parse_field( + &self.ui_toolbar_top_offset, + "ui.toolbar.top_offset", + &mut errors, + |value| config.ui.toolbar.top_offset = value, + ); + parse_field( + &self.ui_toolbar_top_offset_y, + "ui.toolbar.top_offset_y", + &mut errors, + |value| config.ui.toolbar.top_offset_y = value, + ); + parse_field( + &self.ui_toolbar_side_offset, + "ui.toolbar.side_offset", + &mut errors, + |value| config.ui.toolbar.side_offset = value, + ); + parse_field( + &self.ui_toolbar_side_offset_x, + "ui.toolbar.side_offset_x", + &mut errors, + |value| config.ui.toolbar.side_offset_x = value, + ); config.ui.status_bar_position = self.ui_status_position.to_status_position(); parse_field( &self.status_font_size, @@ -506,6 +696,7 @@ impl ConfigDraft { config.session.persist_transparent = self.session_persist_transparent; config.session.persist_whiteboard = self.session_persist_whiteboard; config.session.persist_blackboard = self.session_persist_blackboard; + config.session.persist_history = self.session_persist_history; config.session.restore_tool_state = self.session_restore_tool_state; config.session.per_output = self.session_per_output; config.session.storage = self.session_storage_mode.to_mode(); @@ -534,6 +725,12 @@ impl ConfigDraft { &mut errors, |value| config.session.auto_compress_threshold_kb = value, ); + parse_optional_usize_field( + &self.session_max_persisted_undo_depth, + "session.max_persisted_undo_depth", + &mut errors, + |value| config.session.max_persisted_undo_depth = value, + ); parse_usize_field( &self.session_backup_retention, "session.backup_retention", @@ -541,6 +738,23 @@ impl ConfigDraft { |value| config.session.backup_retention = value, ); + { + config.tablet.enabled = self.tablet_enabled; + config.tablet.pressure_enabled = self.tablet_pressure_enabled; + parse_field( + &self.tablet_min_thickness, + "tablet.min_thickness", + &mut errors, + |value| config.tablet.min_thickness = value, + ); + parse_field( + &self.tablet_max_thickness, + "tablet.max_thickness", + &mut errors, + |value| config.tablet.max_thickness = value, + ); + } + config.presets = self.presets.clone(); match self.keybindings.to_config() { @@ -582,9 +796,18 @@ impl ConfigDraft { ToggleField::DrawingTextBackground => { self.drawing_text_background_enabled = value; } + ToggleField::DrawingFillEnabled => { + self.drawing_default_fill_enabled = value; + } ToggleField::PerformanceVsync => self.performance_enable_vsync = value, ToggleField::UiShowStatusBar => self.ui_show_status_bar = value, ToggleField::UiShowFrozenBadge => self.ui_show_frozen_badge = value, + ToggleField::UiContextMenuEnabled => self.ui_context_menu_enabled = value, + ToggleField::UiXdgFullscreen => self.ui_xdg_fullscreen = value, + ToggleField::UiToolbarTopPinned => self.ui_toolbar_top_pinned = value, + ToggleField::UiToolbarSidePinned => self.ui_toolbar_side_pinned = value, + ToggleField::UiToolbarUseIcons => self.ui_toolbar_use_icons = value, + ToggleField::UiToolbarShowMoreColors => self.ui_toolbar_show_more_colors = value, ToggleField::UiToolbarPresetToasts => self.ui_toolbar_show_preset_toasts = value, ToggleField::UiToolbarShowPresets => self.ui_toolbar_show_presets = value, ToggleField::UiToolbarShowActionsSection => { @@ -598,6 +821,18 @@ impl ConfigDraft { ToggleField::UiToolbarShowSettingsSection => { self.ui_toolbar_show_settings_section = value; } + ToggleField::UiToolbarShowDelaySliders => { + self.ui_toolbar_show_delay_sliders = value; + } + ToggleField::UiToolbarShowMarkerOpacitySection => { + self.ui_toolbar_show_marker_opacity_section = value; + } + ToggleField::UiToolbarShowToolPreview => { + self.ui_toolbar_show_tool_preview = value; + } + ToggleField::UiToolbarForceInline => { + self.ui_toolbar_force_inline = value; + } ToggleField::UiClickHighlightEnabled => self.click_highlight_enabled = value, ToggleField::UiClickHighlightUsePenColor => self.click_highlight_use_pen_color = value, ToggleField::BoardEnabled => self.board_enabled = value, @@ -614,15 +849,23 @@ impl ConfigDraft { ToggleField::SessionPersistBlackboard => { self.session_persist_blackboard = value; } + ToggleField::SessionPersistHistory => { + self.session_persist_history = value; + } ToggleField::SessionRestoreToolState => { self.session_restore_tool_state = value; } ToggleField::SessionPerOutput => { self.session_per_output = value; } + ToggleField::HistoryCustomSectionEnabled => { + self.history_custom_section_enabled = value; + } ToggleField::ArrowHeadAtEnd => { self.arrow_head_at_end = value; } + ToggleField::TabletEnabled => self.tablet_enabled = value, + ToggleField::TabletPressureEnabled => self.tablet_pressure_enabled = value, } } @@ -633,7 +876,9 @@ impl ConfigDraft { self.drawing_color.update_named_from_current(); } TextField::DrawingThickness => self.drawing_default_thickness = value, + TextField::DrawingEraserSize => self.drawing_default_eraser_size = value, TextField::DrawingFontSize => self.drawing_default_font_size = value, + TextField::DrawingMarkerOpacity => self.drawing_marker_opacity = value, TextField::DrawingFontFamily => self.drawing_font_family = value, TextField::DrawingFontWeight => { self.drawing_font_weight = value; @@ -643,9 +888,19 @@ impl ConfigDraft { self.drawing_font_style = value; self.drawing_font_style_option = FontStyleOption::Custom; } + TextField::DrawingHitTestTolerance => self.drawing_hit_test_tolerance = value, + TextField::DrawingHitTestThreshold => self.drawing_hit_test_linear_threshold = value, + TextField::DrawingUndoStackLimit => self.drawing_undo_stack_limit = value, TextField::ArrowLength => self.arrow_length = value, TextField::ArrowAngle => self.arrow_angle = value, TextField::PerformanceUiAnimationFps => self.performance_ui_animation_fps = value, + TextField::HistoryUndoAllDelayMs => self.history_undo_all_delay_ms = value, + TextField::HistoryRedoAllDelayMs => self.history_redo_all_delay_ms = value, + TextField::HistoryCustomUndoDelayMs => self.history_custom_undo_delay_ms = value, + TextField::HistoryCustomRedoDelayMs => self.history_custom_redo_delay_ms = value, + TextField::HistoryCustomUndoSteps => self.history_custom_undo_steps = value, + TextField::HistoryCustomRedoSteps => self.history_custom_redo_steps = value, + TextField::UiPreferredOutput => self.ui_preferred_output = value, TextField::StatusFontSize => self.status_font_size = value, TextField::StatusPadding => self.status_padding = value, TextField::StatusDotRadius => self.status_dot_radius = value, @@ -659,13 +914,22 @@ impl ConfigDraft { TextField::CaptureSaveDirectory => self.capture_save_directory = value, TextField::CaptureFilename => self.capture_filename_template = value, TextField::CaptureFormat => self.capture_format = value, + TextField::ToolbarTopOffset => self.ui_toolbar_top_offset = value, + TextField::ToolbarTopOffsetY => self.ui_toolbar_top_offset_y = value, + TextField::ToolbarSideOffset => self.ui_toolbar_side_offset = value, + TextField::ToolbarSideOffsetX => self.ui_toolbar_side_offset_x = value, TextField::SessionCustomDirectory => self.session_custom_directory = value, TextField::SessionMaxShapesPerFrame => self.session_max_shapes_per_frame = value, TextField::SessionMaxFileSizeMb => self.session_max_file_size_mb = value, TextField::SessionAutoCompressThresholdKb => { self.session_auto_compress_threshold_kb = value } + TextField::SessionMaxPersistedUndoDepth => { + self.session_max_persisted_undo_depth = value + } TextField::SessionBackupRetention => self.session_backup_retention = value, + TextField::TabletMinThickness => self.tablet_min_thickness = value, + TextField::TabletMaxThickness => self.tablet_max_thickness = value, } } @@ -726,6 +990,25 @@ where } } +fn parse_optional_usize_field( + value: &str, + field: &'static str, + errors: &mut Vec, + apply: F, +) where + F: FnOnce(Option), +{ + let trimmed = value.trim(); + if trimmed.is_empty() { + apply(None); + return; + } + match trimmed.parse::() { + Ok(parsed) => apply(Some(parsed)), + Err(err) => errors.push(FormError::new(field, err.to_string())), + } +} + fn parse_u64_field(value: &str, field: &'static str, errors: &mut Vec, apply: F) where F: FnOnce(u64), diff --git a/configurator/src/models/fields.rs b/configurator/src/models/fields.rs index 982e8b7e..ee9e3e84 100644 --- a/configurator/src/models/fields.rs +++ b/configurator/src/models/fields.rs @@ -1,6 +1,7 @@ use wayscriber::config::{ SessionCompression, SessionStorageMode, StatusPosition, ToolbarLayoutMode, }; +use wayscriber::input::EraserMode; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum FontStyleOption { @@ -118,6 +119,45 @@ impl std::fmt::Display for FontWeightOption { } } +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum EraserModeOption { + Brush, + Stroke, +} + +impl EraserModeOption { + pub fn list() -> Vec { + vec![Self::Brush, Self::Stroke] + } + + pub fn label(&self) -> &'static str { + match self { + Self::Brush => "Brush", + Self::Stroke => "Stroke", + } + } + + pub fn to_mode(self) -> EraserMode { + match self { + Self::Brush => EraserMode::Brush, + Self::Stroke => EraserMode::Stroke, + } + } + + pub fn from_mode(mode: EraserMode) -> Self { + match mode { + EraserMode::Brush => EraserModeOption::Brush, + EraserMode::Stroke => EraserModeOption::Stroke, + } + } +} + +impl std::fmt::Display for EraserModeOption { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(self.label()) + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum StatusPositionOption { TopLeft, @@ -336,9 +376,16 @@ impl std::fmt::Display for BoardModeOption { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ToggleField { DrawingTextBackground, + DrawingFillEnabled, PerformanceVsync, UiShowStatusBar, UiShowFrozenBadge, + UiContextMenuEnabled, + UiXdgFullscreen, + UiToolbarTopPinned, + UiToolbarSidePinned, + UiToolbarUseIcons, + UiToolbarShowMoreColors, UiToolbarPresetToasts, UiToolbarShowPresets, UiToolbarShowActionsSection, @@ -346,6 +393,10 @@ pub enum ToggleField { UiToolbarShowStepSection, UiToolbarShowTextControls, UiToolbarShowSettingsSection, + UiToolbarShowDelaySliders, + UiToolbarShowMarkerOpacitySection, + UiToolbarShowToolPreview, + UiToolbarForceInline, UiClickHighlightEnabled, UiClickHighlightUsePenColor, BoardEnabled, @@ -356,22 +407,38 @@ pub enum ToggleField { SessionPersistTransparent, SessionPersistWhiteboard, SessionPersistBlackboard, + SessionPersistHistory, SessionRestoreToolState, SessionPerOutput, + HistoryCustomSectionEnabled, ArrowHeadAtEnd, + TabletEnabled, + TabletPressureEnabled, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum TextField { DrawingColorName, DrawingThickness, + DrawingEraserSize, DrawingFontSize, + DrawingMarkerOpacity, DrawingFontFamily, DrawingFontWeight, DrawingFontStyle, + DrawingHitTestTolerance, + DrawingHitTestThreshold, + DrawingUndoStackLimit, ArrowLength, ArrowAngle, PerformanceUiAnimationFps, + HistoryUndoAllDelayMs, + HistoryRedoAllDelayMs, + HistoryCustomUndoDelayMs, + HistoryCustomRedoDelayMs, + HistoryCustomUndoSteps, + HistoryCustomRedoSteps, + UiPreferredOutput, StatusFontSize, StatusPadding, StatusDotRadius, @@ -385,11 +452,18 @@ pub enum TextField { CaptureSaveDirectory, CaptureFilename, CaptureFormat, + ToolbarTopOffset, + ToolbarTopOffsetY, + ToolbarSideOffset, + ToolbarSideOffsetX, SessionCustomDirectory, SessionMaxShapesPerFrame, SessionMaxFileSizeMb, SessionAutoCompressThresholdKb, + SessionMaxPersistedUndoDepth, SessionBackupRetention, + TabletMinThickness, + TabletMaxThickness, } #[derive(Debug, Clone, Copy, PartialEq, Eq)] diff --git a/configurator/src/models/keybindings.rs b/configurator/src/models/keybindings.rs index 73d27c96..e34d0a4c 100644 --- a/configurator/src/models/keybindings.rs +++ b/configurator/src/models/keybindings.rs @@ -20,21 +20,53 @@ pub enum KeybindingField { EnterStickyNoteMode, ClearCanvas, Undo, + Redo, + UndoAll, + RedoAll, + UndoAllDelayed, + RedoAllDelayed, + DuplicateSelection, CopySelection, PasteSelection, SelectAll, + MoveSelectionToFront, + MoveSelectionToBack, + NudgeSelectionUp, + NudgeSelectionDown, + NudgeSelectionLeft, + NudgeSelectionRight, + NudgeSelectionUpLarge, + NudgeSelectionDownLarge, + MoveSelectionToStart, + MoveSelectionToEnd, + MoveSelectionToTop, + MoveSelectionToBottom, + DeleteSelection, IncreaseThickness, DecreaseThickness, + IncreaseMarkerOpacity, + DecreaseMarkerOpacity, SelectPenTool, SelectEraserTool, ToggleEraserMode, SelectMarkerTool, + SelectLineTool, + SelectRectTool, + SelectEllipseTool, + SelectArrowTool, + SelectHighlightTool, IncreaseFontSize, DecreaseFontSize, ToggleWhiteboard, ToggleBlackboard, ReturnToTransparent, ToggleHelp, + ToggleStatusBar, + ToggleClickHighlight, + ToggleToolbar, + ToggleFill, + ToggleHighlightTool, + OpenContextMenu, OpenConfigurator, SetColorRed, SetColorGreen, @@ -132,21 +164,53 @@ impl KeybindingField { Self::EnterStickyNoteMode, Self::ClearCanvas, Self::Undo, + Self::Redo, + Self::UndoAll, + Self::RedoAll, + Self::UndoAllDelayed, + Self::RedoAllDelayed, + Self::DuplicateSelection, Self::CopySelection, Self::PasteSelection, Self::SelectAll, + Self::MoveSelectionToFront, + Self::MoveSelectionToBack, + Self::NudgeSelectionUp, + Self::NudgeSelectionDown, + Self::NudgeSelectionLeft, + Self::NudgeSelectionRight, + Self::NudgeSelectionUpLarge, + Self::NudgeSelectionDownLarge, + Self::MoveSelectionToStart, + Self::MoveSelectionToEnd, + Self::MoveSelectionToTop, + Self::MoveSelectionToBottom, + Self::DeleteSelection, Self::IncreaseThickness, Self::DecreaseThickness, + Self::IncreaseMarkerOpacity, + Self::DecreaseMarkerOpacity, Self::SelectPenTool, Self::SelectEraserTool, Self::ToggleEraserMode, Self::SelectMarkerTool, + Self::SelectLineTool, + Self::SelectRectTool, + Self::SelectEllipseTool, + Self::SelectArrowTool, + Self::SelectHighlightTool, Self::IncreaseFontSize, Self::DecreaseFontSize, Self::ToggleWhiteboard, Self::ToggleBlackboard, Self::ReturnToTransparent, Self::ToggleHelp, + Self::ToggleStatusBar, + Self::ToggleClickHighlight, + Self::ToggleToolbar, + Self::ToggleFill, + Self::ToggleHighlightTool, + Self::OpenContextMenu, Self::OpenConfigurator, Self::SetColorRed, Self::SetColorGreen, @@ -197,21 +261,53 @@ impl KeybindingField { Self::EnterStickyNoteMode => "Enter sticky note mode", Self::ClearCanvas => "Clear canvas", Self::Undo => "Undo", + Self::Redo => "Redo", + Self::UndoAll => "Undo all", + Self::RedoAll => "Redo all", + Self::UndoAllDelayed => "Undo all (delayed)", + Self::RedoAllDelayed => "Redo all (delayed)", + Self::DuplicateSelection => "Duplicate selection", Self::CopySelection => "Copy selection", Self::PasteSelection => "Paste selection", Self::SelectAll => "Select all", + Self::MoveSelectionToFront => "Move selection to front", + Self::MoveSelectionToBack => "Move selection to back", + Self::NudgeSelectionUp => "Nudge selection up", + Self::NudgeSelectionDown => "Nudge selection down", + Self::NudgeSelectionLeft => "Nudge selection left", + Self::NudgeSelectionRight => "Nudge selection right", + Self::NudgeSelectionUpLarge => "Nudge selection up (large)", + Self::NudgeSelectionDownLarge => "Nudge selection down (large)", + Self::MoveSelectionToStart => "Move selection to start", + Self::MoveSelectionToEnd => "Move selection to end", + Self::MoveSelectionToTop => "Move selection to top", + Self::MoveSelectionToBottom => "Move selection to bottom", + Self::DeleteSelection => "Delete selection", Self::IncreaseThickness => "Increase thickness", Self::DecreaseThickness => "Decrease thickness", + Self::IncreaseMarkerOpacity => "Increase marker opacity", + Self::DecreaseMarkerOpacity => "Decrease marker opacity", Self::SelectPenTool => "Select pen tool", Self::SelectEraserTool => "Select eraser tool", Self::ToggleEraserMode => "Toggle eraser mode", Self::SelectMarkerTool => "Select marker tool", + Self::SelectLineTool => "Select line tool", + Self::SelectRectTool => "Select rectangle tool", + Self::SelectEllipseTool => "Select ellipse tool", + Self::SelectArrowTool => "Select arrow tool", + Self::SelectHighlightTool => "Select highlight tool", Self::IncreaseFontSize => "Increase font size", Self::DecreaseFontSize => "Decrease font size", Self::ToggleWhiteboard => "Toggle whiteboard", Self::ToggleBlackboard => "Toggle blackboard", Self::ReturnToTransparent => "Return to transparent", Self::ToggleHelp => "Toggle help", + Self::ToggleStatusBar => "Toggle status bar", + Self::ToggleClickHighlight => "Toggle click highlight", + Self::ToggleToolbar => "Toggle toolbar", + Self::ToggleFill => "Toggle fill", + Self::ToggleHighlightTool => "Toggle highlight tool", + Self::OpenContextMenu => "Open context menu", Self::OpenConfigurator => "Open configurator", Self::SetColorRed => "Color: red", Self::SetColorGreen => "Color: green", @@ -262,21 +358,53 @@ impl KeybindingField { Self::EnterStickyNoteMode => "enter_sticky_note_mode", Self::ClearCanvas => "clear_canvas", Self::Undo => "undo", + Self::Redo => "redo", + Self::UndoAll => "undo_all", + Self::RedoAll => "redo_all", + Self::UndoAllDelayed => "undo_all_delayed", + Self::RedoAllDelayed => "redo_all_delayed", + Self::DuplicateSelection => "duplicate_selection", Self::CopySelection => "copy_selection", Self::PasteSelection => "paste_selection", Self::SelectAll => "select_all", + Self::MoveSelectionToFront => "move_selection_to_front", + Self::MoveSelectionToBack => "move_selection_to_back", + Self::NudgeSelectionUp => "nudge_selection_up", + Self::NudgeSelectionDown => "nudge_selection_down", + Self::NudgeSelectionLeft => "nudge_selection_left", + Self::NudgeSelectionRight => "nudge_selection_right", + Self::NudgeSelectionUpLarge => "nudge_selection_up_large", + Self::NudgeSelectionDownLarge => "nudge_selection_down_large", + Self::MoveSelectionToStart => "move_selection_to_start", + Self::MoveSelectionToEnd => "move_selection_to_end", + Self::MoveSelectionToTop => "move_selection_to_top", + Self::MoveSelectionToBottom => "move_selection_to_bottom", + Self::DeleteSelection => "delete_selection", Self::IncreaseThickness => "increase_thickness", Self::DecreaseThickness => "decrease_thickness", + Self::IncreaseMarkerOpacity => "increase_marker_opacity", + Self::DecreaseMarkerOpacity => "decrease_marker_opacity", Self::SelectPenTool => "select_pen_tool", Self::SelectEraserTool => "select_eraser_tool", Self::ToggleEraserMode => "toggle_eraser_mode", Self::SelectMarkerTool => "select_marker_tool", + Self::SelectLineTool => "select_line_tool", + Self::SelectRectTool => "select_rect_tool", + Self::SelectEllipseTool => "select_ellipse_tool", + Self::SelectArrowTool => "select_arrow_tool", + Self::SelectHighlightTool => "select_highlight_tool", Self::IncreaseFontSize => "increase_font_size", Self::DecreaseFontSize => "decrease_font_size", Self::ToggleWhiteboard => "toggle_whiteboard", Self::ToggleBlackboard => "toggle_blackboard", Self::ReturnToTransparent => "return_to_transparent", Self::ToggleHelp => "toggle_help", + Self::ToggleStatusBar => "toggle_status_bar", + Self::ToggleClickHighlight => "toggle_click_highlight", + Self::ToggleToolbar => "toggle_toolbar", + Self::ToggleFill => "toggle_fill", + Self::ToggleHighlightTool => "toggle_highlight_tool", + Self::OpenContextMenu => "open_context_menu", Self::OpenConfigurator => "open_configurator", Self::SetColorRed => "set_color_red", Self::SetColorGreen => "set_color_green", @@ -327,21 +455,53 @@ impl KeybindingField { Self::EnterStickyNoteMode => &config.enter_sticky_note_mode, Self::ClearCanvas => &config.clear_canvas, Self::Undo => &config.undo, + Self::Redo => &config.redo, + Self::UndoAll => &config.undo_all, + Self::RedoAll => &config.redo_all, + Self::UndoAllDelayed => &config.undo_all_delayed, + Self::RedoAllDelayed => &config.redo_all_delayed, + Self::DuplicateSelection => &config.duplicate_selection, Self::CopySelection => &config.copy_selection, Self::PasteSelection => &config.paste_selection, Self::SelectAll => &config.select_all, + Self::MoveSelectionToFront => &config.move_selection_to_front, + Self::MoveSelectionToBack => &config.move_selection_to_back, + Self::NudgeSelectionUp => &config.nudge_selection_up, + Self::NudgeSelectionDown => &config.nudge_selection_down, + Self::NudgeSelectionLeft => &config.nudge_selection_left, + Self::NudgeSelectionRight => &config.nudge_selection_right, + Self::NudgeSelectionUpLarge => &config.nudge_selection_up_large, + Self::NudgeSelectionDownLarge => &config.nudge_selection_down_large, + Self::MoveSelectionToStart => &config.move_selection_to_start, + Self::MoveSelectionToEnd => &config.move_selection_to_end, + Self::MoveSelectionToTop => &config.move_selection_to_top, + Self::MoveSelectionToBottom => &config.move_selection_to_bottom, + Self::DeleteSelection => &config.delete_selection, Self::IncreaseThickness => &config.increase_thickness, Self::DecreaseThickness => &config.decrease_thickness, + Self::IncreaseMarkerOpacity => &config.increase_marker_opacity, + Self::DecreaseMarkerOpacity => &config.decrease_marker_opacity, Self::SelectPenTool => &config.select_pen_tool, Self::SelectEraserTool => &config.select_eraser_tool, Self::ToggleEraserMode => &config.toggle_eraser_mode, Self::SelectMarkerTool => &config.select_marker_tool, + Self::SelectLineTool => &config.select_line_tool, + Self::SelectRectTool => &config.select_rect_tool, + Self::SelectEllipseTool => &config.select_ellipse_tool, + Self::SelectArrowTool => &config.select_arrow_tool, + Self::SelectHighlightTool => &config.select_highlight_tool, Self::IncreaseFontSize => &config.increase_font_size, Self::DecreaseFontSize => &config.decrease_font_size, Self::ToggleWhiteboard => &config.toggle_whiteboard, Self::ToggleBlackboard => &config.toggle_blackboard, Self::ReturnToTransparent => &config.return_to_transparent, Self::ToggleHelp => &config.toggle_help, + Self::ToggleStatusBar => &config.toggle_status_bar, + Self::ToggleClickHighlight => &config.toggle_click_highlight, + Self::ToggleToolbar => &config.toggle_toolbar, + Self::ToggleFill => &config.toggle_fill, + Self::ToggleHighlightTool => &config.toggle_highlight_tool, + Self::OpenContextMenu => &config.open_context_menu, Self::OpenConfigurator => &config.open_configurator, Self::SetColorRed => &config.set_color_red, Self::SetColorGreen => &config.set_color_green, @@ -392,21 +552,53 @@ impl KeybindingField { Self::EnterStickyNoteMode => config.enter_sticky_note_mode = value, Self::ClearCanvas => config.clear_canvas = value, Self::Undo => config.undo = value, + Self::Redo => config.redo = value, + Self::UndoAll => config.undo_all = value, + Self::RedoAll => config.redo_all = value, + Self::UndoAllDelayed => config.undo_all_delayed = value, + Self::RedoAllDelayed => config.redo_all_delayed = value, + Self::DuplicateSelection => config.duplicate_selection = value, Self::CopySelection => config.copy_selection = value, Self::PasteSelection => config.paste_selection = value, Self::SelectAll => config.select_all = value, + Self::MoveSelectionToFront => config.move_selection_to_front = value, + Self::MoveSelectionToBack => config.move_selection_to_back = value, + Self::NudgeSelectionUp => config.nudge_selection_up = value, + Self::NudgeSelectionDown => config.nudge_selection_down = value, + Self::NudgeSelectionLeft => config.nudge_selection_left = value, + Self::NudgeSelectionRight => config.nudge_selection_right = value, + Self::NudgeSelectionUpLarge => config.nudge_selection_up_large = value, + Self::NudgeSelectionDownLarge => config.nudge_selection_down_large = value, + Self::MoveSelectionToStart => config.move_selection_to_start = value, + Self::MoveSelectionToEnd => config.move_selection_to_end = value, + Self::MoveSelectionToTop => config.move_selection_to_top = value, + Self::MoveSelectionToBottom => config.move_selection_to_bottom = value, + Self::DeleteSelection => config.delete_selection = value, Self::IncreaseThickness => config.increase_thickness = value, Self::DecreaseThickness => config.decrease_thickness = value, + Self::IncreaseMarkerOpacity => config.increase_marker_opacity = value, + Self::DecreaseMarkerOpacity => config.decrease_marker_opacity = value, Self::SelectPenTool => config.select_pen_tool = value, Self::SelectEraserTool => config.select_eraser_tool = value, Self::ToggleEraserMode => config.toggle_eraser_mode = value, Self::SelectMarkerTool => config.select_marker_tool = value, + Self::SelectLineTool => config.select_line_tool = value, + Self::SelectRectTool => config.select_rect_tool = value, + Self::SelectEllipseTool => config.select_ellipse_tool = value, + Self::SelectArrowTool => config.select_arrow_tool = value, + Self::SelectHighlightTool => config.select_highlight_tool = value, Self::IncreaseFontSize => config.increase_font_size = value, Self::DecreaseFontSize => config.decrease_font_size = value, Self::ToggleWhiteboard => config.toggle_whiteboard = value, Self::ToggleBlackboard => config.toggle_blackboard = value, Self::ReturnToTransparent => config.return_to_transparent = value, Self::ToggleHelp => config.toggle_help = value, + Self::ToggleStatusBar => config.toggle_status_bar = value, + Self::ToggleClickHighlight => config.toggle_click_highlight = value, + Self::ToggleToolbar => config.toggle_toolbar = value, + Self::ToggleFill => config.toggle_fill = value, + Self::ToggleHighlightTool => config.toggle_highlight_tool = value, + Self::OpenContextMenu => config.open_context_menu = value, Self::OpenConfigurator => config.open_configurator = value, Self::SetColorRed => config.set_color_red = value, Self::SetColorGreen => config.set_color_green = value, diff --git a/configurator/src/models/mod.rs b/configurator/src/models/mod.rs index c8da219d..ae062214 100644 --- a/configurator/src/models/mod.rs +++ b/configurator/src/models/mod.rs @@ -9,8 +9,8 @@ pub mod util; pub use color::{ColorMode, ColorQuadInput, ColorTripletInput, NamedColorOption}; pub use config::ConfigDraft; pub use fields::{ - BoardModeOption, FontStyleOption, FontWeightOption, OverrideOption, QuadField, - SessionCompressionOption, SessionStorageModeOption, StatusPositionOption, TextField, + BoardModeOption, EraserModeOption, FontStyleOption, FontWeightOption, OverrideOption, + QuadField, SessionCompressionOption, SessionStorageModeOption, StatusPositionOption, TextField, ToggleField, ToolbarLayoutModeOption, ToolbarOverrideField, TripletField, }; pub use keybindings::KeybindingField; diff --git a/configurator/src/models/tab.rs b/configurator/src/models/tab.rs index 8ef071e9..b22a91fc 100644 --- a/configurator/src/models/tab.rs +++ b/configurator/src/models/tab.rs @@ -2,36 +2,42 @@ pub enum TabId { Drawing, Arrow, + History, Performance, Ui, Board, Capture, Session, Keybindings, + Tablet, } impl TabId { - pub const ALL: [TabId; 8] = [ + pub const ALL: [TabId; 10] = [ TabId::Drawing, TabId::Ui, TabId::Board, TabId::Performance, + TabId::History, TabId::Capture, TabId::Session, TabId::Keybindings, TabId::Arrow, + TabId::Tablet, ]; pub fn title(&self) -> &'static str { match self { TabId::Drawing => "Drawing", TabId::Arrow => "Arrow", + TabId::History => "History", TabId::Performance => "Performance", TabId::Ui => "UI", TabId::Board => "Board", TabId::Capture => "Capture", TabId::Session => "Session", TabId::Keybindings => "Keybindings", + TabId::Tablet => "Tablet", } } }