Thanks to visit codestin.com
Credit goes to github.com

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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ save-after-copy = false
default-hide-toolbars = false
# Experimental: whether window focus shows/hides toolbars. This does not affect initial state of toolbars, see default-hide-toolbars.
focus-toggles-toolbars = false
# Fill shapes by default
default-fill-shapes = false
# The primary highlighter to use, the other is accessible by holding CTRL at the start of a highlight [possible values: block, freehand]
primary-highlighter = "block"
# Disable notifications
Expand Down Expand Up @@ -170,6 +172,8 @@ Options:
Hide toolbars by default
--focus-toggles-toolbars
Experimental: Whether to toggle toolbars based on focus. Doesn't affect initial state
--default-fill-shapes
Fill shapes by default
--font-family <FONT_FAMILY>
Font family to use for text annotations
--font-style <FONT_STYLE>
Expand Down
4 changes: 4 additions & 0 deletions src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ pub struct CommandLine {
#[arg(long)]
pub focus_toggles_toolbars: bool,

/// Fill shapes by default
#[arg(long)]
pub default_fill_shapes: bool,

/// Font family to use for text annotations
#[arg(long)]
pub font_family: Option<String>,
Expand Down
13 changes: 13 additions & 0 deletions src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub struct Configuration {
color_palette: ColorPalette,
default_hide_toolbars: bool,
focus_toggles_toolbars: bool,
default_fill_shapes: bool,
font: FontConfiguration,
primary_highlighter: Highlighters,
disable_notifications: bool,
Expand Down Expand Up @@ -189,6 +190,9 @@ impl Configuration {
if let Some(v) = general.focus_toggles_toolbars {
self.focus_toggles_toolbars = v;
}
if let Some(v) = general.default_fill_shapes {
self.default_fill_shapes = v;
}
if let Some(v) = general.primary_highlighter {
self.primary_highlighter = v;
}
Expand Down Expand Up @@ -250,6 +254,9 @@ impl Configuration {
if command_line.focus_toggles_toolbars {
self.focus_toggles_toolbars = command_line.focus_toggles_toolbars
}
if command_line.default_fill_shapes {
self.default_fill_shapes = command_line.default_fill_shapes;
}
if let Some(v) = command_line.initial_tool {
self.initial_tool = v.into();
}
Expand Down Expand Up @@ -371,6 +378,10 @@ impl Configuration {
self.focus_toggles_toolbars
}

pub fn default_fill_shapes(&self) -> bool {
self.default_fill_shapes
}

pub fn primary_highlighter(&self) -> Highlighters {
self.primary_highlighter
}
Expand Down Expand Up @@ -414,6 +425,7 @@ impl Default for Configuration {
color_palette: ColorPalette::default(),
default_hide_toolbars: false,
focus_toggles_toolbars: false,
default_fill_shapes: false,
font: FontConfiguration::default(),
primary_highlighter: Highlighters::Block,
disable_notifications: false,
Expand Down Expand Up @@ -470,6 +482,7 @@ struct ConfigurationFileGeneral {
actions_on_right_click: Option<Vec<Action>>,
default_hide_toolbars: Option<bool>,
focus_toggles_toolbars: Option<bool>,
default_fill_shapes: Option<bool>,
primary_highlighter: Option<Highlighters>,
disable_notifications: Option<bool>,
no_window_decoration: Option<bool>,
Expand Down
2 changes: 1 addition & 1 deletion src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Default for Style {
Self {
color: Color::default(),
size: Size::default(),
fill: bool::default(),
fill: APP_CONFIG.read().default_fill_shapes(),
annotation_size_factor: APP_CONFIG.read().annotation_size_factor(),
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/ui/toolbars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,11 @@ impl Component for StyleToolbar {
set_focusable: false,
set_hexpand: false,

set_icon_name: "paint-bucket-regular",
set_icon_name: if APP_CONFIG.read().default_fill_shapes() {
"paint-bucket-filled"
} else {
"paint-bucket-regular"
},
set_tooltip: "Fill shape",
connect_clicked[sender] => move |button| {
sender.output_sender().emit(ToolbarEvent::ToggleFill);
Expand Down
Loading