Skip to content

Commit 2bb4509

Browse files
authored
Replace the Spreadsheet panel with an improved Data panel (#3037)
* Improve the table data panel * Add the "Window" menu bar section and polish everything
1 parent 2f4aef3 commit 2bb4509

Some content is hidden

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

54 files changed

+1299
-644
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editor/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ web-sys = { workspace = true }
4747
bytemuck = { workspace = true }
4848
vello = { workspace = true }
4949
tracing = { workspace = true }
50+
base64 = { workspace = true }
5051

5152
# Required dependencies
5253
spin = "0.9.8"

editor/src/dispatcher.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub struct DispatcherMessageHandlers {
2626
pub portfolio_message_handler: PortfolioMessageHandler,
2727
preferences_message_handler: PreferencesMessageHandler,
2828
tool_message_handler: ToolMessageHandler,
29-
workspace_message_handler: WorkspaceMessageHandler,
3029
}
3130

3231
impl DispatcherMessageHandlers {
@@ -231,9 +230,6 @@ impl Dispatcher {
231230

232231
self.message_handlers.tool_message_handler.process_message(message, &mut queue, context);
233232
}
234-
Message::Workspace(message) => {
235-
self.message_handlers.workspace_message_handler.process_message(message, &mut queue, ());
236-
}
237233
Message::NoOp => {}
238234
Message::Batched { messages } => {
239235
messages.iter().for_each(|message| self.handle_message(message.to_owned(), false));

editor/src/messages/defer/defer_message_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ impl MessageHandler<DeferMessage, DeferMessageContext<'_>> for DeferMessageHandl
3838
for (_, message) in elements.rev() {
3939
responses.add_front(message);
4040
}
41-
for (id, messages) in self.after_graph_run.iter() {
41+
for (&document_id, messages) in self.after_graph_run.iter() {
4242
if !messages.is_empty() {
43-
responses.add(PortfolioMessage::SubmitGraphRender { document_id: *id, ignore_hash: false });
43+
responses.add(PortfolioMessage::SubmitGraphRender { document_id, ignore_hash: false });
4444
}
4545
}
4646
}

editor/src/messages/frontend/frontend_message.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,16 @@ pub enum FrontendMessage {
149149
UpdateGraphViewOverlay {
150150
open: bool,
151151
},
152-
UpdateSpreadsheetState {
152+
UpdateDataPanelState {
153153
open: bool,
154-
node: Option<NodeId>,
155154
},
156-
UpdateSpreadsheetLayout {
155+
UpdatePropertiesPanelState {
156+
open: bool,
157+
},
158+
UpdateLayersPanelState {
159+
open: bool,
160+
},
161+
UpdateDataPanelLayout {
157162
#[serde(rename = "layoutTarget")]
158163
layout_target: LayoutTarget,
159164
diff: Vec<WidgetDiff>,
@@ -296,7 +301,7 @@ pub enum FrontendMessage {
296301
#[serde(rename = "openDocuments")]
297302
open_documents: Vec<FrontendDocumentDetails>,
298303
},
299-
UpdatePropertyPanelSectionsLayout {
304+
UpdatePropertiesPanelLayout {
300305
#[serde(rename = "layoutTarget")]
301306
layout_target: LayoutTarget,
302307
diff: Vec<WidgetDiff>,

editor/src/messages/input_mapper/input_mappings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ pub fn input_mappings() -> Mapping {
427427
entry!(KeyDown(KeyX); modifiers=[Accel], action_dispatch=PortfolioMessage::Cut { clipboard: Clipboard::Device }),
428428
entry!(KeyDown(KeyC); modifiers=[Accel], action_dispatch=PortfolioMessage::Copy { clipboard: Clipboard::Device }),
429429
entry!(KeyDown(KeyR); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleRulers),
430+
entry!(KeyDown(KeyD); modifiers=[Alt], action_dispatch=PortfolioMessage::ToggleDataPanelOpen),
430431
//
431432
// FrontendMessage
432433
entry!(KeyDown(KeyV); modifiers=[Accel], action_dispatch=FrontendMessage::TriggerPaste),

editor/src/messages/layout/layout_message_handler.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ impl LayoutMessageHandler {
308308

309309
responses.add(callback_message);
310310
}
311+
Widget::ImageLabel(_) => {}
311312
Widget::IconLabel(_) => {}
312313
Widget::InvisibleStandinInput(invisible) => {
313314
let callback_message = match action {
@@ -481,18 +482,18 @@ impl LayoutMessageHandler {
481482
diff.iter_mut().for_each(|diff| diff.new_value.apply_keyboard_shortcut(action_input_mapping));
482483

483484
let message = match layout_target {
485+
LayoutTarget::MenuBar => unreachable!("Menu bar is not diffed"),
484486
LayoutTarget::DialogButtons => FrontendMessage::UpdateDialogButtons { layout_target, diff },
485487
LayoutTarget::DialogColumn1 => FrontendMessage::UpdateDialogColumn1 { layout_target, diff },
486488
LayoutTarget::DialogColumn2 => FrontendMessage::UpdateDialogColumn2 { layout_target, diff },
487489
LayoutTarget::DocumentBar => FrontendMessage::UpdateDocumentBarLayout { layout_target, diff },
488490
LayoutTarget::DocumentMode => FrontendMessage::UpdateDocumentModeLayout { layout_target, diff },
491+
LayoutTarget::DataPanel => FrontendMessage::UpdateDataPanelLayout { layout_target, diff },
489492
LayoutTarget::LayersPanelControlLeftBar => FrontendMessage::UpdateLayersPanelControlBarLeftLayout { layout_target, diff },
490493
LayoutTarget::LayersPanelControlRightBar => FrontendMessage::UpdateLayersPanelControlBarRightLayout { layout_target, diff },
491494
LayoutTarget::LayersPanelBottomBar => FrontendMessage::UpdateLayersPanelBottomBarLayout { layout_target, diff },
492-
LayoutTarget::MenuBar => unreachable!("Menu bar is not diffed"),
495+
LayoutTarget::PropertiesPanel => FrontendMessage::UpdatePropertiesPanelLayout { layout_target, diff },
493496
LayoutTarget::NodeGraphControlBar => FrontendMessage::UpdateNodeGraphControlBarLayout { layout_target, diff },
494-
LayoutTarget::PropertiesSections => FrontendMessage::UpdatePropertyPanelSectionsLayout { layout_target, diff },
495-
LayoutTarget::Spreadsheet => FrontendMessage::UpdateSpreadsheetLayout { layout_target, diff },
496497
LayoutTarget::ToolOptions => FrontendMessage::UpdateToolOptionsLayout { layout_target, diff },
497498
LayoutTarget::ToolShelf => FrontendMessage::UpdateToolShelfLayout { layout_target, diff },
498499
LayoutTarget::WorkingColors => FrontendMessage::UpdateWorkingColorsLayout { layout_target, diff },

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ pub enum LayoutTarget {
4242
/// Bar at the top of the node graph containing the location and the "Preview" and "Hide" buttons.
4343
NodeGraphControlBar,
4444
/// The body of the Properties panel containing many collapsable sections.
45-
PropertiesSections,
45+
PropertiesPanel,
4646
/// The spredsheet panel allows for the visualisation of data in the graph.
47-
Spreadsheet,
47+
DataPanel,
4848
/// The bar directly above the canvas, left-aligned and to the right of the document mode dropdown.
4949
ToolOptions,
5050
/// The vertical buttons for all of the tools on the left of the canvas.
@@ -369,6 +369,7 @@ impl LayoutGroup {
369369
Widget::IconButton(x) => &mut x.tooltip,
370370
Widget::IconLabel(x) => &mut x.tooltip,
371371
Widget::ImageButton(x) => &mut x.tooltip,
372+
Widget::ImageLabel(x) => &mut x.tooltip,
372373
Widget::NumberInput(x) => &mut x.tooltip,
373374
Widget::ParameterExposeButton(x) => &mut x.tooltip,
374375
Widget::PopoverButton(x) => &mut x.tooltip,
@@ -546,6 +547,7 @@ pub enum Widget {
546547
IconButton(IconButton),
547548
IconLabel(IconLabel),
548549
ImageButton(ImageButton),
550+
ImageLabel(ImageLabel),
549551
InvisibleStandinInput(InvisibleStandinInput),
550552
NodeCatalog(NodeCatalog),
551553
NumberInput(NumberInput),
@@ -622,6 +624,7 @@ impl DiffUpdate {
622624
Widget::TextButton(widget) => Some((&mut widget.tooltip, &mut widget.tooltip_shortcut)),
623625
Widget::ImageButton(widget) => Some((&mut widget.tooltip, &mut widget.tooltip_shortcut)),
624626
Widget::IconLabel(_)
627+
| Widget::ImageLabel(_)
625628
| Widget::CurveInput(_)
626629
| Widget::InvisibleStandinInput(_)
627630
| Widget::NodeCatalog(_)

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@ pub struct ColorInput {
168168
#[widget_builder(constructor)]
169169
pub value: FillChoice,
170170

171-
pub disabled: bool,
172-
173171
// TODO: Implement
174172
// #[serde(rename = "allowTransparency")]
175173
// #[derivative(Default(value = "false"))]
@@ -179,9 +177,11 @@ pub struct ColorInput {
179177
#[derivative(Default(value = "true"))]
180178
pub allow_none: bool,
181179

182-
// TODO: Implement
183-
// pub disabled: bool,
184-
//
180+
pub disabled: bool,
181+
182+
#[serde(rename = "menuDirection")]
183+
pub menu_direction: Option<MenuDirection>,
184+
185185
pub tooltip: String,
186186

187187
#[serde(skip)]

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ pub struct TextInput {
416416
#[serde(rename = "minWidth")]
417417
pub min_width: u32,
418418

419+
#[serde(rename = "maxWidth")]
420+
pub max_width: u32,
421+
419422
// Callbacks
420423
#[serde(skip)]
421424
#[derivative(Debug = "ignore", PartialEq = "ignore")]

0 commit comments

Comments
 (0)