Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ decrease_marker_opacity = ["Ctrl+Alt+ArrowDown"]
select_selection_tool = ["V"]
select_pen_tool = ["F"]
select_marker_tool = ["H"]
select_step_marker_tool = []
select_eraser_tool = ["D"]
# Toggle eraser behavior mode
toggle_eraser_mode = ["Ctrl+Shift+E"]
Expand All @@ -89,6 +90,10 @@ select_arrow_tool = []
select_highlight_tool = []
toggle_highlight_tool = ["Ctrl+Alt+H"]

# Reset label counters
reset_arrow_labels = ["Ctrl+Shift+R"]
reset_step_markers = []

# Adjust font size
increase_font_size = ["Ctrl+Shift++", "Ctrl+Shift+="]
decrease_font_size = ["Ctrl+Shift+-", "Ctrl+Shift+_"]
Expand Down
5 changes: 5 additions & 0 deletions configurator/src/models/fields/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub enum ToolOption {
Ellipse,
Arrow,
Marker,
StepMarker,
Highlight,
Eraser,
}
Expand All @@ -23,6 +24,7 @@ impl ToolOption {
Self::Ellipse,
Self::Arrow,
Self::Marker,
Self::StepMarker,
Self::Highlight,
Self::Eraser,
]
Expand All @@ -37,6 +39,7 @@ impl ToolOption {
Self::Ellipse => "Ellipse",
Self::Arrow => "Arrow",
Self::Marker => "Marker",
Self::StepMarker => "Step",
Self::Highlight => "Highlight",
Self::Eraser => "Eraser",
}
Expand All @@ -51,6 +54,7 @@ impl ToolOption {
Self::Ellipse => Tool::Ellipse,
Self::Arrow => Tool::Arrow,
Self::Marker => Tool::Marker,
Self::StepMarker => Tool::StepMarker,
Self::Highlight => Tool::Highlight,
Self::Eraser => Tool::Eraser,
}
Expand All @@ -65,6 +69,7 @@ impl ToolOption {
Tool::Ellipse => Self::Ellipse,
Tool::Arrow => Self::Arrow,
Tool::Marker => Self::Marker,
Tool::StepMarker => Self::StepMarker,
Tool::Highlight => Self::Highlight,
Tool::Eraser => Self::Eraser,
}
Expand Down
4 changes: 4 additions & 0 deletions configurator/src/models/keybindings/field/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl KeybindingField {
Self::SelectEraserTool => &config.tools.select_eraser_tool,
Self::ToggleEraserMode => &config.tools.toggle_eraser_mode,
Self::SelectMarkerTool => &config.tools.select_marker_tool,
Self::SelectStepMarkerTool => &config.tools.select_step_marker_tool,
Self::SelectLineTool => &config.tools.select_line_tool,
Self::SelectRectTool => &config.tools.select_rect_tool,
Self::SelectEllipseTool => &config.tools.select_ellipse_tool,
Expand Down Expand Up @@ -111,6 +112,7 @@ impl KeybindingField {
Self::ToggleZoomLock => &config.zoom.toggle_zoom_lock,
Self::RefreshZoomCapture => &config.zoom.refresh_zoom_capture,
Self::ResetArrowLabels => &config.tools.reset_arrow_labels,
Self::ResetStepMarkers => &config.tools.reset_step_markers,
Self::ApplyPreset1 => &config.presets.apply_preset_1,
Self::ApplyPreset2 => &config.presets.apply_preset_2,
Self::ApplyPreset3 => &config.presets.apply_preset_3,
Expand Down Expand Up @@ -171,6 +173,7 @@ impl KeybindingField {
Self::SelectEraserTool => config.tools.select_eraser_tool = value,
Self::ToggleEraserMode => config.tools.toggle_eraser_mode = value,
Self::SelectMarkerTool => config.tools.select_marker_tool = value,
Self::SelectStepMarkerTool => config.tools.select_step_marker_tool = value,
Self::SelectLineTool => config.tools.select_line_tool = value,
Self::SelectRectTool => config.tools.select_rect_tool = value,
Self::SelectEllipseTool => config.tools.select_ellipse_tool = value,
Expand Down Expand Up @@ -238,6 +241,7 @@ impl KeybindingField {
Self::ToggleZoomLock => config.zoom.toggle_zoom_lock = value,
Self::RefreshZoomCapture => config.zoom.refresh_zoom_capture = value,
Self::ResetArrowLabels => config.tools.reset_arrow_labels = value,
Self::ResetStepMarkers => config.tools.reset_step_markers = value,
Self::ApplyPreset1 => config.presets.apply_preset_1 = value,
Self::ApplyPreset2 => config.presets.apply_preset_2 = value,
Self::ApplyPreset3 => config.presets.apply_preset_3 = value,
Expand Down
4 changes: 4 additions & 0 deletions configurator/src/models/keybindings/field/labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl KeybindingField {
Self::SelectEraserTool => "Select eraser tool",
Self::ToggleEraserMode => "Toggle eraser mode",
Self::SelectMarkerTool => "Select marker tool",
Self::SelectStepMarkerTool => "Select step marker tool",
Self::SelectLineTool => "Select line tool",
Self::SelectRectTool => "Select rectangle tool",
Self::SelectEllipseTool => "Select ellipse tool",
Expand Down Expand Up @@ -106,6 +107,7 @@ impl KeybindingField {
Self::ToggleZoomLock => "Toggle zoom lock",
Self::RefreshZoomCapture => "Refresh zoom snapshot",
Self::ResetArrowLabels => "Reset arrow labels",
Self::ResetStepMarkers => "Reset step markers",
Self::ApplyPreset1 => "Apply preset 1",
Self::ApplyPreset2 => "Apply preset 2",
Self::ApplyPreset3 => "Apply preset 3",
Expand Down Expand Up @@ -162,6 +164,7 @@ impl KeybindingField {
Self::SelectEraserTool => "select_eraser_tool",
Self::ToggleEraserMode => "toggle_eraser_mode",
Self::SelectMarkerTool => "select_marker_tool",
Self::SelectStepMarkerTool => "select_step_marker_tool",
Self::SelectLineTool => "select_line_tool",
Self::SelectRectTool => "select_rect_tool",
Self::SelectEllipseTool => "select_ellipse_tool",
Expand Down Expand Up @@ -229,6 +232,7 @@ impl KeybindingField {
Self::ToggleZoomLock => "toggle_zoom_lock",
Self::RefreshZoomCapture => "refresh_zoom_capture",
Self::ResetArrowLabels => "reset_arrow_labels",
Self::ResetStepMarkers => "reset_step_markers",
Self::ApplyPreset1 => "apply_preset_1",
Self::ApplyPreset2 => "apply_preset_2",
Self::ApplyPreset3 => "apply_preset_3",
Expand Down
2 changes: 2 additions & 0 deletions configurator/src/models/keybindings/field/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl KeybindingField {
Self::SelectEraserTool,
Self::ToggleEraserMode,
Self::SelectMarkerTool,
Self::SelectStepMarkerTool,
Self::SelectLineTool,
Self::SelectRectTool,
Self::SelectEllipseTool,
Expand Down Expand Up @@ -106,6 +107,7 @@ impl KeybindingField {
Self::ToggleZoomLock,
Self::RefreshZoomCapture,
Self::ResetArrowLabels,
Self::ResetStepMarkers,
Self::ApplyPreset1,
Self::ApplyPreset2,
Self::ApplyPreset3,
Expand Down
2 changes: 2 additions & 0 deletions configurator/src/models/keybindings/field/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub enum KeybindingField {
SelectEraserTool,
ToggleEraserMode,
SelectMarkerTool,
SelectStepMarkerTool,
SelectLineTool,
SelectRectTool,
SelectEllipseTool,
Expand Down Expand Up @@ -93,6 +94,7 @@ pub enum KeybindingField {
ToggleZoomLock,
RefreshZoomCapture,
ResetArrowLabels,
ResetStepMarkers,
Board1,
Board2,
Board3,
Expand Down
4 changes: 3 additions & 1 deletion configurator/src/models/keybindings/field/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ impl KeybindingField {
| Self::SelectEraserTool
| Self::ToggleEraserMode
| Self::SelectMarkerTool
| Self::SelectStepMarkerTool
| Self::SelectLineTool
| Self::SelectRectTool
| Self::SelectEllipseTool
| Self::SelectArrowTool
| Self::SelectHighlightTool
| Self::ToggleHighlightTool
| Self::ResetArrowLabels => KeybindingsTabId::Tools,
| Self::ResetArrowLabels
| Self::ResetStepMarkers => KeybindingsTabId::Tools,
Self::DuplicateSelection
| Self::CopySelection
| Self::PasteSelection
Expand Down
5 changes: 5 additions & 0 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ decrease_marker_opacity = ["Ctrl+Alt+ArrowDown"]
select_selection_tool = ["V"]
select_pen_tool = ["F"]
select_marker_tool = ["H"]
select_step_marker_tool = []
select_eraser_tool = ["D"]
toggle_eraser_mode = ["Ctrl+Shift+E"]
select_line_tool = []
Expand All @@ -717,6 +718,10 @@ select_arrow_tool = []
select_highlight_tool = []
toggle_highlight_tool = ["Ctrl+Alt+H"]

# Reset label counters
reset_arrow_labels = ["Ctrl+Shift+R"]
reset_step_markers = []

# Adjust font size
increase_font_size = ["Ctrl+Shift++", "Ctrl+Shift+="]
decrease_font_size = ["Ctrl+Shift+-", "Ctrl+Shift+_"]
Expand Down
15 changes: 15 additions & 0 deletions src/backend/wayland/handlers/keyboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ impl WaylandState {
self.input_state.font_descriptor.clone(),
self.input_state.fill_enabled,
);
let highlight_before = (
self.input_state.click_highlight_enabled(),
self.input_state.highlight_tool_ring_enabled(),
self.input_state.presenter_mode,
);
self.input_state.on_key_press(key);
self.input_state.needs_redraw = true;
let prefs_changed = prefs_before.0 != self.input_state.current_color
Expand All @@ -257,6 +262,16 @@ impl WaylandState {
if prefs_changed {
self.save_drawing_preferences();
}
let highlight_after = (
self.input_state.click_highlight_enabled(),
self.input_state.highlight_tool_ring_enabled(),
self.input_state.presenter_mode,
);
if highlight_before.2 == highlight_after.2
&& (highlight_before.0 != highlight_after.0 || highlight_before.1 != highlight_after.1)
{
self.save_click_highlight_preferences();
}

#[cfg(tablet)]
if (self.input_state.current_thickness - prev_thickness).abs() > f64::EPSILON {
Expand Down
1 change: 1 addition & 0 deletions src/backend/wayland/state/render/tool_preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub(super) fn draw_tool_preview(
Tool::Ellipse => toolbar_icons::draw_icon_circle(ctx, icon_x, icon_y, icon_size),
Tool::Arrow => toolbar_icons::draw_icon_arrow(ctx, icon_x, icon_y, icon_size),
Tool::Marker => toolbar_icons::draw_icon_marker(ctx, icon_x, icon_y, icon_size),
Tool::StepMarker => toolbar_icons::draw_icon_step_marker(ctx, icon_x, icon_y, icon_size),
Tool::Highlight => toolbar_icons::draw_icon_highlight(ctx, icon_x, icon_y, icon_size),
Tool::Eraser => toolbar_icons::draw_icon_eraser(ctx, icon_x, icon_y, icon_size),
}
Expand Down
13 changes: 12 additions & 1 deletion src/backend/wayland/state/toolbar/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ impl WaylandState {
| ToolbarEvent::ToggleFill(_)
| ToolbarEvent::ApplyPreset(_)
);
let persist_click_highlight = matches!(event, ToolbarEvent::ToggleHighlightToolRing(_));
let persist_click_highlight = matches!(
event,
ToolbarEvent::ToggleAllHighlight(_) | ToolbarEvent::ToggleHighlightToolRing(_)
);

if self.input_state.apply_toolbar_event(event) {
self.toolbar.mark_dirty();
Expand Down Expand Up @@ -206,6 +209,14 @@ impl WaylandState {
}

pub(in crate::backend::wayland) fn save_click_highlight_preferences(&mut self) {
if !(self.input_state.presenter_mode
&& self
.input_state
.presenter_mode_config
.enable_click_highlight)
{
self.config.ui.click_highlight.enabled = self.input_state.click_highlight_enabled();
}
self.config.ui.click_highlight.show_on_highlight_tool =
self.input_state.highlight_tool_ring_enabled();
if let Err(err) = self.config.save() {
Expand Down
4 changes: 4 additions & 0 deletions src/backend/wayland/toolbar/layout/spec/side/sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl ToolbarLayoutSpec {
snapshot.text_active || snapshot.note_active || snapshot.show_text_controls;
let show_arrow_controls =
snapshot.active_tool == Tool::Arrow || snapshot.arrow_label_enabled;
let show_step_marker_controls = snapshot.active_tool == Tool::StepMarker;
let show_drawer_view =
snapshot.drawer_open && snapshot.drawer_tab == crate::input::ToolbarDrawerTab::View;
let show_advanced = snapshot.show_actions_advanced && show_drawer_view;
Expand Down Expand Up @@ -59,6 +60,9 @@ impl ToolbarLayoutSpec {
};
add_section(arrow_height, &mut height);
}
if show_step_marker_controls {
add_section(Self::SIDE_TOGGLE_CARD_HEIGHT_WITH_RESET, &mut height);
}
if show_marker_opacity {
add_section(Self::SIDE_SLIDER_CARD_HEIGHT, &mut height);
}
Expand Down
10 changes: 5 additions & 5 deletions src/backend/wayland/toolbar/layout/spec/top.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ impl ToolbarLayoutSpec {
pub(in crate::backend::wayland::toolbar) const TOP_SIZE_ICONS: (u32, u32) = (735, 80);
pub(in crate::backend::wayland::toolbar) const TOP_SIZE_TEXT: (u32, u32) = (875, 56);

pub(in crate::backend::wayland::toolbar) const TOP_GAP: f64 = 8.0;
pub(in crate::backend::wayland::toolbar) const TOP_START_X: f64 = 16.0;
pub(in crate::backend::wayland::toolbar) const TOP_GAP: f64 = 4.0;
pub(in crate::backend::wayland::toolbar) const TOP_START_X: f64 = 19.0;
pub(in crate::backend::wayland::toolbar) const TOP_HANDLE_SIZE: f64 = 18.0;
pub(in crate::backend::wayland::toolbar) const TOP_HANDLE_Y: f64 = 10.0;
pub(in crate::backend::wayland::toolbar) const TOP_ICON_BUTTON: f64 = 44.0;
Expand All @@ -23,7 +23,7 @@ impl ToolbarLayoutSpec {
pub(in crate::backend::wayland::toolbar) const TOP_TOGGLE_WIDTH: f64 = 84.0;
pub(in crate::backend::wayland::toolbar) const TOP_PIN_BUTTON_SIZE: f64 = 24.0;
pub(in crate::backend::wayland::toolbar) const TOP_PIN_BUTTON_GAP: f64 = 6.0;
pub(in crate::backend::wayland::toolbar) const TOP_PIN_BUTTON_MARGIN_RIGHT: f64 = 12.0;
pub(in crate::backend::wayland::toolbar) const TOP_PIN_BUTTON_MARGIN_RIGHT: f64 = 15.0;
pub(in crate::backend::wayland::toolbar) const TOP_PIN_BUTTON_Y_ICON: f64 = 15.0;
pub(in crate::backend::wayland::toolbar) const TOP_SHAPE_ROW_GAP: f64 = 6.0;

Expand Down Expand Up @@ -53,9 +53,9 @@ impl ToolbarLayoutSpec {
Self::TOP_TEXT_BUTTON_W
};
let tool_count = if self.layout_mode == ToolbarLayoutMode::Simple {
4
5
} else {
8
9
};
let mut x = Self::TOP_START_X + Self::TOP_HANDLE_SIZE + gap;
x += tool_count as f64 * (btn_w + gap);
Expand Down
4 changes: 2 additions & 2 deletions src/backend/wayland/toolbar/layout/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ fn top_size_respects_icon_mode() {
let mut state = create_test_input_state();
state.toolbar_use_icons = true;
let snapshot = snapshot_from_state(&state);
assert_eq!(top_size(&snapshot), (824, 80));
assert_eq!(top_size(&snapshot), (822, 80));

state.toolbar_use_icons = false;
let snapshot = snapshot_from_state(&state);
assert_eq!(top_size(&snapshot), (948, 56));
assert_eq!(top_size(&snapshot), (966, 56));
}

#[test]
Expand Down
2 changes: 2 additions & 0 deletions src/backend/wayland/toolbar/render/side_palette/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod pages;
mod presets;
mod settings;
mod step;
mod step_marker;
mod text;
mod thickness;

Expand Down Expand Up @@ -93,6 +94,7 @@ pub fn render_side_palette(

thickness::draw_thickness_section(&mut layout, &mut y);
arrow::draw_arrow_section(&mut layout, &mut y);
step_marker::draw_step_marker_section(&mut layout, &mut y);
marker::draw_marker_opacity_section(&mut layout, &mut y);
text::draw_text_controls_section(&mut layout, &mut y);
drawer::draw_drawer_tabs(&mut layout, &mut y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ fn draw_preset_icon(ctx: &cairo::Context, tool: Tool, x: f64, y: f64, size: f64)
Tool::Ellipse => toolbar_icons::draw_icon_circle(ctx, x, y, size),
Tool::Arrow => toolbar_icons::draw_icon_arrow(ctx, x, y, size),
Tool::Marker => toolbar_icons::draw_icon_marker(ctx, x, y, size),
Tool::StepMarker => toolbar_icons::draw_icon_step_marker(ctx, x, y, size),
Tool::Highlight => toolbar_icons::draw_icon_highlight(ctx, x, y, size),
Tool::Eraser => toolbar_icons::draw_icon_eraser(ctx, x, y, size),
}
Expand Down
Loading