mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-26 08:29:14 +00:00
Look round 15: toolbar gear icon and margin place, text-only menus, plain Combine header menu, per-document unsaved prompt, Save for comment edits, single stamp title
This commit is contained in:
@@ -261,10 +261,10 @@ impl PdfCraftApp {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let name = self.session.get(doc).map(|d| d.name.clone()).unwrap_or_default();
|
let name = self.session.get(doc).map(|d| d.name.clone()).unwrap_or_default();
|
||||||
let remaining = self.close_guard.as_ref().map_or(1, |g| g.remaining());
|
|
||||||
let shown = crate::dialogs::shorten_middle(&name, 80);
|
let shown = crate::dialogs::shorten_middle(&name, 80);
|
||||||
|
// Production asks about each document in turn, with no Apply to All box (`remaining(1)` leaves it out).
|
||||||
// The question as production words it, on every platform: the name in the title, the consequence as a note.
|
// The question as production words it, on every platform: the name in the title, the consequence as a note.
|
||||||
let dialog = UnsavedChangesDialog::new(scope, shown.clone()).remaining(remaining);
|
let dialog = UnsavedChangesDialog::new(scope, shown.clone()).remaining(1);
|
||||||
let dialog = if scope == CloseScope::Revert {
|
let dialog = if scope == CloseScope::Revert {
|
||||||
dialog
|
dialog
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ pub(crate) fn measure_rail(app: &mut PdfCraftApp, ui: &egui::Ui, width: f32) ->
|
|||||||
let toolbar = slots(app);
|
let toolbar = slots(app);
|
||||||
let current = current_tool(app);
|
let current = current_tool(app);
|
||||||
let last_used = last_used(app);
|
let last_used = last_used(app);
|
||||||
let mut rail = ToolRail::new(tl!("Toolbar").to_string(), &toolbar, ¤t, &last_used).edit_toolbar(tl!("Edit toolbar").to_string());
|
let mut rail = ToolRail::new(tl!("Toolbar").to_string(), &toolbar, ¤t, &last_used).edit_toolbar(tl!("Edit toolbar").to_string()).edit_icon(IconId::new("settings"));
|
||||||
if app.hotbar.drawer_open {
|
if app.hotbar.drawer_open {
|
||||||
rail = rail.editing();
|
rail = rail.editing();
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ pub(crate) fn show_rail(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
|||||||
let current = current_tool(app);
|
let current = current_tool(app);
|
||||||
let last_used = last_used(app);
|
let last_used = last_used(app);
|
||||||
let editing = app.hotbar.drawer_open;
|
let editing = app.hotbar.drawer_open;
|
||||||
let mut rail = ToolRail::new(tl!("Toolbar").to_string(), &toolbar, ¤t, &last_used).edit_toolbar(tl!("Edit toolbar").to_string());
|
let mut rail = ToolRail::new(tl!("Toolbar").to_string(), &toolbar, ¤t, &last_used).edit_toolbar(tl!("Edit toolbar").to_string()).edit_icon(IconId::new("settings"));
|
||||||
if editing {
|
if editing {
|
||||||
rail = rail.editing();
|
rail = rail.editing();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ impl PdfCraftApp {
|
|||||||
let ctx = ui.ctx().clone();
|
let ctx = ui.ctx().clone();
|
||||||
let bar = craft::menu::layout(&self.menu_bar(&ctx), Target::current(), &layout_options()).bar;
|
let bar = craft::menu::layout(&self.menu_bar(&ctx), Target::current(), &layout_options()).bar;
|
||||||
let modal = gated(self);
|
let modal = gated(self);
|
||||||
craft::menu::MenuBarUi::new(&bar).keyboard(!modal).english(&english).show(ui);
|
craft::menu::MenuBarUi::new(&bar).keyboard(!modal).icons(false).english(&english).show(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Install the native menu bar (macOS), once, from the eframe app creator. `false` when
|
/// Install the native menu bar (macOS), once, from the eframe app creator. `false` when
|
||||||
|
|||||||
@@ -183,9 +183,8 @@ impl craft::behavior::ItemSource<usize> for Stamps {
|
|||||||
/// page to place it.
|
/// page to place it.
|
||||||
pub(super) fn stamp_palette(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
pub(super) fn stamp_palette(app: &mut PdfCraftApp, ui: &mut egui::Ui) {
|
||||||
use pdfcraft_engine::{StampGroup, StampKind};
|
use pdfcraft_engine::{StampGroup, StampKind};
|
||||||
// Titled as production's panel is: Back to All tools, the name and Close.
|
// The dock's group header already names the tool and closes it; a second title here showed "Add a stamp" twice.
|
||||||
let commands = vec![HeaderCommand::new(IconId::new("chevron-left"), "tools.all")];
|
let shown = Panel::new(tl!("Add a stamp").to_string()).show(ui, |ui, _| {
|
||||||
let shown = Panel::new(tl!("Add a stamp").to_string()).titled().commands(commands).actions([HeaderAction::Close]).show(ui, |ui, _| {
|
|
||||||
Stack::new().scroll(Scroll::vertical()).show(ui, |ui, _| {
|
Stack::new().scroll(Scroll::vertical()).show(ui, |ui, _| {
|
||||||
Text::new(tl!("Choose a stamp, then click on the page to place it.").to_string()).shade(Shade::Faint).show(ui);
|
Text::new(tl!("Choose a stamp, then click on the page to place it.").to_string()).shade(Shade::Faint).show(ui);
|
||||||
let titles = [
|
let titles = [
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ pub fn default_workspace(rail_side: DockSide) -> Workspace<PanelId> {
|
|||||||
let (start, end) = if rail_edge(rail_side) == DockEdge::Start { (vec![side, tools], Vec::new()) } else { (vec![tools], vec![side]) };
|
let (start, end) = if rail_edge(rail_side) == DockEdge::Start { (vec![side, tools], Vec::new()) } else { (vec![tools], vec![side]) };
|
||||||
let page = Node::split(Axis::X, SplitSize::Ratio(PAGE_SHARE), Node::tabs(vec![PanelId::Document], 0), Node::dock(DockEdge::End, end));
|
let page = Node::split(Axis::X, SplitSize::Ratio(PAGE_SHARE), Node::tabs(vec![PanelId::Document], 0), Node::dock(DockEdge::End, end));
|
||||||
let root = Node::split(Axis::X, SplitSize::Ratio(START_SHARE), Node::dock(DockEdge::Start, start), page);
|
let root = Node::split(Axis::X, SplitSize::Ratio(START_SHARE), Node::dock(DockEdge::Start, start), page);
|
||||||
let rect = egui::Rect::from_min_size(egui::pos2(TOOLS_WIDTH + 3.0, 8.0), egui::vec2(48.0, 400.0));
|
let rect = egui::Rect::from_min_size(egui::pos2(TOOLS_WIDTH + 28.0, 14.0), egui::vec2(48.0, 400.0));
|
||||||
let floating = Floating::new(toolbar, rect).with_id(1);
|
let floating = Floating::new(toolbar, rect).with_id(1);
|
||||||
Workspace::new(Layout::new(Some(root), vec![floating]))
|
Workspace::new(Layout::new(Some(root), vec![floating]))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ pub(crate) fn quick_bar_controls(ui: &mut egui::Ui, tool: CommentTool, prefs: &m
|
|||||||
popover_from(
|
popover_from(
|
||||||
ui,
|
ui,
|
||||||
tl!("Line thickness"),
|
tl!("Line thickness"),
|
||||||
|ui| IconButton::new(IconId::new("sliders-horizontal")).label(tl!("Line thickness")).show(ui).response,
|
|ui| IconButton::new(IconId::new("adjustments")).label(tl!("Line thickness")).show(ui).response,
|
||||||
|ui| {
|
|ui| {
|
||||||
let mut w = style.width;
|
let mut w = style.width;
|
||||||
SliderField::new(tl!("Line thickness"), Bind::bound(&mut w), tool.min_width()..=super::MAX_LINE_WIDTH).step(0.5).unit("pt").show(ui);
|
SliderField::new(tl!("Line thickness"), Bind::bound(&mut w), tool.min_width()..=super::MAX_LINE_WIDTH).step(0.5).unit("pt").show(ui);
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ pub(super) fn table(app: &mut PdfCraftApp, ui: &mut egui::Ui) -> Option<RowActio
|
|||||||
.sort(sort)
|
.sort(sort)
|
||||||
.selection(Bind::bound(&mut app.combine_tab.selection))
|
.selection(Bind::bound(&mut app.combine_tab.selection))
|
||||||
.column_layout(Bind::bound(&mut app.combine_columns))
|
.column_layout(Bind::bound(&mut app.combine_columns))
|
||||||
|
.plain_header_menu(true)
|
||||||
.reorder(ReorderRule::new().keys(ReorderKeys::AltArrows))
|
.reorder(ReorderRule::new().keys(ReorderKeys::AltArrows))
|
||||||
.deletable(true)
|
.deletable(true)
|
||||||
.space(SpaceAction::Preview)
|
.space(SpaceAction::Preview)
|
||||||
|
|||||||
@@ -1826,7 +1826,8 @@ fn delete_one_reply_row() {
|
|||||||
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
||||||
h.event(egui::Event::Text("Right reply, reworded".into()));
|
h.event(egui::Event::Text("Right reply, reworded".into()));
|
||||||
h.run_steps(2);
|
h.run_steps(2);
|
||||||
h.query_all_by_label("Post").find(|n| !n.accesskit_node().is_disabled()).expect("the editor's Post").click();
|
// The document's own Save sits earlier in the tree than the editor's.
|
||||||
|
h.query_all_by_label("Save").filter(|n| !n.accesskit_node().is_disabled()).last().expect("the editor's Save").click();
|
||||||
h.run_steps(3);
|
h.run_steps(3);
|
||||||
assert_eq!(texts(&h), ["The comment", "Right reply, reworded", "Accepted set by Ben"]);
|
assert_eq!(texts(&h), ["The comment", "Right reply, reworded", "Accepted set by Ben"]);
|
||||||
|
|
||||||
@@ -2062,8 +2063,8 @@ fn the_panel_reveals_edits_and_reopens_a_late_thread_without_changing_its_replie
|
|||||||
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
||||||
h.event(egui::Event::Text("Late root edited exactly".into()));
|
h.event(egui::Event::Text("Late root edited exactly".into()));
|
||||||
h.run_steps(2);
|
h.run_steps(2);
|
||||||
// The Comments panel's inline editor commits with its own Post button right beneath the Edit field.
|
// The Comments panel's inline editor commits with its own Save button right beneath the Edit field.
|
||||||
h.query_all_by_role_and_label(Role::Button, "Post")
|
h.query_all_by_role_and_label(Role::Button, "Save")
|
||||||
.filter(|n| n.rect().top() >= editor_bottom - 2.0)
|
.filter(|n| n.rect().top() >= editor_bottom - 2.0)
|
||||||
.min_by(|a, b| a.rect().top().total_cmp(&b.rect().top()))
|
.min_by(|a, b| a.rect().top().total_cmp(&b.rect().top()))
|
||||||
.expect("inline edit Post button")
|
.expect("inline edit Post button")
|
||||||
@@ -4369,7 +4370,7 @@ fn edit_composer_preserves_only_typewriter_whitespace(kind: u8) {
|
|||||||
if shots {
|
if shots {
|
||||||
h.render().unwrap().save(format!("/tmp/5954-composer-{kind}.png")).unwrap();
|
h.render().unwrap().save(format!("/tmp/5954-composer-{kind}.png")).unwrap();
|
||||||
}
|
}
|
||||||
h.get_all_by_label("Post").last().unwrap().click();
|
h.get_all_by_label("Save").last().unwrap().click();
|
||||||
h.run_steps(3);
|
h.run_steps(3);
|
||||||
assert!(h.state().views[0].session.comments.composer.is_none());
|
assert!(h.state().views[0].session.comments.composer.is_none());
|
||||||
let id = h.state().views[0].id;
|
let id = h.state().views[0].id;
|
||||||
|
|||||||
Reference in New Issue
Block a user