Skip to content

Commit 0037f51

Browse files
committed
Add new icons to all menu bar entries
1 parent 0ec91bf commit 0037f51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+484
-194
lines changed

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"css-unused-selector": "ignore",
4444
"vite-plugin-svelte-css-no-scopable-elements": "ignore",
4545
"a11y-no-static-element-interactions": "ignore",
46-
"a11y-no-noninteractive-element-interactions": "ignore"
46+
"a11y-no-noninteractive-element-interactions": "ignore",
47+
"a11y-click-events-have-key-events": "ignore"
4748
},
4849
// VS Code config
4950
"html.format.wrapLineLength": 200,

editor/src/dispatcher.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,18 @@ impl Dispatcher {
211211
let ipp = &self.message_handlers.input_preprocessor_message_handler;
212212
let preferences = &self.message_handlers.preferences_message_handler;
213213
let current_tool = &self.message_handlers.tool_message_handler.tool_state.tool_data.active_tool_type;
214-
215-
self.message_handlers
216-
.portfolio_message_handler
217-
.process_message(message, &mut queue, PortfolioMessageData { ipp, preferences, current_tool });
214+
let message_logging_verbosity = self.message_handlers.debug_message_handler.message_logging_verbosity;
215+
216+
self.message_handlers.portfolio_message_handler.process_message(
217+
message,
218+
&mut queue,
219+
PortfolioMessageData {
220+
ipp,
221+
preferences,
222+
current_tool,
223+
message_logging_verbosity,
224+
},
225+
);
218226
}
219227
Message::Preferences(message) => {
220228
self.message_handlers.preferences_message_handler.process_message(message, &mut queue, ());

editor/src/messages/debug/utility_types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[derive(Debug, Default, Clone, Copy)]
1+
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
22
pub enum MessageLoggingVerbosity {
33
#[default]
44
Off,

editor/src/messages/dialog/simple_dialogs/demo_artwork_dialog.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,25 @@ impl LayoutHolder for DemoArtworkDialog {
3030
let mut rows_of_images_with_buttons: Vec<_> = ARTWORK
3131
.chunks(3)
3232
.flat_map(|chunk| {
33-
let images = chunk.iter().map(|(_, thumbnail, _)| ImageLabel::new(*thumbnail).width(Some("256px".into())).widget_holder()).collect();
33+
fn make_dialog(name: &str, filename: &str) -> Message {
34+
DialogMessage::CloseDialogAndThen {
35+
followups: vec![FrontendMessage::TriggerFetchAndOpenDocument {
36+
name: name.to_string(),
37+
filename: filename.to_string(),
38+
}
39+
.into()],
40+
}
41+
.into()
42+
}
43+
44+
let images = chunk
45+
.iter()
46+
.map(|(name, thumbnail, filename)| ImageButton::new(*thumbnail).width(Some("256px".into())).on_update(|_| make_dialog(name, filename)).widget_holder())
47+
.collect();
3448

3549
let buttons = chunk
3650
.iter()
37-
.map(|(name, _, filename)| {
38-
TextButton::new(*name)
39-
.min_width(256)
40-
.on_update(|_| {
41-
DialogMessage::CloseDialogAndThen {
42-
followups: vec![FrontendMessage::TriggerFetchAndOpenDocument {
43-
name: name.to_string(),
44-
filename: filename.to_string(),
45-
}
46-
.into()],
47-
}
48-
.into()
49-
})
50-
.widget_holder()
51-
})
51+
.map(|(name, _, filename)| TextButton::new(*name).min_width(256).flush(true).on_update(|_| make_dialog(name, filename)).widget_holder())
5252
.collect();
5353

5454
vec![LayoutGroup::Row { widgets: images }, LayoutGroup::Row { widgets: buttons }, LayoutGroup::Row { widgets: vec![] }]

editor/src/messages/layout/layout_message_handler.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,18 @@ impl LayoutMessageHandler {
201201
WidgetValueAction::Commit => (icon_button.on_commit.callback)(&()),
202202
WidgetValueAction::Update => (icon_button.on_update.callback)(icon_button),
203203
};
204+
205+
responses.add(callback_message);
206+
}
207+
Widget::ImageButton(image_label) => {
208+
let callback_message = match action {
209+
WidgetValueAction::Commit => (image_label.on_commit.callback)(&()),
210+
WidgetValueAction::Update => (image_label.on_update.callback)(&()),
211+
};
212+
204213
responses.add(callback_message);
205214
}
206215
Widget::IconLabel(_) => {}
207-
Widget::ImageLabel(_) => {}
208216
Widget::InvisibleStandinInput(invisible) => {
209217
let callback_message = match action {
210218
WidgetValueAction::Commit => (invisible.on_commit.callback)(&()),

editor/src/messages/layout/utility_types/layout_widget.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl LayoutGroup {
333333
Widget::FontInput(x) => &mut x.tooltip,
334334
Widget::IconButton(x) => &mut x.tooltip,
335335
Widget::IconLabel(x) => &mut x.tooltip,
336-
Widget::ImageLabel(x) => &mut x.tooltip,
336+
Widget::ImageButton(x) => &mut x.tooltip,
337337
Widget::NumberInput(x) => &mut x.tooltip,
338338
Widget::ParameterExposeButton(x) => &mut x.tooltip,
339339
Widget::PopoverButton(x) => &mut x.tooltip,
@@ -504,7 +504,7 @@ pub enum Widget {
504504
FontInput(FontInput),
505505
IconButton(IconButton),
506506
IconLabel(IconLabel),
507-
ImageLabel(ImageLabel),
507+
ImageButton(ImageButton),
508508
InvisibleStandinInput(InvisibleStandinInput),
509509
NodeCatalog(NodeCatalog),
510510
NumberInput(NumberInput),
@@ -579,8 +579,8 @@ impl DiffUpdate {
579579
Widget::ParameterExposeButton(widget) => Some((&mut widget.tooltip, &mut widget.tooltip_shortcut)),
580580
Widget::PopoverButton(widget) => Some((&mut widget.tooltip, &mut widget.tooltip_shortcut)),
581581
Widget::TextButton(widget) => Some((&mut widget.tooltip, &mut widget.tooltip_shortcut)),
582+
Widget::ImageButton(widget) => Some((&mut widget.tooltip, &mut widget.tooltip_shortcut)),
582583
Widget::IconLabel(_)
583-
| Widget::ImageLabel(_)
584584
| Widget::CurveInput(_)
585585
| Widget::InvisibleStandinInput(_)
586586
| Widget::NodeCatalog(_)

editor/src/messages/layout/utility_types/widgets/button_widgets.rs

+26
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::messages::input_mapper::utility_types::misc::ActionKeys;
22
use crate::messages::layout::utility_types::widget_prelude::*;
33
use crate::messages::portfolio::document::node_graph::utility_types::FrontendGraphDataType;
4+
use crate::messages::tool::tool_messages::tool_prelude::WidgetCallback;
45

56
use graphene_std::vector::style::FillChoice;
67
use graphite_proc_macros::WidgetBuilder;
@@ -120,6 +121,31 @@ pub struct TextButton {
120121
pub on_commit: WidgetCallback<()>,
121122
}
122123

124+
#[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Default, WidgetBuilder, specta::Type)]
125+
#[derivative(Debug, PartialEq)]
126+
pub struct ImageButton {
127+
#[widget_builder(constructor)]
128+
pub image: String,
129+
130+
pub width: Option<String>,
131+
132+
pub height: Option<String>,
133+
134+
pub tooltip: String,
135+
136+
#[serde(skip)]
137+
pub tooltip_shortcut: Option<ActionKeys>,
138+
139+
// Callbacks
140+
#[serde(skip)]
141+
#[derivative(Debug = "ignore", PartialEq = "ignore")]
142+
pub on_update: WidgetCallback<()>,
143+
144+
#[serde(skip)]
145+
#[derivative(Debug = "ignore", PartialEq = "ignore")]
146+
pub on_commit: WidgetCallback<()>,
147+
}
148+
123149
#[derive(Clone, Derivative, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)]
124150
#[derivative(Debug, PartialEq, Default)]
125151
pub struct ColorButton {

editor/src/messages/layout/utility_types/widgets/label_widgets.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@ pub struct IconLabel {
1111
pub tooltip: String,
1212
}
1313

14-
#[derive(Clone, serde::Serialize, serde::Deserialize, Derivative, Debug, Default, PartialEq, Eq, WidgetBuilder, specta::Type)]
15-
pub struct ImageLabel {
16-
#[widget_builder(constructor)]
17-
pub image: String,
18-
19-
pub width: Option<String>,
20-
21-
pub height: Option<String>,
22-
23-
pub tooltip: String,
24-
}
25-
2614
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, WidgetBuilder, specta::Type)]
2715
pub struct Separator {
2816
pub direction: SeparatorDirection,
@@ -55,6 +43,9 @@ pub struct TextLabel {
5543

5644
pub italic: bool,
5745

46+
#[serde(rename = "centerAlign")]
47+
pub center_align: bool,
48+
5849
#[serde(rename = "tableAlign")]
5950
pub table_align: bool,
6051

editor/src/messages/portfolio/document/document_message.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ pub enum DocumentMessage {
3737
axis: AlignAxis,
3838
aggregate: AlignAggregate,
3939
},
40-
ClearArtboards,
40+
RemoveArtboards,
4141
ClearLayersPanel,
4242
CreateEmptyFolder,
43-
DebugPrintDocument,
4443
DeleteNode {
4544
node_id: NodeId,
4645
},

editor/src/messages/portfolio/document/document_message_handler.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
272272
});
273273
}
274274
}
275-
DocumentMessage::ClearArtboards => {
276-
responses.add(GraphOperationMessage::ClearArtboards);
275+
DocumentMessage::RemoveArtboards => {
276+
responses.add(GraphOperationMessage::RemoveArtboards);
277277
}
278278
DocumentMessage::ClearLayersPanel => {
279279
// Send an empty layer list
@@ -305,9 +305,6 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
305305
});
306306
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: vec![id] });
307307
}
308-
DocumentMessage::DebugPrintDocument => {
309-
info!("{:?}", self.network_interface);
310-
}
311308
DocumentMessage::DeleteNode { node_id } => {
312309
responses.add(DocumentMessage::StartTransaction);
313310

@@ -1337,7 +1334,6 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
13371334
fn actions(&self) -> ActionList {
13381335
let mut common = actions!(DocumentMessageDiscriminant;
13391336
CreateEmptyFolder,
1340-
DebugPrintDocument,
13411337
DeselectAllLayers,
13421338
GraphViewOverlayToggle,
13431339
Noop,

editor/src/messages/portfolio/document/graph_operation/graph_operation_message.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub enum GraphOperationMessage {
103103
location: IVec2,
104104
dimensions: IVec2,
105105
},
106-
ClearArtboards,
106+
RemoveArtboards,
107107
NewSvg {
108108
id: NodeId,
109109
svg: String,

editor/src/messages/portfolio/document/graph_operation/graph_operation_message_handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
202202
modify_inputs.resize_artboard(location, dimensions);
203203
}
204204
}
205-
GraphOperationMessage::ClearArtboards => {
205+
GraphOperationMessage::RemoveArtboards => {
206206
if network_interface.all_artboards().is_empty() {
207207
return;
208208
}

0 commit comments

Comments
 (0)