Skip to content

Commit 4581689

Browse files
committed
Rename WidgetHolder to WidgetInstance
1 parent 810ce40 commit 4581689

36 files changed

+647
-644
lines changed

editor/src/messages/dialog/export_dialog/export_dialog_message_handler.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ impl DialogLayoutHolder for ExportDialogMessageHandler {
7272
}
7373
.into()
7474
})
75-
.widget_holder(),
76-
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_holder(),
75+
.widget_instance(),
76+
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance(),
7777
];
7878

7979
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -92,22 +92,22 @@ impl LayoutHolder for ExportDialogMessageHandler {
9292
.collect();
9393

9494
let export_type = vec![
95-
TextLabel::new("File Type").table_align(true).min_width("100px").widget_holder(),
96-
Separator::new(SeparatorType::Unrelated).widget_holder(),
97-
RadioInput::new(entries).selected_index(Some(self.file_type as u32)).widget_holder(),
95+
TextLabel::new("File Type").table_align(true).min_width("100px").widget_instance(),
96+
Separator::new(SeparatorType::Unrelated).widget_instance(),
97+
RadioInput::new(entries).selected_index(Some(self.file_type as u32)).widget_instance(),
9898
];
9999

100100
let resolution = vec![
101-
TextLabel::new("Scale Factor").table_align(true).min_width("100px").widget_holder(),
102-
Separator::new(SeparatorType::Unrelated).widget_holder(),
101+
TextLabel::new("Scale Factor").table_align(true).min_width("100px").widget_instance(),
102+
Separator::new(SeparatorType::Unrelated).widget_instance(),
103103
NumberInput::new(Some(self.scale_factor))
104104
.unit("")
105105
.min(0.)
106106
.max((1_u64 << f64::MANTISSA_DIGITS) as f64)
107107
.disabled(self.file_type == FileType::Svg)
108108
.on_update(|number_input: &NumberInput| ExportDialogMessage::ScaleFactor { factor: number_input.value.unwrap() }.into())
109109
.min_width(200)
110-
.widget_holder(),
110+
.widget_instance(),
111111
];
112112

113113
let standard_bounds = vec![
@@ -144,20 +144,20 @@ impl LayoutHolder for ExportDialogMessageHandler {
144144
}
145145

146146
let export_area = vec![
147-
TextLabel::new("Bounds").table_align(true).min_width("100px").widget_holder(),
148-
Separator::new(SeparatorType::Unrelated).widget_holder(),
149-
DropdownInput::new(entries).selected_index(Some(index as u32)).widget_holder(),
147+
TextLabel::new("Bounds").table_align(true).min_width("100px").widget_instance(),
148+
Separator::new(SeparatorType::Unrelated).widget_instance(),
149+
DropdownInput::new(entries).selected_index(Some(index as u32)).widget_instance(),
150150
];
151151

152152
let checkbox_id = CheckboxId::new();
153153
let transparent_background = vec![
154-
TextLabel::new("Transparency").table_align(true).min_width("100px").for_checkbox(checkbox_id).widget_holder(),
155-
Separator::new(SeparatorType::Unrelated).widget_holder(),
154+
TextLabel::new("Transparency").table_align(true).min_width("100px").for_checkbox(checkbox_id).widget_instance(),
155+
Separator::new(SeparatorType::Unrelated).widget_instance(),
156156
CheckboxInput::new(self.transparent_background)
157157
.disabled(self.file_type == FileType::Jpg)
158158
.on_update(move |value: &CheckboxInput| ExportDialogMessage::TransparentBackground { transparent: value.checked }.into())
159159
.for_label(checkbox_id)
160-
.widget_holder(),
160+
.widget_instance(),
161161
];
162162

163163
Layout::WidgetLayout(WidgetLayout::new(vec![

editor/src/messages/dialog/new_document_dialog/new_document_dialog_message_handler.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ impl DialogLayoutHolder for NewDocumentDialogMessageHandler {
6262
}
6363
.into()
6464
})
65-
.widget_holder(),
66-
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_holder(),
65+
.widget_instance(),
66+
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance(),
6767
];
6868

6969
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -73,27 +73,27 @@ impl DialogLayoutHolder for NewDocumentDialogMessageHandler {
7373
impl LayoutHolder for NewDocumentDialogMessageHandler {
7474
fn layout(&self) -> Layout {
7575
let name = vec![
76-
TextLabel::new("Name").table_align(true).min_width("90px").widget_holder(),
77-
Separator::new(SeparatorType::Unrelated).widget_holder(),
76+
TextLabel::new("Name").table_align(true).min_width("90px").widget_instance(),
77+
Separator::new(SeparatorType::Unrelated).widget_instance(),
7878
TextInput::new(&self.name)
7979
.on_update(|text_input: &TextInput| NewDocumentDialogMessage::Name { name: text_input.value.clone() }.into())
8080
.min_width(204) // Matches the 100px of both NumberInputs below + the 4px of the Unrelated-type separator
81-
.widget_holder(),
81+
.widget_instance(),
8282
];
8383

8484
let checkbox_id = CheckboxId::new();
8585
let infinite = vec![
86-
TextLabel::new("Infinite Canvas").table_align(true).min_width("90px").for_checkbox(checkbox_id).widget_holder(),
87-
Separator::new(SeparatorType::Unrelated).widget_holder(),
86+
TextLabel::new("Infinite Canvas").table_align(true).min_width("90px").for_checkbox(checkbox_id).widget_instance(),
87+
Separator::new(SeparatorType::Unrelated).widget_instance(),
8888
CheckboxInput::new(self.infinite)
8989
.on_update(|checkbox_input: &CheckboxInput| NewDocumentDialogMessage::Infinite { infinite: checkbox_input.checked }.into())
9090
.for_label(checkbox_id)
91-
.widget_holder(),
91+
.widget_instance(),
9292
];
9393

9494
let scale = vec![
95-
TextLabel::new("Dimensions").table_align(true).min_width("90px").widget_holder(),
96-
Separator::new(SeparatorType::Unrelated).widget_holder(),
95+
TextLabel::new("Dimensions").table_align(true).min_width("90px").widget_instance(),
96+
Separator::new(SeparatorType::Unrelated).widget_instance(),
9797
NumberInput::new(Some(self.dimensions.x as f64))
9898
.label("W")
9999
.unit(" px")
@@ -103,8 +103,8 @@ impl LayoutHolder for NewDocumentDialogMessageHandler {
103103
.disabled(self.infinite)
104104
.min_width(100)
105105
.on_update(|number_input: &NumberInput| NewDocumentDialogMessage::DimensionsX { width: number_input.value.unwrap() }.into())
106-
.widget_holder(),
107-
Separator::new(SeparatorType::Related).widget_holder(),
106+
.widget_instance(),
107+
Separator::new(SeparatorType::Related).widget_instance(),
108108
NumberInput::new(Some(self.dimensions.y as f64))
109109
.label("H")
110110
.unit(" px")
@@ -114,7 +114,7 @@ impl LayoutHolder for NewDocumentDialogMessageHandler {
114114
.disabled(self.infinite)
115115
.min_width(100)
116116
.on_update(|number_input: &NumberInput| NewDocumentDialogMessage::DimensionsY { height: number_input.value.unwrap() }.into())
117-
.widget_holder(),
117+
.widget_instance(),
118118
];
119119

120120
Layout::WidgetLayout(WidgetLayout::new(vec![

editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ impl PreferencesDialogMessageHandler {
4040
// NAVIGATION
4141
// ==========
4242

43-
let navigation_header = vec![TextLabel::new("Navigation").italic(true).widget_holder()];
43+
let navigation_header = vec![TextLabel::new("Navigation").italic(true).widget_instance()];
4444

4545
let zoom_rate_description = "Adjust how fast zooming occurs when using the scroll wheel or pinch gesture (relative to a default of 50).";
4646
let zoom_rate_label = vec![
47-
Separator::new(SeparatorType::Unrelated).widget_holder(),
48-
Separator::new(SeparatorType::Unrelated).widget_holder(),
49-
TextLabel::new("Zoom Rate").tooltip_label("Zoom Rate").tooltip_description(zoom_rate_description).widget_holder(),
47+
Separator::new(SeparatorType::Unrelated).widget_instance(),
48+
Separator::new(SeparatorType::Unrelated).widget_instance(),
49+
TextLabel::new("Zoom Rate").tooltip_label("Zoom Rate").tooltip_description(zoom_rate_description).widget_instance(),
5050
];
5151
let zoom_rate = vec![
52-
Separator::new(SeparatorType::Unrelated).widget_holder(),
53-
Separator::new(SeparatorType::Unrelated).widget_holder(),
52+
Separator::new(SeparatorType::Unrelated).widget_instance(),
53+
Separator::new(SeparatorType::Unrelated).widget_instance(),
5454
NumberInput::new(Some(map_zoom_rate_to_display(preferences.viewport_zoom_wheel_rate)))
5555
.tooltip_label("Zoom Rate")
5656
.tooltip_description(zoom_rate_description)
@@ -66,14 +66,14 @@ impl PreferencesDialogMessageHandler {
6666
PreferencesMessage::ViewportZoomWheelRate { rate: VIEWPORT_ZOOM_WHEEL_RATE }.into()
6767
}
6868
})
69-
.widget_holder(),
69+
.widget_instance(),
7070
];
7171

7272
let checkbox_id = CheckboxId::new();
7373
let zoom_with_scroll_description = "Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads).";
7474
let zoom_with_scroll = vec![
75-
Separator::new(SeparatorType::Unrelated).widget_holder(),
76-
Separator::new(SeparatorType::Unrelated).widget_holder(),
75+
Separator::new(SeparatorType::Unrelated).widget_instance(),
76+
Separator::new(SeparatorType::Unrelated).widget_instance(),
7777
CheckboxInput::new(preferences.zoom_with_scroll)
7878
.tooltip_label("Zoom with Scroll")
7979
.tooltip_description(zoom_with_scroll_description)
@@ -84,25 +84,25 @@ impl PreferencesDialogMessageHandler {
8484
.into()
8585
})
8686
.for_label(checkbox_id)
87-
.widget_holder(),
87+
.widget_instance(),
8888
TextLabel::new("Zoom with Scroll")
8989
.tooltip_label("Zoom with Scroll")
9090
.tooltip_description(zoom_with_scroll_description)
9191
.for_checkbox(checkbox_id)
9292
.table_align(true)
93-
.widget_holder(),
93+
.widget_instance(),
9494
];
9595

9696
// =======
9797
// EDITING
9898
// =======
9999

100-
let editing_header = vec![TextLabel::new("Editing").italic(true).widget_holder()];
100+
let editing_header = vec![TextLabel::new("Editing").italic(true).widget_instance()];
101101

102102
let selection_label = vec![
103-
Separator::new(SeparatorType::Unrelated).widget_holder(),
104-
Separator::new(SeparatorType::Unrelated).widget_holder(),
105-
TextLabel::new("Selection").widget_holder(),
103+
Separator::new(SeparatorType::Unrelated).widget_instance(),
104+
Separator::new(SeparatorType::Unrelated).widget_instance(),
105+
TextLabel::new("Selection").widget_instance(),
106106
];
107107

108108
let selection_mode = RadioInput::new(vec![
@@ -138,27 +138,27 @@ impl PreferencesDialogMessageHandler {
138138
}),
139139
])
140140
.selected_index(Some(preferences.selection_mode as u32))
141-
.widget_holder();
141+
.widget_instance();
142142
let selection_mode = vec![
143-
Separator::new(SeparatorType::Unrelated).widget_holder(),
144-
Separator::new(SeparatorType::Unrelated).widget_holder(),
143+
Separator::new(SeparatorType::Unrelated).widget_instance(),
144+
Separator::new(SeparatorType::Unrelated).widget_instance(),
145145
selection_mode,
146146
];
147147

148148
// ============
149149
// EXPERIMENTAL
150150
// ============
151151

152-
let experimental_header = vec![TextLabel::new("Experimental").italic(true).widget_holder()];
152+
let experimental_header = vec![TextLabel::new("Experimental").italic(true).widget_instance()];
153153

154154
let node_graph_section_description = "Appearance of the wires running between node connections in the graph.";
155155
let node_graph_wires_label = vec![
156-
Separator::new(SeparatorType::Unrelated).widget_holder(),
157-
Separator::new(SeparatorType::Unrelated).widget_holder(),
156+
Separator::new(SeparatorType::Unrelated).widget_instance(),
157+
Separator::new(SeparatorType::Unrelated).widget_instance(),
158158
TextLabel::new("Node Graph Wires")
159159
.tooltip_label("Node Graph Wires")
160160
.tooltip_description(node_graph_section_description)
161-
.widget_holder(),
161+
.widget_instance(),
162162
];
163163
let graph_wire_style = RadioInput::new(vec![
164164
RadioEntryData::new(GraphWireStyle::Direct.to_string())
@@ -173,32 +173,32 @@ impl PreferencesDialogMessageHandler {
173173
.on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::GridAligned }.into()),
174174
])
175175
.selected_index(Some(preferences.graph_wire_style as u32))
176-
.widget_holder();
176+
.widget_instance();
177177
let graph_wire_style = vec![
178-
Separator::new(SeparatorType::Unrelated).widget_holder(),
179-
Separator::new(SeparatorType::Unrelated).widget_holder(),
178+
Separator::new(SeparatorType::Unrelated).widget_instance(),
179+
Separator::new(SeparatorType::Unrelated).widget_instance(),
180180
graph_wire_style,
181181
];
182182

183183
let checkbox_id = CheckboxId::new();
184184
let vello_description = "Use the experimental Vello renderer. (Your browser must support WebGPU).";
185185
let use_vello = vec![
186-
Separator::new(SeparatorType::Unrelated).widget_holder(),
187-
Separator::new(SeparatorType::Unrelated).widget_holder(),
186+
Separator::new(SeparatorType::Unrelated).widget_instance(),
187+
Separator::new(SeparatorType::Unrelated).widget_instance(),
188188
CheckboxInput::new(preferences.use_vello && preferences.supports_wgpu())
189189
.tooltip_label("Vello Renderer")
190190
.tooltip_description(vello_description)
191191
.disabled(!preferences.supports_wgpu())
192192
.on_update(|checkbox_input: &CheckboxInput| PreferencesMessage::UseVello { use_vello: checkbox_input.checked }.into())
193193
.for_label(checkbox_id)
194-
.widget_holder(),
194+
.widget_instance(),
195195
TextLabel::new("Vello Renderer")
196196
.tooltip_label("Vello Renderer")
197197
.tooltip_description(vello_description)
198198
.disabled(!preferences.supports_wgpu())
199199
.for_checkbox(checkbox_id)
200200
.table_align(true)
201-
.widget_holder(),
201+
.widget_instance(),
202202
];
203203

204204
let checkbox_id = CheckboxId::new();
@@ -208,20 +208,20 @@ impl PreferencesDialogMessageHandler {
208208
"
209209
.trim();
210210
let vector_meshes = vec![
211-
Separator::new(SeparatorType::Unrelated).widget_holder(),
212-
Separator::new(SeparatorType::Unrelated).widget_holder(),
211+
Separator::new(SeparatorType::Unrelated).widget_instance(),
212+
Separator::new(SeparatorType::Unrelated).widget_instance(),
213213
CheckboxInput::new(preferences.vector_meshes)
214214
.tooltip_label("Vector Meshes")
215215
.tooltip_description(vector_mesh_description)
216216
.on_update(|checkbox_input: &CheckboxInput| PreferencesMessage::VectorMeshes { enabled: checkbox_input.checked }.into())
217217
.for_label(checkbox_id)
218-
.widget_holder(),
218+
.widget_instance(),
219219
TextLabel::new("Vector Meshes")
220220
.tooltip_label("Vector Meshes")
221221
.tooltip_description(vector_mesh_description)
222222
.for_checkbox(checkbox_id)
223223
.table_align(true)
224-
.widget_holder(),
224+
.widget_instance(),
225225
];
226226

227227
Layout::WidgetLayout(WidgetLayout::new(vec![
@@ -268,8 +268,8 @@ impl PreferencesDialogMessageHandler {
268268
}
269269
.into()
270270
})
271-
.widget_holder(),
272-
TextButton::new("Reset to Defaults").on_update(|_| PreferencesMessage::ResetToDefaults.into()).widget_holder(),
271+
.widget_instance(),
272+
TextButton::new("Reset to Defaults").on_update(|_| PreferencesMessage::ResetToDefaults.into()).widget_instance(),
273273
];
274274

275275
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl DialogLayoutHolder for AboutGraphiteDialog {
1313
const TITLE: &'static str = "About Graphite";
1414

1515
fn layout_buttons(&self) -> Layout {
16-
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_holder()];
16+
let widgets = vec![TextButton::new("OK").emphasized(true).on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance()];
1717

1818
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
1919
}
@@ -32,7 +32,7 @@ impl DialogLayoutHolder for AboutGraphiteDialog {
3232
.icon(Some(icon.into()))
3333
.flush(true)
3434
.on_update(|_| FrontendMessage::TriggerVisitLink { url: url.into() }.into())
35-
.widget_holder()
35+
.widget_instance()
3636
})
3737
.collect::<Vec<_>>();
3838

@@ -48,7 +48,7 @@ impl DialogLayoutHolder for AboutGraphiteDialog {
4848
}
4949
.into()
5050
})
51-
.widget_holder(),
51+
.widget_instance(),
5252
);
5353

5454
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Column { widgets }]))
@@ -59,13 +59,13 @@ impl LayoutHolder for AboutGraphiteDialog {
5959
fn layout(&self) -> Layout {
6060
Layout::WidgetLayout(WidgetLayout::new(vec![
6161
LayoutGroup::Row {
62-
widgets: vec![TextLabel::new("About this release").bold(true).widget_holder()],
62+
widgets: vec![TextLabel::new("About this release").bold(true).widget_instance()],
6363
},
6464
LayoutGroup::Row {
65-
widgets: vec![TextLabel::new(commit_info_localized(&self.localized_commit_date)).multiline(true).widget_holder()],
65+
widgets: vec![TextLabel::new(commit_info_localized(&self.localized_commit_date)).multiline(true).widget_instance()],
6666
},
6767
LayoutGroup::Row {
68-
widgets: vec![TextLabel::new(format!("Copyright © {} Graphite contributors", self.localized_commit_year)).widget_holder()],
68+
widgets: vec![TextLabel::new(format!("Copyright © {} Graphite contributors", self.localized_commit_year)).widget_instance()],
6969
},
7070
]))
7171
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ impl DialogLayoutHolder for CloseAllDocumentsDialog {
2020
}
2121
.into()
2222
})
23-
.widget_holder(),
24-
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_holder(),
23+
.widget_instance(),
24+
TextButton::new("Cancel").on_update(|_| FrontendMessage::DisplayDialogDismiss.into()).widget_instance(),
2525
];
2626

2727
Layout::WidgetLayout(WidgetLayout::new(vec![LayoutGroup::Row { widgets }]))
@@ -34,10 +34,10 @@ impl LayoutHolder for CloseAllDocumentsDialog {
3434

3535
Layout::WidgetLayout(WidgetLayout::new(vec![
3636
LayoutGroup::Row {
37-
widgets: vec![TextLabel::new("Save documents before closing them?").bold(true).multiline(true).widget_holder()],
37+
widgets: vec![TextLabel::new("Save documents before closing them?").bold(true).multiline(true).widget_instance()],
3838
},
3939
LayoutGroup::Row {
40-
widgets: vec![TextLabel::new(format!("Documents with unsaved changes:\n{unsaved_list}")).multiline(true).widget_holder()],
40+
widgets: vec![TextLabel::new(format!("Documents with unsaved changes:\n{unsaved_list}")).multiline(true).widget_instance()],
4141
},
4242
]))
4343
}

0 commit comments

Comments
 (0)