mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 19:41:36 -05:00
Section headings in regular label text, as the reference app drew them, through one helper
Every fixed section of a panel or dialog takes panels::section (Section::fixed at HeaderStrength::Normal), which the Properties panel already used: the dialogs, Separations Preview, Links, Asset Export and the add-on panels were bold (the Section default), and Align, Pathfinder and Find Font faint (Caption). The reference app drew all of them with its regular subheader or section header.
This commit is contained in:
@@ -15,7 +15,6 @@ use craft::ui::buttons::Button;
|
||||
use craft::ui::contract::{Bind, Entry, Show as _, ShowContainer as _};
|
||||
use craft::ui::form::{Field, FieldGroup};
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::sections::Section;
|
||||
use egui::Ui;
|
||||
use serde_json::{Map, Value, json};
|
||||
|
||||
@@ -193,7 +192,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
});
|
||||
// Inks: Duotone's and Print Ink Fixes' dialogs, as their menu items open them.
|
||||
let mut ink = None;
|
||||
Section::fixed(tl!("Inks").to_string()).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Inks").to_string()).show(ui, |ui, _| {
|
||||
for item in [duotone(), print_fixes()] {
|
||||
if Button::new(tl!(item.0).to_string()).show(ui).clicked() {
|
||||
ink = Some(item);
|
||||
|
||||
@@ -9,7 +9,6 @@ use craft::ui::buttons::Button;
|
||||
use craft::ui::choice::Segmented;
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::display::{Shade, Text};
|
||||
use craft::ui::sections::Section;
|
||||
use egui::Ui;
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_tools::addons::smart_pen;
|
||||
@@ -48,7 +47,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let mut curved = shown;
|
||||
let mut action: Option<(&str, Value)> = None;
|
||||
let segments = [Entry::new(false, tl!("Straight")).icon(IconId::new("dc-line")), Entry::new(true, tl!("Curved")).icon(IconId::new("spline"))];
|
||||
Section::fixed(tl!("Next Segment")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Next Segment")).show(ui, |ui, _| {
|
||||
Segmented::new(tl!("Next Segment"), Bind::bound(&mut curved), &segments).show(ui);
|
||||
});
|
||||
if curved != shown {
|
||||
|
||||
@@ -18,7 +18,6 @@ use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::layout_components::Row;
|
||||
use craft::ui::runtime::env::{LengthUnits, UnitKind};
|
||||
use craft::ui::sections::Section;
|
||||
use craft::ui::text::NumberField;
|
||||
use egui::Ui;
|
||||
use serde_json::json;
|
||||
@@ -183,7 +182,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
|
||||
let mut side = conv.side;
|
||||
let (mut read, mut set) = (false, false);
|
||||
Section::fixed(tl!("Selection")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Selection")).show(ui, |ui, _| {
|
||||
RadioGroup::new(tl!("Side"), Bind::bound(&mut side)).nav(NavShape::Spatial).show(ui, |ui, _| {
|
||||
Radio::new(Side::Width).label(tl!("Width")).show(ui);
|
||||
Radio::new(Side::Height).label(tl!("Height")).show(ui);
|
||||
|
||||
@@ -27,7 +27,7 @@ use craft::ui::runtime::env::Label;
|
||||
use craft::ui::runtime::measure;
|
||||
use craft::ui::runtime::overlay::CloseReason;
|
||||
use craft::ui::runtime::requests::{ColorRequest, HostAnswer};
|
||||
use craft::ui::sections::{GroupBox, Section};
|
||||
use craft::ui::sections::GroupBox;
|
||||
use craft::ui::style::TypeRole;
|
||||
use craft::ui::text::{NumberField, TextField};
|
||||
use egui::{Rect, Ui};
|
||||
@@ -689,13 +689,13 @@ pub fn properties_section(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let mut next = o.clone();
|
||||
let mut edited = Edited::default();
|
||||
let e = &mut edited;
|
||||
Section::fixed(tl!("Dimension")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Dimension")).show(ui, |ui, _| {
|
||||
units_row(ui, &mut next, e);
|
||||
precision_row(ui, &mut next, e);
|
||||
line_row(ui, &mut next, e, Line::Dimension, false);
|
||||
arrow_style_row(ui, &mut next, e);
|
||||
Section::fixed(tl!("Extension Lines")).show(ui, |ui, _| line_row(ui, &mut next, e, Line::Extension, false));
|
||||
Section::fixed(tl!("Dimension Text")).show(ui, |ui, _| text_rows(ui, &mut next, e, false));
|
||||
crate::panels::section(tl!("Extension Lines")).show(ui, |ui, _| line_row(ui, &mut next, e, Line::Extension, false));
|
||||
crate::panels::section(tl!("Dimension Text")).show(ui, |ui, _| text_rows(ui, &mut next, e, false));
|
||||
});
|
||||
if edited.set {
|
||||
update(app, id, &next);
|
||||
|
||||
@@ -45,7 +45,6 @@ use craft::ui::list::{List, ListRow, ThumbAspect, ThumbSize, ToggleCell, ToggleS
|
||||
use craft::ui::patterns::form_dialogs::{FormDialog, PathRow};
|
||||
use craft::ui::primitives::ContentPainterCx;
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::sections::Section;
|
||||
use craft::ui::tabs::{Tab, TabKind, TabStrip};
|
||||
use craft::ui::text::TextField;
|
||||
use craft::ui::tile_grid::{Tile, TileGrid, TilePartEvent};
|
||||
@@ -674,10 +673,10 @@ impl ExportForScreensDialog {
|
||||
}
|
||||
if text(fields, "tab") != "assets" {
|
||||
let n = self.doc.as_ref().map_or(0, |s| s.doc.artboards.len());
|
||||
Section::fixed(tl!("Select:")).show(ui, |ui, _| select_options(ui, fields, n));
|
||||
crate::panels::section(tl!("Select:")).show(ui, |ui, _| select_options(ui, fields, n));
|
||||
}
|
||||
let web = self.web;
|
||||
Section::fixed(tl!("Export to:")).show(ui, |ui, _| destination(ui, fields, web));
|
||||
crate::panels::section(tl!("Export to:")).show(ui, |ui, _| destination(ui, fields, web));
|
||||
pdf_mode(ui, fields);
|
||||
let presets = self.presets.as_array().map_or(&[][..], Vec::as_slice);
|
||||
let mut picked = None;
|
||||
|
||||
@@ -31,7 +31,6 @@ use craft::ui::patterns::form_dialogs::FormDialog;
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::primitives::{Glyph, IconSpec};
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::sections::Section;
|
||||
use craft::ui::style::UiTokens;
|
||||
use craft::ui::text::{NumberField, TextField};
|
||||
use egui::{Context, Ui};
|
||||
@@ -810,7 +809,7 @@ fn text_row(ui: &mut Ui, v: &mut GraphTypeValues, key: &str, label: &'static str
|
||||
|
||||
fn options_page(ui: &mut Ui, v: &mut GraphTypeValues, s: &GraphSubject) {
|
||||
let kind = graph_kind(v, s);
|
||||
Section::fixed(tl!("Type")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Type")).show(ui, |ui, _| {
|
||||
type_row(ui, v, s);
|
||||
let sides: &[(&str, &str)] = if s.series.is_empty() { &SIDES } else { &SERIES_SIDES };
|
||||
let enabled = active(v, s, "valueAxis");
|
||||
@@ -818,7 +817,7 @@ fn options_page(ui: &mut Ui, v: &mut GraphTypeValues, s: &GraphSubject) {
|
||||
let enabled = active(v, s, "separateScales");
|
||||
check(ui, v, "separateScales", tl!("Separate Scales"), enabled);
|
||||
});
|
||||
Section::fixed(tl!("Style")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Style")).show(ui, |ui, _| {
|
||||
Grid::new(TWO).show(ui, |ui, _| {
|
||||
let rows = [
|
||||
("dropShadow", tl!("Add Drop Shadow")),
|
||||
@@ -844,7 +843,7 @@ fn type_options(ui: &mut Ui, v: &mut GraphTypeValues, s: &GraphSubject, kind: Gr
|
||||
if !(columns || lines || pie) {
|
||||
return;
|
||||
}
|
||||
Section::fixed(tl!("Options")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Options")).show(ui, |ui, _| {
|
||||
if columns {
|
||||
let width = if matches!(kind, GraphKind::Bar | GraphKind::StackedBar) { tl!("Bar Width") } else { tl!("Column Width") };
|
||||
for (key, label) in [("columnWidth", width), ("clusterWidth", tl!("Cluster Width"))] {
|
||||
@@ -884,7 +883,7 @@ fn type_options(ui: &mut Ui, v: &mut GraphTypeValues, s: &GraphSubject, kind: Gr
|
||||
fn value_page(ui: &mut Ui, v: &mut GraphTypeValues, s: &GraphSubject, right: bool) {
|
||||
let (scale, side) = page_axes(v, s, right);
|
||||
let own_scale = scale_used(v, s, right);
|
||||
Section::fixed(tl!("Tick Values")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Tick Values")).show(ui, |ui, _| {
|
||||
let (drawn, (lo, hi), count) = shown_scale(v, s, right);
|
||||
check(ui, v, drawn.overridden, tl!("Override Calculated Values"), own_scale);
|
||||
let enabled = own_scale && v.bool(scale.overridden);
|
||||
@@ -893,7 +892,7 @@ fn value_page(ui: &mut Ui, v: &mut GraphTypeValues, s: &GraphSubject, right: boo
|
||||
number_row(ui, v, scale.ticks, tl!("Divisions"), count as f64, &DIVISION_COUNT, enabled);
|
||||
});
|
||||
tick_marks(ui, v, side.length, side.marks);
|
||||
Section::fixed(tl!("Add Labels")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Add Labels")).show(ui, |ui, _| {
|
||||
text_row(ui, v, side.prefix, tl!("Prefix"));
|
||||
text_row(ui, v, side.suffix, tl!("Suffix"));
|
||||
});
|
||||
@@ -928,7 +927,7 @@ fn category_page(ui: &mut Ui, v: &mut GraphTypeValues, s: &GraphSubject) {
|
||||
|
||||
/// Tick Marks: the length, and the tick marks per division while there are tick marks to draw.
|
||||
fn tick_marks(ui: &mut Ui, v: &mut GraphTypeValues, length: &str, marks: &str) {
|
||||
Section::fixed(tl!("Tick Marks")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Tick Marks")).show(ui, |ui, _| {
|
||||
choice(ui, v, length, tl!("Length"), &TICK_LENGTHS, true);
|
||||
let shown = number(v, marks).unwrap_or(1.0);
|
||||
let enabled = v.str(length) != "none";
|
||||
|
||||
@@ -28,7 +28,6 @@ use craft::ui::patterns::presets::{PresetPicker, PresetRow, PresetSource, Preset
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::runtime::env::{Label, LengthUnits, UnitKind};
|
||||
use craft::ui::runtime::overlay::CloseReason;
|
||||
use craft::ui::sections::Section;
|
||||
use craft::ui::style::TypeRole;
|
||||
use craft::ui::text::{NumberField, TextField};
|
||||
use serde_json::{Value, json};
|
||||
@@ -263,8 +262,8 @@ impl Pass<'_> {
|
||||
/// The rows; whether the draft can be accepted. `save` is set when Save Preset… was pressed.
|
||||
fn body(&self, ui: &mut egui::Ui, draft: &mut GridDraft, picker: &mut PresetState<String>, save: &mut bool) -> bool {
|
||||
self.name(ui, draft, picker, save);
|
||||
Section::fixed(word("Perspective Grid Settings")).id_salt("settings").show(ui, |ui, _| self.settings(ui, draft));
|
||||
Section::fixed(word("Grid Color & Opacity")).id_salt("colors").show(ui, |ui, _| colors(ui, draft));
|
||||
crate::panels::section(word("Perspective Grid Settings")).id_salt("settings").show(ui, |ui, _| self.settings(ui, draft));
|
||||
crate::panels::section(word("Grid Color & Opacity")).id_salt("colors").show(ui, |ui, _| colors(ui, draft));
|
||||
let valid = draft.def.validate();
|
||||
if let Err(why) = &valid {
|
||||
Text::new(why.clone()).role(TypeRole::Caption).tone(Tone::Bad).show(ui);
|
||||
|
||||
@@ -47,7 +47,7 @@ use craft::ui::notices::{Notice, NoticeLayout};
|
||||
use craft::ui::patterns::form_dialogs::{FormDialog, ResetFooter, ResetPick};
|
||||
use craft::ui::runtime::env::{Label, LengthUnits};
|
||||
use craft::ui::runtime::overlay::CloseReason;
|
||||
use craft::ui::sections::{DialogRole, FooterButton, Section};
|
||||
use craft::ui::sections::{DialogRole, FooterButton};
|
||||
use craft::ui::text::{NumberField, link_toggle};
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{Unit, WidthProfile};
|
||||
@@ -449,9 +449,9 @@ fn body(ui: &mut egui::Ui, form: &mut Form, lengths: LengthUnits, refusal: Optio
|
||||
};
|
||||
match out {
|
||||
Some((_, out)) => {
|
||||
Section::fixed(titles[0].clone()).show(ui, |ui, _| rows(ui, &titles[0], sides));
|
||||
Section::fixed(titles[1].clone()).show(ui, |ui, _| rows(ui, &titles[1], out));
|
||||
Section::fixed(word(tl!("Single Width Only"))).show(ui, |ui, _| {
|
||||
crate::panels::section(titles[0].clone()).show(ui, |ui, _| rows(ui, &titles[0], sides));
|
||||
crate::panels::section(titles[1].clone()).show(ui, |ui, _| rows(ui, &titles[1], out));
|
||||
crate::panels::section(word(tl!("Single Width Only"))).show(ui, |ui, _| {
|
||||
RadioGroup::new(word(tl!("Single Width Only")), Bind::bound(single)).show(ui, |ui, _| {
|
||||
Row::new().show(ui, |ui, _| {
|
||||
for (choice, text) in
|
||||
@@ -477,8 +477,8 @@ fn body(ui: &mut egui::Ui, form: &mut Form, lengths: LengthUnits, refusal: Optio
|
||||
}
|
||||
};
|
||||
if *discontinuous {
|
||||
Section::fixed(titles[0].clone()).show(ui, |ui, _| rows(ui, 0));
|
||||
Section::fixed(titles[1].clone()).show(ui, |ui, _| rows(ui, 1));
|
||||
crate::panels::section(titles[0].clone()).show(ui, |ui, _| rows(ui, 0));
|
||||
crate::panels::section(titles[1].clone()).show(ui, |ui, _| rows(ui, 1));
|
||||
} else {
|
||||
rows(ui, 0);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ use craft::ui::layout_components::Stack;
|
||||
use craft::ui::list::{List, ListRow};
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::primitives::IconSpec;
|
||||
use craft::ui::sections::{DialogRole, FooterButton, HeaderStrength, Section};
|
||||
use craft::ui::sections::{DialogRole, FooterButton};
|
||||
use craft::ui::text::TextField;
|
||||
use egui::{Context, Ui};
|
||||
use serde_json::{Value, json};
|
||||
@@ -513,7 +513,7 @@ impl StackDialog for FindFontDialog {
|
||||
let row_text = |at: usize| shown.get(at).and_then(|&i| rows.get(i)).map_or_else(String::new, |r| row_label(&r.family, &r.style));
|
||||
let out = Dialog::new(tl!("Find Font").to_string()).buttons(buttons).show(ui, |ui, _| {
|
||||
Stack::new().show(ui, |ui, _| {
|
||||
Section::fixed(heading.clone()).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(heading.clone()).show(ui, |ui, _| {
|
||||
let docs = Lines { len: count, text: &doc_text };
|
||||
List::<usize>::new(tl!("Fonts in Document").to_string())
|
||||
.select(SelectMode::Single)
|
||||
@@ -526,7 +526,7 @@ impl StackDialog for FindFontDialog {
|
||||
if offer_folder {
|
||||
folder = clicked(&Button::new(tl!("Find in Folder…").to_string()).show(ui));
|
||||
}
|
||||
Section::fixed(tl!("Replace With Font").to_string()).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Replace With Font").to_string()).show(ui, |ui, _| {
|
||||
Field::new(tl!("Replace With Font From").to_string()).show(ui, |ui, _| {
|
||||
let edit = Select::new(tl!("Replace With Font From").to_string(), Bind::given(source), &source_entries).show(ui);
|
||||
new_source = edit.events.value().copied();
|
||||
|
||||
@@ -75,6 +75,7 @@ use craft::ui::popover::Popover;
|
||||
use craft::ui::primitives::IconSpec;
|
||||
use craft::ui::runtime::commands::CommandStates;
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::sections::{HeaderStrength, Section};
|
||||
use craft::ui::text::{NumberField, link_toggle};
|
||||
use egui::Ui;
|
||||
use serde_json::{Value, json};
|
||||
@@ -893,6 +894,12 @@ pub(crate) fn whole_steps(range: std::ops::RangeInclusive<f64>) -> ChannelRule {
|
||||
rule
|
||||
}
|
||||
|
||||
/// A section of a panel or dialog under its heading in label text: the reference app's section headings are regular
|
||||
/// weight, not bold.
|
||||
pub(crate) fn section<'a>(title: impl Into<Label>) -> Section<'a> {
|
||||
Section::fixed(title).strength(HeaderStrength::Normal)
|
||||
}
|
||||
|
||||
/// The empty state of a panel with nothing to show: `icon` over the title and the message,
|
||||
/// centred in the panel.
|
||||
pub(crate) fn empty_state(ui: &mut Ui, icon: &'static str, title: &str, body: &str) {
|
||||
|
||||
@@ -10,7 +10,6 @@ use craft::ui::buttons::{IconButton, PopupMark, ToggleButton};
|
||||
use craft::ui::contract::{Bind, PopupKind, Props as _, Show as _, ShowContainer as _, Trigger};
|
||||
use craft::ui::menu::{Menu, MenuItem, PanelRow};
|
||||
use craft::ui::runtime::commands::{CommandState, CommandStates};
|
||||
use craft::ui::sections::{HeaderStrength, Section};
|
||||
use craft::ui::text::NumberField;
|
||||
use egui::Ui;
|
||||
use serde::Serialize;
|
||||
@@ -479,14 +478,14 @@ pub(crate) fn run_align_to(app: &mut VectorcraftApp, v: AlignTo) -> Result<Value
|
||||
/// Spacing with its value and Align To. The buttons are commands, so their state and clicks come
|
||||
/// from the command layer ([`button_enabled`], [`run_button`]).
|
||||
pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
Section::fixed(tl!("Align Objects:")).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Align Objects:")).show(ui, |ui, _| {
|
||||
ui.horizontal(|ui| {
|
||||
for (icon, b) in align_icons() {
|
||||
command_button(ui, icon, b);
|
||||
}
|
||||
});
|
||||
});
|
||||
Section::fixed(tl!("Distribute Objects:")).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Distribute Objects:")).show(ui, |ui, _| {
|
||||
ui.horizontal(|ui| {
|
||||
for (icon, b) in distribute_icons() {
|
||||
command_button(ui, icon, b);
|
||||
@@ -504,7 +503,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let lengths = crate::canvas::general_lengths(app);
|
||||
let min_spacing = spacing_min(app);
|
||||
let mut edited = None;
|
||||
Section::fixed(tl!("Distribute Spacing:")).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Distribute Spacing:")).show(ui, |ui, _| {
|
||||
ui.horizontal(|ui| {
|
||||
command_button(ui, "dc-dist-vspace", Button::Spacing("vertical"));
|
||||
command_button(ui, "dc-dist-hspace", Button::Spacing("horizontal"));
|
||||
@@ -519,7 +518,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
if let Some(v) = edited {
|
||||
app.ui.align_spacing = v;
|
||||
}
|
||||
Section::fixed(tl!("Align To:")).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Align To:")).show(ui, |ui, _| {
|
||||
// With one object selected the buttons align it to the artboard, and Align To shows Artboard.
|
||||
let anchor = key_is_anchor(app);
|
||||
ui.horizontal(|ui| {
|
||||
|
||||
@@ -47,7 +47,7 @@ use craft::ui::notices::{Notice, NoticeIcon, NoticeLayout};
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::primitives::IconSpec;
|
||||
use craft::ui::runtime::commands::{CommandState, CommandStates};
|
||||
use craft::ui::sections::{DropAction, FooterAction, FooterBar, Section};
|
||||
use craft::ui::sections::{DropAction, FooterAction, FooterBar};
|
||||
use craft::ui::tile_grid::{BadgeKind, BadgeSlot, Tile, TileBadge, TileGrid};
|
||||
use egui::{Color32, Rect, Ui};
|
||||
use serde_json::{Map, Value, json};
|
||||
@@ -524,7 +524,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let (mut export_clicked, mut footer, mut screens) = (false, None, false);
|
||||
// The grid takes the room the settings, Export and the footer bar leave.
|
||||
let footed = Stack::new().fill().footer(|ui, _| {
|
||||
Section::fixed(tl!("Export Settings")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Export Settings")).show(ui, |ui, _| {
|
||||
let (change, files_each) = settings(ui, st);
|
||||
(seen.change, seen.files_each) = (change, files_each);
|
||||
seen.format_3d = format_3d(ui, st, &sel_or_all(&shown_sel, &all));
|
||||
|
||||
@@ -31,7 +31,7 @@ use craft::ui::form::Field;
|
||||
use craft::ui::list::{List, ListRow, ThumbSize};
|
||||
use craft::ui::menu::{Menu, MenuItem, PanelRow};
|
||||
use craft::ui::runtime::commands::{CommandState, CommandStates};
|
||||
use craft::ui::sections::{FooterAction, FooterBar, Panel, Section};
|
||||
use craft::ui::sections::{FooterAction, FooterBar, Panel};
|
||||
use egui::Ui;
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::NodeId;
|
||||
@@ -920,7 +920,7 @@ fn info_row(ui: &mut Ui, label: &'static str, value: String) {
|
||||
|
||||
/// The Link Info section: the details of `info` (`links.info`), or a hint.
|
||||
fn link_info(ui: &mut Ui, info: Option<&Value>, units: vectorcraft_doc::Unit) {
|
||||
Section::fixed(tl!("Link Info")).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Link Info")).show(ui, |ui, _| {
|
||||
let Some(i) = info else {
|
||||
Text::new(tl!("Select an image to see its Link Info.")).shade(Shade::Muted).show(ui);
|
||||
return;
|
||||
|
||||
@@ -12,7 +12,6 @@ use craft::ui::menu::PanelRow;
|
||||
use craft::ui::primitives::{Glyph, IconSpec, paint_icon};
|
||||
use craft::ui::runtime::commands::{CommandState, CommandStates};
|
||||
use craft::ui::runtime::env::Direction;
|
||||
use craft::ui::sections::{HeaderStrength, Section};
|
||||
use craft::ui::style::UiTokens;
|
||||
use egui::{Align2, Color32, FontId, Painter, Rect, Stroke, Ui, vec2};
|
||||
use serde_json::{Value, json};
|
||||
@@ -133,7 +132,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
let mixed = !modes.is_empty() && shared.is_none();
|
||||
// Selected members can always take a mode.
|
||||
let count = if modes.is_empty() { n } else { n.max(2) };
|
||||
Section::fixed(tl!("Shape Modes:")).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Shape Modes:")).show(ui, |ui, _| {
|
||||
Row::new().gap(Gap::Item).show(ui, |ui, _| {
|
||||
for ((icon, label, op), mode) in SHAPE_MODES.into_iter().zip(ShapeMode::ALL) {
|
||||
let glyph = ShapeModeGlyph { icon: IconId::new(icon), mixed };
|
||||
@@ -154,7 +153,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
.show(ui);
|
||||
});
|
||||
});
|
||||
Section::fixed(tl!("Pathfinders:")).strength(HeaderStrength::Caption).show(ui, |ui, _| {
|
||||
crate::panels::section(tl!("Pathfinders:")).show(ui, |ui, _| {
|
||||
Row::new().gap(Gap::Item).show(ui, |ui, _| {
|
||||
for (icon, label, op) in PATHFINDERS {
|
||||
IconButton::command(IconSpec::svg(IconId::new(icon)), CommandRef::new(format!("object.pathfinder.{op}")))
|
||||
|
||||
@@ -7,12 +7,11 @@ use craft::ui::layout_components::{Grid, Row, Stack};
|
||||
use craft::ui::patterns::panels::Inspector;
|
||||
|
||||
use craft::ui::runtime::commands::CommandRef;
|
||||
use craft::ui::sections::{HeaderStrength, Section};
|
||||
use egui::Ui;
|
||||
use serde_json::json;
|
||||
use vectorcraft_doc::{LiveShape, Node, NodeKind};
|
||||
|
||||
use super::first_selected;
|
||||
use super::{first_selected, section};
|
||||
use crate::VectorcraftApp;
|
||||
|
||||
/// Run-only state of the Properties panel.
|
||||
@@ -68,11 +67,6 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
});
|
||||
}
|
||||
|
||||
/// A section of the panel under its heading in label text, as the reference panel's section headings are.
|
||||
fn section<'a>(title: &'static str) -> Section<'a> {
|
||||
Section::fixed(title).strength(HeaderStrength::Normal)
|
||||
}
|
||||
|
||||
/// The document's uid: production's field ids do not change with the selection, so neither does the key and the
|
||||
/// scroll position stays.
|
||||
fn target_key(app: &VectorcraftApp) -> Option<u64> {
|
||||
|
||||
@@ -25,7 +25,6 @@ use craft::ui::notices::Notice;
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::runtime::commands::{CommandState, CommandStates};
|
||||
use craft::ui::runtime::env::Label;
|
||||
use craft::ui::sections::Section;
|
||||
use egui::{Color32, Ui};
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_color::cms::{self, Intent, Policy, ProfileKind};
|
||||
@@ -423,10 +422,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) {
|
||||
// pass (not a sizing one) spends it.
|
||||
let reveal = app.ui.color_settings_scroll;
|
||||
Stack::new().label(tl!("Separations Preview")).show(ui, |ui, _| {
|
||||
Section::fixed(tl!("Separations Preview")).show(ui, |ui, _| plates_section(app, ui));
|
||||
Section::fixed(tl!("Proof Setup")).show(ui, |ui, _| proof_section(app, ui));
|
||||
crate::panels::section(tl!("Separations Preview")).show(ui, |ui, _| plates_section(app, ui));
|
||||
crate::panels::section(tl!("Proof Setup")).show(ui, |ui, _| proof_section(app, ui));
|
||||
Lazy::new("color-settings", COLOR_SETTINGS_ESTIMATE).reveal(reveal).show(ui, |ui| {
|
||||
Section::fixed(tl!("Color Settings")).show(ui, |ui, _| settings_rows(app, ui));
|
||||
crate::panels::section(tl!("Color Settings")).show(ui, |ui, _| settings_rows(app, ui));
|
||||
});
|
||||
});
|
||||
if reveal && !ui.is_sizing_pass() {
|
||||
|
||||
Reference in New Issue
Block a user