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
10 changes: 9 additions & 1 deletion config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ capture_clipboard_selection = ["Ctrl+Shift+C"]
capture_file_selection = ["Ctrl+Shift+S"]
capture_clipboard_region = ["Ctrl+6"]
capture_file_region = ["Ctrl+Alt+6"]
export_canvas_file = []
export_canvas_clipboard = []
export_canvas_clipboard_and_file = []

# Open the most recent capture folder
open_capture_folder = ["Ctrl+Alt+O"]
Expand Down Expand Up @@ -622,11 +625,16 @@ auto_adjust_pen = true
apply_to_canvas = true
# Apply profiles to screen-space UI chrome, toolbars, popups, and status text
apply_to_ui = true
# Accepted values: "off", "active", "profile".
# Explicit canvas PNG export applies this selector to persisted canvas content.
export = "off"
# Used only when export = "profile".
# export_profile = "print"

# Render profiles remap final rendered pixels by exact RGB match. Alpha is
# preserved, and colors not listed here are unchanged.
#
# [[render_profiles.items]]
# [[render_profiles.profiles]]
# id = "print"
# name = "Print"
# mappings = [
Expand Down
6 changes: 4 additions & 2 deletions configurator/src/app/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use wayscriber::config::{Config, PRESET_SLOTS_MAX};

use crate::messages::Message;
use crate::models::{
ColorPickerId, ConfigDraft, DaemonRuntimeStatus, DesktopEnvironment, KeybindingsTabId, TabId,
ToolbarLayoutModeOption, UiTabId,
ColorPickerId, ConfigDraft, DaemonRuntimeStatus, DesktopEnvironment, DragMouseButton,
KeybindingsTabId, TabId, ToolbarLayoutModeOption, UiTabId,
};

use super::daemon_setup::load_daemon_runtime_status;
Expand All @@ -24,6 +24,7 @@ pub(crate) struct ConfiguratorApp {
pub(crate) active_tab: TabId,
pub(crate) active_ui_tab: UiTabId,
pub(crate) active_keybindings_tab: KeybindingsTabId,
pub(crate) active_drawing_drag_button: Option<DragMouseButton>,
pub(crate) preset_collapsed: Vec<bool>,
pub(crate) boards_collapsed: Vec<bool>,
pub(crate) color_picker_open: Option<ColorPickerId>,
Expand Down Expand Up @@ -97,6 +98,7 @@ impl ConfiguratorApp {
active_tab: TabId::Daemon,
active_ui_tab: UiTabId::Toolbar,
active_keybindings_tab: KeybindingsTabId::General,
active_drawing_drag_button: None,
preset_collapsed: vec![false; PRESET_SLOTS_MAX],
boards_collapsed: vec![false; boards_len],
color_picker_open: None,
Expand Down
51 changes: 51 additions & 0 deletions configurator/src/app/update/color_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,27 @@ impl ConfiguratorApp {
}
}

pub(super) fn sync_render_profile_color_picker_hex(&mut self) {
for profile_index in 0..self.draft.render_profiles.profiles.len() {
let mapping_len = self.draft.render_profiles.profiles[profile_index]
.mappings
.len();
for mapping_index in 0..mapping_len {
self.sync_color_picker_hex_for_id(ColorPickerId::RenderProfileMappingFrom(
profile_index,
mapping_index,
));
self.sync_color_picker_hex_for_id(ColorPickerId::RenderProfileMappingTo(
profile_index,
mapping_index,
));
}
}
}

pub(crate) fn sync_all_color_picker_hex(&mut self) {
self.sync_board_color_picker_hex();
self.sync_render_profile_color_picker_hex();
for id in [
ColorPickerId::DrawingColor,
ColorPickerId::StatusBarBg,
Expand Down Expand Up @@ -130,6 +149,23 @@ impl ConfiguratorApp {
}
}
}
ColorPickerId::RenderProfileMappingFrom(profile_index, mapping_index)
| ColorPickerId::RenderProfileMappingTo(profile_index, mapping_index) => {
if let Some(mapping) = self
.draft
.render_profiles
.profiles
.get_mut(profile_index)
.and_then(|profile| profile.mappings.get_mut(mapping_index))
{
let hex = hex_from_rgb(rgb);
match id {
ColorPickerId::RenderProfileMappingFrom(_, _) => mapping.from = hex,
ColorPickerId::RenderProfileMappingTo(_, _) => mapping.to = hex,
_ => {}
}
}
}
ColorPickerId::StatusBarBg => {
self.apply_quad_rgb(QuadField::StatusBarBg, values, alpha);
}
Expand Down Expand Up @@ -184,6 +220,21 @@ impl ConfiguratorApp {
None,
)
}),
ColorPickerId::RenderProfileMappingFrom(profile_index, mapping_index)
| ColorPickerId::RenderProfileMappingTo(profile_index, mapping_index) => {
let mapping = self
.draft
.render_profiles
.profiles
.get(profile_index)
.and_then(|profile| profile.mappings.get(mapping_index))?;
let value = match id {
ColorPickerId::RenderProfileMappingFrom(_, _) => &mapping.from,
ColorPickerId::RenderProfileMappingTo(_, _) => &mapping.to,
_ => return None,
};
parse_hex(value).map(|(rgb, _)| (rgb, None))
}
ColorPickerId::StatusBarBg => {
let values = parse_quad_values(&self.draft.status_bar_bg_color.components);
Some(([values[0], values[1], values[2]], Some(values[3])))
Expand Down
34 changes: 34 additions & 0 deletions configurator/src/app/update/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod config;
mod daemon;
mod fields;
mod presets;
mod render_profiles;
mod tabs;

use iced::Task;
Expand Down Expand Up @@ -52,6 +53,9 @@ impl ConfiguratorApp {
Message::ColorModeChanged(mode) => self.handle_color_mode_changed(mode),
Message::NamedColorSelected(option) => self.handle_named_color_selected(option),
Message::EraserModeChanged(option) => self.handle_eraser_mode_changed(option),
Message::DrawingDragMappingSectionToggled(button) => {
self.handle_drawing_drag_mapping_section_toggled(button)
}
Message::DrawingMouseDragToolChanged(button, field, option) => {
self.handle_drawing_mouse_drag_tool_changed(button, field, option)
}
Expand Down Expand Up @@ -93,6 +97,36 @@ impl ConfiguratorApp {
Message::BoardsItemToggleChanged(index, field, value) => {
self.handle_boards_item_toggle_changed(index, field, value)
}
Message::RenderProfileAdd => self.handle_render_profile_add(),
Message::RenderProfileRemove(index) => self.handle_render_profile_remove(index),
Message::RenderProfileDuplicate(index) => self.handle_render_profile_duplicate(index),
Message::RenderProfileTextChanged(index, field, value) => {
self.handle_render_profile_text_changed(index, field, value)
}
Message::RenderProfileActiveChanged(value) => {
self.handle_render_profile_active_changed(value)
}
Message::RenderProfileExportChanged(value) => {
self.handle_render_profile_export_changed(value)
}
Message::RenderProfileExportProfileChanged(value) => {
self.handle_render_profile_export_profile_changed(value)
}
Message::RenderProfileApplyCanvasChanged(value) => {
self.handle_render_profile_apply_canvas_changed(value)
}
Message::RenderProfileApplyUiChanged(value) => {
self.handle_render_profile_apply_ui_changed(value)
}
Message::RenderProfileMappingAdd(index) => {
self.handle_render_profile_mapping_add(index)
}
Message::RenderProfileMappingRemove(profile, mapping) => {
self.handle_render_profile_mapping_remove(profile, mapping)
}
Message::RenderProfileMappingColorChanged(profile, mapping, side, value) => {
self.handle_render_profile_mapping_color_changed(profile, mapping, side, value)
}
Message::SessionStorageModeChanged(option) => {
self.handle_session_storage_mode_changed(option)
}
Expand Down
Loading
Loading