diff --git a/ROADMAP.md b/ROADMAP.md index 4358817b60..2fb84ab127 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -128,11 +128,13 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-14: Built-in Tech Circuit brush library: Circuit Trace (chamfered art with 45-degree elbows and terminal pads), Bus Lines (parallel conductor pattern) and Terminal Nodes (repeating solder pads, test points and leads), all original geometry generated in code. Ten built-in brush libraries; G5 remaining estimate 3–13 h (estimated), headline numbers unchanged. - 2026-11-05: Window › Toolbars › Keep Tools Beside the Canvas, off by default, docks the Tools panel between left-side panels and the canvas instead of at the window's left edge, and the canvas's left edge then also docks a floating Tools panel (`window.toolsBesideCanvas`, #5395). Workspaces keep the setting; workspaces saved without it keep Tools at the window's edge. An optional VectorCraft layout choice; headline numbers unchanged. +- 2026-11-17: The canvas's left edge docks a floating Tools panel whichever way Keep Tools Beside the Canvas is set: a drop there, right of panels docked on the left, turns the setting on, and a drop on the window's left edge turns it off (#7837). Headline numbers unchanged. - 2026-11-12: Stencil Bridges in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): strips of a set width are cut out of the selected art so that every island of a stencil cut from it (the inside of an O, a hole in a shape) stays attached to the sheet, by the shortest crossings first, vertical, horizontal or the shortest among 12 directions 15° apart, with up to 16 bridges per island; type is measured by its glyph outlines and stays type, and the original goes to a hidden layer or is replaced. One undo step (`addon.cutting.bridges`). A VectorCraft addition: headline numbers unchanged. - 2026-11-13: Banner Hems and Grommets in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): on the chosen sides of the selected art's bounds, or of each artboard, a hem line at a set depth inside the edge and grommet marks (a circle with a cross) at a set inset, one at each end of a side and the rest spread evenly at most a set spacing apart, stroked in a chosen swatch; a dialog with Preview, one undo step (`addon.cutting.banner`). A VectorCraft addition: headline numbers unchanged. - 2026-11-14: Nest Shapes in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): the selected objects move close together onto an artboard, a sheet of a set size or a roll of a set width, packed by their bounding boxes with a margin inside the edges and a spacing between them, optionally turning objects 90° to fit; objects that do not fit go in a column beside the sheet; a dialog with Preview, one undo step (`addon.cutting.nest`). A VectorCraft addition: headline numbers unchanged. - 2026-11-15: With Smart Guides and Snap to Tangent on, a circle drawn from its center with the Ellipse tool (Alt and Shift) snaps its radius so that the circle touches a nearby path (a straight segment, a curve, or another circle from outside or inside) when the radius comes within the snapping tolerance of that size, and the touch point shows the "tangent" label. A VectorCraft addition: headline numbers unchanged. - 2026-11-05: Release Type on a Path joins the Type Tools add-on (Object › Plug-ins › Type Tools): each selected type on a path splits into point type with the same text and attributes, on one straight line starting where its first character sat, and the plain path it was set on, with its exact shape and place in the stacking order and no paint; or keeps only the path or only the text, optionally leaving the original. A dialog with Preview, one undo step (`addon.type.releasePath`, #5532). A VectorCraft addition: headline numbers unchanged. +- 2026-11-14: Unit Converter add-on (Object › Plug-ins › Unit Converter): a panel with one field per unit (pt, picas, in, mm, cm, px, ft & in, m, yd, ft, Q, Ha) where a length typed in any field updates the others as it is typed; From Selection reads the selection's width or height, Apply sets it as one undo step, and each field copies its value with or without the unit (`addon.units.convert`, `addon.units.selectionSize`, #5528). A VectorCraft addition: headline numbers unchanged. - 2026-11-04: New Document: the units chosen in Preset Details now belong to the chosen document, as the pane's options are listed for the selected preset; the chosen card shows them, every other Recent and Saved card keeps the units its document or preset was made in, and the built-in tabs still follow the chosen units, so switching between inches and millimetres no longer restyles every recent template. Scores and estimates unchanged. - 2026-11-14: Packaging Tools add-on (Object › Plug-ins › Packaging Tools): fold line roles for dielines (Cut, Crease, Partial Cut, Perforation), each carried by the swatch on a path's top stroke through a per-document role table that native files keep; PDF prints a role line on its swatch's separation when that swatch is a spot color, as the default role swatches are, and SVG, DXF and HP-GL keep the stroke's color. Make Cut Line, Make Crease Line, Make Partial Cut Line and Make Perforation Line give the selected paths a role, overprinting by default, and make a missing role swatch; the Fold Lines panel counts each role in the selection or the document, and its Role Swatches… picks another swatch for a role (`addon.packaging.setRole`, `addon.packaging.roles`, `addon.packaging.setRoleSwatch`). A VectorCraft addition: headline numbers unchanged. - 2026-11-16: Check Fold Lines in the Packaging Tools add-on (Object › Plug-ins › Packaging Tools, and the Fold Lines panel's Check button): the fold lines of the selection or the document are split into blanks, panels and hinges (cut lines bound the material, and creases, partial cuts and perforations divide it into panels), and 15 kinds of issue are listed, errors and warnings, each naming its lines: cut lines that enclose nothing or end loose, gaps closed within a tolerance, a cut on top of a crease, duplicate lines, creases that end inside a panel, divide nothing, lie outside the blank or are not straight, gaps too narrow to map, fold lines in a hole, panels joined by no crease, and fold lines on a non-printing layer. The panel lists the issues in the interface language; clicking one selects its lines (`addon.packaging.check`). A VectorCraft addition: headline numbers unchanged. diff --git a/apps/vectorcraft/src/app.rs b/apps/vectorcraft/src/app.rs index dddaf0a91e..a40eb0c92f 100644 --- a/apps/vectorcraft/src/app.rs +++ b/apps/vectorcraft/src/app.rs @@ -43,6 +43,16 @@ impl eframe::App for App { /// Restore the borderless caption, apply platform menu and pen input, and hand the frame to the /// app's raw-input hook while the keyboard user is unconfined. fn raw_input_hook(&mut self, ctx: &egui::Context, raw: &mut egui::RawInput) { + // Without vsync, a main-window frame starts no sooner than the minimum interval after the + // last one. eframe runs this hook once per frame, shown or not, before egui reads the input. + // The frame's time moves on by the wait, and the hang report's frame time starts after it. + if raw.viewport_id == egui::ViewportId::ROOT { + if let Some(wait) = super::presentation::frame_wait(self.min_frame, self.last_frame_began.map(|t| t.elapsed())) { + std::thread::sleep(wait); + raw.time = raw.time.map(|time| time + wait.as_secs_f64()); + } + self.last_frame_began = Some(std::time::Instant::now()); + } let _timed = BEACON.enter_timed(Stage::Input); self.frame_start = Some(std::time::Instant::now()); // winit gives the window its caption back when it changes the window's flags (maximize, diff --git a/apps/vectorcraft/src/main.rs b/apps/vectorcraft/src/main.rs index 4f8e326981..e48152c523 100644 --- a/apps/vectorcraft/src/main.rs +++ b/apps/vectorcraft/src/main.rs @@ -142,6 +142,11 @@ struct App { display_profile: display_profile::Reader, /// When this frame's input hook started, for the hang report's frame times (`hang_watch`). frame_start: Option, + /// The shortest time between the starts of two frames, while the window presents without vsync + /// ([`presentation::min_frame_interval`]). + min_frame: Option, + /// When the last frame started, after its wait for [`Self::min_frame`]. + last_frame_began: Option, } /// `vectorcraft --help`. Headless work (convert, run, MCP) is `vectorcraft-cli`'s. @@ -365,6 +370,10 @@ fn main() -> std::process::ExitCode { let saved_window = saved.as_ref().and_then(|ui| ui.window); #[cfg(feature = "wgpu")] let gpu_pref = saved.as_ref().and_then(|ui| ui.engine_prefs.get("gpuPreference")).and_then(serde_json::Value::as_str); + // Preferences › Performance › Low-Latency Drawing; anything but `true` in the file is off. + #[cfg(feature = "wgpu")] + let low_latency_drawing = + saved.as_ref().and_then(|ui| ui.engine_prefs.get("lowLatencyDrawing")).and_then(serde_json::Value::as_bool).unwrap_or(false); #[cfg(feature = "wgpu")] let power_env = eframe::wgpu::PowerPreference::from_env(); #[cfg(feature = "wgpu")] @@ -458,10 +467,11 @@ fn main() -> std::process::ExitCode { let mut options = options; // One frame queued, not two: the canvas is rasterized on the CPU and the GPU only // composites it, so the window answers the pointer a frame sooner (#444). - // `--present-mode` and `--frame-latency` change it for a launch (`presentation`). - options.wgpu_options.surface = presentation.apply(eframe::egui_wgpu::SurfaceConfig::LOW_LATENCY); + // `--present-mode` and `--frame-latency` change it for a launch, and Low-Latency Drawing + // asks for no vsync when neither sets the mode (`presentation`). + options.wgpu_options.surface = presentation.apply(eframe::egui_wgpu::SurfaceConfig::LOW_LATENCY, low_latency_drawing); // What the app asks for: the driver picks novsync's mode and may clamp the latency. - log::info!("requested window surface: {}", presentation::describe(&options.wgpu_options.surface, &presentation)); + log::info!("requested window surface: {}", presentation::describe(&options.wgpu_options.surface, &presentation, low_latency_drawing)); // Only adapters that can show the window, in the order `gpu` gives (#306, #502). if let eframe::egui_wgpu::WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup { create.native_adapter_selector = Some(gpu::selector(power, displays, compositor, left_out.adapters.clone(), startup.clone())); @@ -508,6 +518,11 @@ fn main() -> std::process::ExitCode { // For the hang report (`hang_watch`). #[cfg(feature = "wgpu")] let requested_surface = options.wgpu_options.surface; + // Without vsync, frames start at most 240 times a second (`presentation`). + #[cfg(feature = "wgpu")] + let min_frame = presentation::min_frame_interval(&requested_surface); + #[cfg(not(feature = "wgpu"))] + let min_frame = None; // A panic that ends the window (egui-wgpu's own, #502) is caught here: never a crash. let run = |options: eframe::NativeOptions, app_creator: eframe::AppCreator<'_>| { #[cfg(target_os = "linux")] @@ -694,6 +709,8 @@ fn main() -> std::process::ExitCode { monitors_listed: None, display_profile: Default::default(), frame_start: None, + min_frame, + last_frame_began: None, })) }), ) diff --git a/apps/vectorcraft/src/presentation.rs b/apps/vectorcraft/src/presentation.rs index 7c2f1dc48a..76438ab996 100644 --- a/apps/vectorcraft/src/presentation.rs +++ b/apps/vectorcraft/src/presentation.rs @@ -6,9 +6,17 @@ //! frames the swap chain may queue, 1 to 3. Unset, the app keeps its own surface settings. A flag //! overrides its variable; a value that isn't one of these stops the app with a message, as //! `--control` does. A launch that sets either one runs as its own app, as with `--new-instance`. -//! The surface the app asks for is logged at start-up. +//! Preferences › Performance › Low-Latency Drawing (`lowLatencyDrawing`, off by default, read at +//! start-up) asks for `novsync` when neither the flag nor the variable sets the mode. Whenever the +//! surface presents without vsync, frames start at most 240 times a second. The surface the app +//! asks for is logged at start-up, with where its present mode came from. use std::ffi::OsString; +use std::time::Duration; + +/// The most frames a second the window draws while it presents without vsync. +#[cfg(feature = "wgpu")] +pub const UNSYNCED_FRAME_CAP: u32 = 240; /// A present mode the command line or the environment can ask for. #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -96,25 +104,44 @@ impl Overrides { Ok(Self { mode, latency }) } - /// `surface` with the overrides applied. + /// `surface` with the overrides applied. With Low-Latency Drawing on (`low_latency_drawing`) and + /// no present mode override, the mode is `novsync`. #[cfg(feature = "wgpu")] - pub fn apply(&self, surface: eframe::egui_wgpu::SurfaceConfig) -> eframe::egui_wgpu::SurfaceConfig { + pub fn apply(&self, surface: eframe::egui_wgpu::SurfaceConfig, low_latency_drawing: bool) -> eframe::egui_wgpu::SurfaceConfig { use eframe::wgpu::PresentMode; let present_mode = match self.mode { Some(Mode::Fifo) => PresentMode::Fifo, Some(Mode::AutoVsync) => PresentMode::AutoVsync, Some(Mode::NoVsync) => PresentMode::AutoNoVsync, + None if low_latency_drawing => PresentMode::AutoNoVsync, None => surface.present_mode, }; eframe::egui_wgpu::SurfaceConfig { present_mode, desired_maximum_frame_latency: self.latency.or(surface.desired_maximum_frame_latency) } } } -/// The present mode and frame latency `surface` asks for, for the start-up log: -/// "autovsync, frame latency 1", with "(override)" -/// after a value a flag or variable set. +/// The shortest time between the starts of two frames on `surface`: `None` with vsync, where the +/// display paces the frames, and 1/[`UNSYNCED_FRAME_CAP`] of a second without it. #[cfg(feature = "wgpu")] -pub fn describe(surface: &eframe::egui_wgpu::SurfaceConfig, overrides: &Overrides) -> String { +pub fn min_frame_interval(surface: &eframe::egui_wgpu::SurfaceConfig) -> Option { + use eframe::wgpu::PresentMode; + match surface.present_mode { + PresentMode::AutoNoVsync | PresentMode::Immediate | PresentMode::Mailbox => Some(Duration::from_secs(1) / UNSYNCED_FRAME_CAP), + PresentMode::AutoVsync | PresentMode::Fifo | PresentMode::FifoRelaxed => None, + } +} + +/// How long a frame waits before it starts, `since_last` after the previous frame started, so that +/// frames start at least `min` apart. `None`: no wait (no cap, the first frame, or `min` has passed). +pub fn frame_wait(min: Option, since_last: Option) -> Option { + min?.checked_sub(since_last?).filter(|wait| !wait.is_zero()) +} + +/// The present mode and frame latency `surface` asks for, for the start-up log: +/// "autovsync, frame latency 1", with "(override)" after a value a flag or variable set, and +/// "(preference)" after a present mode Low-Latency Drawing set. +#[cfg(feature = "wgpu")] +pub fn describe(surface: &eframe::egui_wgpu::SurfaceConfig, overrides: &Overrides, low_latency_drawing: bool) -> String { use eframe::wgpu::PresentMode; let mode = match surface.present_mode { PresentMode::AutoVsync => "autovsync", @@ -126,7 +153,8 @@ pub fn describe(surface: &eframe::egui_wgpu::SurfaceConfig, overrides: &Override }; let latency = surface.desired_maximum_frame_latency.map_or("default".to_string(), |n| n.to_string()); let tag = |set: bool| if set { " (override)" } else { "" }; - format!("{mode}{}, frame latency {latency}{}", tag(overrides.mode.is_some()), tag(overrides.latency.is_some())) + let mode_tag = if overrides.mode.is_none() && low_latency_drawing { " (preference)" } else { tag(overrides.mode.is_some()) }; + format!("{mode}{mode_tag}, frame latency {latency}{}", tag(overrides.latency.is_some())) } #[cfg(test)] @@ -224,20 +252,99 @@ mod tests { use eframe::wgpu::PresentMode; let app = SurfaceConfig::LOW_LATENCY; // No override: the surface the app asks for is unchanged. - assert_eq!(Overrides::default().apply(app), app); + assert_eq!(Overrides::default().apply(app, false), app); let latency = Overrides { mode: None, latency: Some(2) }; - let s = latency.apply(app); + let s = latency.apply(app, false); assert_eq!((s.present_mode, s.desired_maximum_frame_latency), (PresentMode::AutoVsync, Some(2))); - assert_eq!(describe(&s, &latency), "autovsync, frame latency 2 (override)"); + assert_eq!(describe(&s, &latency, false), "autovsync, frame latency 2 (override)"); let fifo = Overrides { mode: Some(Mode::Fifo), latency: None }; - let s = fifo.apply(app); + let s = fifo.apply(app, false); assert_eq!((s.present_mode, s.desired_maximum_frame_latency), (PresentMode::Fifo, app.desired_maximum_frame_latency)); // Never a mode the driver may lack: no vsync lets wgpu fall back by support. let novsync = Overrides { mode: Some(Mode::NoVsync), latency: Some(3) }; - let s = novsync.apply(app); + let s = novsync.apply(app, false); assert_eq!((s.present_mode, s.desired_maximum_frame_latency), (PresentMode::AutoNoVsync, Some(3))); - assert_eq!(describe(&s, &novsync), "novsync (override), frame latency 3 (override)"); + assert_eq!(describe(&s, &novsync, false), "novsync (override), frame latency 3 (override)"); let unset = SurfaceConfig { present_mode: PresentMode::Fifo, desired_maximum_frame_latency: None }; - assert_eq!(describe(&unset, &Overrides::default()), "fifo, frame latency default"); + assert_eq!(describe(&unset, &Overrides::default(), false), "fifo, frame latency default"); + } + + /// Low-Latency Drawing alone asks for no vsync, through wgpu's fallback by support and never an + /// explicit Immediate or Mailbox; off, the app's surface is exactly its own. + #[cfg(feature = "wgpu")] + #[test] + fn low_latency_drawing_alone_presents_without_vsync_and_off_keeps_the_app_surface() { + use eframe::egui_wgpu::SurfaceConfig; + use eframe::wgpu::PresentMode; + let app = SurfaceConfig::LOW_LATENCY; + let none = Overrides::default(); + assert_eq!(none.apply(app, false), app); + let s = none.apply(app, true); + assert_eq!(s.present_mode, PresentMode::AutoNoVsync); + assert_eq!(s.desired_maximum_frame_latency, app.desired_maximum_frame_latency); + let frames = app.desired_maximum_frame_latency.map_or("default".to_string(), |n| n.to_string()); + assert_eq!(describe(&s, &none, true), format!("novsync (preference), frame latency {frames}")); + // A latency override still applies with the preference's mode. + let latency = Overrides { mode: None, latency: Some(2) }; + let s = latency.apply(app, true); + assert_eq!((s.present_mode, s.desired_maximum_frame_latency), (PresentMode::AutoNoVsync, Some(2))); + assert_eq!(describe(&s, &latency, true), "novsync (preference), frame latency 2 (override)"); + } + + /// The flag and the variable each set the present mode over Low-Latency Drawing. + #[cfg(feature = "wgpu")] + #[test] + fn the_flag_and_the_variable_win_over_low_latency_drawing() { + use eframe::egui_wgpu::SurfaceConfig; + use eframe::wgpu::PresentMode; + let app = SurfaceConfig::LOW_LATENCY; + let flag = parse(&["--present-mode", "fifo"]).unwrap(); + let s = flag.apply(app, true); + assert_eq!(s.present_mode, PresentMode::Fifo); + assert!(describe(&s, &flag, true).starts_with("fifo (override),"), "{}", describe(&s, &flag, true)); + let var = Overrides::default().with_env(Some("autovsync".into()), None).unwrap(); + let s = var.apply(app, true); + assert_eq!(s.present_mode, PresentMode::AutoVsync); + assert!(describe(&s, &var, true).starts_with("autovsync (override),"), "{}", describe(&s, &var, true)); + // The flag wins over the variable, and both over the preference. + let both = parse(&["--present-mode=fifo"]).unwrap().with_env(Some("novsync".into()), None).unwrap(); + assert_eq!(both.apply(app, true).present_mode, PresentMode::Fifo); + } + + /// Frames start at most 240 times a second without vsync, from the preference or an override, + /// and the display paces them with vsync. + #[cfg(feature = "wgpu")] + #[test] + fn the_frame_cap_applies_only_without_vsync_at_240_frames_a_second() { + use eframe::egui_wgpu::SurfaceConfig; + use eframe::wgpu::PresentMode; + let app = SurfaceConfig::LOW_LATENCY; + let cap = Duration::from_secs(1) / 240; + assert_eq!(cap.as_nanos(), 4_166_666); + assert_eq!(min_frame_interval(&Overrides::default().apply(app, true)), Some(cap)); + assert_eq!(min_frame_interval(&Overrides { mode: Some(Mode::NoVsync), latency: None }.apply(app, false)), Some(cap)); + assert_eq!(min_frame_interval(&Overrides::default().apply(app, false)), None); + assert_eq!(min_frame_interval(&Overrides { mode: Some(Mode::Fifo), latency: None }.apply(app, true)), None); + for (mode, capped) in [ + (PresentMode::Immediate, true), + (PresentMode::Mailbox, true), + (PresentMode::AutoNoVsync, true), + (PresentMode::Fifo, false), + (PresentMode::FifoRelaxed, false), + (PresentMode::AutoVsync, false), + ] { + let s = SurfaceConfig { present_mode: mode, desired_maximum_frame_latency: Some(1) }; + assert_eq!(min_frame_interval(&s).is_some(), capped, "{mode:?}"); + } + } + + #[test] + fn a_frame_waits_out_the_rest_of_the_minimum_interval() { + let min = Some(Duration::from_millis(4)); + assert_eq!(frame_wait(min, Some(Duration::from_millis(1))), Some(Duration::from_millis(3))); + assert_eq!(frame_wait(min, Some(Duration::from_millis(4))), None); + assert_eq!(frame_wait(min, Some(Duration::from_millis(9))), None); + assert_eq!(frame_wait(min, None), None, "the first frame starts at once"); + assert_eq!(frame_wait(None, Some(Duration::ZERO)), None, "no cap with vsync"); } } diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs index 7f26dc9a50..18974db32a 100644 --- a/crates/doc/src/lib.rs +++ b/crates/doc/src/lib.rs @@ -168,7 +168,7 @@ use limits::MAX_NEXT_ID; pub use limits::{DocError, FORMAT_VERSION, MAX_COORD}; pub use records::{ImageBlob, MaskEdit, NewArtIds, SavedSelection, SavedView, SvgFilter, Symbol, SymbolEdit}; pub use stored_art::{StoredPlace, StoredRoot}; -pub use units::{ColorMode, Unit, parse_number}; +pub use units::{ColorMode, Unit, decimal_point, finite_in_every_unit, parse_number}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Document { diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 6863960230..a07afd0843 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -32,8 +32,8 @@ pub use para_style::{ pub use runs::PATH_LEAD_MAX; pub use runs::{INLINE_CHAR, INLINE_MAX_SCALE, InlineArt, RubyAlign, RubyPosition, RubySpan, TextKind, TextRun, TextStyleDef, TypeAntiAlias}; pub use tabs_lists::{ - Bullet, DEFAULT_TAB_INTERVAL, LIST_HANGING_INDENT, LIST_LEVEL_INDENT, LIST_LEVELS, ListAlign, ListCounts, NumberStyle, ParaList, TabAlign, - TabStop, + Bullet, DEFAULT_TAB_INTERVAL, LIST_HANGING_INDENT, LIST_LEVEL_INDENT, LIST_LEVELS, ListAlign, ListCounts, MAX_LIST_START, NumberStyle, ParaList, + TabAlign, TabStop, }; pub use wrap::{resolve_wrap, wrap_outline, wrap_sources, wrap_work}; diff --git a/crates/doc/src/text/object.rs b/crates/doc/src/text/object.rs index c556f2f5b0..746c0b69d5 100644 --- a/crates/doc/src/text/object.rs +++ b/crates/doc/src/text/object.rs @@ -304,17 +304,40 @@ impl TextObject { /// Update the paragraph styles for replacing bytes `start..end` of the current plain text by /// `insert` (call before changing the runs). The paragraph the range starts in keeps its /// style (merging paragraphs: the first one's wins); paragraphs the insertion starts take that - /// style too (Return continues the paragraph it splits); later paragraphs keep theirs. + /// style too (Return continues the paragraph it splits), without the number its list gives it + /// ([`ParaList::start`]); later paragraphs keep theirs. When an insertion that starts new + /// paragraphs is made at the start of a paragraph and some of that paragraph's text stays + /// after it, that number moves with the text to the last paragraph the insertion starts. pub fn splice_paras(&mut self, start: usize, end: usize, insert: &str) { - if self.paras.is_empty() { + let added = insert.bytes().filter(|&b| b == b'\n').count(); + let numbered = |p: &ParaStyle| p.list.is_some_and(|l| l.start.is_some()); + // With one style for every paragraph, the new paragraphs take it as it is unless its list + // gives the paragraph a number. + if self.paras.is_empty() && (added == 0 || !numbered(&self.para)) { return; } let r = self.paragraphs_in(start, end); let v = self.paragraph_styles(); - let Some(keep) = v.get(r.start).cloned() else { return }; - let added = insert.bytes().filter(|&b| b == b'\n').count(); + let Some(mut keep) = v.get(r.start).cloned() else { return }; + let given = keep.list.and_then(|l| l.start); + if let Some(l) = keep.list.as_mut() { + l.start = None; + } let mut out: Vec = v.iter().take(r.start + 1).cloned().collect(); out.extend(std::iter::repeat_n(keep, added)); + let text = self.plain_text(); + let (at, to) = (start.min(end).min(text.len()), start.max(end).min(text.len())); + let at_para_start = text.as_bytes().get(..at).is_some_and(|b| b.last().is_none_or(|&c| c == b'\n')); + // The paragraph's text after the replaced bytes, which the last new paragraph then holds. + let text_kept = r.len() == 1 && text.as_bytes().get(to).is_some_and(|&c| c != b'\n'); + if given.is_some() && added > 0 && at_para_start && text_kept { + if let Some(l) = out.get_mut(r.start).and_then(|p| p.list.as_mut()) { + l.start = None; + } + if let Some(l) = out.last_mut().and_then(|p| p.list.as_mut()) { + l.start = given; + } + } out.extend(v.iter().skip(r.end).cloned()); self.paras = out; if let Some(first) = self.paras.first() { diff --git a/crates/doc/src/text/tabs_lists.rs b/crates/doc/src/text/tabs_lists.rs index 26622fa115..2d62eb2f0d 100644 --- a/crates/doc/src/text/tabs_lists.rs +++ b/crates/doc/src/text/tabs_lists.rs @@ -206,15 +206,41 @@ pub struct ParaList { /// ([`Self::depth`]). The file saves it only when it is not 1. #[serde(skip_serializing_if = "is_first_level", deserialize_with = "read_level")] pub level: u8, + /// The number a numbered paragraph is given, 1 to [`MAX_LIST_START`]: the numbered paragraphs + /// after it at its level count on from it ([`Self::next_marker`]). None: it counts on from the + /// numbered paragraph before it. A bulleted paragraph does not use it. A paragraph made + /// with Return in a paragraph that has one does not take it, and a paragraph style does not + /// keep it. A saved number outside the range is read as the nearest one. The file saves it + /// only when it is set. + #[serde(skip_serializing_if = "Option::is_none", deserialize_with = "read_start")] + pub start: Option, } impl Default for ParaList { - /// A bulleted list with a dot, its marker aligned left, at level 1. + /// A bulleted list with a dot, its marker aligned left, at level 1, numbered on from the + /// paragraph before. fn default() -> Self { - Self { bullet: Bullet::default(), number: None, align: ListAlign::default(), level: 1 } + Self { bullet: Bullet::default(), number: None, align: ListAlign::default(), level: 1, start: None } } } +/// The largest number a numbered paragraph can be given ([`ParaList::start`]). +pub const MAX_LIST_START: u32 = 999_999_999; + +/// Reads a saved list start, a whole number or null, as the nearest of 1 to [`MAX_LIST_START`], +/// so a start such as 0 or 5000000000 opens the file at 1 or [`MAX_LIST_START`]. Anything else +/// is an error. +fn read_start<'de, D: serde::Deserializer<'de>>(d: D) -> Result, D::Error> { + let start = match serde_json::Value::deserialize(d)? { + serde_json::Value::Null => return Ok(None), + serde_json::Value::Number(n) if n.is_i64() || n.is_u64() => { + n.as_i64().map_or(i64::from(MAX_LIST_START), |n| n.clamp(1, i64::from(MAX_LIST_START))) + } + _ => return Err(serde::de::Error::custom("a list start must be a whole number")), + }; + Ok(u32::try_from(start).ok()) +} + /// Is `level` the first list level, which the file does not save? fn is_first_level(level: &u8) -> bool { *level == 1 @@ -307,6 +333,12 @@ impl ParaList { Self { level, ..self } } + /// This list with the paragraph numbered `start` (1 to [`MAX_LIST_START`]; None: on from the + /// paragraph before). + pub fn starting_at(self, start: Option) -> Self { + Self { start, ..self } + } + /// The list's level, 1 to [`LIST_LEVELS`]: [`Self::level`], a value outside the range taken /// as the nearest level. pub fn depth(&self) -> usize { @@ -334,8 +366,9 @@ impl ParaList { /// paragraph has none and leaves the counts as they are. A paragraph with text sets the counts /// of the levels deeper than its own back to 0, so a deeper paragraph after it counts from 1 /// again; a bulleted one has its bullet and leaves the count of its level as it is, and a - /// numbered one adds one to the count of its level and is numbered with it. A paragraph back - /// at a shallower level then goes on with that level's count. + /// numbered one adds one to the count of its level and is numbered with it, or with the number + /// it is given ([`Self::start`]), which becomes the count of its level. A paragraph back at a + /// shallower level then goes on with that level's count. pub fn next_marker(list: Option, empty: bool, counts: &mut ListCounts) -> Option { let Some(list) = list else { *counts = ListCounts::default(); @@ -350,7 +383,7 @@ impl ParaList { } let count = &mut counts.0[level]; if list.number.is_some() { - *count = count.saturating_add(1); + *count = list.start.map_or_else(|| count.saturating_add(1), |s| s.clamp(1, MAX_LIST_START)); } Some(list.marker(*count)) } diff --git a/crates/doc/src/text/tests.rs b/crates/doc/src/text/tests.rs index a5230d5d86..53419ecb53 100644 --- a/crates/doc/src/text/tests.rs +++ b/crates/doc/src/text/tests.rs @@ -456,6 +456,99 @@ fn list_levels_count_their_own_numbers_and_save_only_past_the_first() { assert_eq!(opened.list_level_counts, (1..=8).collect::>(), "a file keeps only the counts of levels 2 to 9"); } +/// A numbered paragraph given a number shows it, and the numbered paragraphs after it at its level +/// count on from it; deeper levels still count from 1 after it, a bulleted or empty paragraph does +/// not use the number, and a paragraph in no list still starts the count again. The file saves the +/// number only when it is set, and a saved number outside 1 to 999999999 reads as the nearest one. +#[test] +fn a_numbered_paragraph_given_a_number_starts_its_level_count_there() { + let num = |level, start| Some(ParaList::numbered(NumberStyle::Arabic).at_level(level).starting_at(start)); + let dot = Some(ParaList::bulleted(Bullet::Dot).starting_at(Some(7))); + let mut counts = ListCounts::default(); + let markers: Vec> = [ + (num(1, None), false), + (num(1, Some(5)), false), + (num(1, None), false), + (num(2, None), false), + (num(2, Some(1)), false), + (num(2, None), false), + (num(1, None), false), + (num(1, Some(9)), true), + (num(1, None), false), + (dot, false), + (num(1, Some(1)), false), + (None, false), + (num(1, None), false), + ] + .iter() + .map(|&(l, empty)| ParaList::next_marker(l, empty, &mut counts)) + .collect(); + let want = ["1.", "5.", "6.", "1.", "1.", "2.", "7.", "", "8.", "\u{2022}", "1.", "", "1."]; + assert_eq!(markers.iter().map(|m| m.as_deref().unwrap_or("")).collect::>(), want); + let mut counts = ListCounts::default(); + let roman = Some(ParaList::numbered(NumberStyle::UpperRoman).starting_at(Some(MAX_LIST_START))); + assert_eq!(ParaList::next_marker(roman, false, &mut counts).as_deref(), Some("999999999.")); + let zero = Some(ParaList::numbered(NumberStyle::Arabic).starting_at(Some(0))); + assert_eq!(ParaList::next_marker(zero, false, &mut counts).as_deref(), Some("1."), "a number below 1 counts as 1"); + assert_eq!(serde_json::to_value(num(1, None)).unwrap(), serde_json::json!({"bullet": "dot", "number": "arabic"})); + assert_eq!(serde_json::to_value(num(1, Some(5))).unwrap(), serde_json::json!({"bullet": "dot", "number": "arabic", "start": 5})); + let read = |v: serde_json::Value| serde_json::from_value::(v).unwrap().start; + assert_eq!(read(serde_json::json!({"number": "arabic", "start": 5})), Some(5)); + assert_eq!(read(serde_json::json!({"number": "arabic"})), None); + assert_eq!(read(serde_json::json!({"number": "arabic", "start": null})), None); + let starts = [serde_json::json!(0), serde_json::json!(-3), serde_json::json!(5_000_000_000_u64), serde_json::json!(u64::MAX)]; + assert_eq!( + starts.map(|s| read(serde_json::json!({ "number": "arabic", "start": s }))), + [Some(1), Some(1), Some(MAX_LIST_START), Some(MAX_LIST_START)], + "a saved number outside 1 to 999999999 reads as the nearest one" + ); + for bad in [serde_json::json!(2.5), serde_json::json!("5"), serde_json::json!(true)] { + assert!(serde_json::from_value::(serde_json::json!({ "start": bad })).is_err(), "{bad}"); + } +} + +/// Return in a paragraph that its list gives a number makes paragraphs without it, also while +/// every paragraph shares one style; Return at the start of its text moves the number with the +/// text, and Return elsewhere leaves it where it was. +#[test] +fn return_does_not_copy_a_paragraphs_number() { + let five = ParaStyle { list: Some(ParaList::numbered(NumberStyle::Arabic).starting_at(Some(5))), ..ParaStyle::default() }; + let starts = |t: &TextObject| t.paragraph_styles().iter().map(|p| p.list.and_then(|l| l.start)).collect::>(); + // One style for the whole text: Return after "one" splits it. + let mut t = TextObject::point(Point::ZERO, "onetwo", CharStyle::default()); + t.set_all_paras(five); + t.splice_paras(3, 3, "\n"); + t.runs[0].text.insert(3, '\n'); + t.normalize_paras(); + assert_eq!(starts(&t), [Some(5), None]); + assert!(t.para_at(1).list.is_some_and(|l| l.number == Some(NumberStyle::Arabic)), "the new paragraph stays in the list"); + // Return at the start of "two" (a paragraph with a number of its own): the number moves on + // with the text, and the empty paragraph left before it has none. + t.edit_paras(Some(1..2), |p| p.list = p.list.map(|l| l.starting_at(Some(8)))); + t.splice_paras(4, 4, "\n\n"); + t.runs[0].text.insert_str(4, "\n\n"); + t.normalize_paras(); + assert_eq!(t.plain_text(), "one\n\n\ntwo"); + assert_eq!(starts(&t), [Some(5), None, None, Some(8)]); + // A whole paragraph pasted at the start of "two": the number stays with "two". + t.splice_paras(6, 6, "Pasted\n"); + t.runs[0].text.insert_str(6, "Pasted\n"); + t.normalize_paras(); + assert_eq!(t.plain_text(), "one\n\n\nPasted\ntwo"); + assert_eq!(starts(&t), [Some(5), None, None, None, Some(8)]); + // "two" replaced by two paragraphs: none of its text is left, so the first new one keeps it. + t.splice_paras(13, 16, "A\nB"); + t.runs[0].text.replace_range(13..16, "A\nB"); + t.normalize_paras(); + assert_eq!(t.plain_text(), "one\n\n\nPasted\nA\nB"); + assert_eq!(starts(&t), [Some(5), None, None, None, Some(8), None]); + // Text without a number keeps one style for every paragraph. + let mut t = TextObject::point(Point::ZERO, "onetwo", CharStyle::default()); + t.set_all_paras(ParaStyle { list: Some(ParaList::numbered(NumberStyle::Arabic)), ..ParaStyle::default() }); + t.splice_paras(3, 3, "\n"); + assert!(t.paras.is_empty()); +} + /// In a threaded frame whose first paragraph continues from the frame before, the text at the /// frame's start is not the start of a paragraph, so typing a list's start there starts nothing. /// The paragraphs after it still start lists. diff --git a/crates/doc/src/units.rs b/crates/doc/src/units.rs index 5fabfece65..7e061d02c0 100644 --- a/crates/doc/src/units.rs +++ b/crates/doc/src/units.rs @@ -316,6 +316,37 @@ fn percent(s: &str) -> Option { } } +/// `text` typed in a numeric field, with a decimal comma read as a point: `0,1 mm` is `0.1 mm` +/// (#3837), and each number of a sum reads its own separator, so `100.5 mm-0,5` (a comma typed +/// after the value the field shows) is 100 mm (#5684). A number written with both separators has +/// two points once read, so `1,000.5` and `1.234,5` are refused rather than guessed at; so is a +/// number that reads as thousands ([`thousands`]). +pub fn decimal_point(text: &str) -> std::borrow::Cow<'_, str> { + if text.contains(',') && !thousands(text) { text.replace(',', ".").into() } else { text.into() } +} + +/// Is `text` a number written with a thousands comma, as `1,000`, `+1,000`, `12,500 mm` or +/// `1,000"`: a sign, one to three digits (not a lone 0), a comma, exactly three digits, then at +/// most a unit? Read as a decimal it would be a thousand times too small, so the field refuses it +/// instead (`0,125` and `1,25` are decimals). +fn thousands(text: &str) -> bool { + let number = text.trim(); + let number = number.strip_prefix(['+', '-']).unwrap_or(number); + let Some((whole, rest)) = number.split_once(',') else { return false }; + let (part, unit) = rest.split_at(rest.find(|c: char| !c.is_ascii_digit()).unwrap_or(rest.len())); + (1..=3).contains(&whole.len()) + && whole.bytes().all(|b| b.is_ascii_digit()) + && !whole.starts_with('0') + && part.len() == 3 + && unit.trim().chars().all(|c| c.is_alphabetic() || c == '"' || c == '\'') +} + +/// Is the length `pt` (points) a finite number in every unit of [`Unit::EAST_ASIAN`]? A length +/// near the largest number in points is too large in Q and Ha. +pub fn finite_in_every_unit(pt: f64) -> bool { + pt.is_finite() && Unit::EAST_ASIAN.iter().all(|u| u.from_pt(pt).is_finite()) +} + /// A unitless field value (percent, degrees, counts) with the same `+ - * /` arithmetic as /// [`Unit::parse`] (`45*2`, `100/3`); text other than digits, `.` and operators reads as nothing. pub fn parse_number(s: &str) -> Option { diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index c4a86dd3a5..182ea31c27 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -901,6 +901,10 @@ pub use brushsym::current_symbol; /// Data window reads files by it too). pub use variablecmds::utf16_order_without_mark; +/// How the Graph Data window's Import Data and Import Data Sets' `%` columns read a graph data +/// file: its size limit, its text, its cells and the data `graph.setData` takes from them. +pub use graph::{MAX_GRAPH_DATA_FILE, graph_cell_text, graph_data_from_grid, graph_data_text, graph_grid_from_text}; + /// The Variables panel's sort (`variable.sort`) and its rows in that order. pub use variablecmds::{VariableSort, VariableSortKey, variable_order}; diff --git a/crates/engine/src/cmd/addons.rs b/crates/engine/src/cmd/addons.rs index 8c310878fd..7437abc0b5 100644 --- a/crates/engine/src/cmd/addons.rs +++ b/crates/engine/src/cmd/addons.rs @@ -14,6 +14,7 @@ mod pen; mod select; mod shapes; mod typetools; +mod units; pub(crate) use image::{DecodedImages, refresh_color_masks}; pub(crate) use packaging::{role_swatch_edited, role_swatches_merged}; @@ -35,5 +36,6 @@ pub fn specs() -> Vec { v.extend(select::specs()); v.extend(shapes::specs()); v.extend(typetools::specs()); + v.extend(units::specs()); v } diff --git a/crates/engine/src/cmd/addons/units.rs b/crates/engine/src/cmd/addons/units.rs new file mode 100644 index 0000000000..b5d844709a --- /dev/null +++ b/crates/engine/src/cmd/addons/units.rs @@ -0,0 +1,124 @@ +//! Unit Converter (`addon.units.*`), a built-in add-on that shows one length in every unit at once. +//! `addon.units.convert` reads a length as a number field reads it ([`Unit::parse`]: units and +//! arithmetic) and gives it in each unit of Preferences › Units › East Asian Type +//! ([`Unit::EAST_ASIAN`]), written as the fields write it ([`Unit::number`], [`Unit::format`]). +//! `addon.units.selectionSize` gives the selection's width and height, measured as the Transform +//! panel measures them, in the same units. Its panel and its place in Object › Plug-ins are the +//! UI's; the panel applies a length to the selection with `object.setBounds`. + +#[cfg(test)] +mod tests; + +use serde_json::{Value, json}; +use vectorcraft_doc::{OrientedBox, Unit, decimal_point, finite_in_every_unit}; +use vectorcraft_render::effects; + +use super::super::{CommandSpec, always, bad, cmd, has_selection}; +use crate::{Result, Session}; + +const CONVERT: &str = "addon.units.convert"; +const SELECTION_SIZE: &str = "addon.units.selectionSize"; +/// The most characters of a refused value an error message shows. +const SHOWN_CHARS: usize = 64; +/// The longest `value` or `unit` text `addon.units.convert` reads, in bytes. +const MAX_TEXT_LEN: usize = 1024; +/// The most `+ - * /` signs `addon.units.convert` reads in one `value`: [`Unit::parse`] takes one +/// level of recursion per sign. +const MAX_OPERATORS: usize = 128; + +pub fn specs() -> Vec { + vec![ + cmd!( + query "addon.units.convert", + "Convert Units", + [], + None, + "{value: a length (a number, or text as a number field reads it, with a unit suffix and + - * / arithmetic: \"10mm\", \"1in/2\", \"2p6\", \"3cm*50%\"; a decimal comma reads as a point: \"0,5 mm\"; at most 1024 bytes and 128 operators), unit?: the unit of a number without a suffix (a unit's name, suffix or key: points, picas, inches, millimeters, centimeters, pixels, feetInches, meters, yards, feet, q, ha; default: points)} the length in every unit of Preferences › Units › East Asian Type, written as the number fields write it (rounded to 3 decimals in pt, px, picas, Q and Ha and to 4 in the others; pixels are points). Nothing in the document changes → {points, units: [{unit (its key), label, number (no suffix), text (with the suffix)}]}", + always, + convert + ), + cmd!( + query "addon.units.selectionSize", + "Selection Size in Units", + [], + None, + "{} the selection's width and height as the Transform panel shows them (its bounding box, rotated with rotated objects; with Use Preview Bounds, the visual bounds; with anchor points selected (Direct Selection), the box around those points), each as addon.units.convert gives it → {width: {points, units}, height: {points, units}}", + has_selection, + selection_size + ), + ] +} + +/// The length `pt` (points) in every unit of [`Unit::EAST_ASIAN`]: `{points, units: [{unit, +/// label, number, text}]}`. +pub fn in_every_unit(pt: f64) -> Value { + let units: Vec = + Unit::EAST_ASIAN.iter().map(|u| json!({"unit": u.key(), "label": u.label(), "number": u.number(pt), "text": u.format(pt)})).collect(); + json!({ "points": pt, "units": units }) +} + +/// The unit `p` gives for a number without a suffix (points when left out; null is an error). +fn unit_param(p: &Value) -> Result { + let Some(given) = p.get("unit") else { return Ok(Unit::Points) }; + let named = given.as_str().filter(|name| name.len() <= MAX_TEXT_LEN).and_then(Unit::named_east_asian); + named.ok_or_else(|| { + let u = match given { + Value::String(s) => clipped(s).escape_debug().to_string(), + other => shown(other), + }; + bad(CONVERT, format!("unknown units `{u}`")) + }) +} + +fn convert(_: &mut Session, p: &Value) -> Result { + let unit = unit_param(p)?; + let Some(v) = p.get("value").filter(|v| !v.is_null()) else { + return Err(bad(CONVERT, "missing `value`")); + }; + let pt = match v { + Value::String(s) if readable(s) => unit.parse(&decimal_point(s)), + Value::Number(n) => n.as_f64().map(|n| unit.to_pt(n)), + _ => None, + }; + let pt = pt.filter(|&pt| finite_in_every_unit(pt)); + pt.map(in_every_unit).ok_or_else(|| { + let v = shown(v); + bad(CONVERT, format!("`value` must be a number, not {v}")) + }) +} + +/// Is `s` short enough to read: at most [`MAX_TEXT_LEN`] bytes and [`MAX_OPERATORS`] `+ - * /` +/// signs? +fn readable(s: &str) -> bool { + s.len() <= MAX_TEXT_LEN && s.chars().filter(|c| matches!(c, '+' | '-' | '*' | '/')).count() <= MAX_OPERATORS +} + +/// `v` as an error message shows it: text cut at [`SHOWN_CHARS`] characters with "…", as JSON, +/// an array as `[…]` and an object as `{…}`. +fn shown(v: &Value) -> String { + match v { + Value::String(s) => Value::String(clipped(s)).to_string(), + Value::Array(_) => "[…]".into(), + Value::Object(_) => "{…}".into(), + other => other.to_string(), + } +} + +/// `s` cut at [`SHOWN_CHARS`] characters, with "…" when it is longer. +fn clipped(s: &str) -> String { + match s.char_indices().nth(SHOWN_CHARS) { + Some((at, _)) => format!("{}…", s.get(..at).unwrap_or_default()), + None => s.to_string(), + } +} + +fn selection_size(s: &mut Session, _: &Value) -> Result { + let st = s.doc()?; + let measure = s.bounds_measure(); + let b = match effects::preview::anchor_bounds_with(&st.selection, &st.doc, measure) { + Some(r) => Some(OrientedBox::aligned(r)), + None => s.transform_box(&st.selection.objects), + }; + let b = b.ok_or_else(|| bad(SELECTION_SIZE, "nothing selected"))?; + Ok(json!({ "width": in_every_unit(b.rect.width()), "height": in_every_unit(b.rect.height()) })) +} diff --git a/crates/engine/src/cmd/addons/units/tests.rs b/crates/engine/src/cmd/addons/units/tests.rs new file mode 100644 index 0000000000..f914c53092 --- /dev/null +++ b/crates/engine/src/cmd/addons/units/tests.rs @@ -0,0 +1,209 @@ +//! Unit Converter's commands: a length in every unit, read as number fields read it, the selection's +//! size as the Transform panel measures it, bad params refused, and nothing in the document changed. + +use serde_json::{Value, json}; +use vectorcraft_doc::Unit; + +use crate::{EngineError, Session}; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + s +} + +fn convert(s: &mut Session, p: Value) -> Value { + s.execute("addon.units.convert", &p).unwrap() +} + +/// The row of `r` for the unit with key `key`. +fn row<'a>(r: &'a Value, key: &str) -> &'a Value { + r["units"].as_array().unwrap().iter().find(|u| u["unit"] == key).unwrap_or_else(|| panic!("{key} in {r}")) +} + +fn near(a: f64, b: f64) -> bool { + (a - b).abs() < 1e-9 +} + +#[test] +fn a_length_comes_back_in_every_unit_in_order() { + let mut s = session(); + let r = convert(&mut s, json!({"value": "10mm"})); + assert!(near(r["points"].as_f64().unwrap(), 720.0 / 25.4)); + let keys: Vec<&str> = r["units"].as_array().unwrap().iter().map(|u| u["unit"].as_str().unwrap()).collect(); + assert_eq!(keys, Unit::EAST_ASIAN.map(Unit::key)); + assert_eq!(row(&r, "millimeters")["number"], "10"); + assert_eq!(row(&r, "millimeters")["text"], "10 mm"); + assert_eq!(row(&r, "centimeters")["text"], "1 cm"); + assert_eq!(row(&r, "inches")["text"], "0.3937 in"); + assert_eq!(row(&r, "points")["text"], "28.346 pt"); + assert_eq!(row(&r, "q")["text"], "40 Q"); + assert_eq!(row(&r, "ha")["text"], "40 H"); + assert_eq!(row(&r, "pixels")["number"], row(&r, "points")["number"], "pixels are points"); + assert_eq!(row(&r, "feetInches")["label"], "Feet & Inches"); + // Each row is what a field of that unit shows for the length. + for u in Unit::EAST_ASIAN { + let pt = 720.0 / 25.4; + assert_eq!(row(&r, u.key())["text"], u.format(pt), "{u:?}"); + assert_eq!(row(&r, u.key())["number"], u.number(pt), "{u:?}"); + } +} + +#[test] +fn values_read_as_number_fields_read_them() { + let mut s = session(); + let pt = |s: &mut Session, p: Value| convert(s, p)["points"].as_f64().unwrap(); + assert!(near(pt(&mut s, json!({"value": "1in/2"})), 36.0)); + assert!(near(pt(&mut s, json!({"value": "2p6"})), 30.0)); + assert!(near(pt(&mut s, json!({"value": "1080/2 px"})), 540.0)); + assert!(near(pt(&mut s, json!({"value": "3cm*50%"})), 1.5 * 72.0 / 2.54)); + assert!(near(pt(&mut s, json!({"value": "13q"})), 13.0 * 72.0 / 101.6)); + // A number without a unit is in `unit`, points by default. + assert!(near(pt(&mut s, json!({"value": 12})), 12.0)); + assert!(near(pt(&mut s, json!({"value": 2, "unit": "in"})), 144.0)); + assert!(near(pt(&mut s, json!({"value": "2", "unit": "Inches"})), 144.0)); + assert!(near(pt(&mut s, json!({"value": "3+1", "unit": "cm"})), 4.0 * 72.0 / 2.54)); + assert!(near(pt(&mut s, json!({"value": 6, "unit": "ha"})), 6.0 * 72.0 / 101.6)); + assert!(near(pt(&mut s, json!({"value": 1, "unit": "feetInches"})), 864.0)); + // A suffix wins over `unit`. + assert!(near(pt(&mut s, json!({"value": "1in", "unit": "mm"})), 72.0)); + // A decimal comma reads as a point, as in the number fields. + assert!(near(pt(&mut s, json!({"value": "0,5 in"})), 36.0)); + assert!(near(pt(&mut s, json!({"value": "1,5", "unit": "in"})), 108.0)); + // Each number of a sum reads its own separator. + assert!(near(pt(&mut s, json!({"value": "100.5 mm-0,5", "unit": "mm"})), 100.0 * 72.0 / 25.4)); + // A comma in a sum is a decimal comma, as in the number fields: 1,500+2 is 3.5. + assert!(near(pt(&mut s, json!({"value": "1,500+2", "unit": "mm"})), 3.5 * 72.0 / 25.4)); + // A sum of 128 signs still reads. + assert!(near(pt(&mut s, json!({"value": format!("1{}", "+1".repeat(128))})), 129.0)); +} + +#[test] +fn keys_the_commands_do_not_take_are_refused() { + let s = session(); + s.check_params("addon.units.convert", &json!({"value": 1, "unit": "mm"})).unwrap(); + s.check_params("addon.units.selectionSize", &json!({})).unwrap(); + for (id, p) in [ + ("addon.units.convert", json!({"value": 1, "units": "mm"})), + ("addon.units.convert", json!({"value": 1, "ids": [1]})), + ("addon.units.selectionSize", json!({"ids": [1]})), + ("addon.units.selectionSize", json!({"value": 1})), + ] { + match s.check_params(id, &p) { + Err(EngineError::BadParams { cmd, .. }) => assert_eq!(cmd, id, "{p}"), + other => panic!("{id} {p}: expected BadParams, got {other:?}"), + } + } +} + +#[test] +fn the_selection_size_follows_preview_bounds_and_selected_anchors() { + let mut s = session(); + let id = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 72, "height": 36})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id], "color": "#000000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [id], "weight": 10})).unwrap(); + let wh = |s: &mut Session| { + let r = s.execute("addon.units.selectionSize", &json!({})).unwrap(); + (r["width"]["points"].as_f64().unwrap(), r["height"]["points"].as_f64().unwrap()) + }; + assert_eq!(wh(&mut s), (72.0, 36.0), "geometric bounds"); + // Use Preview Bounds: the stroke's outer half on every side. + s.execute("prefs.set", &json!({"key": "usePreviewBounds", "value": true})).unwrap(); + let (w, h) = wh(&mut s); + assert!(near(w, 82.0) && near(h, 46.0), "{w} × {h}"); + s.execute("prefs.set", &json!({"key": "usePreviewBounds", "value": false})).unwrap(); + // Two neighboring anchors selected (Direct Selection): the box around them, one edge of the + // rectangle. + s.execute("select.anchors", &json!({"id": id, "anchors": [[0, 0], [0, 1]], "mode": "set"})).unwrap(); + let (w, h) = wh(&mut s); + assert!((near(w, 72.0) && near(h, 0.0)) || (near(w, 0.0) && near(h, 36.0)), "{w} × {h}"); +} + +#[test] +fn it_needs_no_document_and_changes_nothing() { + let mut s = Session::new(); + assert!(near(convert(&mut s, json!({"value": "1in"}))["points"].as_f64().unwrap(), 72.0)); + let mut s = session(); + let (before, steps) = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); + convert(&mut s, json!({"value": "5mm"})); + assert_eq!(s.doc().unwrap().history.undo.len(), steps); + assert!(*s.doc().unwrap().doc == *before); +} + +#[test] +fn bad_values_and_units_are_refused() { + let mut s = session(); + for p in [ + json!({}), + json!({"value": null}), + json!({"value": "abc"}), + json!({"value": "10 furlongs"}), + json!({"value": "1in/0"}), + json!({"value": "1e400"}), + // Finite in points, too large in Q and Ha. + json!({"value": 1.5e308}), + json!({"value": "1.5e308"}), + // A thousands comma is refused, as the number fields refuse it. + json!({"value": "1,000 mm"}), + json!({"value": "1,000.5"}), + json!({"value": "+1,000"}), + json!({"value": "1,000\""}), + json!({"value": "1,000'"}), + // A long expression is refused instead of exhausting the stack. + json!({"value": format!("1{}", "+1".repeat(200_000))}), + json!({"value": format!("1{}", "+1".repeat(129))}), + json!({"value": true}), + json!({"value": [1]}), + json!({"value": 1, "unit": "furlongs"}), + json!({"value": 1, "unit": 5}), + json!({"value": 1, "unit": ["mm"]}), + // Only an omitted `unit` is points. + json!({"value": 1, "unit": null}), + ] { + match s.execute("addon.units.convert", &p) { + Err(EngineError::BadParams { cmd, .. }) => assert_eq!(cmd, "addon.units.convert", "{p}"), + other => panic!("{p}: expected BadParams, got {other:?}"), + } + } +} + +#[test] +fn a_long_value_or_unit_is_refused_with_a_short_message() { + let mut s = session(); + let long = "9".repeat(100_000); + for (p, says) in [ + (json!({"value": long.clone()}), format!("`value` must be a number, not \"{}…\"", "9".repeat(64))), + (json!({"value": [long.clone()]}), "`value` must be a number, not […]".to_string()), + (json!({"value": 1, "unit": long.clone()}), format!("unknown units `{}…`", "9".repeat(64))), + (json!({"value": 1, "unit": "furlongs"}), "unknown units `furlongs`".to_string()), + (json!({"value": "a\"b\nc"}), "`value` must be a number, not \"a\\\"b\\nc\"".to_string()), + ] { + match s.execute("addon.units.convert", &p) { + Err(e @ EngineError::BadParams { .. }) => assert!(e.to_string().ends_with(&says), "{e}"), + other => panic!("expected BadParams, got {other:?}"), + } + } +} + +#[test] +fn the_selection_size_is_the_transform_panels() { + let mut s = session(); + assert!(s.execute("addon.units.selectionSize", &json!({})).is_err(), "nothing selected"); + let id = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 72, "height": 36})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + let steps = s.doc().unwrap().history.undo.len(); + let r = s.execute("addon.units.selectionSize", &json!({})).unwrap(); + assert!(near(r["width"]["points"].as_f64().unwrap(), 72.0)); + assert!(near(r["height"]["points"].as_f64().unwrap(), 36.0)); + assert_eq!(row(&r["width"], "inches")["text"], "1 in"); + assert_eq!(row(&r["height"], "picas")["text"], "3 p"); + // A turned object keeps its own sides, as the Transform panel's W and H show them. + s.execute("object.rotate", &json!({"angle": 30})).unwrap(); + let r = s.execute("addon.units.selectionSize", &json!({})).unwrap(); + let b = s.transform_box(&s.doc().unwrap().selection.objects).unwrap(); + assert!(near(r["width"]["points"].as_f64().unwrap(), b.rect.width())); + assert!(near(r["width"]["points"].as_f64().unwrap(), 72.0)); + assert!(near(r["height"]["points"].as_f64().unwrap(), 36.0)); + assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "only the rotation is a step"); +} diff --git a/crates/engine/src/cmd/clipboard/resources.rs b/crates/engine/src/cmd/clipboard/resources.rs index f912fce7ae..0a98ddd9bc 100644 --- a/crates/engine/src/cmd/clipboard/resources.rs +++ b/crates/engine/src/cmd/clipboard/resources.rs @@ -579,6 +579,11 @@ impl SwatchChoices { Some(v) => Ok(Self { all: one(v)?, by_name: BTreeMap::new() }), } } + /// Add for every conflict: each pasted swatch whose name the document gives another color + /// comes in renamed. + pub(crate) fn add_all() -> Self { + Self { all: SwatchChoice::Add, by_name: BTreeMap::new() } + } fn of(&self, name: &str) -> SwatchChoice { self.by_name.get(name).copied().unwrap_or(self.all) } diff --git a/crates/engine/src/cmd/fileio.rs b/crates/engine/src/cmd/fileio.rs index a6e913f9f6..86c72dec0e 100644 --- a/crates/engine/src/cmd/fileio.rs +++ b/crates/engine/src/cmd/fileio.rs @@ -133,7 +133,7 @@ mod formats; #[cfg(not(target_arch = "wasm32"))] pub(crate) use access::list_dir; -pub(crate) use access::{check_images_in, check_scripts_of}; +pub(crate) use access::{check_images_in, check_scripts_of, with_readable_settings_folder}; pub use access::{check_linked_images, check_linked_scripts, write_file_with, write_save_file, write_save_file_with}; #[cfg(all(test, not(target_arch = "wasm32")))] diff --git a/crates/engine/src/cmd/fileio/access.rs b/crates/engine/src/cmd/fileio/access.rs index 9d2d9a4a33..1ded8d1f0b 100644 --- a/crates/engine/src/cmd/fileio/access.rs +++ b/crates/engine/src/cmd/fileio/access.rs @@ -171,13 +171,14 @@ pub(crate) fn names_linked_scripts(cmd: &str, format: &str, p: &Value, artboards } } -/// The error for an SVG that would name a linked image's file outside the read roots. +/// The error for a file that would name a linked image's file outside the read roots. pub(crate) const IMAGE_OUTSIDE: &str = "a linked image file is outside the read roots"; /// `cmd` may write `d`, the document an output of `st` writes (all of it, or the objects it -/// exports), in format `format` (a format id) with options `p`: any format but SVG and SVGZ, and -/// those too unless read roots are in force and the file would name a linked image's file outside -/// them (a relative path taken from `st`'s folder; a URL is not checked). An `` names the +/// exports), in format `format` (a format id) with options `p`: always, unless read roots are in +/// force and the file would name a linked image's file outside them (a relative path taken from +/// `st`'s folder; a URL is not checked). In any format but SVG and SVGZ, the file names them when it +/// carries the native document ([`check_native_images`]). An `` names the /// file with SVG Options › Images set to Link, and with Embed when the document holds no pixels for /// the image, for the images of the art each file draws (with chosen artboards, the art over each /// one; hidden layers and objects only with `hiddenLayers`, template layers and the opacity-mask @@ -193,9 +194,12 @@ pub fn check_linked_images(cmd: &str, format: &str, st: &crate::DocState, d: &ve /// [`check_linked_images`] for `d`, a document whose links are looked for from `base` (the /// objects on the clipboard, looked for from the document they came from). pub(crate) fn check_images_in(cmd: &str, format: &str, d: &vectorcraft_doc::Document, base: crate::cmd::links::LinkBase, p: &Value) -> Result<()> { - if !matches!(format, "svg" | "svgz") || crate::file_access::current().is_none() { + if crate::file_access::current().is_none() { return Ok(()); } + if !matches!(format, "svg" | "svgz") { + return check_native_images(cmd, format, d, base, p); + } // Options that don't read as the encoder's choices count as Link, Preserve Editing, hidden // layers kept and SVG 1.1: the encoder refuses them anyway. let (link, preserve, hidden, tiny) = match super::svg::options_map(p) { @@ -222,6 +226,38 @@ pub(crate) fn check_images_in(cmd: &str, format: &str, d: &vectorcraft_doc::Docu Ok(()) } +/// `cmd` may write `d` in format `format` (a format id other than SVG and SVGZ) with options `p`: +/// always, unless read roots are in force, the file carries the native document (a native file or +/// template, an EPS file, a `.ai` or `.ait` file or a PDF with Preserve Editing, as +/// [`names_linked_scripts`] counts them with `d`'s artboards) and that document names a file +/// outside them ([`crate::cmd::links::names_hidden_file`]: a linked image or placed file, the +/// relative path kept of one taken from `base`, a data set's image, or stored brushes that can't be +/// read). The error names no file or folder. +pub(crate) fn check_native_images( + cmd: &str, + format: &str, + d: &vectorcraft_doc::Document, + base: crate::cmd::links::LinkBase, + p: &Value, +) -> Result<()> { + let carried = + crate::file_access::current().is_some() && !matches!(format, "svg" | "svgz") && names_linked_scripts(cmd, format, p, d.artboards.len()); + if carried && crate::cmd::links::names_hidden_file(d, base) { Err(bad(cmd, IMAGE_OUTSIDE)) } else { Ok(()) } +} + +/// `doc` as a file written for the request being served carries it: without an Export for Screens +/// `folder` outside the read roots ([`super::screens::leave_out_unreadable_settings_folder`]). The +/// open document keeps it. +pub(crate) fn with_readable_settings_folder(doc: &vectorcraft_doc::Document) -> std::borrow::Cow<'_, vectorcraft_doc::Document> { + let settings = super::screens::leave_out_unreadable_settings_folder(doc.export_settings.clone()); + if settings.len() == doc.export_settings.len() { + return std::borrow::Cow::Borrowed(doc); + } + let mut kept = doc.clone(); + kept.export_settings = settings; + std::borrow::Cow::Owned(kept) +} + /// `path` checked for writing against the automation roots in force. #[cfg(not(target_arch = "wasm32"))] pub(crate) fn may_write(path: &str) -> Result<()> { diff --git a/crates/engine/src/cmd/fileio/eps.rs b/crates/engine/src/cmd/fileio/eps.rs index 3acd23e854..5067b1c6d5 100644 --- a/crates/engine/src/cmd/fileio/eps.rs +++ b/crates/engine/src/cmd/fileio/eps.rs @@ -280,8 +280,10 @@ fn thumbnail_of(preview: &Rendered, rect: Rect) -> Result { } /// What the file carries to reopen: `doc` (with only artboard `board` when the file is one of -/// several artboards), with linked images whole when `include_linked`. +/// several artboards), with linked images whole when `include_linked`, and without an Export for +/// Screens folder outside the read roots ([`super::access::with_readable_settings_folder`]). fn native(doc: &Document, board: Option, include_linked: bool) -> Vec { + let doc = &*super::access::with_readable_settings_folder(doc); let several = board.filter(|_| doc.artboards.len() > 1); if several.is_none() && !include_linked { return vectorcraft_format::save(doc, false); diff --git a/crates/engine/src/cmd/fileio/formats.rs b/crates/engine/src/cmd/fileio/formats.rs index c53822868c..2cc57144fb 100644 --- a/crates/engine/src/cmd/fileio/formats.rs +++ b/crates/engine/src/cmd/fileio/formats.rs @@ -838,13 +838,13 @@ fn other_open_filters() -> impl Iterator impl Iterator { - std::iter::once((library_label, library_exts)).chain(builtin_open_filters().filter(move |f| *f != (library_label, library_exts))) + std::iter::once((library_label, library_exts)).chain(builtin_open_filters().filter(move |f| f.0 != library_label)) } /// File → Place dialog filters: "All placeable files", then one per placeable format, then text, diff --git a/crates/engine/src/cmd/fileio/native.rs b/crates/engine/src/cmd/fileio/native.rs index cbf46c97c0..a4e0e4d24c 100644 --- a/crates/engine/src/cmd/fileio/native.rs +++ b/crates/engine/src/cmd/fileio/native.rs @@ -231,6 +231,8 @@ pub(super) fn encode_to(cmd: &str, f: &Format, doc: &Document, p: &Value, w: imp } other => other, }; + // Without an Export for Screens folder outside the read roots. + let native = super::access::with_readable_settings_folder(&native); so.pretty = so.pretty_fits(&native); vectorcraft_format::save_to(&native, &so, w).map_err(|e| bad(cmd, e.to_string())) } @@ -308,6 +310,8 @@ pub(super) fn ai_native(cmd: &str, doc: &Document, so: &SaveOptions) -> Result = placed.into_iter().map(Note::loss).collect(); - let (bytes, drawn) = encode_carrying_at(cmd, &full, p, modified, || Ok(vectorcraft_format::save(doc, false)), || Ok(None))?; + // The editing data leaves out an Export for Screens folder outside the read roots. + let native = || Ok(vectorcraft_format::save(&super::access::with_readable_settings_folder(doc), false)); + let (bytes, drawn) = encode_carrying_at(cmd, &full, p, modified, native, || Ok(None))?; notes.extend(drawn); if notes.iter().any(|n| n.text.ends_with(SHOWN_SMALLER)) && options(cmd, &full, p)?.settings.standard == Standard::None { for n in notes.iter_mut().filter(|n| n.text.ends_with(SHOWN_SMALLER)) { @@ -504,6 +506,7 @@ fn export_pdf(s: &mut Session, p: &Value) -> Result { let p = &*expanded; let st = s.doc()?; super::check_linked_scripts(C, "pdf", st, p)?; + super::check_linked_images(C, "pdf", st, &st.doc, p)?; let display_doc_title = super::has_own_title(&st.doc); let titled = super::titled_for_export(&st.doc, st.path.as_deref(), "pdf"); let mut q = p.clone(); diff --git a/crates/engine/src/cmd/fileio/save.rs b/crates/engine/src/cmd/fileio/save.rs index 09b7924442..8a9b29fec2 100644 --- a/crates/engine/src/cmd/fileio/save.rs +++ b/crates/engine/src/cmd/fileio/save.rs @@ -896,7 +896,10 @@ fn job_for_stamped(s: &Session, st: &DocState, plan: SavePlan, stamped: Option std::borrow::Cow::Borrowed(¶ms), }; super::check_linked_scripts(cmd, plan.format.id, st, &checked)?; + super::access::check_native_images(cmd, plan.format.id, &st.doc, crate::cmd::links::LinkBase::of(st), &checked)?; Ok(SaveJob { plan, doc, params, snapshot, source: st.doc.clone(), stamped, boards }) } diff --git a/crates/engine/src/cmd/fileio/screens.rs b/crates/engine/src/cmd/fileio/screens.rs index b8e797373d..3663d3e2f6 100644 --- a/crates/engine/src/cmd/fileio/screens.rs +++ b/crates/engine/src/cmd/fileio/screens.rs @@ -1129,6 +1129,28 @@ fn names_scripts(item: &Item, r: &Row, single: Option<&[usize]>) -> bool { super::access::names_linked_scripts(C, "pdf", &options, doc.artboards.len()) } +/// The document the file of `item` that row `r` writes carries when it carries one +/// ([`names_scripts`]): Full Document's PDF of every artboard, the item's artboard alone for a +/// native, `.ai` or EPS row ([`board_document`]), else the item's document. +fn carried_document<'a>(item: &'a Item, r: &Row, single: Option<&[usize]>) -> std::borrow::Cow<'a, Document> { + match (&item.every_artboard, r.format.id, single) { + (Some(all), "pdf", None) => std::borrow::Cow::Borrowed(&**all), + _ if r.whole_document() && item.artboard.is_some() => std::borrow::Cow::Owned(board_document(item)), + _ => std::borrow::Cow::Borrowed(&*item.doc), + } +} + +/// The document a native, `.ai` or EPS row writes for `item`'s artboard: that artboard alone, with +/// its background color and the art on it, as Save's separateArtboards writes it (#3868). +fn board_document(item: &Item) -> Document { + let mut d = single_artboard(&item.doc, item.region, &item.name); + if let (Some(a), Some(from)) = (d.artboards.first_mut(), item.doc.artboards.get(item.artboard.unwrap_or(0))) { + a.color = from.color; + } + super::save::keep_art_on(&mut d, item.region); + d +} + /// Every chosen artboard (asset, layer, selected object) in every format row, one file each (a PDF /// holds its artboard alone), or with `fullDocument` one file per row (a PDF of every artboard, /// else the bounds of all art). Items that share a name get `-2`, `-3`… instead of overwriting, and @@ -1177,6 +1199,23 @@ pub(crate) fn export(s: &mut Session, p: &Value, asked: &Value) -> Result super::check_images_in(C, r.format.id, &item.doc, base, &r.options_for(item.region, item.artboard)?)?; } } + // The native document the files of the other rows carry, each document looked through once. + if crate::file_access::current().is_some() { + let mut looked: HashSet<(usize, bool, Option)> = HashSet::new(); + for r in rows.iter().filter(|r| !matches!(r.format.id, "svg" | "svgz")) { + // A single-file PDF carries the first item's document alone, as the writer writes it. + let carried = items.iter().enumerate().filter(|(index, _)| !(single.is_some() && r.format.id == "pdf" && *index > 0)); + for (_, item) in carried.filter(|(_, i)| names_scripts(i, r, single.as_deref())) { + let all = item.every_artboard.is_some() && r.format.id == "pdf" && single.is_none(); + let board = item.artboard.filter(|_| !all && r.whole_document()); + if looked.insert((Arc::as_ptr(&item.doc) as usize, all, board)) + && crate::cmd::links::names_hidden_file(&carried_document(item, r, single.as_deref()), base) + { + return Err(bad(C, super::access::IMAGE_OUTSIDE)); + } + } + } + } // Appearance of Black › Printing / Exporting for RGB raster rows. // Include Artboard Fill off: the encoders leave the background colors out. let fill = if o.include_artboard_fill == Some(false) { json!({ "includeArtboardFill": false }) } else { json!({}) }; @@ -1318,8 +1357,9 @@ fn encode_and_write(export: ScreenExport, writer: &mut dyn FnMut(&str, &[u8]) -> } Ok(bytes) }; - // A whole-document copy of an artboard, for the formats that write documents to edit. - let mut board_docs: std::collections::HashMap> = std::collections::HashMap::new(); + // A whole-document copy of an artboard of an item's document, for the formats that write + // documents to edit. + let mut board_docs: std::collections::HashMap<(usize, usize), Arc> = std::collections::HashMap::new(); let mut files = 0u64; // One step per item and row, the files a name collision skips included. let steps = (items.len() * rows.len()) as u64; @@ -1358,19 +1398,7 @@ fn encode_and_write(export: ScreenExport, writer: &mut dyn FnMut(&str, &[u8]) -> write(pdf_doc.unwrap_or(all), "pdf", &options)? } else if r.whole_document() && item.artboard.is_some() { let b = item.artboard.unwrap_or(0); - // That artboard alone, as Save's separateArtboards writes it: its art, not the others' (#3868). - let d = board_docs - .entry(b) - .or_insert_with(|| { - let mut d = single_artboard(&item.doc, item.region, &item.name); - // It keeps its background color. - if let (Some(a), Some(from)) = (d.artboards.first_mut(), item.doc.artboards.get(b)) { - a.color = from.color; - } - super::save::keep_art_on(&mut d, item.region); - Arc::new(d) - }) - .clone(); + let d = board_docs.entry((Arc::as_ptr(&item.doc) as usize, b)).or_insert_with(|| Arc::new(board_document(item))).clone(); let mut options = r.options_for(item.region, None)?; // An EPS page is the artboard, not its art's bounds: an artboard without art still writes. if r.format.id == "eps" { diff --git a/crates/engine/src/cmd/fileio/svg.rs b/crates/engine/src/cmd/fileio/svg.rs index bcc01e37a4..066c6fc63f 100644 --- a/crates/engine/src/cmd/fileio/svg.rs +++ b/crates/engine/src/cmd/fileio/svg.rs @@ -183,13 +183,7 @@ pub(super) fn lost_artboards_warning(doc: &Document, p: &Value, label: &str) -> /// The native document Preserve Editing embeds: `doc`, without an Export for Screens `folder` /// outside the read roots of the request being served (the open document keeps it). fn native_attachment(doc: &Document) -> Vec { - let settings = super::screens::leave_out_unreadable_settings_folder(doc.export_settings.clone()); - if settings.len() == doc.export_settings.len() { - return vectorcraft_format::save(doc, false); - } - let mut kept = doc.clone(); - kept.export_settings = settings; - vectorcraft_format::save(&kept, false) + vectorcraft_format::save(&super::access::with_readable_settings_folder(doc), false) } /// Encode `doc` as SVG (or gzipped, SVGZ): one file per chosen artboard, with the images they diff --git a/crates/engine/src/cmd/fileio/tests.rs b/crates/engine/src/cmd/fileio/tests.rs index bbf6883834..f3161c229d 100644 --- a/crates/engine/src/cmd/fileio/tests.rs +++ b/crates/engine/src/cmd/fileio/tests.rs @@ -492,6 +492,19 @@ fn library_open_filters_list_library_formats_first() { } } +/// Other Library…'s Swatch Libraries filter lists the `.ai` and `.eps` documents whose swatches load +/// as a library, and it is the only filter of that label. +#[test] +fn the_swatch_library_filter_lists_ai_and_eps_files() { + let filters: Vec<_> = library_open_filters("Swatch libraries", crate::cmd::swatchlib::LIBRARY_PICK_EXTS).collect(); + for ext in ["ai", "ait", "eps", "epsf", "ase", "gpl", "acb", "vcswatches"] { + assert!(filters[0].1.contains(&ext), "{ext}: {:?}", filters[0]); + } + assert_eq!(filters.iter().filter(|f| f.0 == "Swatch libraries").count(), 1, "{filters:?}"); + // File › Open still opens a `.ai` as a document, not as a swatch library. + assert!(!crate::cmd::swatchlib::LIBRARY_EXTS.contains(&"ai") && !opens_as_other("ai")); +} + /// The extensions usage texts list for export: one per writable format, each picking that format /// (`.png` picks PNG; PNG-8 is asked for by `format`). #[test] diff --git a/crates/engine/src/cmd/fileio/tests_aiimport.rs b/crates/engine/src/cmd/fileio/tests_aiimport.rs index 9d263c8c97..3754752939 100644 --- a/crates/engine/src/cmd/fileio/tests_aiimport.rs +++ b/crates/engine/src/cmd/fileio/tests_aiimport.rs @@ -413,6 +413,114 @@ fn a_swatch_library_in_a_ai_file_without_layers_loads_its_palette() { assert!(matches!(sky, Some(vectorcraft_color::Paint::Gradient(_))), "{sky:?}"); } +/// A `.ai` swatch library (a palette and no layers) holding White, the gradient Sky and, in the +/// color group Textures, the swatch Tiles of the 4 pt pattern Dots, whose square is painted with +/// `square` (a color operator), a color the palette doesn't list. +fn textures_library(square: &str) -> Vec { + let dots = format!("%AI3_BeginPattern: (Dots)\n(Dots) 0 0 4 4\n%_{square}\n%_1 1 m\n%_3 1 L\n%_3 3 L\n%_1 3 L\n%_f\nE\n%AI3_EndPattern\n"); + let gradient = + "%AI5_BeginGradient: (Sky)\n(Sky) 0 2 Bd\n[\n%_0 0 0 0 1 1 1 2 1 6 50 0 Bs\n%_0 0 0 1 0 0 0 2 0.5 6 50 100 Bs\nBD\n%AI5_EndGradient\n"; + let palette = "%AI5_BeginPalette\n0 0 Pb\n0 0 0 0 1 1 1 Xa\n(White)\nPc\nBb\n2 (Sky) 0 0 0 1 1 0 0 1 0 0 1 Bg\n0 BB\n(Sky)\nPc\n\ + 1 (Textures) 1 Pg\n(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] p\n(Tiles)\nPc\nPB\n%AI5_EndPalette\n"; + let data = ai::editing_data(200.0, 100.0, &format!("{dots}{gradient}{palette}")); + ai::ai(&compressed(data.as_bytes()), "1 0 0 rg 10 50 30 40 re f") +} + +/// `swatch.library.load` of `file` named `name` → its library id. +fn load_library(s: &mut Session, name: &str, file: &[u8]) -> Value { + let p = json!({"dataBase64": vectorcraft_format::base64_encode(file), "name": name}); + s.execute("swatch.library.load", &p).unwrap()["library"].clone() +} + +/// Other Library… on a `.ai` swatch library lists its colors, gradients and pattern swatches in its +/// order and color groups, and adding the pattern swatch makes a pattern swatch with the pattern's +/// tile and art in the document, in the library's color group, not the pattern's colors. +#[test] +fn a_swatch_library_in_a_ai_file_lists_and_adds_its_pattern_swatches() { + let mut s = Session::new(); + let id = load_library(&mut s, "textures.ai", &textures_library("0 0 0 1 k")); + let lib = s.execute("swatch.library.get", &json!({"library": id})).unwrap(); + let kinds: Vec<(&str, &str, Option<&str>)> = + lib["swatches"].as_array().unwrap().iter().map(|w| (w["name"].as_str().unwrap(), w["kind"].as_str().unwrap(), w["group"].as_str())).collect(); + assert_eq!(kinds, [("White", "color", None), ("Sky", "gradient", None), ("Tiles", "pattern", Some("Textures"))], "{lib}"); + assert_eq!(lib["swatches"][2]["pattern"], json!("Dots"), "{lib}"); + // The library panel draws the pattern from the file it came from; a copy of the swatch isn't its own. + let (_, library) = crate::cmd::swatchlib::library(&s, id.as_str().unwrap()).unwrap(); + let tiles = library.iter().find(|w| w.name == "Tiles").unwrap(); + assert!(crate::cmd::swatchlib::pattern_source(&s, tiles).is_some_and(|d| d.pattern("Dots").is_some())); + assert!(crate::cmd::swatchlib::pattern_source(&s, &tiles.clone()).is_none()); + + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + let r = s.execute("swatch.library.add", &json!({"library": id, "names": ["Textures"]})).unwrap(); + assert_eq!(r["added"], json!(["Tiles"]), "{r}"); + let doc = &s.doc().unwrap().doc; + let dots = doc.pattern("Dots").expect("the pattern comes with its swatch"); + assert_eq!((dots.tile.width(), dots.tile.height()), (4.0, 4.0)); + assert_eq!(dots.art.len(), 1, "{:?}", dots.art); + let textures = doc.swatch_groups.iter().find(|g| g.name == "Textures").expect("the color group comes too"); + let tiles: Vec<_> = textures.swatches.iter().map(|w| (w.name.as_str(), &w.paint)).collect(); + assert!(matches!(tiles[..], [("Tiles", vectorcraft_color::Paint::Pattern { pattern, .. })] if pattern == "Dots"), "{tiles:?}"); + // Added again, the swatch the document has is used. + let again = s.execute("swatch.library.add", &json!({"library": id, "names": ["Tiles"]})).unwrap(); + assert_eq!((again["added"].clone(), again["existing"].clone()), (json!([]), json!(["Tiles"])), "{again}"); +} + +/// A pattern swatch of a `.ai` library whose pattern paints with a color the library doesn't list +/// still comes in with that color in its art. +#[test] +fn a_pattern_from_a_ai_library_keeps_a_color_the_library_lacks() { + let mut s = Session::new(); + let id = load_library(&mut s, "textures.ai", &textures_library("0 0.5 1 0 k")); + let lib = s.execute("swatch.library.get", &json!({"library": id})).unwrap(); + let names: Vec<&str> = lib["swatches"].as_array().unwrap().iter().map(|w| w["name"].as_str().unwrap()).collect(); + assert_eq!(names, ["White", "Sky", "Tiles"], "the pattern's color isn't listed: {lib}"); + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + s.execute("swatch.library.add", &json!({"library": id, "names": ["Tiles"]})).unwrap(); + let doc = &s.doc().unwrap().doc; + let art = &doc.pattern("Dots").unwrap().art; + let fill = art.first().and_then(|n| n.appearance.fill()).map(|f| f.paint.color()); + assert_eq!(fill, Some(Some(vectorcraft_color::Color::cmyk(0.0, 0.5, 1.0, 0.0))), "{art:?}"); + // Copy to User Defined would write a .vcswatches file, which can't hold the pattern swatch: it is + // refused, writes nothing and leaves the library loaded. + let dir = std::env::temp_dir().join(format!("vc-pattern-copy-{}", std::process::id())); + s.swatch_libraries.set_user_dir(Some(dir.to_string_lossy().to_string())); + let e = s.execute("swatch.library.copyToUser", &json!({"library": id})).unwrap_err().to_string(); + assert!(e.contains("`textures` has pattern swatches"), "{e}"); + assert!(!dir.exists() || std::fs::read_dir(&dir).unwrap().next().is_none(), "nothing written"); + assert!(s.execute("swatch.library.get", &json!({"library": id})).is_ok()); + std::fs::remove_dir_all(&dir).ok(); +} + +/// A `.ai` file without a palette of its own, and a document with no swatches, are refused as +/// swatch libraries with a message, not listed as the default swatches or as an empty library. A +/// damaged `.ai` is refused with the reader's error, and none of them is listed. A library file +/// with no swatches loads as an empty library. +#[test] +fn swatch_library_documents_without_swatches_or_damaged_are_refused() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + s.edit("Clear", |d, _| { + d.swatches.clear(); + d.swatch_groups.clear(); + Ok(()) + }) + .unwrap(); + let b64 = s.execute("document.serialize", &json!({})).unwrap()["dataBase64"].as_str().unwrap().to_string(); + let e = s.execute("swatch.library.load", &json!({"dataBase64": b64, "name": "Bare.vectorcraft"})).unwrap_err().to_string(); + assert!(e.contains("`Bare.vectorcraft` has no swatches of its own"), "{e}"); + let data = ai::editing_data(200.0, 100.0, &ai::layer("Art", &format!("0 0 0 1 k\n{}f\n", ai::rect(10.0, 50.0, 40.0, 90.0)))); + let p = json!({"dataBase64": vectorcraft_format::base64_encode(&ai::ai(&compressed(data.as_bytes()), "1 0 0 rg 10 50 30 40 re f")), "name": "art.ai"}); + let e = s.execute("swatch.library.load", &p).unwrap_err().to_string(); + assert!(e.contains("`art.ai` has no swatches of its own"), "{e}"); + let damaged = json!({"data": "%PDF-1.4\n%damaged\n", "name": "damaged.ai"}); + assert!(s.execute("swatch.library.load", &damaged).is_err()); + let list = s.execute("swatch.library.list", &json!({})).unwrap(); + assert!(list["libraries"].as_array().unwrap().iter().all(|l| l["category"] != "loaded"), "{list}"); + // A library file without swatches still loads, as an empty library. + let r = s.execute("swatch.library.load", &json!({"data": "GIMP Palette\nName: Empty\n#\n", "name": "Empty.gpl"})).unwrap(); + assert_eq!(r["count"], json!(0), "{r}"); +} + /// Other Library… on a `.ai` graphic style library (art styles, their list and no layers) gives the /// library the styles of its list, in the list's order, not the default styles; the file opens with /// them too. diff --git a/crates/engine/src/cmd/fileio/tests_screens.rs b/crates/engine/src/cmd/fileio/tests_screens.rs index 0f610b073f..c7c258b304 100644 --- a/crates/engine/src/cmd/fileio/tests_screens.rs +++ b/crates/engine/src/cmd/fileio/tests_screens.rs @@ -1461,3 +1461,25 @@ fn an_export_preset_adds_no_notes() { let r = export(&mut s, json!({"exportPreset": "Mixed"})); assert!(unused(&r).is_empty(), "{r}"); } + +/// Assets, layers and selected objects each write a native, `.ai` or EPS file of their own art: +/// every piece's file holds its own artboard, named after it, not the first piece's. +#[test] +fn each_piece_writes_its_own_native_document() { + let mut s = session(1); + s.execute("shape.ellipse", &json!({"x": 2, "y": 2, "width": 10, "height": 10})).unwrap(); + let ids: Vec = s.doc().unwrap().doc.layers[0].children().unwrap().iter().map(|n| n.id.0).collect(); + let mut assets = vec![]; + for (id, name) in ids.iter().zip(["Square", "Circle"]) { + assets.push(s.execute("assets.add", &json!({"ids": [id], "name": name})).unwrap()["assets"][0].as_u64().unwrap()); + } + let r = export(&mut s, json!({"assets": assets, "formats": [{"format": "vectorcraft"}, {"format": "eps"}]})); + let written = files(&r); + assert_eq!(written.len(), 4, "{r}"); + for (name, bytes) in written { + let native = if name.ends_with(".eps") { vectorcraft_eps::native(&bytes).expect("native document") } else { bytes }; + let doc = vectorcraft_format::load(&native).unwrap(); + let board = doc.artboards[0].name.clone(); + assert!(name.contains(&board), "{name} holds the artboard {board}"); + } +} diff --git a/crates/engine/src/cmd/graph.rs b/crates/engine/src/cmd/graph.rs index 301d361a1a..f1db9dd58a 100644 --- a/crates/engine/src/cmd/graph.rs +++ b/crates/engine/src/cmd/graph.rs @@ -37,7 +37,8 @@ use axis::{nice_axis, tick_values}; #[cfg(test)] use columns::{fill_totals, total_text}; pub use commands::specs; -pub(crate) use data::{apply_csv, parse_csv}; +pub use data::{MAX_GRAPH_DATA_FILE, graph_cell_text, graph_data_from_grid, graph_data_text, graph_grid_from_text}; +pub(crate) use data::{apply_csv, graph_csv_from_file, parse_csv}; #[cfg(test)] use data::{fmt_value, to_csv}; pub use edit::{GraphTypeSubject, graph_type_subject}; diff --git a/crates/engine/src/cmd/graph/data.rs b/crates/engine/src/cmd/graph/data.rs index 68a83fd80a..11cfd4ed26 100644 --- a/crates/engine/src/cmd/graph/data.rs +++ b/crates/engine/src/cmd/graph/data.rs @@ -91,6 +91,102 @@ pub(super) fn to_csv(g: &GraphSpec) -> String { g.to_csv() } +// ---------- graph data files ---------- + +/// The largest graph data file that Graph Data's Import Data and Import Data Sets' `%` columns +/// read, 1 MB (1,048,576 bytes). +pub const MAX_GRAPH_DATA_FILE: usize = 1 << 20; + +/// A graph data sheet's size: a row of labels over a graph's categories, a column of labels +/// before its series; a cell's longest text. +const SHEET_ROWS: usize = vectorcraft_doc::MAX_GRAPH_CATEGORIES + 1; +const SHEET_COLS: usize = vectorcraft_doc::MAX_GRAPH_SERIES + 1; +const SHEET_CELL: usize = 256; + +/// A graph data file's bytes as text: UTF-16 with its byte-order mark (spreadsheets' "Unicode +/// Text"), else UTF-16 without one when the bytes hold NUL bytes and Import Data Sets' rule gives +/// them a byte order ([`crate::cmd::utf16_order_without_mark`]), else UTF-8 with or without one. +/// UTF-16 is read as it is after a byte-order mark: an odd last byte is left out, and an unpaired +/// surrogate reads as U+FFFD. +pub fn graph_data_text(bytes: &[u8]) -> String { + let utf16 = |rest: &[u8], le: bool| { + let units: Vec = rest.as_chunks::<2>().0.iter().map(|p| if le { u16::from_le_bytes(*p) } else { u16::from_be_bytes(*p) }).collect(); + String::from_utf16_lossy(&units) + }; + match bytes { + [0xFF, 0xFE, rest @ ..] => utf16(rest, true), + [0xFE, 0xFF, rest @ ..] => utf16(rest, false), + [0xEF, 0xBB, 0xBF, rest @ ..] => String::from_utf8_lossy(rest).into_owned(), + _ => match bytes.contains(&0).then(|| crate::cmd::utf16_order_without_mark(bytes)).flatten() { + Some(le) => utf16(bytes, le), + None => String::from_utf8_lossy(bytes).into_owned(), + }, + } +} + +/// A graph data sheet cell's text: one line (tabs and line breaks become spaces), at most 256 +/// characters. +pub fn graph_cell_text(s: &str) -> String { + s.chars().map(|c| if matches!(c, '\t' | '\r' | '\n') { ' ' } else { c }).take(SHEET_CELL).collect() +} + +/// Text from a file or the clipboard as graph data sheet cells: tab-separated when any line holds +/// a tab, else comma-separated (decided once, so a label with a comma in a tab-separated file +/// stays whole), at most a graph's rows and columns. +pub fn graph_grid_from_text(text: &str) -> Vec> { + let sep = if text.contains('\t') { '\t' } else { ',' }; + text.lines().take(SHEET_ROWS).map(|l| l.trim_end_matches('\r').split(sep).take(SHEET_COLS).map(|c| graph_cell_text(c.trim())).collect()).collect() +} + +/// A graph data sheet as `graph.setData` takes it: the first row holds the series labels, the +/// first column the category labels (none when all are blank), and the other cells the values (a +/// blank cell, or text that isn't a number, has none), without the empty rows and columns past +/// the data. +pub fn graph_data_from_grid(grid: &[Vec]) -> Value { + let cell = |r: usize, c: usize| grid.get(r).and_then(|row| row.get(c)).cloned().unwrap_or_default(); + let filled = |s: &String| !s.trim().is_empty(); + // At most a graph's rows and columns, as a file gives (`graph_grid_from_text`): a grid sent by + // automation is any size, and the values are their product. + let grid = &grid[..grid.len().min(SHEET_ROWS)]; + let rows = grid.iter().rposition(|r| r.iter().take(SHEET_COLS).any(filled)).map_or(1, |i| i + 1).max(1); + let cols = grid.iter().take(rows).filter_map(|r| r.iter().take(SHEET_COLS).rposition(filled)).max().map_or(1, |i| i + 1).max(1); + let label = |s: &str| { + let s = s.trim(); + // A label typed in straight quotes (as the CSV form takes a number as a label) is the text inside. + s.strip_prefix('"').and_then(|t| t.strip_suffix('"')).unwrap_or(s).to_string() + }; + // Series labels up to the last one given (none when all are blank). + let mut series: Vec = (1..cols).map(|c| label(&cell(0, c))).collect(); + while series.last().is_some_and(String::is_empty) { + series.pop(); + } + let mut categories: Vec = (1..rows).map(|r| label(&cell(r, 0))).collect(); + if categories.iter().all(String::is_empty) { + categories.clear(); + } + let values: Vec> = (1..rows) + .map(|r| { + (1..cols) + .map(|c| { + let t = cell(r, c); + t.trim().parse::().ok().filter(|v| v.is_finite() && !t.trim().starts_with('"')).map_or(Value::Null, |v| json!(v)) + }) + .collect() + }) + .collect(); + json!({ "series": series, "categories": categories, "rows": values }) +} + +/// The graph value (the CSV form [`apply_csv`] reads) of a graph data file's bytes, read as Graph +/// Data's Import Data reads the file into its sheet and Apply sends the sheet: so applying the +/// value gives a graph the data that Import Data and Apply give it. +pub(crate) fn graph_csv_from_file(bytes: &[u8]) -> Result { + let data = graph_data_from_grid(&graph_grid_from_text(&graph_data_text(bytes))); + let mut spec = GraphSpec::default(); + apply_data(&mut spec, &data, "dataset.import")?; + Ok(spec.to_csv()) +} + /// Apply CSV graph data to the graph root `id` and rebuild its art (Variables data merge), as `graph.setData` with /// `csv` does. Data the graph already holds leaves the graph as it is. pub(crate) fn apply_csv(d: &mut Document, id: NodeId, csv: &str) -> Result<()> { @@ -149,6 +245,11 @@ pub(super) fn apply_data(g: &mut GraphSpec, p: &Value, cmd: &str) -> Result Result { }; let len = edit::runs_len(&t.runs); let from_tool = editing == Some(id); - let (a, b) = match p.get("at") { - None | Some(Value::Null) if from_tool => { - let g = |k: &str| tool.get(k).and_then(Value::as_u64).map_or(len, |v| (v as usize).min(len)); - let (x, y) = (g("start"), g("end")); - (x.min(y), x.max(y)) - } - None | Some(Value::Null) => (len, len), - Some(v) => { - let at = v.as_u64().ok_or_else(|| bad(C, "`at` must be a byte offset"))?.min(len as u64) as usize; - (at, at) - } + // Where the graphic goes in text `len` bytes long. + let range = |len: usize| -> Result<(usize, usize)> { + Ok(match p.get("at") { + None | Some(Value::Null) if from_tool => { + let g = |k: &str| tool.get(k).and_then(Value::as_u64).map_or(len, |v| (v as usize).min(len)); + let (x, y) = (g("start"), g("end")); + (x.min(y), x.max(y)) + } + None | Some(Value::Null) => (len, len), + Some(v) => { + let at = v.as_u64().ok_or_else(|| bad(C, "`at` must be a byte offset"))?.min(len as u64) as usize; + (at, at) + } + }) }; + let (mut a, mut b) = range(len)?; let symbol = match str_param(p, "symbol") { Some(n) if doc.symbols.iter().any(|s| s.name == n) => n.to_string(), Some(n) => return Err(bad(C, format!("no symbol named `{n}`"))), @@ -76,11 +80,16 @@ fn insert_inline(s: &mut Session, p: &Value) -> Result { None | Some(Value::Null) => 0.0, Some(v) => v.as_f64().filter(|k| k.is_finite() && k.abs() <= 1e5).ok_or_else(|| bad(C, "`shift` must be a number of points"))?, }; - // A typing session ends first: the insertion is a step of its own. + // A typing session ends first: the insertion is a step of its own. Typing that Real-time + // Drawing off left unapplied is applied first, and the caret is read in the typed text. let typing = tool.get("typing").and_then(Value::as_bool) == Some(true); if typing && from_tool { s.set_tool_option("commitTyping", &Value::Bool(true)); - s.commit_interaction()?; + super::settle_interaction(s)?; + let NodeKind::Text(t) = &s.doc()?.doc.node(id).ok_or(EngineError::NoNode(id))?.kind else { + return Err(bad(C, format!("node {} is not text", id.0))); + }; + (a, b) = range(edit::runs_len(&t.runs))?; } let caret = s.edit("Insert Inline Symbol", |d, _| { let mut art = InlineArt { scale, baseline_shift: shift, ..InlineArt::new(symbol.clone()) }; diff --git a/crates/engine/src/cmd/links.rs b/crates/engine/src/cmd/links.rs index 81d1c72497..55c6612494 100644 --- a/crates/engine/src/cmd/links.rs +++ b/crates/engine/src/cmd/links.rs @@ -36,7 +36,7 @@ use vectorcraft_doc::{ use vectorcraft_geom::{Affine, FillRule, PathData, Rect, shapes}; use super::fileio::{self, RasterImage, absolute_path, file_created, file_stamp, read_file, write_file}; -use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, has_doc, ids_param, object_param, str_param, switch_or}; +use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, has_doc, ids_param, object_param, str_param, switch_or, text_param}; pub fn specs() -> Vec { vec![ @@ -108,7 +108,7 @@ pub fn specs() -> Vec { "Unembed", [], None, - "{id?: an embedded image (default: the one selected), path?} write the image's pixels to the file at path (PNG, JPEG, GIF or WebP as stored, other images as PNG; a path ending in .png/.jpg/.jpeg/.gif/.webp/.tif/.tiff/.bmp converts them) and link the image to it, keeping its bounds. One undo step → {id, path}; no path → {name, dataBase64} (nothing changes: there is no file to link to)", + "{id?: an embedded image (default: the one selected), path?, ids?: [image ids] (instead of id; one id is the same as id), folder?} write the image's pixels to the file at path (PNG, JPEG, GIF or WebP as stored, other images as PNG; a path ending in .png/.jpg/.jpeg/.gif/.webp/.tif/.tiff/.bmp converts them) and link the image to it, keeping its bounds. One undo step → {id, path}; no path → {name, dataBase64} (nothing changes: there is no file to link to). With folder: write each embedded image of ids or id (default: the selected embedded images) to a new file in folder, as stored (as PNG when that format is not one of VectorCraft's raster file formats), named after the image (characters a file name can't hold become _; Image when nothing is left), with Name 2 … Name 99 when the name is taken; a file already there is never replaced. Linked images among ids are left as they are. Each image links to its file and keeps its bounds. One undo step (undo does not remove the files); when a file can't be written, the files this call wrote are removed and nothing changes → {unembedded: [{id, path}], skipped: [ids of linked images]}; id with ids, path with folder, and ids of more or fewer than one image without folder are errors", has_doc, unembed ), @@ -2686,11 +2686,35 @@ fn convert_image(bytes: &[u8], ext: &str) -> std::result::Result, String craft_image_codecs::encode(&raw, format, &craft_image_codecs::EncodeOptions::default()).map_err(|e| e.to_string()) } +/// The extension of the format embedded image `blob` is stored in (PNG for one Unembed doesn't +/// name). +fn stored_extension(blob: &vectorcraft_doc::ImageBlob) -> &'static str { + fileio::FORMATS.iter().find(|f| f.raster && f.mime == blob.mime).map_or("png", |f| f.extensions.first().copied().unwrap_or("png")) +} + +/// The bytes of embedded image `blob` in the format of extension `ext`: its own bytes when it is +/// stored in that format, else converted. +fn unembed_bytes(blob: &vectorcraft_doc::ImageBlob, ext: &str) -> std::result::Result, String> { + let same = fileio::format(ext).is_some_and(|f| f.mime == blob.mime); + if same { Ok(blob.bytes.to_vec()) } else { convert_image(&blob.bytes, ext) } +} + fn unembed(s: &mut Session, p: &Value) -> Result { const C: &str = "links.unembed"; + let given = |k: &str| p.get(k).is_some_and(|v| !v.is_null()); + // `id` with `ids`, and `path` with `folder`, are refused, in a replayed step too. + super::params::check_exclusive_keys(C, p)?; + let ids = ids_param(p, "ids", C)?; + if given("folder") || ids.as_ref().is_some_and(|ids| ids.len() != 1) { + return unembed_to_folder(s, p, ids); + } let st = s.doc()?; let doc = with_brush_art(&st.doc); - let id = image_param(st, &doc, p, C)?; + // `ids` of one image is `id`. + let id = match ids.as_deref() { + Some(&[id]) => id, + _ => image_param(st, &doc, p, C)?, + }; let n = stored(&doc, id).ok_or(crate::EngineError::NoNode(id))?; let im = image_of(&doc, id).ok_or_else(|| bad(C, format!("object {} is not an image", id.0)))?; if im.link.is_some() { @@ -2698,15 +2722,14 @@ fn unembed(s: &mut Session, p: &Value) -> Result { } let blob = st.doc.images.get(&im.key).filter(|b| !b.is_proxy()).ok_or_else(|| bad(C, "the image's pixels aren't in the document"))?; // As stored (PNG, JPEG, GIF, WebP), unless the path names another format. - let stored = fileio::FORMATS.iter().find(|f| f.raster && f.mime == blob.mime).map_or("png", |f| f.extensions.first().copied().unwrap_or("png")); + let stored = stored_extension(blob); let path = str_param(p, "path"); let ext = match path.map(fileio::extension) { Some(e) if UNEMBED_EXTS.contains(&e.as_str()) => e, Some(e) if !e.is_empty() => return Err(bad(C, format!("can't write .{e} images: use .png, .jpg, .gif, .webp, .tif or .bmp"))), _ => stored.to_string(), }; - let same = fileio::format(&ext).is_some_and(|f| f.mime == blob.mime); - let bytes = if same { blob.bytes.to_vec() } else { convert_image(&blob.bytes, &ext).map_err(|e| bad(C, e))? }; + let bytes = unembed_bytes(blob, &ext).map_err(|e| bad(C, e))?; let Some(path) = path else { let name = n.display_name(); let stem = Path::new(&name).file_stem().map_or_else(|| name.clone(), |s| s.to_string_lossy().into_owned()); @@ -2722,6 +2745,146 @@ fn unembed(s: &mut Session, p: &Value) -> Result { Ok(json!({ "id": id.0, "path": path })) } +/// `links.unembed {ids?, folder}`: each embedded image of `ids` (`id` as `ids` of one; default: the +/// selected embedded images) written to a new file in `folder` as stored (as PNG when that format is not one of +/// VectorCraft's raster file formats) and linked to it, in one undo step. Linked images are skipped. When any image fails, the files written before it +/// are removed and the document does not change. +fn unembed_to_folder(s: &mut Session, p: &Value, ids: Option>) -> Result { + const C: &str = "links.unembed"; + let folder = text_param(p, "folder", C)?.filter(|f| !f.is_empty()).ok_or_else(|| bad(C, "missing `folder`"))?; + let ids = match ids { + Some(ids) => Some(ids), + None => object_param(p, "id", C)?.map(|id| vec![id]), + }; + let st = s.doc()?; + let doc = with_brush_art(&st.doc); + let ids = ids.unwrap_or_else(|| selected_images(st, |im| im.link.is_none())); + let mut seen = BTreeSet::new(); + if !ids.iter().all(|id| seen.insert(id.0)) { + return Err(bad(C, "`ids` names an object twice")); + } + let (mut embedded, mut skipped) = (vec![], vec![]); + for &id in &ids { + let n = stored(&doc, id).ok_or(crate::EngineError::NoNode(id))?; + let im = image_of(&doc, id).ok_or_else(|| bad(C, format!("object {} is not an image", id.0)))?; + if im.link.is_some() { + skipped.push(id); + continue; + } + let blob = st.doc.images.get(&im.key).filter(|b| !b.is_proxy()).ok_or_else(|| bad(C, "the image's pixels aren't in the document"))?; + embedded.push((id, n.display_name(), blob)); + } + match (embedded.is_empty(), skipped.first()) { + (true, Some(id)) => return Err(bad(C, format!("image {} is linked already", id.0))), + (true, None) => return Err(bad(C, "select an image")), + _ => {} + } + let dir = absolute_path(folder); + writable_folder(&dir)?; + // One image at a time: its bytes are read before its file is written, so pixels that can't be + // read leave no file behind. + let mut written: Vec = vec![]; + let mut reads = Vec::with_capacity(embedded.len()); + let wrote = embedded.iter().try_for_each(|(id, name, blob)| { + vectorcraft_doc::cancel::check()?; + let ext = stored_extension(blob); + let bytes = unembed_bytes(blob, ext).map_err(|e| bad(C, e))?; + let name = format!("{}.{ext}", unembed_stem(name)); + let img = linked_image(&bytes, Some(Path::new(&dir).join(&name).to_string_lossy().as_ref()))?; + let path = write_numbered(&dir, &name, &bytes)?; + written.push(path.clone()); + reads.push((*id, (link_info(&path, &bytes), img))); + Ok(()) + }); + let remove_written = |written: &[String]| { + for path in written { + let _ = std::fs::remove_file(path); + } + }; + if let Err(e) = wrote { + remove_written(&written); + return Err(e); + } + drop(doc); + let done: Vec = reads.iter().map(|(id, (l, _))| json!({ "id": id.0, "path": l.path })).collect(); + let edited = s.edit("Unembed", |d, _| { + editing_brush_art(d, |d| reads.into_iter().try_for_each(|(id, read)| install(d, &[id], read, Some(Preserve::Bounds), None))) + }); + if let Err(e) = edited { + remove_written(&written); + return Err(e); + } + Ok(json!({ "unembedded": done, "skipped": ids_json(&skipped) })) +} + +/// The name Unembed gives image `name`'s file in a folder, before its extension: the name without +/// a folder part or extension, each character a file name can't hold on some system +/// (`/ \ : * ? " < > |` and control characters) as `_`, without leading spaces or trailing dots and +/// spaces, at most 150 bytes long, and `Image` when nothing is left. A name Windows keeps for a +/// device (`CON`, `NUL`, `COM1` …) gets `_` after it. +fn unembed_stem(name: &str) -> String { + let base = name.rsplit(['/', '\\']).next().unwrap_or_default(); + let stem = match base.rfind('.') { + Some(i) if i > 0 => &base[..i], + _ => base, + }; + let mut clean = String::new(); + for c in stem.chars().map(|c| if c.is_control() || "/\\:*?\"<>|".contains(c) { '_' } else { c }) { + if clean.len() + c.len_utf8() > 150 { + break; + } + clean.push(c); + } + let clean = clean.trim_start_matches(' ').trim_end_matches(['.', ' ']); + if clean.is_empty() { + return "Image".to_string(); + } + let device = clean.split('.').next().unwrap_or_default().trim_end().to_ascii_uppercase(); + let numbered = |prefix: &str| device.strip_prefix(prefix).is_some_and(|d| d.len() == 1 && matches!(d.as_bytes().first(), Some(b'1'..=b'9'))); + if matches!(device.as_str(), "CON" | "PRN" | "AUX" | "NUL") || numbered("COM") || numbered("LPT") { + format!("{clean}_") + } else { + clean.to_string() + } +} + +/// Folder `path` may take Unembed's files: inside the automation write roots, and a folder. +#[cfg(not(target_arch = "wasm32"))] +fn writable_folder(path: &str) -> Result<()> { + crate::file_access::check_write(path).map_err(EngineError::Other)?; + if !std::fs::metadata(path).is_ok_and(|m| m.is_dir()) { + return Err(EngineError::Other(format!("{path} is not a folder"))); + } + Ok(()) +} + +/// Write `bytes` to a new file named `name` in folder `dir`, never replacing a file there: `Name.ext`, +/// else `Name 2.ext` up to `Name 99.ext`, as [`fileio::copy_new`] names them → its path. +#[cfg(not(target_arch = "wasm32"))] +fn write_numbered(dir: &str, name: &str, bytes: &[u8]) -> Result { + use std::io::Write as _; + let create = |to: &Path| { + crate::file_access::check_write(&to.to_string_lossy()).map_err(|e| std::io::Error::new(std::io::ErrorKind::PermissionDenied, e))?; + vectorcraft_format::write_new_with(to, |f| f.write_all(bytes)) + }; + match fileio::copy_new(Path::new(name), Path::new(dir), create, |_, _| false) { + Ok(Some(fileio::Placed::Copied(to) | fileio::Placed::Kept(to))) => Ok(to.to_string_lossy().into_owned()), + Ok(None) => Err(EngineError::Other(format!("every numbered name for {name} is taken in that folder"))), + Err(e) => Err(EngineError::Other(format!("{dir}: {e}"))), + } +} + +/// The web has no folders to write to. +#[cfg(target_arch = "wasm32")] +fn writable_folder(_: &str) -> Result<()> { + Err(EngineError::Other("no file system here".into())) +} + +#[cfg(target_arch = "wasm32")] +fn write_numbered(_: &str, _: &str, _: &[u8]) -> Result { + Err(EngineError::Other("no file system here".into())) +} + /// Placement Options as `{preserve, align, clip}`. fn placement_json(o: PlacementOptions) -> Value { json!({ "preserve": o.preserve.id(), "align": o.align.id(), "clip": o.clip }) @@ -2901,4 +3064,28 @@ mod tests { let c = read(); assert!(!Arc::ptr_eq(&a.blob.bytes, &c.blob.bytes)); } + + #[test] + fn unembed_names_a_file_after_the_image_with_only_characters_a_file_name_holds() { + for (name, stem) in [ + ("photo.png", "photo"), + ("Image", "Image"), + ("../../etc/passwd", "passwd"), + ("C:\\art\\logo.tif", "logo"), + ("a:b*c?d\"eg|h", "a_b_c_d_e_f_g_h"), + ("tab\there", "tab_here"), + (" name. .png", "name"), + ("..", "Image"), + ("", "Image"), + (".hidden", ".hidden"), + ("CON.png", "CON_"), + ("lpt1", "lpt1_"), + ("COM0", "COM0"), + ("console", "console"), + ] { + assert_eq!(unembed_stem(name), stem, "{name:?}"); + } + let long = unembed_stem(&"é".repeat(200)); + assert!(long.len() <= 150 && long.chars().all(|c| c == 'é'), "{}", long.len()); + } } diff --git a/crates/engine/src/cmd/menucmds.rs b/crates/engine/src/cmd/menucmds.rs index 2a073ab62a..defc405514 100644 --- a/crates/engine/src/cmd/menucmds.rs +++ b/crates/engine/src/cmd/menucmds.rs @@ -1,6 +1,6 @@ //! Object menu long tail: Lock/Hide All Artwork Above & Other Layers, Transform Each, Reset -//! Bounding Box, Rasterize, Crop Image, Mask (an image), Create Trim Marks, Convert to Shape and -//! Artboards → Convert / Rearrange. (Live blends are in `live.rs`.) +//! Bounding Box, Rotate Bounding Box, Rasterize, Crop Image, Mask (an image), Create Trim Marks, +//! Convert to Shape and Artboards → Convert / Rearrange. (Live blends are in `live.rs`.) use std::collections::{BTreeMap, BTreeSet, HashSet}; use std::sync::Arc; @@ -15,8 +15,8 @@ use vectorcraft_render::encode::{RasterExportOptions, RasterFormat}; use super::edit::{duplicate_in, selected_roots, selected_roots_to_transform}; use super::{ - CommandSpec, EngineError, Result, Session, bad, check_numbers, check_switches, cmd, f64_or, fileio, find_command, has_doc, has_selected_member, - has_selection, switch_or, + CommandSpec, EngineError, Result, Session, bad, check_numbers, check_switches, cmd, f64_or, f64_req, fileio, find_command, has_doc, + has_selected_member, has_selection, switch_or, }; /// Session-level (not saved) state owned by the menu commands. @@ -110,6 +110,15 @@ pub fn specs() -> Vec { has_selection, reset_bounding_box ), + cmd!( + "object.rotateBoundingBox", + "Rotate Bounding Box…", + ["Object", "Transform"], + None, + "{angle: degrees (counter-clockwise), absolute?: bool (true: turn the box to angle; default false: turn it by angle from the angle the selected objects share, 0 when theirs differ)} turn the bounding box of the selected objects to one angle without moving their art; the objects inside them (the children of groups, compound paths, clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks) turn with them and keep their angle relative to them; a path of a compound path selected on its own turns only its own box; one undo step, none when every box is already at the angle; object.resetBoundingBox squares the boxes again; a missing or non-numeric angle is an error → {angle: the new angle of the boxes, in (-180, 180], changed: objects whose box turned, the objects inside the selected ones included}", + has_selection, + rotate_bounding_box + ), cmd!( "object.rasterize", "Rasterize…", @@ -225,9 +234,10 @@ pub(crate) fn squash(s: &mut Session, from: usize, label: &str) { // ---------- Reset Bounding Box ---------- /// Squares each selected object and every object inside it: the children of groups, compound paths, -/// clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks. +/// clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks. A +/// path of a compound path selected on its own is squared alone, as the transforms move it alone. fn reset_bounding_box(s: &mut Session, _: &Value) -> Result { - let ids = selected_roots(s)?; + let ids = selected_roots_to_transform(s)?; let d = &s.doc()?.doc; let mut changed = 0; let squared: Vec<(NodeId, Node)> = ids @@ -251,6 +261,69 @@ fn reset_bounding_box(s: &mut Session, _: &Value) -> Result { Ok(json!({ "changed": changed })) } +// ---------- Rotate Bounding Box ---------- + +/// Turns the bounding box of the selected objects to one angle without moving their art: by `angle` +/// from the angle they share (0 when it differs), or to `angle` with `absolute`. Each object's box +/// turns by what takes it there, and so do the boxes of the objects inside it (the children of +/// groups and the art of linked opacity masks), which keep their angle relative to it. +fn rotate_bounding_box(s: &mut Session, p: &Value) -> Result { + const C: &str = "object.rotateBoundingBox"; + // A JSON number is always finite. + let angle = f64_req(p, "angle", C)?; + let absolute = switch_or(p, "absolute", false, C)?; + // The same objects the transforms move: a path of a compound path selected on its own turns + // its own box. Layers are left out, as they have no box. + let owners = selected_roots_to_transform(s)?; + let d = &s.doc()?.doc; + let start = if absolute { 0.0 } else { d.bbox_angle(&owners) }; + // An angle within the tolerance of 0 is stored as 0, as `Node::turn_boxes` stores it. + let target = match vectorcraft_geom::normalize_deg(start + angle) { + a if a.abs() <= BOX_EPS_DEG => 0.0, + a => a, + }; + let mut changed = 0; + let turned: Vec<(NodeId, Node)> = owners + .iter() + .filter_map(|id| { + let n = d.node(*id)?; + let by = vectorcraft_geom::normalize_deg(target - n.bbox_angle); + (by.abs() > BOX_EPS_DEG).then(|| { + let mut c = n.clone(); + c.turn_boxes(by); + // The selected object's box is set to the target itself, so repeated turns add no + // rounding error to it. + c.bbox_angle = target; + changed += boxes(&c); + (*id, c) + }) + }) + .collect(); + if !turned.is_empty() { + s.edit("Rotate Bounding Box", |d, _| { + for (id, n) in turned { + if let Some(slot) = d.node_mut(id) { + *slot = n; + } + } + Ok(()) + })?; + } + Ok(json!({ "angle": target, "changed": changed })) +} + +/// Angles closer than this (degrees) are the same, as `vectorcraft_doc::orient` compares them. +const BOX_EPS_DEG: f64 = 1e-6; + +/// The number of objects in `n`'s subtree whose box [`Node::turn_boxes`] turns: `n`, its children +/// and the art of a linked opacity mask, layers left out. +fn boxes(n: &Node) -> usize { + let own = usize::from(!n.is_layer()); + let children: usize = n.children().into_iter().flatten().map(|c| boxes(c)).sum(); + let mask = n.extras().mask.as_ref().filter(|m| m.linked).map_or(0, |m| boxes(&m.art)); + own + children + mask +} + /// A copy of `n` with the angle of every object in its subtree set to 0, or `None` when no box in /// it stands at an angle, and the number of objects squared. The subtree takes in children and the /// art of linked opacity masks (an unlinked mask's art turns on its own); layers have no box. Only diff --git a/crates/engine/src/cmd/package.rs b/crates/engine/src/cmd/package.rs index cb22ac160d..04c0d2ba51 100644 --- a/crates/engine/src/cmd/package.rs +++ b/crates/engine/src/cmd/package.rs @@ -137,6 +137,24 @@ fn check_carried_scripts(name: &str, bytes: &[u8], path: &str) -> Result<()> { } } +/// The error for a linked file the package would copy with an Export for Screens folder outside +/// the read roots in the native document it is or carries. +const FOLDER_OUTSIDE: &str = "a linked file's export folder is outside the read roots"; + +/// Under read roots, the linked file `name` (`bytes`, as the package writes it) is copied only when +/// the native document it is or carries ([`carried_document`]) keeps no Export for Screens folder +/// outside them: a file copied as it is, a PDF, `.ai` or EPS file or a native document not +/// rewritten, would name it. The error names no file or folder. +fn check_carried_folder(name: &str, bytes: &[u8]) -> Result<()> { + if crate::file_access::current().is_none() { + return Ok(()); + } + match carried_document(name, bytes) { + Some(carried) if matches!(super::fileio::with_readable_settings_folder(&carried), std::borrow::Cow::Owned(_)) => Err(bad(C, FOLDER_OUTSIDE)), + _ => Ok(()), + } +} + /// The fonts of the type on `pages` of the PDF or `.ai` file `name` (`bytes`, found at `path`); /// none for other files. fn page_fonts(name: &str, bytes: &[u8], path: &str, pages: &PlacedPages) -> BTreeSet { @@ -363,6 +381,7 @@ impl<'a> Collector<'a> { options.profiles = saved.profiles; options.compress = compressed; options.include_linked = include_linked; + let nested = super::fileio::with_readable_settings_folder(&nested); match vectorcraft_format::save_with(&nested, &options) { Ok(rewritten) => bytes = rewritten, Err(e) => self.warn( @@ -381,6 +400,7 @@ impl<'a> Collector<'a> { } } } + check_carried_folder(&file.name, &bytes)?; let copy = Copied { name: destination_file.clone(), size: Some(bytes.len() as u64), hash: Some(hash_bytes(&bytes)) }; self.copies.insert(found_path.to_string(), copy.clone()); local.insert(file.path.clone(), copy); @@ -520,7 +540,9 @@ fn prepare(s: &mut Session, p: &Value) -> Result { } let root = folder.map(|f| Path::new(f).join(&name)); let info = if o.report { Some(super::docinfo::report(s, false)?) } else { None }; + // The package's document leaves out an Export for Screens folder outside the read roots. let doc = s.doc()?.doc.clone(); + let doc = if let std::borrow::Cow::Owned(kept) = super::fileio::with_readable_settings_folder(&doc) { std::sync::Arc::new(kept) } else { doc }; let links_from = s.doc()?.links_from.clone().unwrap_or_else(|| doc_path.clone()); Ok(Package { o, doc_path, links_from, stem, name, root, info, doc }) } diff --git a/crates/engine/src/cmd/panelcmds.rs b/crates/engine/src/cmd/panelcmds.rs index aa83466693..7c9d8c6cb9 100644 --- a/crates/engine/src/cmd/panelcmds.rs +++ b/crates/engine/src/cmd/panelcmds.rs @@ -67,7 +67,7 @@ pub fn specs() -> Vec { "Character / Paragraph", [], None, - "{ids?|id?, kerning?: 1/1000 em|\"auto\"|\"optical\", baselineShift?: pt, hScale?: %, vScale?: %, rotation?: deg counter-clockwise (0: upright), underline?, strikethrough?, allCaps?, smallCaps?: bool, position?: \"normal\"|\"superscript\"|\"subscript\" (sizes from Document Setup), antiAlias?: \"none\"|\"sharp\"|\"crisp\"|\"strong\" (Character panel › Anti-aliasing Method, how the type's edges are drawn as pixels; it sets each targeted type object, with or without a range; each frame of a thread keeps its own method; graph labels keep it for every label of their kind when the graph is drawn again; new type: \"sharp\"), leftIndent?, rightIndent?, firstLineIndent?, spaceBefore?, spaceAfter?: pt (±1296), list?: \"none\"|\"bullet\"|\"number\", bullet?: \"none\"|\"dot\"|\"dash\"|\"circle\"|\"square\", number?: \"none\"|\"arabic\"|\"upperLetters\"|\"lowerLetters\"|\"upperRoman\"|\"lowerRoman\"|\"twoDigits\"|\"threeDigits\", listAlign?: \"left\"|\"right\", listLevel?: 1..9 (Paragraph panel › Bullets and Numbered List: each paragraph of a list starts with its marker, drawn in the font, size and color of the paragraph's first character, and its text starts at the next tab stop after the marker, the left indent counting as a stop; a bulleted list's marker is its bullet, and a numbered list's is the paragraph's number and a period: 1, 2, 3; A to Z, then AA, BB; a to z, then aa, bb; I, II, III; i, ii, iii; 01 to 99, then 100; 001 to 999, then 1000; letters and roman numerals past 3999 in Arabic digits; the numbers count the story's numbered paragraphs, its threaded frames included, from 1 after a paragraph in no list, and an empty or bulleted paragraph is not counted; list \"bullet\" keeps a list's bullet, else a dot, and list \"number\" keeps a numbered list's style, else arabic; without list, a number style makes a numbered list and a bullet makes a bulleted one; \"none\" in any of the three turns the list off; a paragraph that joins a list with left and first-line indents of 0 gets 18 and -18 unless the call sets an indent; a horizontal right-to-left list paragraph has its indents mirrored, measured from the right; listAlign \"right\" (Bullets and Numbering…'s Alignment) puts the marker against the text, and \"left\" (the default) puts it at the first line's start, the text starting at the same place with either; it sets the paragraphs that are in a list or that the call puts in one, and a list keeps it when it changes between bullets and numbers; listLevel (Tab and Shift+Tab at the start of a list paragraph, Bullets and Numbering…'s Level) is a whole number from 1 to 9 that sets the paragraphs in a list or that the call puts in one, a list keeping it when it changes between bullets and numbers, and a list turned on without listLevel starting at level 1; each level past the first sets the paragraph 18 pt further in than its left indent, and each level counts its own numbers: a list paragraph with text sets the counts of the levels deeper than its own back to 0, so a deeper numbered paragraph after it counts from 1, and a paragraph back at a shallower level goes on with that level's count), hyphenate?: bool, wordsLongerThan?: letters 1..25 (5), afterFirst?, beforeLast?: letters 1..15 (3), hyphenLimit?: lines 0..25 (0: no limit), hyphenationZone?: pt 0..1296 (0; Single-line Composer only), hyphenateCapitalized?: bool (true) (Paragraph panel menu › Hyphenation…: only words longer than wordsLongerThan break, keeping afterFirst letters before the hyphen and beforeLast after it; at most hyphenLimit lines in a row end with a hyphen; a line whose text already ends within hyphenationZone of its right edge breaks before the next word instead of hyphenating it; the counts are rounded, and every value is clamped to its range), wordSpacing?: % 0..1000 (80, 100, 133), letterSpacing?: % of a word space -100..500 (0, 0, 0), glyphScaling?: % 50..200 (100, 100, 100): each [min, desired, max] or {min?, desired?, max?} (Paragraph panel menu › Justification…: Desired applies to every line, Minimum and Maximum bound what justified lines may use; values are clamped to their range, and Minimum ≤ Desired ≤ Maximum must hold afterwards or nothing changes), autoLeading?: % of the size 0..500 (120; the leading of characters whose leading is Auto), singleWordJustification?: \"fullJustify\"|\"alignLeft\"|\"alignCenter\"|\"alignRight\" (a justified line holding one word), mojikumi?: \"none\"|\"yakumonoHankaku\"|\"gyomatsuYakumonoHankaku\"|\"gyomatsuYakumonoZenkaku\"|\"yakumonoZenkaku\"|\"lineEndHalf\" (Mojikumi Set: Japanese punctuation spacing), kinsoku?: \"none\"|\"hard\"|\"soft\" (Kinsoku Set: Soft lets 々, ー and small kana start a line), kinsokuType?: \"pushInFirst\"|\"pushOutFirst\"|\"pushOutOnly\" (Paragraph panel menu › Kinsoku Shori Type: how area type keeps those characters off a line's ends; pushInFirst sets them on the line when its gaps next to CJK characters can close up enough, by at most a tenth of an em each, pushOutFirst does so only when moving the character before them to the next line would leave the line more than an em short, and pushOutOnly, the default, moves it unless Burasagari hangs an overflowing comma or full stop; no effect with kinsoku \"none\"), bunriKinshi?: bool (Paragraph panel menu › Bunri-Kinshi: a line never breaks inside an inseparable pair, two em dashes, two horizontal ellipses, two two-dot leaders or the two halves of a vertical kana repeat mark, and justification adds no space inside one; kept but without effect with kinsoku \"none\"; off by default), kurikaeshiMojiShori?: bool (Paragraph panel menu › Kurikaeshi Moji Shori: a repeat mark 々, ゝ, ゞ, ヽ or ヾ that starts a line is drawn as the character before it, the voiced marks ゞ and ヾ as its voiced form when it has one, and the text keeps the mark; off by default), direction?: \"auto\"|\"leftToRight\"|\"rightToLeft\" (paragraph direction; auto: from each paragraph's first strong character), leadingModel?: \"romanBaseline\"|\"emBoxTop\" (leading measured baseline to baseline, or em box top to top), charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\" (where characters smaller than the largest on their line line up with it), proportionalMetrics?: bool (full-width glyphs on the font's proportional widths: `palt` in horizontal type, `vpal` in vertical type), tateChuYoko?: bool (Character panel menu › Tate-chu-yoko, with Show East Asian Options: in vertical type those characters stand side by side across one em of the column; kept on the characters and ignored in horizontal type), tcyUpDown?, tcyLeftRight?: pt -1296..1296 (Character panel menu › Tate-chu-yoko Settings, as text.setRangeStyle: a tate-chu-yoko block moves up or down, right or left, and on a vertical path toward or away from the path's start, to its left or right), warichu?: bool, warichuLines?: 1..6, warichuGap?: pt 0..100, warichuScale?: % 10..100, warichuAlign?: \"auto\"|\"left\"|\"center\"|\"right\"|\"justifyLeft\"|\"justifyCenter\"|\"justifyRight\"|\"justifyAll\" (Character panel menu › Warichu and Warichu Settings, as text.setRangeStyle: the characters set smaller and stacked on lines inside their line), akiLeft?, akiRight?: 1/1000 em 0..1000 (Character panel › Insert Aki Left and Right, with Show East Asian Options, as text.setRangeStyle: space before and after each character in reading order), tsume?: % 0..100 (Character panel › Tsume, with Show East Asian Options, as text.setRangeStyle: the share of the blank space beside each character's ink taken away, down the column for an upright character in vertical type), diacriticHorizontal?, diacriticVertical?: 1/1000 em -1000..1000 (Character panel › Adjust Horizontal and Vertical Diacritic Position, with Show Indic Options, as text.setRangeStyle: the mark glyphs among the characters move right or up relative to their letters), standardVerticalRoman?: bool (Character panel menu › Standard Vertical Roman Alignment, as text.setRangeStyle), noBreak?: bool (Character panel menu › No Break: these characters stay on one line, including across a space inside the run), kashidas?: bool (Character panel menu › Kashidas: selected characters allow insertion only when both joined neighbors have it on; on by default), charDirection?: \"default\"|\"leftToRight\"|\"rightToLeft\" (Character panel menu › Character Direction: the characters are set left to right or right to left inside their paragraph, as a Unicode bidi embedding; default: as the bidi algorithm sets them), digits?: \"default\"|\"arabic\"|\"hindi\"|\"farsi\"|\"devanagari\"|\"bengali\"|\"gurmukhi\"|\"gujarati\"|\"odia\"|\"tamil\"|\"telugu\"|\"kannada\"|\"malayalam\" (Character panel menu › Digits: the numeral system every digit is drawn in, whatever was typed: Western, Arabic-Indic (hindi), Eastern Arabic-Indic (farsi) or an Indic script's own digits), glyphForm?: \"traditional\"|\"expert\"|\"jis04\"|\"jis90\"|\"jis78\"|\"jis83\"|\"fullWidth\"|\"halfWidth\"|\"thirdWidth\"|\"quarterWidth\"|\"default\" (Glyphs panel menu, with Show East Asian Options, as text.setRangeStyle: the characters drawn in one OpenType form of the font, or its default glyphs; a form other than \"default\" takes away their glyph choice), fontHeightReference?: \"emBox\"|\"capHeight\"|\"xHeight\"|\"icfBox\" (Character panel › Set Font Height Reference, as text.setRangeStyle: the height of the font that the size measures), language?: name|tag (Character panel › Language, as text.setRangeStyle), fontAxes?: {\"wght\": 650, …} (Character panel › Variable Font, as text.setRangeStyle: each axis named set in its units and clamped to its range, null back to the style's own setting), burasagari?: \"none\"|\"standard\"|\"forced\" (Paragraph panel menu › Burasagari None/Regular/Force: an East Asian comma or full stop ending an area type line hangs outside it: when it doesn't fit, or always; new type: \"standard\"), romanHangingPunctuation?: bool (Paragraph panel menu › Roman Hanging Punctuation: quotation marks, hyphens, full stops and commas starting or ending a line hang outside the margin, asterisks, tildes, ellipses, dashes, colons and semicolons by half; off by default), koreanLineBreakAnywhere?: bool (Paragraph panel menu › Korean Line Break Anywhere: a line may break between any two Hangul syllables; off, a word with Hangul in it breaks only at its spaces and punctuation, or where it is wider than the line; new type: false, paragraphs saved before the option: true), kashida?: \"none\"|\"short\"|\"medium\"|\"long\"|\"stylistic\" (Paragraph panel › Insert Kashidas: justified lines of horizontal area type lengthen each Arabic word with a kashida between its last pair of joined letters, at most a quarter, half or whole em long, or whole tatweels up to an em for stylistic, before they widen their word spaces; none by default), composer?: \"singleLine\"|\"everyLine\"|\"standardSingleLine\"|\"standardEveryLine\" (line breaking, Every-line by default; singleLine and everyLine are the Middle Eastern & South Asian composers, which shape Indic, Arabic and Hebrew type; the standard ones set it glyph by glyph as the font maps its characters, for legacy fonts that keep a script on Latin character codes), start?: byte, end?: byte} (baselineShift is in document points and hScale includes the object transform; groups include their text descendants; with a range: the character attributes style that range and the paragraph attributes apply to the paragraphs it touches; without: all the text, and graph labels keep the character and paragraph attributes for every label of their kind when the graph is drawn again, the graph still setting each label's alignment; a number or switch given as another type fails the call, and a null value leaves its attribute as it is, so a call with only null values fails with nothing to change; a call that gives the values the text already has records no undo step). Or {paragraphIndents: [{id, start: byte where the paragraph starts, leftIndent?, firstLineIndent?: pt -1296..1296}…]} alone (Tabs panel indent markers over paragraphs with indents of their own): each entry sets one paragraph of a type object, at least one indent each, at most 100000 entries; every entry is checked before anything changes, and an unknown key, a value out of range, an object that is not type, a byte where no paragraph starts or two entries for one paragraph with other values fail the call; all of it is one edit, a threaded story flowing again once, and when no paragraph's indents change nothing is recorded → {ids}", + "{ids?|id?, kerning?: 1/1000 em|\"auto\"|\"optical\", baselineShift?: pt, hScale?: %, vScale?: %, rotation?: deg counter-clockwise (0: upright), underline?, strikethrough?, allCaps?, smallCaps?: bool, position?: \"normal\"|\"superscript\"|\"subscript\" (sizes from Document Setup), antiAlias?: \"none\"|\"sharp\"|\"crisp\"|\"strong\" (Character panel › Anti-aliasing Method, how the type's edges are drawn as pixels; it sets each targeted type object, with or without a range; each frame of a thread keeps its own method; graph labels keep it for every label of their kind when the graph is drawn again; new type: \"sharp\"), leftIndent?, rightIndent?, firstLineIndent?, spaceBefore?, spaceAfter?: pt (±1296), list?: \"none\"|\"bullet\"|\"number\", bullet?: \"none\"|\"dot\"|\"dash\"|\"circle\"|\"square\", number?: \"none\"|\"arabic\"|\"upperLetters\"|\"lowerLetters\"|\"upperRoman\"|\"lowerRoman\"|\"twoDigits\"|\"threeDigits\", listAlign?: \"left\"|\"right\", listLevel?: 1..9 (Paragraph panel › Bullets and Numbered List: each paragraph of a list starts with its marker, drawn in the font, size and color of the paragraph's first character, and its text starts at the next tab stop after the marker, the left indent counting as a stop; a bulleted list's marker is its bullet, and a numbered list's is the paragraph's number and a period: 1, 2, 3; A to Z, then AA, BB; a to z, then aa, bb; I, II, III; i, ii, iii; 01 to 99, then 100; 001 to 999, then 1000; letters and roman numerals past 3999 in Arabic digits; the numbers count the story's numbered paragraphs, its threaded frames included, from 1 after a paragraph in no list, and an empty or bulleted paragraph is not counted; list \"bullet\" keeps a list's bullet, else a dot, and list \"number\" keeps a numbered list's style, else arabic; without list, a number style makes a numbered list and a bullet makes a bulleted one; \"none\" in any of the three turns the list off; a paragraph that joins a list with left and first-line indents of 0 gets 18 and -18 unless the call sets an indent; a horizontal right-to-left list paragraph has its indents mirrored, measured from the right; listAlign \"right\" (Bullets and Numbering…'s Alignment) puts the marker against the text, and \"left\" (the default) puts it at the first line's start, the text starting at the same place with either; it sets the paragraphs that are in a list or that the call puts in one, and a list keeps it when it changes between bullets and numbers; listLevel (Tab and Shift+Tab at the start of a list paragraph, Bullets and Numbering…'s Level) is a whole number from 1 to 9 that sets the paragraphs in a list or that the call puts in one, a list keeping it when it changes between bullets and numbers, and a list turned on without listLevel starting at level 1; each level past the first sets the paragraph 18 pt further in than its left indent, and each level counts its own numbers: a list paragraph with text sets the counts of the levels deeper than its own back to 0, so a deeper numbered paragraph after it counts from 1, and a paragraph back at a shallower level goes on with that level's count), startNumber?: 1..999999999, restartNumbering?: bool (Bullets and Numbering…'s Start At, VectorCraft's own: startNumber gives the first numbered paragraph the call touches, the first that holds text or else the first, taking the type objects in the order of `ids` and passing over a threaded frame's first paragraph when it continues from the frame before, that number, and the numbered paragraphs after it at its level count on from it, through the story's threaded frames; restartNumbering true gives it 1, and false takes the number away from every paragraph the call touches but such a continued first paragraph, which then count on from the paragraph before; giving both fails the call, and when the call touches no numbered paragraph nothing changes; a paragraph made with Return does not take the number, a paragraph made bulleted keeps none, and a paragraph style made from the paragraph does not keep it, nor does a graph label when the graph is drawn again), hyphenate?: bool, wordsLongerThan?: letters 1..25 (5), afterFirst?, beforeLast?: letters 1..15 (3), hyphenLimit?: lines 0..25 (0: no limit), hyphenationZone?: pt 0..1296 (0; Single-line Composer only), hyphenateCapitalized?: bool (true) (Paragraph panel menu › Hyphenation…: only words longer than wordsLongerThan break, keeping afterFirst letters before the hyphen and beforeLast after it; at most hyphenLimit lines in a row end with a hyphen; a line whose text already ends within hyphenationZone of its right edge breaks before the next word instead of hyphenating it; the counts are rounded, and every value is clamped to its range), wordSpacing?: % 0..1000 (80, 100, 133), letterSpacing?: % of a word space -100..500 (0, 0, 0), glyphScaling?: % 50..200 (100, 100, 100): each [min, desired, max] or {min?, desired?, max?} (Paragraph panel menu › Justification…: Desired applies to every line, Minimum and Maximum bound what justified lines may use; values are clamped to their range, and Minimum ≤ Desired ≤ Maximum must hold afterwards or nothing changes), autoLeading?: % of the size 0..500 (120; the leading of characters whose leading is Auto), singleWordJustification?: \"fullJustify\"|\"alignLeft\"|\"alignCenter\"|\"alignRight\" (a justified line holding one word), mojikumi?: \"none\"|\"yakumonoHankaku\"|\"gyomatsuYakumonoHankaku\"|\"gyomatsuYakumonoZenkaku\"|\"yakumonoZenkaku\"|\"lineEndHalf\" (Mojikumi Set: Japanese punctuation spacing), kinsoku?: \"none\"|\"hard\"|\"soft\" (Kinsoku Set: Soft lets 々, ー and small kana start a line), kinsokuType?: \"pushInFirst\"|\"pushOutFirst\"|\"pushOutOnly\" (Paragraph panel menu › Kinsoku Shori Type: how area type keeps those characters off a line's ends; pushInFirst sets them on the line when its gaps next to CJK characters can close up enough, by at most a tenth of an em each, pushOutFirst does so only when moving the character before them to the next line would leave the line more than an em short, and pushOutOnly, the default, moves it unless Burasagari hangs an overflowing comma or full stop; no effect with kinsoku \"none\"), bunriKinshi?: bool (Paragraph panel menu › Bunri-Kinshi: a line never breaks inside an inseparable pair, two em dashes, two horizontal ellipses, two two-dot leaders or the two halves of a vertical kana repeat mark, and justification adds no space inside one; kept but without effect with kinsoku \"none\"; off by default), kurikaeshiMojiShori?: bool (Paragraph panel menu › Kurikaeshi Moji Shori: a repeat mark 々, ゝ, ゞ, ヽ or ヾ that starts a line is drawn as the character before it, the voiced marks ゞ and ヾ as its voiced form when it has one, and the text keeps the mark; off by default), direction?: \"auto\"|\"leftToRight\"|\"rightToLeft\" (paragraph direction; auto: from each paragraph's first strong character), leadingModel?: \"romanBaseline\"|\"emBoxTop\" (leading measured baseline to baseline, or em box top to top), charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\" (where characters smaller than the largest on their line line up with it), proportionalMetrics?: bool (full-width glyphs on the font's proportional widths: `palt` in horizontal type, `vpal` in vertical type), tateChuYoko?: bool (Character panel menu › Tate-chu-yoko, with Show East Asian Options: in vertical type those characters stand side by side across one em of the column; kept on the characters and ignored in horizontal type), tcyUpDown?, tcyLeftRight?: pt -1296..1296 (Character panel menu › Tate-chu-yoko Settings, as text.setRangeStyle: a tate-chu-yoko block moves up or down, right or left, and on a vertical path toward or away from the path's start, to its left or right), warichu?: bool, warichuLines?: 1..6, warichuGap?: pt 0..100, warichuScale?: % 10..100, warichuAlign?: \"auto\"|\"left\"|\"center\"|\"right\"|\"justifyLeft\"|\"justifyCenter\"|\"justifyRight\"|\"justifyAll\" (Character panel menu › Warichu and Warichu Settings, as text.setRangeStyle: the characters set smaller and stacked on lines inside their line), akiLeft?, akiRight?: 1/1000 em 0..1000 (Character panel › Insert Aki Left and Right, with Show East Asian Options, as text.setRangeStyle: space before and after each character in reading order), tsume?: % 0..100 (Character panel › Tsume, with Show East Asian Options, as text.setRangeStyle: the share of the blank space beside each character's ink taken away, down the column for an upright character in vertical type), diacriticHorizontal?, diacriticVertical?: 1/1000 em -1000..1000 (Character panel › Adjust Horizontal and Vertical Diacritic Position, with Show Indic Options, as text.setRangeStyle: the mark glyphs among the characters move right or up relative to their letters), standardVerticalRoman?: bool (Character panel menu › Standard Vertical Roman Alignment, as text.setRangeStyle), noBreak?: bool (Character panel menu › No Break: these characters stay on one line, including across a space inside the run), kashidas?: bool (Character panel menu › Kashidas: selected characters allow insertion only when both joined neighbors have it on; on by default), charDirection?: \"default\"|\"leftToRight\"|\"rightToLeft\" (Character panel menu › Character Direction: the characters are set left to right or right to left inside their paragraph, as a Unicode bidi embedding; default: as the bidi algorithm sets them), digits?: \"default\"|\"arabic\"|\"hindi\"|\"farsi\"|\"devanagari\"|\"bengali\"|\"gurmukhi\"|\"gujarati\"|\"odia\"|\"tamil\"|\"telugu\"|\"kannada\"|\"malayalam\" (Character panel menu › Digits: the numeral system every digit is drawn in, whatever was typed: Western, Arabic-Indic (hindi), Eastern Arabic-Indic (farsi) or an Indic script's own digits), glyphForm?: \"traditional\"|\"expert\"|\"jis04\"|\"jis90\"|\"jis78\"|\"jis83\"|\"fullWidth\"|\"halfWidth\"|\"thirdWidth\"|\"quarterWidth\"|\"default\" (Glyphs panel menu, with Show East Asian Options, as text.setRangeStyle: the characters drawn in one OpenType form of the font, or its default glyphs; a form other than \"default\" takes away their glyph choice), fontHeightReference?: \"emBox\"|\"capHeight\"|\"xHeight\"|\"icfBox\" (Character panel › Set Font Height Reference, as text.setRangeStyle: the height of the font that the size measures), language?: name|tag (Character panel › Language, as text.setRangeStyle), fontAxes?: {\"wght\": 650, …} (Character panel › Variable Font, as text.setRangeStyle: each axis named set in its units and clamped to its range, null back to the style's own setting), burasagari?: \"none\"|\"standard\"|\"forced\" (Paragraph panel menu › Burasagari None/Regular/Force: an East Asian comma or full stop ending an area type line hangs outside it: when it doesn't fit, or always; new type: \"standard\"), romanHangingPunctuation?: bool (Paragraph panel menu › Roman Hanging Punctuation: quotation marks, hyphens, full stops and commas starting or ending a line hang outside the margin, asterisks, tildes, ellipses, dashes, colons and semicolons by half; off by default), koreanLineBreakAnywhere?: bool (Paragraph panel menu › Korean Line Break Anywhere: a line may break between any two Hangul syllables; off, a word with Hangul in it breaks only at its spaces and punctuation, or where it is wider than the line; new type: false, paragraphs saved before the option: true), kashida?: \"none\"|\"short\"|\"medium\"|\"long\"|\"stylistic\" (Paragraph panel › Insert Kashidas: justified lines of horizontal area type lengthen each Arabic word with a kashida between its last pair of joined letters, at most a quarter, half or whole em long, or whole tatweels up to an em for stylistic, before they widen their word spaces; none by default), composer?: \"singleLine\"|\"everyLine\"|\"standardSingleLine\"|\"standardEveryLine\" (line breaking, Every-line by default; singleLine and everyLine are the Middle Eastern & South Asian composers, which shape Indic, Arabic and Hebrew type; the standard ones set it glyph by glyph as the font maps its characters, for legacy fonts that keep a script on Latin character codes), start?: byte, end?: byte} (baselineShift is in document points and hScale includes the object transform; groups include their text descendants; with a range: the character attributes style that range and the paragraph attributes apply to the paragraphs it touches; without: all the text, and graph labels keep the character and paragraph attributes for every label of their kind when the graph is drawn again, the graph still setting each label's alignment; a number or switch given as another type fails the call, and a null value leaves its attribute as it is, so a call with only null values fails with nothing to change; a call that gives the values the text already has records no undo step). Or {paragraphIndents: [{id, start: byte where the paragraph starts, leftIndent?, firstLineIndent?: pt -1296..1296}…]} alone (Tabs panel indent markers over paragraphs with indents of their own): each entry sets one paragraph of a type object, at least one indent each, at most 100000 entries; every entry is checked before anything changes, and an unknown key, a value out of range, an object that is not type, a byte where no paragraph starts or two entries for one paragraph with other values fail the call; all of it is one edit, a threaded story flowing again once, and when no paragraph's indents change nothing is recorded → {ids}", has_doc, set_format ), @@ -482,6 +482,66 @@ fn list_level_param(p: &Value, cmd: &str) -> Result> { } } +/// The number a numbered paragraph is given, from `startNumber` (a whole number from 1 to +/// [`vectorcraft_doc::text::MAX_LIST_START`]) or `restartNumbering` (true: 1): `Some(Some(n))`, +/// or `Some(None)` for `restartNumbering` false, which numbers paragraphs on from the one before. +/// None without either; giving both is an error. +fn list_start_param(p: &Value, cmd: &str) -> Result>> { + let (key, other) = ("startNumber", "restartNumbering"); + let start = p.get(key).filter(|v| !v.is_null()); + let restart = p.get(other).filter(|v| !v.is_null()); + if start.is_some() && restart.is_some() { + return Err(bad(cmd, format!("give `{key}` or `{other}`, not both"))); + } + if let Some(v) = start { + let (min, max) = (1, vectorcraft_doc::text::MAX_LIST_START); + return match v.as_f64() { + Some(x) if x.fract() == 0.0 && (f64::from(min)..=f64::from(max)).contains(&x) => Ok(Some(Some(x as u32))), + Some(x) => Err(bad(cmd, format!("`{key}` must be a whole number between {min} and {max} (got {x})"))), + None => Err(bad(cmd, format!("`{key}` must be a whole number"))), + }; + } + // `check_switches` has already refused a value that is not true or false. + Ok(restart.and_then(Value::as_bool).map(|on| on.then_some(1))) +} + +/// Take the number its list gives a paragraph away from paragraphs `paras` of `t` (indices; +/// None: every paragraph), so they count on from the paragraph before. A first paragraph that +/// continues from the frame before ([`TextObject::first_para_continues`]) keeps its number: its +/// item begins in that frame. +/// +/// [`TextObject::first_para_continues`]: vectorcraft_doc::text::TextObject::first_para_continues +fn clear_list_start(t: &mut vectorcraft_doc::text::TextObject, paras: Option>) { + let mut paras = paras.unwrap_or(0..t.paragraph_count()); + if paras.start == 0 && t.first_para_continues { + paras.start = 1; + } + if paras.is_empty() { + return; + } + t.edit_paras(Some(paras), |p| { + if let Some(l) = p.list.as_mut() { + l.start = None; + } + }); +} + +/// Among paragraphs `paras` of `t` (indices; None: every paragraph), the first numbered paragraph +/// that holds text and the first numbered paragraph: where a number from [`list_start_param`] can go. +/// A first paragraph that continues from the frame before ([`TextObject::first_para_continues`]) is +/// skipped: its item begins in that frame. +/// +/// [`TextObject::first_para_continues`]: vectorcraft_doc::text::TextObject::first_para_continues +fn list_start_candidates(t: &vectorcraft_doc::text::TextObject, paras: Option>) -> (Option, Option) { + let paras = paras.unwrap_or(0..t.paragraph_count()); + let text = t.plain_text(); + let pieces: Vec<&str> = text.split('\n').collect(); + let mut numbered = paras.filter(|&i| !(i == 0 && t.first_para_continues) && t.para_at(i).list.is_some_and(|l| l.number.is_some())).peekable(); + let first = numbered.peek().copied(); + let with_text = numbered.find(|&i| pieces.get(i).is_some_and(|s| !s.is_empty())); + (with_text, first) +} + /// Set the Warichu and Warichu Settings of `st` that are given: Warichu on or off, Lines, Line Gap /// (in the type's own units), Scale and Alignment. fn set_warichu( @@ -523,6 +583,7 @@ fn set_format(s: &mut Session, p: &Value) -> Result { "koreanLineBreakAnywhere", "bunriKinshi", "kurikaeshiMojiShori", + "restartNumbering", ], C, )?; @@ -582,6 +643,8 @@ fn set_format(s: &mut Session, p: &Value) -> Result { "number", "listAlign", "listLevel", + "startNumber", + "restartNumbering", "hyphenate", "wordsLongerThan", "afterFirst", @@ -762,6 +825,8 @@ fn set_format(s: &mut Session, p: &Value) -> Result { .map(|a| if a == "right" { vectorcraft_doc::text::ListAlign::Right } else { vectorcraft_doc::text::ListAlign::Left }); // …and `listLevel` the level of every list paragraph, 1 to 9. let list_level = list_level_param(p, C)?; + // …and `startNumber` or `restartNumbering` the number of the first numbered paragraph. + let list_start = list_start_param(p, C)?; let indents_given = num("leftIndent").is_some() || num("firstLineIndent").is_some(); let spacing = |k: &str| spacing_param(p, k, C); let (word_spacing, letter_spacing, glyph_scaling) = (spacing("wordSpacing")?, spacing("letterSpacing")?, spacing("glyphScaling")?); @@ -885,9 +950,11 @@ fn set_format(s: &mut Session, p: &Value) -> Result { // A numbered list for list "number", or without `list` for a number style. let numbered = list == Some("number") || (list.is_none() && number.is_some()); // The list's other settings (the marker's alignment) stay as they were. + // A paragraph made bulleted keeps no number of its own. para.list = on.then(|| vectorcraft_doc::text::ParaList { bullet: bullet.flatten().or(had.map(|l| l.bullet)).unwrap_or_default(), number: numbered.then(|| number.flatten().or(had.and_then(|l| l.number)).unwrap_or_default()), + start: had.and_then(|l| l.start).filter(|_| numbered), ..had.unwrap_or_default() }); // A paragraph that joins a list with no left or first-line indent gets a @@ -912,6 +979,9 @@ fn set_format(s: &mut Session, p: &Value) -> Result { let d = &mut doc; // The paragraph change, for the graph labels to keep. let mut para_change = None; + // Where the number `startNumber` or `restartNumbering` gives goes: the first numbered + // paragraph with text the call touches, through every target, else the first numbered one. + let (mut start_with_text, mut start_first) = (None, None); let out_of_order_error = |name: &str| bad(C, format!("`{name}`: Minimum must not exceed Desired, nor Desired Maximum")); for id in &ids { let Some(NodeKind::Text(t)) = d.node_mut(*id).map(|n| &mut n.kind) else { continue }; @@ -1021,14 +1091,36 @@ fn set_format(s: &mut Session, p: &Value) -> Result { para.composer = v; } }; - t.edit_paras(span, |para| paras(para, &mut out_of_order)); + t.edit_paras(span.clone(), |para| paras(para, &mut out_of_order)); if let Some(name) = out_of_order { return Err(out_of_order_error(name)); } + match list_start { + Some(None) => clear_list_start(t, span), + Some(Some(_)) if start_with_text.is_none() => { + let (with_text, first) = list_start_candidates(t, span); + start_with_text = with_text.map(|i| (*id, i)); + start_first = start_first.or(first.map(|i| (*id, i))); + } + _ => {} + } super::typecmd::refresh_bounds(t); changed |= *t != before; para_change = Some(paras); } + if let Some(Some(n)) = list_start + && let Some((id, i)) = start_with_text.or(start_first) + && let Some(NodeKind::Text(t)) = d.node_mut(id).map(|node| &mut node.kind) + { + let before = t.clone(); + t.edit_paras(Some(i..i + 1), |p| { + if let Some(l) = p.list.as_mut() { + l.start = Some(n); + } + }); + super::typecmd::refresh_bounds(t); + changed |= *t != before; + } // Graph labels keep a change made to all of their text through the graph being drawn again. if range.is_none() { let shift = num("baselineShift").map(|v| v.clamp(-1296.0, 1296.0)); diff --git a/crates/engine/src/cmd/params.rs b/crates/engine/src/cmd/params.rs index 8dc29b9704..3ee7117dbb 100644 --- a/crates/engine/src/cmd/params.rs +++ b/crates/engine/src/cmd/params.rs @@ -258,11 +258,16 @@ pub fn check_keys(id: &str, doc: &'static str, params: &Value) -> Result<()> { /// Parameters a command takes instead of one another: (command, key, other key). Giving both, /// neither null, is a parameter error ([`check_exclusive_keys`]). -const EXCLUSIVE_KEYS: &[(&str, &str, &str)] = &[("addon.pathtools.cornerSet", "items", "ids"), ("addon.pathtools.cornerRemove", "items", "ids")]; +const EXCLUSIVE_KEYS: &[(&str, &str, &str)] = &[ + ("addon.pathtools.cornerSet", "items", "ids"), + ("addon.pathtools.cornerRemove", "items", "ids"), + ("links.unembed", "id", "ids"), + ("links.unembed", "path", "folder"), +]; /// `params` of command `id` give at most one of each pair in [`EXCLUSIVE_KEYS`], or the parameter /// error naming the pair. -fn check_exclusive_keys(id: &str, params: &Value) -> Result<()> { +pub(crate) fn check_exclusive_keys(id: &str, params: &Value) -> Result<()> { let given = |key: &str| params.get(key).filter(|v| !v.is_null()); for (_, key, other) in EXCLUSIVE_KEYS.iter().filter(|(c, ..)| *c == id) { if given(key).is_some() && given(other).is_some() { diff --git a/crates/engine/src/cmd/patternlib.rs b/crates/engine/src/cmd/patternlib.rs index f69e4b889e..97351a27a2 100644 --- a/crates/engine/src/cmd/patternlib.rs +++ b/crates/engine/src/cmd/patternlib.rs @@ -12,7 +12,7 @@ use vectorcraft_geom::{PathData, Point, Rect, SubPath, shapes}; use super::Result; use super::clipboard::Clipboard; -use super::clipboard::resources::SwatchChoices; +use super::clipboard::resources::{Imported, SwatchChoices}; use super::swatchlib::LibraryInfo; /// A built-in pattern library: a stable id, its menu name and the function that adds its patterns. @@ -87,12 +87,67 @@ pub fn swatch_source(w: &Swatch) -> Option> { /// Add pattern `name` of library `lib` to `d` with the resources its art uses, as pasting art /// painted with it does: the same pattern there already is used, and a name another pattern or -/// swatch has gets a number → the pattern's name in `d`. -pub(crate) fn import(d: &mut Document, lib: &Document, name: &str) -> Result { +/// swatch has gets a number → the pattern's name in `d`, and the swatches the import added for +/// the pattern's art: (the swatch's name in `lib`, its name in `d`), pattern swatches left out. +/// A global or spot color whose name `d` gives another color comes in under a free name, as Add +/// to Swatches adds such a color, so that the pattern keeps the library's colors. +pub(crate) fn import(d: &mut Document, lib: &Document, name: &str) -> Result<(String, Vec<(String, String)>)> { + let had: std::collections::HashSet = d.swatches_iter().map(|w| w.name.clone()).collect(); + let imported = gather(lib, name).import_into(d, &SwatchChoices::add_all(), false)?; + let from = |to: &str| { + let renamed = imported.renamed.iter().find(|r| r["kind"] == "swatch" && r["to"] == to).and_then(|r| r["from"].as_str()); + renamed.unwrap_or(to).to_string() + }; + let added = d + .swatches_iter() + .filter(|w| !had.contains(&w.name) && !matches!(w.paint, Paint::Pattern { .. })) + .map(|w| (from(&w.name), w.name.clone())) + .collect(); + Ok((imported_name(&imported, name), added)) +} + +/// Pattern `name` of `lib` with the resources its art uses, as an object painted with it is copied. +fn gather(lib: &Document, name: &str) -> Clipboard { let user = Node::path(NodeId(0), shapes::rectangle(Rect::new(0.0, 0.0, 1.0, 1.0)), Appearance::basic(pattern_paint(name), Paint::None, 0.0)); - let imported = Clipboard::gather(lib, vec![user]).import_into(d, &SwatchChoices::default(), false)?; + Clipboard::gather(lib, vec![user]) +} + +/// The name pattern `name` has in the document `imported` went into. +fn imported_name(imported: &Imported, name: &str) -> String { let renamed = imported.renamed.iter().find(|r| r["kind"] == "pattern" && r["from"] == name).and_then(|r| r["to"].as_str()); - Ok(renamed.unwrap_or(name).to_string()) + renamed.unwrap_or(name).to_string() +} + +/// The pattern of `d` that [`import`] of pattern `name` of library `lib` would use without adding +/// anything to `d` → its name in `d`. A pattern whose art uses no other resource is compared as +/// [`existing_pattern`] does. One whose art uses other resources, such as a pattern it is painted +/// with, is imported into a copy of `d`, so that those resources are compared too. +pub(crate) fn present_pattern(d: &Document, lib: &Document, name: &str) -> Option { + let gathered = gather(lib, name); + let only_pattern = gathered.patterns.len() == 1 + && gathered.symbols.is_empty() + && gathered.swatches.is_empty() + && gathered.graphic_styles.is_empty() + && gathered.char_styles.is_empty() + && gathered.para_styles.is_empty() + && gathered.brushes.is_empty() + && gathered.images.is_empty(); + if only_pattern { + return existing_pattern(d, lib, name); + } + // Importing reuses only a pattern under that name or a numbered copy of it with the same tile + // options and as many art objects; without one, the document is not copied. + let def = lib.pattern(name)?; + let bare = |p: &PatternDef| PatternDef { name: String::new(), art: vec![], ..p.clone() }; + let copy = |n: &str| { + n == name || n.strip_prefix(name).and_then(|r| r.strip_prefix(' ')).is_some_and(|r| !r.is_empty() && r.bytes().all(|b| b.is_ascii_digit())) + }; + if !d.patterns.iter().any(|p| copy(&p.name) && p.art.len() == def.art.len() && bare(p) == bare(def)) { + return None; + } + let mut probe = d.clone(); + let imported = gathered.import_into(&mut probe, &SwatchChoices::add_all(), false).ok()?; + (imported.added == 0).then(|| imported_name(&imported, name)) } /// The pattern of `d` that is pattern `name` of library `lib`: the same tile options and art under diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 6a0caf4cd6..6633840bec 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -84,6 +84,8 @@ pub(super) const ALLOWED: &[&str] = &[ "addon.shapes.star", "addon.type.releasePath", "addon.type.textTweaker", + "addon.units.convert", + "addon.units.selectionSize", "appearance.addEffect", "appearance.addFill", "appearance.addStroke", @@ -366,6 +368,7 @@ pub(super) const ALLOWED: &[&str] = &[ "object.repeat.release", "object.resetBoundingBox", "object.rotate", + "object.rotateBoundingBox", "object.scale", "object.setBounds", "object.setLiveShape", diff --git a/crates/engine/src/cmd/prefscmds.rs b/crates/engine/src/cmd/prefscmds.rs index 1d5286b11d..03d770ac0e 100644 --- a/crates/engine/src/cmd/prefscmds.rs +++ b/crates/engine/src/cmd/prefscmds.rs @@ -368,6 +368,8 @@ pub const PREF_SPECS: &[PrefSpec] = &[ p!("gpuPerformance", "Performance", "GPU Performance", "GPU Performance", bool), p!("animatedZoom", "Performance", "GPU Performance", "Animated Zoom", bool), p!("gpuPreference", "Performance", "GPU Performance", "Graphics Processor", choice(GPU_PREFERENCES)), + // Read by the desktop app at startup: the window presents without vsync, capped at 240 fps (#6013). + p!("lowLatencyDrawing", "Performance", "GPU Performance", "Low-Latency Drawing", bool), p!("historyStates", "Performance", "", "History States", int(5, 1000)), p!("realTimeDrawing", "Performance", "", "Real-time Drawing and Editing", bool), p!("renderThreads", "Performance", "", "Render Threads (-1 = Automatic)", int(-1, 64)), diff --git a/crates/engine/src/cmd/recolor.rs b/crates/engine/src/cmd/recolor.rs index b51bb4a97d..cb179148cc 100644 --- a/crates/engine/src/cmd/recolor.rs +++ b/crates/engine/src/cmd/recolor.rs @@ -34,7 +34,7 @@ pub fn specs() -> Vec { "Recolor Artwork", ["Edit", "Edit Colors"], None, - "{map: rows [{from: [colour keys (recolor.colors) or \"#rrggbb\" (every colour shown as that hex); may be empty: an empty row recolours nothing, adds no library swatch and gives `group` no colour unless `added`], to: colour (hex, key, {c,m,y,k} or {l,a,b}) | null (in from, to and groupColors, #rrggbbaa and #rgba are refused), exclude?: false (the row's colours are kept), tint?: 100 (percent; with limitTo, art linked to the global or spot swatch the new color is takes this share of its tint), added?: false (an empty row's new color is a color added to `group`)}] | {\"key or #rrggbb\": colour, …} (one row per colour), method?: \"exact\" (default)|\"preserveTints\"|\"scaleTints\"|\"tintsShades\"|\"hueShift\" (how a row's colours take its new colour, relative to the row's darkest, average or most saturated colour), limitTo?: swatch library id or name; or \"document\" (the document's swatches): new colours snap to its nearest colour, group?: colour group to rewrite, groupColors?: [colour | null] (what `group` is rewritten with, a null removing the group's swatch at its place; default: the new colors of the rows with current colors, in order, then those of the empty rows with `added`, excluded rows left out), rename?: the group's new name, includeImages?: true, includePatterns?: true, globalAdjust?: {saturation?: 0, brightness?: 0, temperature?: 0, luminosity?: 0} (Global Adjust: percent from -100 to 100, 0 changes nothing; every colour a row that isn't excluded recolours, and the group's new colours, take the same change after the row's new colour: saturation scales HSB saturation by 1 + saturation/100, brightness moves HSB brightness that share of the way to full or to black, temperature adds 0.2 × temperature/100 to red and takes it from blue, luminosity moves Lab lightness that share of the way to 100 or 0 keeping a and b; with limitTo each row's new colour takes the change before it snaps to the library)} recolour the selection (gradients, text, meshes, image pixels and pattern tiles included; each new colour keeps the model of the one it replaces (model?: \"keep\" default | \"new\" (the new colour's own model, so a CMYK colour replacing RGB art gives CMYK art) | \"document\" (the document's colour mode)), except a library swatch's with limitTo: art takes the swatch itself, linked to a global or spot colour at its tints, and the swatch joins the document's swatches; art linked to a global swatch of `group` that is rewritten with its row's new color stays linked to it, at its tint, unless the row converts the color into the art's model; other recolored art, and art in a row linked to a global swatch of `group` that is rewritten with another color, keeps its row's new color and loses its swatch link) and the group, as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind, and on a graph's axis line, tick mark or radar ring its rows for every line of its kind (docs/mcp.md) → {changed, swatches: [names added to the document's swatches], relinked?: with group, the other paints linked to its global swatches that took their new colors, note?: set when a colour kept a model other than its new colour's (see model), notChanged: {locked, hidden} (as edit.colors.invert), warning?: set when notChanged counts any object}", + "{map: rows [{from: [colour keys (recolor.colors) or \"#rrggbb\" (every colour shown as that hex); may be empty: an empty row recolours nothing, adds no library swatch and gives `group` no colour unless `added`], to: colour (hex, key, {c,m,y,k} or {l,a,b}) | null (in from, to and groupColors, #rrggbbaa and #rgba are refused), exclude?: false (the row's colours are kept), tint?: 100 (percent; with limitTo, art linked to the global or spot swatch the new color is takes this share of its tint), added?: false (an empty row's new color is a color added to `group`)}] | {\"key or #rrggbb\": colour, …} (one row per colour), method?: \"exact\" (default)|\"preserveTints\"|\"scaleTints\"|\"tintsShades\"|\"hueShift\" (how a row's colours take its new colour, relative to the row's darkest, average or most saturated colour), limitTo?: swatch library id or name; or \"document\" (the document's swatches): new colours snap to its nearest colour, group?: colour group to rewrite, groupColors?: [colour | null | \"keep\"] (what `group` is rewritten with, a null removing the group's swatch at its place and \"keep\" leaving that swatch its colour, without the Global Adjust (past the swatches it adds nothing; refused for a swatch that is not a colour); default: the new colors of the rows with current colors, in order, then those of the empty rows with `added`, excluded rows left out), rename?: the group's new name, includeImages?: true, includePatterns?: true, globalAdjust?: {saturation?: 0, brightness?: 0, temperature?: 0, luminosity?: 0} (Global Adjust: percent from -100 to 100, 0 changes nothing; every colour a row that isn't excluded recolours, and the group's new colours, take the same change after the row's new colour: saturation scales HSB saturation by 1 + saturation/100, brightness moves HSB brightness that share of the way to full or to black, temperature adds 0.2 × temperature/100 to red and takes it from blue, luminosity moves Lab lightness that share of the way to 100 or 0 keeping a and b; with limitTo each row's new colour takes the change before it snaps to the library)} recolour the selection (gradients, text, meshes, image pixels and pattern tiles included; each new colour keeps the model of the one it replaces (model?: \"keep\" default | \"new\" (the new colour's own model, so a CMYK colour replacing RGB art gives CMYK art) | \"document\" (the document's colour mode)), except a library swatch's with limitTo: art takes the swatch itself, linked to a global or spot colour at its tints, and the swatch joins the document's swatches; art linked to a global swatch of `group` that is rewritten with its row's new color stays linked to it, at its tint, unless the row converts the color into the art's model; other recolored art, and art in a row linked to a global swatch of `group` that is rewritten with another color, keeps its row's new color and loses its swatch link) and the group, as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind, and on a graph's axis line, tick mark or radar ring its rows for every line of its kind (docs/mcp.md) → {changed, swatches: [names added to the document's swatches], relinked?: with group, the other paints linked to its global swatches that took their new colors, note?: set when a colour kept a model other than its new colour's (see model), notChanged: {locked, hidden} (as edit.colors.invert), warning?: set when notChanged counts any object}", has_doc, apply ), @@ -1680,12 +1680,26 @@ fn apply(s: &mut Session, p: &Value) -> Result { Some(Value::Array(cs)) => Some(cs), Some(_) => return Err(bad(C, "`groupColors` must be an array")), }; - // A null in groupColors removes the group's swatch at its place. + // A null in groupColors removes the group's swatch at its place, and "keep" leaves the swatch + // at its place its color, without the Global Adjust. + let own: Vec> = match group { + Some(g) => { + s.doc()?.doc.swatch_groups.iter().find(|x| x.name == g).map(|g| g.swatches.iter().map(|w| w.paint.color()).collect()).unwrap_or_default() + } + None => vec![], + }; let new: Vec> = match group_colors { Some(cs) => cs .iter() - .map(|v| match v { + .enumerate() + .map(|(i, v)| match v { Value::Null => Ok(None), + // Past the group's swatches it adds nothing. + Value::String(k) if k == "keep" => match own.get(i) { + Some(Some(c)) => Ok(Some(*c)), + Some(None) => Err(bad(C, format!("the swatch at place {i} of groupColors is not a colour to keep"))), + None => Ok(None), + }, v => color_value(v) .map(|c| adjust.apply(c)) .map(|c| Some(in_doc_model(palette.as_ref().map_or(c, |pl| pl.nearest(c))))) diff --git a/crates/engine/src/cmd/swatch.rs b/crates/engine/src/cmd/swatch.rs index 59c13d9603..2b746b7634 100644 --- a/crates/engine/src/cmd/swatch.rs +++ b/crates/engine/src/cmd/swatch.rs @@ -129,7 +129,7 @@ pub fn specs() -> Vec { "Edit Color Group", ["Window", "Swatches"], None, - "{group: colour group, colors: [colour] (hex, key, {c,m,y,k} or {l,a,b}; #rrggbbaa and #rgba are refused; the group's swatches take them in order, extra colours become new swatches, swatches past the end are removed; built-in swatches can't change; a color the swatch already has keeps its model), keepModel?: bool (as paint.setFill), rename?: new group name} rewrite a colour group as one undo step; art linked to its global swatches takes their new colours (and keeps its colour, unlinked, when its swatch goes) → {name, swatches: [names], relinked}", + "{group: colour group, colors: [colour] (hex, key, {c,m,y,k} or {l,a,b}; #rrggbbaa and #rgba are refused; the group's swatches take them in order, extra colours become new swatches, swatches past the end are removed; a null removes the swatch at that place; built-in swatches can't change; a color the swatch already has keeps its model, and a key that names the swatch's color, rounded to the key's steps, keeps the swatch's color unrounded), keepModel?: bool (as paint.setFill), rename?: new group name} rewrite a colour group as one undo step; art linked to its global swatches takes their new colours (and keeps its colour, unlinked, when its swatch goes) → {name, swatches: [names], relinked}", has_doc, swatch_edit_group ), @@ -1340,21 +1340,45 @@ pub(super) fn rewrite_group(d: &mut Document, group: &str, colors: &[Option Result { const C: &str = "swatch.editGroup"; let group = str_param(p, "group").ok_or_else(|| bad(C, "missing `group`"))?; - let colors: Vec = p + // A null removes the swatch at that place. + let colors: Vec> = p .get("colors") .and_then(Value::as_array) .ok_or_else(|| bad(C, "missing `colors`"))? .iter() - .map(|v| color_value(v).ok_or_else(|| bad(C, format!("bad colour {v}")))) + .map(|v| if v.is_null() { Ok(None) } else { color_value(v).map(Some).ok_or_else(|| bad(C, format!("bad colour {v}"))) }) .collect::>()?; super::paint::check_keep_model(p, C)?; - // A color its swatch already has keeps its model. The others take the document's. + // A color its swatch already has keeps its model. The others take the document's. A color key + // (`recolor.colors`) names a color rounded to its steps, so a key of the swatch's own color + // gives the swatch that color, unrounded. let old: Vec> = s.doc()?.doc.swatch_groups.iter().find(|g| g.name == group).map(|g| g.swatches.iter().map(|w| w.paint.color()).collect()).unwrap_or_default(); - let colors: Vec = - colors.into_iter().enumerate().map(|(i, c)| if old.get(i) == Some(&Some(c)) { c } else { super::paint::new_color(s, p, c) }).collect(); + let entries = p.get("colors").and_then(Value::as_array); + let is_key = |i: usize| entries.and_then(|a| a.get(i)).and_then(Value::as_str).and_then(vectorcraft_color::recolor::ColorKey::parse); + let mut colors: Vec> = colors + .into_iter() + .enumerate() + .map(|(i, c)| { + c.map(|c| match old.get(i).copied().flatten() { + Some(o) if o == c || is_key(i).is_some_and(|k| k == vectorcraft_color::recolor::ColorKey::of(&o)) => o, + _ => super::paint::new_color(s, p, c), + }) + }) + .collect(); + // A null past the group's swatches removes nothing. + while colors.len() > old.len() && colors.last() == Some(&None) { + colors.pop(); + } let rename = str_param(p, "rename"); - let colors: Vec> = colors.into_iter().map(Some).collect(); + // The group's own colors, in order, under its own name change nothing: no undo step. + if let Some(g) = s.doc()?.doc.swatch_groups.iter().find(|g| g.name == group) + && rename.map(str::trim).is_none_or(|n| n.is_empty() || n == group) + && old.len() == colors.len() + && old.iter().zip(&colors).all(|(o, c)| c.is_some() && o == c) + { + return Ok(json!({"name": group, "swatches": g.swatches.iter().map(|w| w.name.clone()).collect::>(), "relinked": 0})); + } let e = s.edit("Edit Color Group", |d, _| rewrite_group(d, group, &colors, rename, C))?; e.defaults(s)?; Ok(json!({"name": e.name, "swatches": e.swatches, "relinked": e.relinked})) diff --git a/crates/engine/src/cmd/swatchlib.rs b/crates/engine/src/cmd/swatchlib.rs index ed712d8509..f072a75bf3 100644 --- a/crates/engine/src/cmd/swatchlib.rs +++ b/crates/engine/src/cmd/swatchlib.rs @@ -49,7 +49,7 @@ pub fn specs() -> Vec { "Add to Swatches", ["Window", "Swatch Libraries"], None, - "{library: id or name, names?: [swatch or colour group names in the library] (default: all of it; a group comes as a colour group, a single swatch ungrouped), apply?: \"fill\"|\"stroke\" (also apply the first one to the selection and the defaults, as paint.setFill / paint.setStroke), focus?: true (with apply: false keeps the active proxy)} copy library swatches into the document as one undo step. A swatch the document already has (same name and paint) isn't added again; a name taken by another swatch gets a number (\"Clay 1 2\"). A pattern swatch brings its pattern, as pasting art painted with it does: the same pattern the document has is used, and a name another pattern or swatch has gets a number → {library, added: [names in the document], existing: [names already there], applied?: name}", + "{library: id or name, names?: [swatch or colour group names in the library] (default: all of it; a group comes as a colour group, a single swatch ungrouped), apply?: \"fill\"|\"stroke\" (also apply the first one to the selection and the defaults, as paint.setFill / paint.setStroke), focus?: true (with apply: false keeps the active proxy)} copy library swatches into the document as one undo step. A swatch the document already has (same name and paint) isn't added again; a name taken by another swatch gets a number (\"Clay 1 2\"). A pattern swatch brings its pattern, as pasting art painted with it does: the same pattern the document has is used, and a name another pattern or swatch has gets a number; a global or spot color its art links to whose name the document gives another color comes in numbered, and the pattern links to it → {library, added: [names in the document], existing: [names already there], applied?: name}", has_doc, add ), @@ -76,7 +76,7 @@ pub fn specs() -> Vec { "Other Library…", ["Window", "Swatch Libraries"], None, - "{path? | data?: file text | dataBase64?, name?: file name (default: the path's)} load a .vcswatches, .gpl, .ase (swatch exchange) or .acb (color book, read only) library, or the swatches of any document VectorCraft opens (see document.formats), for the library panel (Window → Swatch Libraries lists it until the app quits; a file of the user library folder, or a file with the same extension and bytes as one there, opens as that User Defined library) → {library: id, name, count}", + "{path? | data?: file text | dataBase64?, name?: file name (default: the path's)} load a .vcswatches, .gpl, .ase (swatch exchange) or .acb (color book, read only) library, or the swatches of any document VectorCraft opens (see document.formats), such as a .ai or .eps swatch library, for the library panel (Window → Swatch Libraries lists it until the app quits; a file of the user library folder, or a file with the same extension and bytes as one there, opens as that User Defined library). A document's colors, tints, gradients and pattern swatches come in, in its order and color groups; swatch.library.add brings a pattern swatch's pattern with it. A document with no swatches is an error, and so is a .ai, .eps or PostScript file whose swatches are only the default ones (it has no palette of its own) → {library: id, name, count}", always, load ), @@ -85,7 +85,7 @@ pub fn specs() -> Vec { "Copy to User Defined", ["Window", "Swatch Libraries"], None, - "{library: id or name of a loaded library (category \"loaded\", swatch.library.load)} copy it into the user library folder of the desktop app, whose libraries VectorCraft lists as User Defined every time it starts (a loaded library is listed until the app quits): a library file as it is, the swatches of a document or a library loaded from data as a .vcswatches file. A name the folder already has gets a number (\"Brand 2.ase\") and no file is replaced; when the folder already holds the same file, that file is used. The library is then listed as User Defined only, and until the app quits commands given its loaded id use the copy; a User Defined library comes back as it is → {library: its User Defined id, name, count, path (left out when it is outside the read roots), copied: false when nothing was written}", + "{library: id or name of a loaded library (category \"loaded\", swatch.library.load)} copy it into the user library folder of the desktop app, whose libraries VectorCraft lists as User Defined every time it starts (a loaded library is listed until the app quits): a library file as it is, the swatches of a document or a library loaded from data as a .vcswatches file (a library with pattern swatches is refused). A name the folder already has gets a number (\"Brand 2.ase\") and no file is replaced; when the folder already holds the same file, that file is used. The library is then listed as User Defined only, and until the app quits commands given its loaded id use the copy; a User Defined library comes back as it is → {library: its User Defined id, name, count, path (left out when it is outside the read roots), copied: false when nothing was written}", has_user_folder, copy_to_user ), @@ -109,6 +109,9 @@ pub struct Libraries { /// the file name instead. [`Libraries::rescan`] drops an entry whose file no longer holds those /// bytes, and keeps one whose file is missing so a file put back can be checked. saved_as: HashMap, + /// The documents loaded swatch libraries were read from, by library id, for those with pattern + /// swatches: the patterns live there ([`Libraries::pattern_doc`]). + pattern_docs: HashMap>, } /// A User Defined file this session wrote: the library's name, and [`vectorcraft_doc::links::hash_bytes`] @@ -149,6 +152,38 @@ impl LibraryFile for SwatchLibrary { /// The extensions of library files [`palette_io::read_bytes`] reads. pub const LIBRARY_EXTS: &[&str] = &["vcswatches", "gpl", "ase", "acb"]; +/// The extensions the Swatch Libraries filter of Other Library… lists: the library files, and the +/// `.ai`, `.ait` and `.eps` (`.epsf`) documents whose swatches load as a library (`swatch.library.load`). +pub const LIBRARY_PICK_EXTS: &[&str] = &["vcswatches", "gpl", "ase", "acb", "ai", "ait", "eps", "epsf"]; + +impl Libraries { + /// Keep `doc`, the document loaded library `id` was read from, for its pattern swatches; `None` + /// forgets the one kept for `id`. + fn set_pattern_doc(&mut self, id: &str, doc: Option>) { + match doc { + Some(doc) => self.pattern_docs.insert(id.to_string(), doc), + None => self.pattern_docs.remove(id), + }; + } + + /// The document holding the patterns of loaded library `id`'s pattern swatches. + pub fn pattern_doc(&self, id: &str) -> Option> { + self.pattern_docs.get(id).cloned() + } + + /// The document holding the pattern of swatch `w`, when `w` is one of a loaded library's own + /// pattern swatches (a library panel draws them from it). Only the libraries that have pattern + /// swatches are looked at, each by the address ranges of its swatch lists. + pub fn pattern_source(&self, w: &Swatch) -> Option> { + let Paint::Pattern { pattern, .. } = &w.paint else { return None }; + let at = std::ptr::from_ref(w); + let holds = |v: &[Swatch]| v.as_ptr_range().contains(&at); + let own = |lib: &SwatchLibrary| holds(&lib.swatches) || lib.groups.iter().any(|g| holds(&g.swatches)); + let (_, doc) = self.pattern_docs.iter().find(|(id, _)| self.extra.iter().any(|e| e.info.id == **id && own(&e.lib)))?; + Some(doc.clone()).filter(|d| d.pattern(pattern).is_some()) + } +} + /// A library file the save commands write ([`Libraries::write`]). pub(crate) enum FileData { /// Text (`.vcswatches`, `.gpl`, CSS, `.vcstyles`), returned as `data`. @@ -646,6 +681,12 @@ pub fn library_swatches(s: &Session, key: &str) -> Option> { Some(library(s, key)?.1.iter().filter(own).cloned().collect()) } +/// The document holding the pattern of library swatch `w`: a built-in pattern library's or a loaded +/// library's own pattern swatch (a library panel draws them from it). +pub fn pattern_source(s: &Session, w: &Swatch) -> Option> { + patternlib::swatch_source(w).or_else(|| s.swatch_libraries.pattern_source(w)) +} + /// The `limitTo` parameter's palette ([`limit_palette`]); `None` without one (or for "" or null). /// A `limitTo` that is not a string, such as `5`, names no library. pub(crate) fn limit_param(s: &Session, p: &Value, cmd: &str) -> Result> { @@ -694,13 +735,17 @@ fn list(s: &mut Session, _: &Value) -> Result { } /// The document's swatches `names` (swatches or colour groups; empty: all) as a library named -/// `name`, without None and patterns. -fn document_library(d: &vectorcraft_doc::Document, names: &[String], name: String, cmd: &str) -> Result { +/// `name`, without None, and without pattern swatches unless `patterns`. +fn document_library(d: &vectorcraft_doc::Document, names: &[String], name: String, patterns: bool, cmd: &str) -> Result { if let Some(n) = names.iter().find(|n| !d.swatch_name_taken(n)) { return Err(bad(cmd, format!("no swatch or colour group `{n}`"))); } let want = |n: &str| names.is_empty() || names.iter().any(|x| x == n); - let savable = |w: &&Swatch| matches!(w.paint, Paint::Solid { .. } | Paint::Gradient(_)); + let savable = |w: &&Swatch| match w.paint { + Paint::Solid { .. } | Paint::Gradient(_) => true, + Paint::Pattern { .. } => patterns, + _ => false, + }; let swatches = d.swatches.iter().filter(savable).filter(|w| want(&w.name)).cloned().collect(); let groups = d .swatch_groups @@ -724,7 +769,7 @@ fn save(s: &mut Session, p: &Value) -> Result { let names = names_param(p, C)?; let st = s.doc()?; let name = text_param(p, "name", C)?.map(str::trim).filter(|n| !n.is_empty()).map_or_else(|| stem(&st.title()).to_string(), str::to_string); - let lib = document_library(&st.doc, &names, name, C)?; + let lib = document_library(&st.doc, &names, name, false, C)?; let bytes = palette_io::write(&lib, format).map_err(|e| bad(C, e))?; let data = if format.binary() { FileData::Binary(bytes) } else { FileData::Text(String::from_utf8_lossy(&bytes).into_owned()) }; let mut out = json!({"format": format.id(), "count": lib.iter().filter(|w| format.holds(&w.paint)).count()}); @@ -734,21 +779,44 @@ fn save(s: &mut Session, p: &Value) -> Result { fn load(s: &mut Session, p: &Value) -> Result { const C: &str = "swatch.library.load"; + // The document a library with pattern swatches was read from, which holds their patterns. + let mut patterns = None; let (info, lib) = s.swatch_libraries.load(p, C, |bytes, file| { // A library file, or a document whose swatches become the library. if palette_io::sniff_bytes(bytes) { - palette_io::read_bytes(bytes, stem(file)).map_err(|e| bad(C, e)) - } else { - let loaded = super::fileio::load(file, bytes).map_err(|e| bad(C, e.to_string()))?; - if loaded.preview_only { - return Err(bad(C, "only this Affinity file's embedded preview could be read; use File › Open to see it with its warning")); - } - document_library(&loaded.doc, &[], stem(file).to_string(), C) + return palette_io::read_bytes(bytes, stem(file)).map_err(|e| bad(C, e)); } + let loaded = super::fileio::load(file, bytes).map_err(|e| bad(C, e.to_string()))?; + if loaded.preview_only { + return Err(bad(C, "only this Affinity file's embedded preview could be read; use File › Open to see it with its warning")); + } + // A `.ai`, EPS or PostScript file without a palette of its own opens with the default swatches. + let defaults = matches!(loaded.format.id, "ai" | "ait" | "eps" | "ps") && has_only_default_swatches(&loaded.doc); + let lib = document_library(&loaded.doc, &[], stem(file).to_string(), true, C)?; + if defaults || lib.is_empty() { + return Err(bad(C, format!("`{file}` has no swatches of its own"))); + } + if lib.iter().any(|w| matches!(w.paint, Paint::Pattern { .. })) { + patterns = Some(Arc::new(loaded.doc)); + } + Ok(lib) })?; + if info.category == "loaded" { + s.swatch_libraries.set_pattern_doc(&info.id, patterns); + } Ok(json!({"library": shown_library_id(s, &info.id), "name": info.name, "count": lib.len()})) } +/// `d`'s swatches and color groups are exactly the default ones of a color mode, as a new +/// document's are. +fn has_only_default_swatches(d: &vectorcraft_doc::Document) -> bool { + use vectorcraft_color::cms::Model; + [Model::Rgb, Model::Cmyk].into_iter().any(|model| { + let (swatches, groups) = default_swatches(model); + d.swatches[..] == swatches[..] && d.swatch_groups[..] == groups[..] + }) +} + fn get(s: &mut Session, p: &Value) -> Result { let (info, lib) = library_param(s, p, "swatch.library.get")?; let ungrouped = lib.swatches.iter().map(|w| swatch_json(w, None)); @@ -772,6 +840,9 @@ fn copy_to_user(s: &mut Session, p: &Value) -> Result { const C: &str = "swatch.library.copyToUser"; let (info, lib) = library_param(s, p, C)?; let (info, lib, copied) = match info.category { + "loaded" if lib.iter().any(|w| matches!(w.paint, Paint::Pattern { .. })) => { + return Err(bad(C, format!("`{}` has pattern swatches, which a .vcswatches file can't hold", info.name))); + } "loaded" => { let native = |lib: &SwatchLibrary| palette_io::write(lib, PaletteFormat::Native).map_err(|e| bad(C, e)); s.swatch_libraries.copy_to_user(&info.id, PaletteFormat::Native.id(), native, C)? @@ -811,6 +882,22 @@ fn picked<'a>(lib: &'a SwatchLibrary, names: &[String], cmd: &str) -> Result Option { + let Paint::Pattern { pattern, xf } = &w.paint else { return None }; + let paint = Paint::Pattern { pattern: target.to_string(), xf: *xf }; + let named = |n: &str| { + w.name == *pattern + || n == w.name + || n.strip_prefix(w.name.as_str()) + .and_then(|r| r.strip_prefix(' ')) + .is_some_and(|r| !r.is_empty() && r.bytes().all(|b| b.is_ascii_digit())) + }; + d.swatches_iter().find(|x| x.paint == paint && named(&x.name)).map(|x| x.name.clone()) +} + /// Every name a swatch or colour group of `d` uses (they share one namespace, with the registration swatch). fn taken_names(d: &vectorcraft_doc::Document) -> HashSet { let names = d.swatches_iter().map(|w| &w.name).chain(d.swatch_groups.iter().map(|g| &g.name)); @@ -840,8 +927,9 @@ fn add(s: &mut Session, p: &Value) -> Result { let focus = switch_or(p, "focus", true, C)?; let picked = picked(&lib, &names_param(p, C)?, C)?; // Swatches the document already has (same name and paint; for a pattern swatch, a swatch of the - // same pattern) are reused, not added again. - let patterns = patternlib::library_doc(&info.id); + // same pattern) are reused, not added again. The patterns are in a built-in pattern library's + // document, or in the document a loaded library was read from. + let patterns = patternlib::library_doc(&info.id).or_else(|| s.swatch_libraries.pattern_doc(&info.id)); let d = &s.doc()?.doc; // The document's swatches by name (the first of a name wins, as in `Document::swatch`), looked // up once so that a large palette takes linear time. @@ -851,7 +939,7 @@ fn add(s: &mut Session, p: &Value) -> Result { } let there = |w: &Swatch| match (&w.paint, &patterns) { (Paint::Pattern { pattern, .. }, Some(src)) => { - patternlib::existing_pattern(d, src, pattern).and_then(|target| patternlib::pattern_swatch(d, &target)) + patternlib::present_pattern(d, src, pattern).and_then(|target| library_pattern_swatch(d, w, &target)) } _ => match by_name.get(w.name.as_str()) { Some(x) => x.paint == w.paint, @@ -873,32 +961,64 @@ fn add(s: &mut Session, p: &Value) -> Result { let added: Vec<(String, String)> = if fresh.is_empty() { vec![] } else { - s.edit("Add to Swatches", |d, _| { + let (added, reused) = s.edit("Add to Swatches", |d, _| { let mut out = vec![]; + // Library pattern swatches that stand for a swatch added earlier in this call. + let mut reused = vec![]; // Each library group goes into one document group: the group of that name the document // already had, or one made here. let before = d.swatch_groups.len(); let mut placed: Vec<(&str, usize)> = vec![]; let mut taken = taken_names(d); + // The swatches the patterns imported in this call brought with their art: (library + // name, document name). + let mut brought: Vec<(String, String)> = vec![]; for (group, w) in fresh { - if let (Paint::Pattern { pattern, .. }, Some(src)) = (&w.paint, &patterns) { + let (name, sw) = if let (Paint::Pattern { pattern, .. }, Some(src)) = (&w.paint, &patterns) { // The pattern comes with its swatch; a pattern the document has without one - // gets one. - let target = patternlib::import(d, src, pattern)?; - let name = match patternlib::pattern_swatch(d, &target) { - Some(name) => name, - None => { - let name = d.free_swatch_name(&target); - d.swatches.push(Swatch { name: name.clone(), paint: pattern_paint(&target), global: false, spot: false }); - name - } - }; - out.push((w.name.clone(), name)); + // gets one. The swatch a pattern that comes in brings is named after the pattern: + // it takes the library swatch's name and color group instead. + let had = taken_names(d); + let (target, colors) = patternlib::import(d, src, pattern)?; + brought.extend(colors); + if let Some(name) = library_pattern_swatch(d, w, &target).filter(|n| had.contains(n)) { + reused.push((w.name.clone(), name)); + taken = taken_names(d); + continue; + } + let made = patternlib::pattern_swatch(d, &target).filter(|n| !had.contains(n)); + if let Some(made) = &made { + d.swatches.retain(|x| x.name != *made); + } taken = taken_names(d); - continue; - } - let name = free_in(&mut taken, &w.name); - let sw = Swatch { name: name.clone(), ..(*w).clone() }; + let name = match made { + Some(made) if w.name == *pattern => made, + None if w.name == *pattern => d.free_swatch_name(&target), + _ => free_in(&mut taken, &w.name), + }; + taken.insert(name.clone()); + // The library swatch's placement of its pattern is kept. + let paint = match &w.paint { + Paint::Pattern { xf, .. } => Paint::Pattern { pattern: target, xf: *xf }, + _ => pattern_paint(&target), + }; + (name.clone(), Swatch { name, paint, global: false, spot: false }) + } else { + // A color a pattern added earlier in this call brought with its art is that + // swatch: it moves to the library swatch's place. + let at = brought.iter().position(|(from, _)| *from == w.name); + let moved = at.map(|i| brought.swap_remove(i).1).and_then(|n| { + let i = d.swatches.iter().position(|x| x.name == n)?; + Some(d.swatches.remove(i)) + }); + match moved { + Some(sw) => (sw.name.clone(), sw), + None => { + let name = free_in(&mut taken, &w.name); + (name.clone(), Swatch { name, ..(*w).clone() }) + } + } + }; match group { Some(g) => { let found = placed.iter().find(|(n, _)| *n == g).map(|&(_, i)| i); @@ -919,8 +1039,10 @@ fn add(s: &mut Session, p: &Value) -> Result { } out.push((w.name.clone(), name)); } - Ok(out) - })? + Ok((out, reused)) + })?; + existing.extend(reused); + added }; let names = |list: &[(String, String)]| list.iter().map(|(_, n)| n.clone()).collect::>(); let mut out = json!({"library": shown_library_id(s, &info.id), "added": names(&added), "existing": names(&existing)}); diff --git a/crates/engine/src/cmd/textedit.rs b/crates/engine/src/cmd/textedit.rs index cf0ceb82ee..0d75061bee 100644 --- a/crates/engine/src/cmd/textedit.rs +++ b/crates/engine/src/cmd/textedit.rs @@ -1883,13 +1883,14 @@ enum Step { BaselineShift, } -/// The Type tool's selected text while it edits (its typing session ends first: one undo step). +/// The Type tool's selected text while it edits (its typing session ends first: one undo step, +/// with typing that Real-time Drawing off left unapplied applied first). pub(crate) fn editing_range(s: &mut Session) -> Result> { let o = s.tool_options(); let Some(id) = o.get("editing").and_then(Value::as_u64).map(NodeId) else { return Ok(None) }; if super::edit::typing_in_progress(s) { s.set_tool_option("commitTyping", &Value::Bool(true)); - s.commit_interaction()?; + super::edit::settle_interaction(s)?; } let at = |k: &str| byte_param(&o, k).unwrap_or(0); Ok(Some((id, at("start"), at("end")))) diff --git a/crates/engine/src/cmd/textstyles.rs b/crates/engine/src/cmd/textstyles.rs index e560c831cd..d544697c5c 100644 --- a/crates/engine/src/cmd/textstyles.rs +++ b/crates/engine/src/cmd/textstyles.rs @@ -488,8 +488,14 @@ fn selection_attrs(s: &Session, p: &Value, kind: Kind, verb: &str) -> Result para_attrs(t.para_at(t.paragraphs_in(at, at).start)), + // The paragraph at `start`, without the number its list gives that paragraph alone. + Kind::Para => { + let mut para = t.para_at(t.paragraphs_in(at, at).start).clone(); + if let Some(l) = para.list.as_mut() { + l.start = None; + } + para_attrs(¶) + } })) } @@ -639,6 +645,11 @@ fn attrs_param(d: &Document, p: &Value, kind: Kind, verb: &str, kept: Option<&Ma } Kind::Para => { let mut st = with_attrs(&ParaStyle::default(), m, &c)?; + // A list's number belongs to one paragraph, not to a style. + if st.list.is_some_and(|l| l.start.is_some()) { + let k = "list.start"; + return Err(bad(&c, format!("unknown attribute `{k}`"))); + } para_ranges(&st, m, kept, &c)?; sort_tabs(&mut st, m, kept); para_attrs(&st) diff --git a/crates/engine/src/cmd/typecmd/area_tests.rs b/crates/engine/src/cmd/typecmd/area_tests.rs index aa6b75032d..058c05beb2 100644 --- a/crates/engine/src/cmd/typecmd/area_tests.rs +++ b/crates/engine/src/cmd/typecmd/area_tests.rs @@ -736,6 +736,189 @@ fn numbered_lists_are_set_per_paragraph_saved_and_styled() { assert_eq!((list(&s, 0), list(&s, 1), list(&s, 2)), (None, None, None)); } +/// `text.setFormat {startNumber}` gives the first numbered paragraph it touches a number, and the +/// paragraphs after it count on from it; `restartNumbering` true gives it 1 and false takes the +/// numbers away. Each change is one undo step, a call that changes nothing records none, and a +/// bad value or both keys change nothing. The file keeps the number, Return and paragraph styles +/// do not take it, a bulleted paragraph keeps none, and Convert to Text writes the numbers shown. +#[test] +fn a_numbered_paragraph_starts_at_a_given_number_or_restarts() { + use vectorcraft_doc::text::{Bullet, ParaList}; + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap(); + let id = s + .execute("text.create", &json!({"x": 10, "y": 10, "text": "Intro\nOne\nTwo\nThree\nFour", "area": {"width": 300, "height": 200}})) + .unwrap()["id"] + .as_u64() + .unwrap(); + let text = |s: &Session| match &s.doc().unwrap().doc.node(NodeId(id)).unwrap().kind { + NodeKind::Text(t) => (**t).clone(), + _ => panic!("text"), + }; + let starts = |s: &Session| text(s).paragraph_styles().iter().map(|p| p.list.and_then(|l| l.start)).collect::>(); + let numbers = |s: &Session| { + vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &text(s)).markers.iter().map(|m| m.text.clone()).collect::>() + }; + let undo = |s: &Session| s.active().unwrap().history.undo.len(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + // A call over all the text gives the number to the first paragraph the same call numbers. + s.execute("text.setFormat", &json!({"start": 6, "end": 24, "number": "arabic", "startNumber": 5})).unwrap(); + assert_eq!(starts(&s), [None, Some(5), None, None, None]); + assert_eq!(numbers(&s), ["5.", "6.", "7.", "8."]); + // On "Three": `restartNumbering` gives it 1, and "Four" counts on from it. + let steps = undo(&s); + s.execute("text.setFormat", &json!({"start": 14, "end": 14, "restartNumbering": true})).unwrap(); + assert_eq!((numbers(&s), undo(&s)), (vec!["5.".to_string(), "6.".into(), "1.".into(), "2.".into()], steps + 1)); + // The same number again, or a call on a paragraph in no list, changes nothing. + s.execute("text.setFormat", &json!({"start": 14, "end": 14, "startNumber": 1.0})).unwrap(); + s.execute("text.setFormat", &json!({"start": 0, "end": 0, "startNumber": 3})).unwrap(); + assert_eq!((starts(&s), undo(&s)), (vec![None, Some(5), None, Some(1), None], steps + 1)); + // Bad values and both keys at once are errors and change nothing. + for bad in [ + json!({"startNumber": 0}), + json!({"startNumber": -2}), + json!({"startNumber": 2.5}), + json!({"startNumber": 1_000_000_000}), + json!({"startNumber": "5"}), + json!({"restartNumbering": "yes"}), + json!({"startNumber": 3, "restartNumbering": true}), + ] { + assert!(s.execute("text.setFormat", &bad).is_err(), "{bad}"); + } + assert_eq!((starts(&s), undo(&s)), (vec![None, Some(5), None, Some(1), None], steps + 1)); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(numbers(&s), ["5.", "6.", "7.", "8."], "one Undo takes the restart back"); + s.execute("edit.redo", &json!({})).unwrap(); + // The file keeps the numbers. + assert_eq!(serde_json::to_value(text(&s).para_at(1)).unwrap()["list"], json!({"bullet": "dot", "number": "arabic", "start": 5})); + let reopened = vectorcraft_format::load(&vectorcraft_format::save(&s.doc().unwrap().doc, false)).unwrap(); + let Some(NodeKind::Text(back)) = reopened.node(NodeId(id)).map(|n| &n.kind) else { panic!("text") }; + assert_eq!(back.paragraph_styles(), text(&s).paragraph_styles()); + // Return at the end of "One" makes an item that counts on, without a number of its own. + s.execute("text.editRange", &json!({"id": id, "start": 9, "end": 9, "insert": "\nOne and a half"})).unwrap(); + assert_eq!(numbers(&s), ["5.", "6.", "7.", "1.", "2."]); + assert_eq!(starts(&s), [None, Some(5), None, None, Some(1), None]); + // A paragraph style made from the paragraph does not keep its number, and a style's list + // with a number is an error. + s.execute("paraStyle.new", &json!({"name": "Item", "id": id, "start": 6, "end": 6})).unwrap(); + s.execute("paraStyle.apply", &json!({"name": "Item", "id": id})).unwrap(); + assert_eq!(starts(&s), [None; 6]); + assert_eq!(numbers(&s), ["1.", "2.", "3.", "4.", "5.", "6."]); + let given = json!({"name": "Given", "attrs": {"list": {"number": "arabic", "start": 4}}}); + assert!(s.execute("paraStyle.new", &given).is_err()); + // `restartNumbering` false takes every number the call touches away; a paragraph made bulleted + // keeps none. + s.execute("text.setFormat", &json!({"start": 0, "end": 0, "startNumber": 7})).unwrap(); + s.execute("text.setFormat", &json!({"start": 6, "end": 6, "startNumber": 3})).unwrap(); + assert_eq!(starts(&s)[..2], [Some(7), Some(3)]); + s.execute("text.setFormat", &json!({"restartNumbering": false})).unwrap(); + assert_eq!(starts(&s), [None; 6]); + s.execute("text.setFormat", &json!({"start": 0, "end": 0, "startNumber": 7})).unwrap(); + s.execute("text.setFormat", &json!({"start": 0, "end": 0, "bullet": "dot"})).unwrap(); + assert_eq!(text(&s).para_at(0).list, Some(ParaList::bulleted(Bullet::Dot))); + s.execute("text.setFormat", &json!({"start": 0, "end": 0, "number": "upperRoman"})).unwrap(); + assert_eq!(text(&s).para_at(0).list.and_then(|l| l.start), None, "numbered again, it counts on"); + // Convert to Text writes the numbers the paragraphs showed. + s.execute("text.setFormat", &json!({"start": 0, "end": 0, "number": "arabic", "startNumber": 10})).unwrap(); + s.execute("text.setFormat", &json!({"start": 30, "end": 30, "restartNumbering": true})).unwrap(); + let shown = numbers(&s); + assert_eq!(shown, ["10.", "11.", "12.", "13.", "1.", "2."]); + s.execute("text.convertListToText", &json!({})).unwrap(); + let written: Vec = text(&s).plain_text().split('\n').map(|p| p.split('\t').next().unwrap_or("").to_string()).collect(); + assert_eq!(written, shown); + assert_eq!(starts(&s), [None; 6]); + assert!(text(&s).paragraph_styles().iter().all(|p| p.list.is_none())); +} + +/// In threaded type, a paragraph given a number in the first frame carries its count on through +/// the later frames, and a paragraph given 1 in a later frame starts the count again there. +#[test] +fn a_given_number_carries_through_threaded_frames() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 600, "height": 300})).unwrap(); + let numbers = |s: &Session, id: u64| { + let Some(NodeKind::Text(t)) = s.doc().unwrap().doc.node(NodeId(id)).map(|n| &n.kind) else { panic!("text") }; + vectorcraft_text::layout(vectorcraft_text::FontDb::global(), t).markers.iter().map(|m| m.text.clone()).collect::>() + }; + let story = (1..=10).map(|i| format!("Item {i}")).collect::>().join("\n"); + let a = + s.execute("text.create", &json!({"x": 10, "y": 10, "text": story, "area": {"width": 150, "height": 60}})).unwrap()["id"].as_u64().unwrap(); + let b = s.execute("shape.rectangle", &json!({"x": 200, "y": 10, "width": 150, "height": 200})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); + s.execute("text.thread.create", &json!({})).unwrap(); + s.execute("text.setFormat", &json!({"ids": [a, b], "list": "number"})).unwrap(); + let first = numbers(&s, a).len(); + assert!((2..10).contains(&first), "both frames hold items: {first}"); + s.execute("text.setFormat", &json!({"ids": [a], "start": 0, "end": 0, "startNumber": 20})).unwrap(); + let want: Vec = (20..30).map(|n| format!("{n}.")).collect(); + assert_eq!([numbers(&s, a), numbers(&s, b)].concat(), want); + // The first paragraph of the second frame given 1: the second frame counts from 1. + s.execute("text.setFormat", &json!({"ids": [b], "start": 0, "end": 0, "restartNumbering": true})).unwrap(); + let want: Vec = (20..20 + first).chain(1..=10 - first).map(|n| format!("{n}.")).collect(); + assert_eq!([numbers(&s, a), numbers(&s, b)].concat(), want); + // Editing the first frame's number moves every later number on with it. + s.execute("text.setFormat", &json!({"ids": [a], "start": 0, "end": 0, "startNumber": 2})).unwrap(); + let want: Vec = (2..2 + first).chain(1..=10 - first).map(|n| format!("{n}.")).collect(); + assert_eq!([numbers(&s, a), numbers(&s, b)].concat(), want); +} + +/// A number given in a threaded frame whose first paragraph continues from the frame before goes +/// to the next numbered paragraph that begins in that frame, not to the item the earlier frame shows, +/// and `restartNumbering` false there leaves that item's number alone. +#[test] +fn a_given_number_skips_the_paragraph_continued_from_the_frame_before() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 600, "height": 300})).unwrap(); + let text = |s: &Session, id: u64| match &s.doc().unwrap().doc.node(NodeId(id)).unwrap().kind { + NodeKind::Text(t) => (**t).clone(), + _ => panic!("text"), + }; + let numbers = |s: &Session, id: u64| { + vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &text(s, id)).markers.iter().map(|m| m.text.clone()).collect::>() + }; + let long = (1..=40).map(|i| format!("word{i}")).collect::>().join(" "); + let story = format!("One\n{long}\nThree"); + let a = + s.execute("text.create", &json!({"x": 10, "y": 10, "text": story, "area": {"width": 150, "height": 60}})).unwrap()["id"].as_u64().unwrap(); + let b = s.execute("shape.rectangle", &json!({"x": 200, "y": 10, "width": 150, "height": 250})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); + s.execute("text.thread.create", &json!({})).unwrap(); + s.execute("text.setFormat", &json!({"ids": [a, b], "list": "number"})).unwrap(); + assert!(text(&s, b).first_para_continues, "the second frame starts inside the long paragraph"); + assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "2.".into()], vec!["3.".to_string()])); + s.execute("text.setFormat", &json!({"ids": [b], "startNumber": 5})).unwrap(); + assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "2.".into()], vec!["5.".to_string()])); + // The long item, numbered in the first frame, keeps its number when the second frame's are taken away. + s.execute("text.setFormat", &json!({"ids": [a], "start": 4, "end": 4, "startNumber": 8})).unwrap(); + assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "8.".into()], vec!["5.".to_string()])); + s.execute("text.setFormat", &json!({"ids": [b], "restartNumbering": false})).unwrap(); + assert_eq!((numbers(&s, a), numbers(&s, b)), (vec!["1.".to_string(), "8.".into()], vec!["9.".to_string()])); +} + +/// `startNumber` over several type objects goes to the first numbered paragraph with text among +/// all of them, past an empty numbered object listed first; with no text anywhere it goes to the +/// first numbered paragraph. +#[test] +fn a_given_number_goes_to_the_first_numbered_text_across_objects() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap(); + let make = + |s: &mut Session, y: u32, text: &str| s.execute("text.create", &json!({"x": 10, "y": y, "text": text})).unwrap()["id"].as_u64().unwrap(); + let empty = make(&mut s, 10, ""); + let full = make(&mut s, 60, "One\nTwo"); + let start = |s: &Session, id: u64| match &s.doc().unwrap().doc.node(NodeId(id)).unwrap().kind { + NodeKind::Text(t) => t.para_at(0).list.and_then(|l| l.start), + _ => panic!("text"), + }; + s.execute("text.setFormat", &json!({"ids": [empty, full], "number": "arabic"})).unwrap(); + s.execute("text.setFormat", &json!({"ids": [empty, full], "startNumber": 4})).unwrap(); + assert_eq!((start(&s, empty), start(&s, full)), (None, Some(4))); + let other = make(&mut s, 120, ""); + s.execute("text.setFormat", &json!({"ids": [other, empty], "number": "arabic"})).unwrap(); + s.execute("text.setFormat", &json!({"ids": [other, empty], "startNumber": 6})).unwrap(); + assert_eq!((start(&s, other), start(&s, empty)), (Some(6), None)); +} + /// Bullets and Numbering… › Alignment: `text.setFormat {listAlign}` sets where the marker /// stands in the list paragraphs it touches, in one undo step, and refuses unknown values; /// a paragraph in no list gets no list from it. A list keeps its alignment when it changes diff --git a/crates/engine/src/cmd/variablecmds.rs b/crates/engine/src/cmd/variablecmds.rs index 229aa1db3a..ea6647b7a4 100644 --- a/crates/engine/src/cmd/variablecmds.rs +++ b/crates/engine/src/cmd/variablecmds.rs @@ -8,7 +8,8 @@ //! variable name per column, which export writes with `#` before a visibility variable and `@` //! before an image variable); import replaces the datasets, names the rows Data Set 1, 2…, //! also reads tab-separated files, and reads header cells that define new variables (`#` for -//! visibility, `@` for image, no prefix for text). `variable.loadLibrary` replaces the variables and data sets with the +//! visibility, `@` for image, `%` for graph, whose cells name graph data files, no prefix for +//! text). `variable.loadLibrary` replaces the variables and data sets with the //! variables and data sets of a variable library, the XML file of the reference app's Save //! Variable Library, and `variable.saveLibrary` writes the variables and data sets as one. //! `variable.import` (the panel's Import…) runs one of the two readers by the file's extension. @@ -1070,7 +1071,7 @@ pub fn specs() -> Vec { "Import Data Sets…", ["Window", "Variables"], None, - "{path? | data? | dataBase64? | csv?} replace every dataset with the rows of a CSV, comma- or tab-separated, in UTF-16 (with a byte-order mark, or without one when at least half of its two-byte units hold a NUL byte and only one byte order reads a line break; any other file with NUL bytes is refused), UTF-8 or else Windows-1252 (header: one variable name per column, whatever its case; one row per dataset, named Data Set 1, 2… in file order). The document's variables and their bindings stay. A header that names no variable defines one, unbound: `#Name` defines a visibility variable, `@Name` defines an image variable, and a header without a prefix defines a text variable. A prefixed header whose name is a variable of another kind, and a `%` header that isn't a variable's exact name (graph data files), are refused, and so are two headers that name one variable and a header that would define a variable while the variables are locked. An import that leaves the variables and data sets as they were adds no undo step → {imported, names, defined, deletedDataSets}", + "{path? | data? | dataBase64? | csv?, base?: folder} replace every dataset with the rows of a CSV, comma- or tab-separated, in UTF-16 (with a byte-order mark, or without one when at least half of its two-byte units hold a NUL byte and only one byte order reads a line break; any other file with NUL bytes is refused), UTF-8 or else Windows-1252 (header: one variable name per column, whatever its case; one row per dataset, named Data Set 1, 2… in file order). The document's variables and their bindings stay. A header that names no variable defines one, unbound: `#Name` defines a visibility variable, `@Name` defines an image variable, `%Name` defines a graph variable, and a header without a prefix defines a text variable. A `%Name` column's cells are paths of graph data files, each read as Graph Data's Import Data reads one (at most 1 MB; tab-separated when a line holds a tab, else comma-separated; UTF-16 by dataset.import's rule, else UTF-8, with bytes that aren't UTF-8 read as replacement characters; the first row holds the series labels and the first column the category labels) and kept as the data set's graph value, which applies as graph.setData applies it. The files are read at import. A relative path is taken from `base`, else from the folder of the CSV file at `path`; with neither, it is refused (an `@Name` column's relative paths are kept as they are and taken from the document's folder when a data set is selected). A path on another computer, or on a network share other than the one `base` or the CSV is on, a device and a URL other than a `file:` URL without a host are refused, as image variables' paths are, before anything is read. A file that is missing, can't be read or is larger than 1 MB, a file that gives a graph value longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all (each file counted once, each cell's value every time) refuse the import, naming the line and the column. A prefixed header whose name is a variable of another kind is refused, and so are two headers that name one variable and a header that would define a variable while the variables are locked. An import that leaves the variables and data sets as they were adds no undo step → {imported, names, defined, deletedDataSets}", has_doc, dataset_import ), diff --git a/crates/engine/src/cmd/variablecmds/csv.rs b/crates/engine/src/cmd/variablecmds/csv.rs index be9db3b841..856ea4060e 100644 --- a/crates/engine/src/cmd/variablecmds/csv.rs +++ b/crates/engine/src/cmd/variablecmds/csv.rs @@ -3,6 +3,7 @@ use super::{ json, read_file_head, str_param, variables_unlocked, write_file, }; use crate::cmd::place::text::windows_1252; +use crate::cmd::{MAX_GRAPH_DATA_FILE, text_param}; /// Cap on a graph variable's CSV (MCP and files are untrusted). pub(super) const MAX_GRAPH_CSV: usize = 256 * 1024; @@ -268,10 +269,11 @@ fn export_header(v: &Variable) -> String { /// What [`dataset_import`] does with each variable's column of the CSV that [`datasets_to_csv`] /// writes, in a document without the variables: the first list names the variables whose header -/// or values it refuses, so it doesn't import the file (a `%` header, a `#` header whose values -/// aren't true or false, a header that names a variable an earlier column named), and the second -/// the variables it reads as another variable (a text variable whose name starts with `#` or `@`, -/// and a graph variable, which no header cell defines). +/// or values it refuses, so it doesn't import the file (a `%` header over values, which it reads as +/// paths of graph data files, a `#` header whose values aren't true or false, a header that names +/// a variable an earlier column named), and the second the variables it reads as another variable +/// (a variable whose name starts with `#`, `@` or `%` and isn't of that prefix's kind, and a graph +/// variable, which the export writes without `%`). fn kinds_a_new_document_loses(vars: &Variables) -> (Vec<&str>, Vec<&str>) { const C: &str = "dataset.import"; let none = BTreeMap::new(); @@ -287,9 +289,11 @@ fn kinds_a_new_document_loses(vars: &Variables) -> (Vec<&str>, Vec<&str>) { refused.push(v.name.as_str()); continue; }; + // A `%` header's cells are paths of graph data files, which the values the export writes aren't. + let files = kind == VariableKind::Graph && name != cell; let cells_read = vars.datasets.iter().filter_map(|d| d.values.get(&v.name)).all(|val| { let cell = value_to_cell(val); - cell_to_value(kind, &cell, cell.is_empty(), &name, 2, C).is_ok() + if files { cell.trim().is_empty() } else { cell_to_value(kind, &cell, cell.is_empty(), &name, 2, C).is_ok() } }); if !cells_read { refused.push(v.name.as_str()); @@ -340,7 +344,9 @@ fn datasets_to_csv(vars: &Variables, cmd: &str) -> Result { /// that earlier columns define) names that variable. Otherwise `#` before the name makes it a /// visibility variable, `@` makes it an image variable, and a cell without a prefix names a text /// variable. A prefixed name that is already a variable must be one of the prefix's kind; a new -/// name is added to `defined`. A `%` cell that names no variable (graph data files) is refused. +/// name is added to `defined`. `%` before a name makes it a graph variable whose column holds the +/// paths of graph data files ([`graph_file_value`]); [`dataset_import`] tells such a column apart +/// by a returned name that is not the cell. fn header_variable( cell: &str, column: usize, @@ -356,8 +362,8 @@ fn header_variable( (rest.trim(), VariableKind::Visibility) } else if let Some(rest) = cell.strip_prefix('@') { (rest.trim(), VariableKind::Image) - } else if cell.starts_with('%') { - return Err(bad(cmd, format!("column {column}: `{cell}` is a `%` column of graph data files, which are not read"))); + } else if let Some(rest) = cell.strip_prefix('%') { + (rest.trim(), VariableKind::Graph) } else { (cell, VariableKind::Text) }; @@ -375,13 +381,94 @@ fn header_variable( } } +/// The most bytes the `%` columns of one import read from graph data files and keep as graph +/// values, counted together: each file's bytes once (it is read once, however many cells name it), +/// and the graph value of every cell, which each data set holds a copy of. +const MAX_GRAPH_FILES_TOTAL: usize = 256 * 1_048_576; + +/// The graph data files the `%` columns of one import have read, by path, and the bytes counted +/// against [`MAX_GRAPH_FILES_TOTAL`] so far. +#[derive(Default)] +struct GraphFiles { + read: BTreeMap, + total: usize, +} + +/// The graph value of a `%` column's cell `path` on file line `line`, in 1-based `column`, for the +/// graph variable `var`: the graph data file at `path` (taken from the folder `base` when +/// relative), read as Graph Data's Import Data reads one ([`crate::cmd::graph::graph_csv_from_file`]), +/// or no value for an empty cell. The path is followed as an image variable's path is +/// ([`crate::cmd::fileio::document_path`]): only files on this computer, or on the network share +/// `base` is on, are read. A relative path without `base`, a path on another computer or share, a +/// device or a URL, a file that can't be read or is larger than 1 MB, a file that gives a graph +/// value longer than [`MAX_GRAPH_CSV`] bytes and more than [`MAX_GRAPH_FILES_TOTAL`] bytes in all +/// are refused, with the line and the column. +fn graph_file_value(files: &mut GraphFiles, path: &str, base: Option<&str>, var: &str, (line, column): (usize, usize)) -> Result> { + const C: &str = "dataset.import"; + let path = path.trim(); + if path.is_empty() { + return Ok(None); + } + // Without `base`, a path that stays relative once a `file:` URL is read is refused here, so the + // error says what to give. + if base.is_none() && craft_docpath::resolve(path, None).is_ok_and(|p| !p.is_absolute()) { + return Err(bad( + C, + format!("line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path"), + )); + } + // `document_path` takes a relative path from the folder of a document; any file name in `base` + // stands for the CSV there. + let document = base.map(|base| std::path::Path::new(base).join("data sets.csv").to_string_lossy().into_owned()); + let full = crate::cmd::fileio::document_path(path, document.as_deref()) + .map_err(|r| bad(C, format!("line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r}")))?; + let csv = match files.read.get(&full) { + Some(csv) => csv.clone(), + None => { + // One byte past the limit is enough to refuse the file. + let bytes = read_file_head(&full, MAX_GRAPH_DATA_FILE + 1) + .map_err(|e| bad(C, format!("line {line}, column {column}: the graph data file for `{var}` can't be read: {e}")))?; + if bytes.len() > MAX_GRAPH_DATA_FILE { + return Err(bad( + C, + format!("line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes"), + )); + } + let csv = crate::cmd::graph::graph_csv_from_file(&bytes)?; + if csv.len() > MAX_GRAPH_CSV { + return Err(bad( + C, + format!( + "line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes" + ), + )); + } + files.total += bytes.len(); + files.read.insert(full, csv.clone()); + csv + } + }; + files.total += csv.len(); + if files.total > MAX_GRAPH_FILES_TOTAL { + return Err(bad(C, format!("line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all"))); + } + Ok(Some(DataValue::Graph(csv))) +} + /// Import datasets from CSV. Every header cell names a variable, as [`header_variable`] reads it, /// and the variables the document doesn't define yet are defined, unbound. Two headers that name -/// one variable are refused. The rows replace every dataset of the document and are named "Data -/// Set 1", "Data Set 2" and so on, in file order. The document's variables and their bindings +/// one variable are refused. The cells of a `%` column are paths of graph data files +/// ([`graph_file_value`]); a relative one is taken from the folder `base` gives, else from the +/// folder of the file `path` names. The rows replace every dataset of the document and are named +/// "Data Set 1", "Data Set 2" and so on, in file order. The document's variables and their bindings /// stay. One undo step, and none when the variables and datasets stay as they were. pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { const C: &str = "dataset.import"; + let base = match text_param(p, "base", C)? { + Some("") => return Err(bad(C, "`base` is empty")), + Some(base) => Some(absolute_path(base)), + None => str_param(p, "path").and_then(|path| std::path::Path::new(&absolute_path(path)).parent().map(|d| d.to_string_lossy().into_owned())), + }; let (bytes, given_as_text) = datasets_csv_bytes(p, C)?; // `data` and `csv` are already text, NUL characters included (`dataset.export` writes them). let text = if given_as_text { String::from_utf8(bytes).map_err(|_| bad(C, "CSV is not UTF-8"))? } else { datasets_csv_text(&bytes, C)? }; @@ -390,7 +477,8 @@ pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { return Err(bad(C, "CSV is empty")); }; let kinds: BTreeMap = s.doc()?.doc.variables.variables.iter().map(|v| (v.name.clone(), v.kind)).collect(); - let mut columns: Vec<(usize, String, VariableKind)> = Vec::new(); + // Each column: its index, its variable and kind, and whether its cells are graph data files. + let mut columns: Vec<(usize, String, VariableKind, bool)> = Vec::new(); let mut defined: Vec = Vec::new(); for (i, h) in header.iter().enumerate() { let cell = h.trim(); @@ -398,11 +486,12 @@ pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { return Err(bad(C, format!("empty header in column {}", i + 1))); } let (name, kind) = header_variable(cell, i + 1, &kinds, &mut defined, C)?; - if let Some(&(first, ..)) = columns.iter().find(|(_, n, _)| *n == name) { + if let Some(&(first, ..)) = columns.iter().find(|(_, n, ..)| *n == name) { let (first, column) = (first + 1, i + 1); return Err(bad(C, format!("columns {first} and {column} both name the variable `{name}`"))); } - columns.push((i, name, kind)); + let files = kind == VariableKind::Graph && name != cell; + columns.push((i, name, kind, files)); } // Lock Variables refuses New Variable, so the import is refused when a header would define one. if !defined.is_empty() { @@ -412,13 +501,19 @@ pub(super) fn dataset_import(s: &mut Session, p: &Value) -> Result { return Err(bad(C, "CSV has a header but no data rows")); } let mut parsed: Vec = Vec::new(); + let mut files = GraphFiles::default(); for (n, &(line, ref row, ref quoted)) in rows.iter().skip(1).enumerate() { let name = format!("Data Set {}", n + 1); let mut values = BTreeMap::new(); - for &(col, ref var, kind) in &columns { + for &(col, ref var, kind, from_files) in &columns { let cell = row.get(col).map(String::as_str).unwrap_or(""); let was_quoted = quoted.get(col).copied().unwrap_or(false); - if let Some(v) = cell_to_value(kind, cell, was_quoted, var, line, C)? { + let value = if from_files { + graph_file_value(&mut files, cell, base.as_deref(), var, (line, col + 1))? + } else { + cell_to_value(kind, cell, was_quoted, var, line, C)? + }; + if let Some(v) = value { values.insert(var.clone(), v); } } diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index 86525e9214..ebee8b6e77 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -214,6 +214,10 @@ pub struct Prefs { /// runs on: a Wayland compositor may not show frames from another GPU (#502). Single-GPU /// machines are unaffected. pub gpu_preference: String, + /// The desktop app's window presents without vsync, with frames capped at 240 a second (#6013). + /// Read at startup (it takes effect after a restart); `--present-mode` and + /// `VECTORCRAFT_PRESENT_MODE` take precedence over it. + pub low_latency_drawing: bool, pub history_states: u32, pub real_time_drawing: bool, /// Rasterizer worker threads; -1 = automatic. @@ -503,6 +507,7 @@ impl Default for Prefs { gpu_performance: true, animated_zoom: true, gpu_preference: s("automatic"), + low_latency_drawing: false, history_states: 500, real_time_drawing: true, render_threads: -1, diff --git a/crates/engine/src/session/edit.rs b/crates/engine/src/session/edit.rs index 4f47b325b9..8c0f3e8803 100644 --- a/crates/engine/src/session/edit.rs +++ b/crates/engine/src/session/edit.rs @@ -255,6 +255,21 @@ impl Session { (r, settled) } + /// [`Session::begin_interaction`] for a dialog or a panel that starts a preview → the warnings + /// of the preview that keeping typing in progress applied, for its status bar. + pub fn begin_interaction_warned(&mut self, label: &str) -> Result> { + let (r, settled) = self.collect_settled_warnings(|s| s.begin_interaction(label)); + r.map(|()| settled) + } + + /// Keep typing in progress as one undo step, applying the preview Real-time Drawing off left + /// unapplied, and end the Type tool's typing session → the applied preview's warnings. Nothing + /// changes when no typing is in progress. + pub fn keep_typing(&mut self) -> Result> { + let (r, settled) = self.collect_settled_warnings(|s| if cmd::typing_in_progress(s) { cmd::settle_interaction(s) } else { Ok(()) }); + r.map(|()| settled) + } + pub fn begin_interaction(&mut self, label: &str) -> Result<()> { if self.script_running() { return Err(EngineError::Busy); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index e6c622963a..a16f01cfa0 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -2809,6 +2809,26 @@ fn an_isolated_compound_paths_member_moves_alone() { assert_eq!((x0(&s, outer), x0(&s, hole)), (5.0, 55.0), "the compound path selected: the whole ring"); } +/// Rotate Bounding Box and Reset Bounding Box take the same objects as the transforms: a path of +/// a compound path selected alone turns or squares its own box, and the compound path selected +/// turns its box and its paths'. +#[test] +fn rotate_bounding_box_of_a_compound_paths_member_turns_only_that_path() { + let angle = |s: &Session, id: NodeId| s.doc().unwrap().doc.node(id).unwrap().bbox_angle; + let mut s = session(); + let (c, outer, hole) = isolated_ring(&mut s); + s.execute("object.exitIsolation", &json!({})).unwrap(); + s.execute("select.set", &json!({"ids": [hole.0]})).unwrap(); + s.execute("object.rotateBoundingBox", &json!({"angle": 30})).unwrap(); + assert_eq!((angle(&s, c), angle(&s, outer), angle(&s, hole)), (0.0, 0.0, 30.0), "only the hole's box turned"); + s.execute("select.set", &json!({"ids": [c.0]})).unwrap(); + s.execute("object.rotateBoundingBox", &json!({"angle": 10})).unwrap(); + assert_eq!((angle(&s, c), angle(&s, outer), angle(&s, hole)), (10.0, 10.0, 40.0), "the compound path and its paths"); + s.execute("select.set", &json!({"ids": [hole.0]})).unwrap(); + assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 1); + assert_eq!((angle(&s, c), angle(&s, outer), angle(&s, hole)), (10.0, 10.0, 0.0), "Reset squared only the hole's box"); +} + /// The X, Y, W and H of the Properties and Transform panels run `object.setBounds`, which takes the /// same objects as the other transforms: a path of a compound path selected alone sets its own /// box and leaves the ring around it (#4046). The hole is off-centre, and a plain rectangle diff --git a/crates/engine/src/tests/bboxrotate.rs b/crates/engine/src/tests/bboxrotate.rs index db09eba280..eec4ee191a 100644 --- a/crates/engine/src/tests/bboxrotate.rs +++ b/crates/engine/src/tests/bboxrotate.rs @@ -579,6 +579,157 @@ fn reset_bounding_box_squares_the_turned_members_of_a_square_group() { assert_eq!(selection_box(&s).angle, 0.0); } +#[test] +fn rotate_bounding_box_turns_the_box_and_leaves_the_art() { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + sel(&mut s, &[a]); + let art = anchors(&s, a); + let n = undo_len(&s); + let r = s.execute("object.rotateBoundingBox", &json!({"angle": 90})).unwrap(); + assert_eq!((r["changed"].as_u64(), r["angle"].as_f64()), (Some(1), Some(90.0))); + assert_eq!(undo_len(&s), n + 1); + assert_eq!(anchors(&s, a), art, "the art stays where it is"); + // The box is at 90°, so its width runs along the rectangle's 50 pt side. + let b = selection_box(&s); + assert!(near(b.angle, 90.0)); + assert!(near(b.rect.width(), 50.0) && near(b.rect.height(), 100.0), "{b:?}"); + // By an angle from the box's angle; absolute sets it; the result wraps to (-180, 180]. + s.execute("object.rotateBoundingBox", &json!({"angle": 20})).unwrap(); + assert!(near(angle(&s, a), 110.0)); + let r = s.execute("object.rotateBoundingBox", &json!({"angle": 200, "absolute": true})).unwrap(); + assert!(near(r["angle"].as_f64().unwrap(), -160.0) && near(angle(&s, a), -160.0)); + // A box already at the angle changes nothing and adds no step. + let n = undo_len(&s); + let r = s.execute("object.rotateBoundingBox", &json!({"angle": -160, "absolute": true})).unwrap(); + assert_eq!(r["changed"], 0); + let r = s.execute("object.rotateBoundingBox", &json!({"angle": 360})).unwrap(); + assert_eq!(r["changed"], 0); + assert_eq!(undo_len(&s), n); + // Undo turns the box back; Reset Bounding Box squares it. + s.execute("edit.undo", &json!({})).unwrap(); + assert!(near(angle(&s, a), 110.0)); + assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 1); + assert_eq!(anchors(&s, a), art); +} + +/// Turns that add up to 0 within the tolerance leave the box at exactly 0, so the box measures +/// square to the page and Reset Bounding Box has nothing to square. +#[test] +fn rotate_bounding_box_back_to_zero_stores_zero() { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + sel(&mut s, &[a]); + for by in [0.3, -0.1] { + s.execute("object.rotateBoundingBox", &json!({"angle": by})).unwrap(); + } + let r = s.execute("object.rotateBoundingBox", &json!({"angle": -0.2})).unwrap(); + assert_eq!((r["angle"].as_f64(), angle(&s, a)), (Some(0.0), 0.0), "{r}"); + assert_eq!(selection_box(&s).angle, 0.0); + let n = undo_len(&s); + assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 0); + assert_eq!(undo_len(&s), n); + // A negative zero is reported and stored as 0. + let r = s.execute("object.rotateBoundingBox", &json!({"angle": -0.0, "absolute": true})).unwrap(); + let got = r["angle"].as_f64().unwrap(); + assert!(got == 0.0 && got.is_sign_positive(), "{r}"); + assert_eq!(r["changed"], 0); +} + +#[test] +fn rotate_bounding_box_gives_a_mixed_selection_one_angle() { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + let b = turned_rect(&mut s); + sel(&mut s, &[a, b]); + // The objects share no angle, so the box is square to the page and turns from 0. + assert_eq!(selection_box(&s).angle, 0.0); + let n = undo_len(&s); + assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 10})).unwrap()["changed"], 2); + assert_eq!(undo_len(&s), n + 1, "one step for both"); + assert!(near(angle(&s, a), 10.0) && near(angle(&s, b), 10.0)); + assert!(near(selection_box(&s).angle, 10.0)); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(near(angle(&s, a), 0.0) && near(angle(&s, b), 45.0)); + s.execute("edit.redo", &json!({})).unwrap(); + assert!(near(angle(&s, a), 10.0) && near(angle(&s, b), 10.0)); +} + +#[test] +fn rotate_bounding_box_turns_the_objects_inside_a_group_with_it() { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + let b = rect(&mut s, 300.0, 100.0, 100.0, 50.0); + sel(&mut s, &[a, b]); + s.execute("object.rotate", &json!({"angle": 20})).unwrap(); + let g = id_of(&s.execute("object.group", &json!({})).unwrap()); + let art = (anchors(&s, a), anchors(&s, b)); + // The group and both members, as Reset Bounding Box counts them. + assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 30})).unwrap()["changed"], 3); + // The members keep their 20° relative to the group's box. + assert!(near(angle(&s, g), 30.0) && near(angle(&s, a), 50.0) && near(angle(&s, b), 50.0)); + assert_eq!((anchors(&s, a), anchors(&s, b)), art); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(near(angle(&s, g), 0.0) && near(angle(&s, a), 20.0) && near(angle(&s, b), 20.0)); + s.execute("edit.redo", &json!({})).unwrap(); + assert!(near(angle(&s, g), 30.0) && near(angle(&s, a), 50.0) && near(angle(&s, b), 50.0)); + // After Ungroup the members still share a turned box. + s.execute("object.ungroup", &json!({})).unwrap(); + assert!(near(selection_box(&s).angle, 50.0)); +} + +/// The art of a linked opacity mask turns with its object; an unlinked mask's art keeps its angle. +#[test] +fn rotate_bounding_box_turns_a_linked_masks_art_only() { + let mask_angle = |s: &Session, a: NodeId| s.doc().unwrap().doc.node(a).unwrap().extras().mask.as_ref().unwrap().art.bbox_angle; + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + let b = rect(&mut s, 150.0, 120.0, 100.0, 50.0); + sel(&mut s, &[a, b]); + s.execute("transparency.makeOpacityMask", &json!({})).unwrap(); + assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 30})).unwrap()["changed"], 2); + assert!(near(angle(&s, a), 30.0) && near(mask_angle(&s, a), 30.0)); + s.execute("transparency.unlinkOpacityMask", &json!({})).unwrap(); + assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 10})).unwrap()["changed"], 1); + assert!(near(angle(&s, a), 40.0) && near(mask_angle(&s, a), 30.0)); +} + +/// Rotate Bounding Box and Reset Bounding Box act on the same boxes: after a turn of a group that +/// holds an object with a linked opacity mask, Reset squares every box it turned. +#[test] +fn reset_bounding_box_squares_every_box_rotate_bounding_box_turned() { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + let b = rect(&mut s, 150.0, 120.0, 100.0, 50.0); + sel(&mut s, &[a, b]); + s.execute("transparency.makeOpacityMask", &json!({})).unwrap(); + let c = rect(&mut s, 300.0, 100.0, 100.0, 50.0); + sel(&mut s, &[a, c]); + s.execute("object.group", &json!({})).unwrap(); + let art = (anchors(&s, a), anchors(&s, c)); + // The group, the masked object, its mask's art and the other rectangle. + assert_eq!(s.execute("object.rotateBoundingBox", &json!({"angle": 25})).unwrap()["changed"], 4); + assert!(object_angles(&s).iter().all(|x| near(*x, 25.0)), "{:?}", object_angles(&s)); + assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 4); + assert!(object_angles(&s).iter().all(|x| *x == 0.0), "{:?}", object_angles(&s)); + assert_eq!((anchors(&s, a), anchors(&s, c)), art); +} + +#[test] +fn rotate_bounding_box_refuses_bad_params() { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + sel(&mut s, &[a]); + let n = undo_len(&s); + for p in [json!({}), json!({"angle": null}), json!({"angle": "30"}), json!({"angle": 30, "absolute": "yes"})] { + assert!(s.execute("object.rotateBoundingBox", &p).is_err(), "{p}"); + } + assert_eq!((angle(&s, a), undo_len(&s)), (0.0, n)); + // Nothing selected: the command is not enabled. + s.execute("select.none", &json!({})).unwrap(); + assert!(s.execute("object.rotateBoundingBox", &json!({"angle": 30})).is_err()); +} + /// Two rectangles turned 20°, put in a container by `make`, turned 10° with it and reset, then /// released by `release`: nothing stands at an angle before or after the release. fn reset_then_release(make: &str, release: &str) -> Session { diff --git a/crates/engine/src/tests/blendopts.rs b/crates/engine/src/tests/blendopts.rs index e9da509e02..1a7ba8b0ae 100644 --- a/crates/engine/src/tests/blendopts.rs +++ b/crates/engine/src/tests/blendopts.rs @@ -120,8 +120,9 @@ fn a_blend_and_an_object_make_one_blend_with_more_keys() { } /// Choosing the Blend tool again (its button, W, `tool.select`) finishes the blend: the first -/// pick and the chain are dropped, and the document and the selection stay. Choosing another -/// tool again keeps its work: the Pen's open path stays open. +/// pick and the chain are dropped, and the document and the selection stay. The Pen chosen again +/// ends the path it is drawing, as Escape does: the path stays open and the next click starts a +/// new one. #[test] fn choosing_the_blend_tool_again_finishes_the_blend() { let mut s = session(); @@ -148,7 +149,7 @@ fn choosing_the_blend_tool_again_finishes_the_blend() { click(&mut s, 20.0, 20.0); assert_eq!(s.doc().unwrap().selection.objects, vec![a]); assert_eq!(spec(&s, g).0, vec![b, c], "a was not added"); - // The Pen chosen again goes on drawing its open path. + // The Pen chosen again ends its open path; the next click starts a new one. s.select_tool("pen", v).unwrap(); s.execute("select.none", &json!({})).unwrap(); let pen = |s: &mut Session, x: f64, y: f64| { @@ -156,16 +157,27 @@ fn choosing_the_blend_tool_again_finishes_the_blend() { s.pointer(&PointerEvent::new(kind, x, y), ViewInfo::default()).unwrap(); } }; + let anchors = |s: &Session, id| match node(s, id).kind { + NodeKind::Path { path, .. } => path.subpaths.iter().map(|sp| (sp.anchors.len(), sp.closed)).collect(), + _ => vec![], + }; + // With no path being drawn, choosing the Pen again changes nothing. + let depth = s.doc().unwrap().history.undo.len(); + s.select_tool("pen", v).unwrap(); + assert_eq!((s.doc().unwrap().history.undo.len(), s.doc().unwrap().selection.objects.len()), (depth, 0)); pen(&mut s, 100.0, 300.0); pen(&mut s, 200.0, 300.0); let p = s.doc().unwrap().selection.objects[0]; + let depth = s.doc().unwrap().history.undo.len(); s.select_tool("pen", v).unwrap(); + assert_eq!(s.tool_id(), "pen", "the Pen stays chosen"); + assert_eq!(s.doc().unwrap().history.undo.len(), depth, "ending the path adds no undo step"); + assert_eq!(s.doc().unwrap().selection.objects, vec![p], "the path stays selected"); pen(&mut s, 300.0, 300.0); - let anchors = match node(&s, p).kind { - NodeKind::Path { path, .. } => path.subpaths[0].anchors.len(), - _ => 0, - }; - assert_eq!(anchors, 3, "the Pen keeps drawing the same path"); + assert_eq!(anchors(&s, p), vec![(2, false)], "the path stays open with its two anchors"); + let q = s.doc().unwrap().selection.objects[0]; + assert_ne!(q, p, "the click starts a new path"); + assert_eq!(anchors(&s, q), vec![(1, false)]); } #[test] diff --git a/crates/engine/src/tests/inline.rs b/crates/engine/src/tests/inline.rs index 71caf14bf8..b6ea42d3f2 100644 --- a/crates/engine/src/tests/inline.rs +++ b/crates/engine/src/tests/inline.rs @@ -146,6 +146,31 @@ fn type_tool_inserts_at_its_caret_and_deletes_the_graphic_whole() { assert_eq!(inline_count(&obj(&s, id)), 1); } +/// With Performance › Real-time Drawing and Editing off, the typing waits for its session to end: +/// a graphic inserted while typing applies it first, as a step of its own, and goes in at the +/// caret after it. +#[test] +fn inserting_while_deferred_typing_keeps_the_typing() { + let mut s = session(); + s.prefs.real_time_drawing = false; + // The new type starts empty: the caret after "Pay " is past the end of the text until the + // typing is applied. + s.prefs.placeholder_text = false; + circle_symbol(&mut s, "Mana", 10.0); + s.execute("symbol.setCurrent", &json!({"name": "Mana"})).unwrap(); + let v = ViewInfo::default(); + s.select_tool("type", v).unwrap(); + for k in [PointerKind::Down, PointerKind::Up] { + s.pointer(&PointerEvent::new(k, 50.0, 300.0), v).unwrap(); + } + let id = s.doc().unwrap().selection.objects[0]; + s.tool_text("Pay ", v).unwrap(); + s.execute("text.insertInline", &json!({})).unwrap(); + assert_eq!(obj(&s, id).plain_text(), format!("Pay {INLINE_CHAR}")); + let labels: Vec = s.doc().unwrap().history.undo.iter().map(|e| e.label.clone()).collect(); + assert_eq!(labels[labels.len() - 2..], ["Typing", "Insert Inline Symbol"], "{labels:?}"); +} + #[test] fn inline_graphics_follow_their_symbol() { let mut s = session(); diff --git a/crates/engine/src/tests/links.rs b/crates/engine/src/tests/links.rs index b3b98189fb..87dd7453f6 100644 --- a/crates/engine/src/tests/links.rs +++ b/crates/engine/src/tests/links.rs @@ -2377,6 +2377,255 @@ fn confined_preserve_editing_svg_leaves_out_an_export_folder_outside_the_read_ro every(&mut s, true, Some(&inside)); } +/// The native document a file of `format` carries: the file itself, a PDF's or `.ai` file's +/// editing data, or an EPS file's. +fn carried_document(format: &str, bytes: &[u8]) -> Document { + let native = if bytes.starts_with(b"%PDF") { + vectorcraft_pdf::editing(bytes).expect("editing data").data + } else if format == "eps" { + vectorcraft_eps::native(bytes).expect("native document") + } else { + bytes.to_vec() + }; + vectorcraft_format::load(&native).unwrap() +} + +/// A confined caller: every output that carries the native document (a native file or template, a +/// `.ai` or EPS file, a PDF with Preserve Editing) of a document that links an image +/// file outside the read roots is refused before a file or folder is written, with an error that +/// names no file or folder, and the document keeps the link. +#[test] +fn confined_native_output_refuses_a_linked_image_file_outside_the_read_roots() { + use crate::file_access::{AutomationRoots, confine}; + + let away = Folder::new("native-image-away"); + let home = Folder::new("native-image-home"); + let photo = away.file("photo.png"); + write(&photo, &png(60, 30, RED)); + let mut s = session(); + let a = place(&mut s, &photo); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + s.execute("assets.add", &json!({"ids": [a.0]})).unwrap(); + let own = home.file("own.vectorcraft"); + s.execute("file.saveAs", &json!({"path": own})).unwrap(); + let before = std::fs::read(&own).unwrap(); + let roots = AutomationRoots::new(&[home.0.as_path()], &[home.0.as_path()]).unwrap(); + let hidden = [away.0.to_string_lossy().into_owned(), home.0.to_string_lossy().into_owned(), "photo.png".to_string()]; + let refused = |s: &mut Session, cmd: &str, p: Value| { + let e = confine(roots.as_ref(), || s.execute(cmd, &p)).expect_err(cmd); + assert!(matches!(e, EngineError::BadParams { .. }), "{cmd} {p}: {e:?}"); + let e = e.to_string(); + assert!(e.contains("a linked image file is outside the read roots"), "{cmd} {p}: {e}"); + for h in &hidden { + assert!(!e.contains(h.as_str()), "{cmd} {p} names {h}: {e}"); + } + }; + let file = |name: &str| home.file(name); + let out = file("out"); + refused(&mut s, "document.serialize", json!({})); + for format in ["vectorcraft", "template", "pdf", "ai", "eps"] { + refused(&mut s, "document.serialize", json!({"format": format})); + refused(&mut s, "document.export", json!({"format": format})); + refused(&mut s, "document.export", json!({"format": format, "selectedOnly": true})); + refused(&mut s, "document.exportSelection", json!({"format": format})); + } + refused(&mut s, "document.export", json!({"format": "pdf", "path": file("export.pdf")})); + refused(&mut s, "document.export", json!({"format": "ai", "path": file("export.ai")})); + refused(&mut s, "document.export", json!({"format": "eps", "path": file("export.eps")})); + refused(&mut s, "document.export", json!({"format": "vectorcraft", "path": file("export.vectorcraft")})); + refused(&mut s, "document.exportPdf", json!({})); + refused(&mut s, "document.exportPdf", json!({"path": file("direct.pdf")})); + refused(&mut s, "document.exportEps", json!({"path": file("direct.eps")})); + refused(&mut s, "document.save", json!({})); + refused(&mut s, "document.save", json!({"path": file("save.pdf")})); + refused(&mut s, "file.saveAs", json!({"path": file("save-as.ai")})); + // A saved `.ai` file has the artboards as its pages, whatever `useArtboards` says. + refused(&mut s, "file.saveAs", json!({"path": file("save-as-art.ai"), "useArtboards": false})); + refused(&mut s, "file.saveAs", json!({"path": file("save-as.eps")})); + refused(&mut s, "file.saveCopy", json!({"path": file("copy.vectorcraft")})); + refused(&mut s, "file.saveAsTemplate", json!({})); + refused(&mut s, "file.saveAsTemplate", json!({"format": "ait"})); + refused(&mut s, "document.exportForScreens", json!({"folder": out, "formats": [{"format": "png"}, {"format": "vectorcraft"}]})); + refused(&mut s, "document.exportForScreens", json!({"zip": true, "formats": [{"format": "pdf", "preserveEditing": true}]})); + refused(&mut s, "assets.export", json!({"folder": out, "formats": [{"format": "ai"}]})); + refused(&mut s, "assets.export", json!({"folder": out, "formats": [{"format": "eps"}]})); + assert_eq!(std::fs::read(&own).unwrap(), before, "the document's own file is left as it was"); + let written: Vec<_> = std::fs::read_dir(&home.0).unwrap().map(|e| e.unwrap().file_name()).collect(); + assert_eq!(written, ["own.vectorcraft"]); + assert_eq!(image(&s, a).link.map(|l| l.path), Some(photo)); +} + +/// A confined caller's native outputs are refused when the document they carry names a file +/// outside the read roots only as a data set's image, or holds stored brushes that cannot be read. +/// Outputs that carry no native document (a PDF without Preserve Editing, a PDF or `.ai` file of +/// some artboards or of the art's bounds, a legacy `.ai` file, an image, an SVG without Preserve +/// Editing) are written, and so is a native file whose data set image is inside the read roots, or +/// any data set image without roots. +#[test] +fn confined_native_output_refuses_a_data_set_image_outside_the_read_roots() { + use crate::file_access::{AutomationRoots, confine}; + + let away = Folder::new("native-dataset-away"); + let home = Folder::new("native-dataset-home"); + let outside = away.file("photo.png"); + let mut s = session(); + s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 20})).unwrap(); + s.execute("artboard.new", &json!({"x": 500, "y": 0, "width": 100, "height": 100})).unwrap(); + let set_image = |s: &mut Session, path: &str| { + let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); + let values = [("Photo".to_string(), vectorcraft_doc::DataValue::Image(path.into()))].into_iter().collect(); + doc.variables.datasets = vec![vectorcraft_doc::DataSet { name: "Row 1".into(), values }]; + }; + set_image(&mut s, &outside); + let roots = AutomationRoots::new(&[home.0.as_path()], &[home.0.as_path()]).unwrap(); + let refused = |s: &mut Session, cmd: &str, p: Value| { + let e = confine(roots.as_ref(), || s.execute(cmd, &p)).expect_err(cmd).to_string(); + assert!(e.contains("a linked image file is outside the read roots"), "{cmd} {p}: {e}"); + assert!(!e.contains(&away.0.to_string_lossy().into_owned()) && !e.contains("photo.png"), "{cmd} {p}: {e}"); + }; + let written = |s: &mut Session, p: Value| { + confine(roots.as_ref(), || s.execute("document.serialize", &p)).unwrap_or_else(|e| panic!("{p}: {e}")); + }; + for format in ["vectorcraft", "template", "pdf", "ai", "eps"] { + refused(&mut s, "document.serialize", json!({"format": format})); + } + refused(&mut s, "document.serialize", json!({"format": "svg", "preserveEditing": true})); + refused(&mut s, "document.exportPdf", json!({})); + for p in [ + json!({"format": "pdf", "preserveEditing": false}), + json!({"format": "pdf", "useArtboards": false}), + json!({"format": "pdf", "range": "2"}), + json!({"format": "ai", "artboards": [1]}), + json!({"format": "ai", "useArtboards": false}), + json!({"format": "ai", "aiVersion": "7"}), + json!({"format": "png"}), + json!({"format": "svg"}), + ] { + written(&mut s, p); + } + // Without roots, the native document keeps the data set's image as stored. + let r = s.execute("document.serialize", &json!({})).unwrap(); + let bytes = vectorcraft_format::base64_decode(r["dataBase64"].as_str().unwrap()).unwrap(); + let carried = carried_document("vectorcraft", &bytes); + assert_eq!(carried.variables.datasets[0].values["Photo"], vectorcraft_doc::DataValue::Image(outside.clone())); + // An image inside the read roots. + set_image(&mut s, &home.file("photo.png")); + written(&mut s, json!({"format": "vectorcraft"})); + // Stored brushes that cannot be read: their links cannot be checked. + std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).unknown.insert(vectorcraft_brush::DOC_KEY.into(), json!(["not a brush"])); + refused(&mut s, "document.serialize", json!({"format": "vectorcraft"})); + written(&mut s, json!({"format": "png"})); +} + +/// A confined caller's Export for Screens rows that write an artboard alone (native, `.ai` and EPS +/// files) are checked against that artboard's document: an image linked outside the read roots +/// on another artboard does not refuse them, and one on the artboard does. +#[test] +fn confined_screens_rows_check_the_artboard_each_file_holds() { + use crate::file_access::{AutomationRoots, confine}; + + let away = Folder::new("screens-board-away"); + let home = Folder::new("screens-board-home"); + let photo = away.file("photo.png"); + write(&photo, &png(60, 30, RED)); + let mut s = session(); + place(&mut s, &photo); + s.execute("artboard.new", &json!({"x": 2000, "y": 0, "width": 100, "height": 100})).unwrap(); + s.execute("shape.rectangle", &json!({"x": 2010, "y": 10, "width": 50, "height": 20})).unwrap(); + let roots = AutomationRoots::new(&[home.0.as_path()], &[home.0.as_path()]).unwrap(); + for format in ["vectorcraft", "ai", "eps"] { + let p = |range: &str| json!({"range": range, "formats": [{"format": format}]}); + let r = confine(roots.as_ref(), || s.execute("document.exportForScreens", &p("2"))).unwrap_or_else(|e| panic!("{format}: {e}")); + assert_eq!(r["files"].as_array().map(Vec::len), Some(1), "{format}: {r}"); + let e = confine(roots.as_ref(), || s.execute("document.exportForScreens", &p("1"))).expect_err(format).to_string(); + assert!(e.contains("a linked image file is outside the read roots"), "{format}: {e}"); + } +} + +/// A confined caller's single-file PDF with Preserve Editing of several assets carries the first +/// asset's document alone, so only that document is checked: an image linked outside the read roots in a later asset does +/// not refuse it, and one in the first asset does. +#[test] +fn confined_single_file_pdf_checks_the_document_it_carries() { + use crate::file_access::{AutomationRoots, confine}; + + let away = Folder::new("single-pdf-away"); + let home = Folder::new("single-pdf-home"); + let photo = away.file("photo.png"); + write(&photo, &png(60, 30, RED)); + let mut s = session(); + let r = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 20})).unwrap(); + let rect: vectorcraft_doc::NodeId = serde_json::from_value(r["id"].clone()).unwrap(); + let placed = place(&mut s, &photo); + let mut assets = vec![]; + for id in [rect, placed] { + assets.push(s.execute("assets.add", &json!({"ids": [id.0]})).unwrap()["assets"][0].as_u64().unwrap()); + } + let roots = AutomationRoots::new(&[home.0.as_path()], &[home.0.as_path()]).unwrap(); + let p = |ids: &[u64], folder: &str| json!({"assets": ids, "folder": home.file(folder), "pdfs": "single", "formats": [{"format": "pdf", "preserveEditing": true}]}); + let r = confine(roots.as_ref(), || s.execute("assets.export", &p(&assets, "first-plain"))).unwrap_or_else(|e| panic!("{e}")); + assert_eq!(r["files"].as_array().map(Vec::len), Some(1), "{r}"); + let reversed = [assets[1], assets[0]]; + let e = confine(roots.as_ref(), || s.execute("assets.export", &p(&reversed, "first-linked"))).expect_err("first asset links outside").to_string(); + assert!(e.contains("a linked image file is outside the read roots"), "{e}"); +} + +/// A confined caller's native outputs (a native file or template, an EPS or `.ai` file, a PDF with +/// Preserve Editing, a package's document) carry the document without the Export for Screens +/// folder when it is outside the read roots, with the other export settings and the art; the open +/// document keeps the folder. A folder inside the roots, and any folder without roots, stays. +#[test] +fn confined_native_output_leaves_out_an_export_folder_outside_the_read_roots() { + use crate::file_access::{AutomationRoots, confine}; + + let away = Folder::new("native-export-folder-away"); + let home = Folder::new("native-export-folder-home"); + let outside = away.0.to_string_lossy().into_owned(); + let inside = home.file("screens"); + let mut s = session(); + let r = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 20})).unwrap(); + let rect: vectorcraft_doc::NodeId = serde_json::from_value(r["id"].clone()).unwrap(); + s.execute("file.saveAs", &json!({"path": home.file("own.vectorcraft")})).unwrap(); + let set_folder = |s: &mut Session, folder: &str| { + let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); + doc.export_settings = serde_json::from_value(json!({"folder": folder, "prefix": "web-"})).unwrap(); + }; + let roots = AutomationRoots::new(&[home.0.as_path()], &[home.0.as_path()]).unwrap(); + let check = |d: &Document, folder: Option<&str>, what: &str| { + assert_eq!(d.export_settings.get("folder").and_then(Value::as_str), folder, "{what}"); + assert_eq!(d.export_settings.get("prefix").and_then(Value::as_str), Some("web-"), "{what}"); + assert!(d.node(rect).is_some(), "{what}: no art"); + }; + let package = home.file("package"); + let every = |s: &mut Session, confined: bool, folder: Option<&str>| { + let run = |s: &mut Session, cmd: &str, p: Value| { + let r = if confined { confine(roots.as_ref(), || s.execute(cmd, &p)) } else { s.execute(cmd, &p) }; + r.unwrap_or_else(|e| panic!("{cmd} {p}: {e}")) + }; + for format in ["vectorcraft", "template", "pdf", "ai", "eps"] { + let r = run(s, "document.serialize", json!({"format": format})); + let bytes = vectorcraft_format::base64_decode(r["dataBase64"].as_str().unwrap()).unwrap(); + check(&carried_document(format, &bytes), folder, &format!("{format} serialize")); + } + let pdf = home.file("direct.pdf"); + run(s, "document.exportPdf", json!({"path": pdf})); + check(&carried_document("pdf", &std::fs::read(&pdf).unwrap()), folder, "exportPdf"); + let eps = home.file("copy.eps"); + run(s, "file.saveCopy", json!({"path": eps})); + check(&carried_document("eps", &std::fs::read(&eps).unwrap()), folder, "eps copy"); + let _ = std::fs::remove_dir_all(&package); + run(s, "file.package", json!({"folder": package, "report": false, "copyFonts": false})); + let packaged = std::fs::read(Path::new(&package).join("own Folder").join("own.vectorcraft")).unwrap(); + check(&vectorcraft_format::load_file(&packaged).unwrap().doc, folder, "package"); + }; + set_folder(&mut s, &outside); + every(&mut s, true, None); + assert_eq!(s.doc().unwrap().doc.export_settings.get("folder").and_then(Value::as_str), Some(outside.as_str())); + every(&mut s, false, Some(&outside)); + set_folder(&mut s, &inside); + every(&mut s, true, Some(&inside)); +} + /// A confined caller's SVG of a placed document whose art links an image: the file draws that art /// and names the image's file, so a file outside the read roots refuses it and one inside them is /// written. Any output that names no file is written. diff --git a/crates/engine/src/tests/linkspanel.rs b/crates/engine/src/tests/linkspanel.rs index a1402cc43f..cd844fa28d 100644 --- a/crates/engine/src/tests/linkspanel.rs +++ b/crates/engine/src/tests/linkspanel.rs @@ -203,6 +203,140 @@ fn unembed_of_pixels_that_cant_be_read_writes_no_file() { assert!(image(&s, id).link.is_none()); } +/// The files of folder `dir`, sorted by name. +fn files_in(dir: &str) -> Vec { + let mut names: Vec = std::fs::read_dir(dir).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().into_owned()).collect(); + names.sort(); + names +} + +/// The path of the file `name` in folder `dir`. +fn file_in(dir: &str, name: &str) -> String { + std::path::Path::new(dir).join(name).to_string_lossy().into_owned() +} + +/// Several images unembed into one folder: each gets a new file named after it (a taken name +/// numbered, a file already there never replaced), links to it and keeps its bounds, linked images +/// are skipped, and one undo step makes them embedded again while the files stay. +#[test] +fn unembed_to_a_folder_writes_each_image_and_links_it_in_one_undo_step() { + let dir = Folder::new("unembed-folder"); + let out = dir.file("out"); + for sub in ["a", "b", "out"] { + std::fs::create_dir_all(dir.file(sub)).unwrap(); + } + let (red, blue) = (png(60, 30, RED), png(40, 20, BLUE)); + write(&dir.file("a/photo.png"), &red); + write(&dir.file("b/photo.png"), &blue); + write(&dir.file("a/linked.png"), &red); + let kept = b"not an image".to_vec(); + write(&file_in(&out, "photo.png"), &kept); + let mut s = session(); + let a = place_embedded(&mut s, &dir.file("a/photo.png")); + let b = place_embedded(&mut s, &dir.file("b/photo.png")); + let linked = place(&mut s, &dir.file("a/linked.png")); + let linked_path = image(&s, linked).link.unwrap().path; + let (bounds_a, bounds_b) = (bounds(&s, a), bounds(&s, b)); + let undo_before = s.doc().unwrap().history.undo.len(); + let r = run(&mut s, "links.unembed", json!({"ids": [a.0, linked.0, b.0], "folder": out})); + let (path_a, path_b) = (file_in(&out, "photo 2.png"), file_in(&out, "photo 3.png")); + assert_eq!(r, json!({"unembedded": [{"id": a.0, "path": path_a}, {"id": b.0, "path": path_b}], "skipped": [linked.0]})); + assert_eq!(files_in(&out), ["photo 2.png", "photo 3.png", "photo.png"]); + assert_eq!(std::fs::read(file_in(&out, "photo.png")).unwrap(), kept, "a file already there is not replaced"); + assert_eq!(std::fs::read(&path_a).unwrap(), red); + assert_eq!(std::fs::read(&path_b).unwrap(), blue); + assert_eq!(image(&s, a).link.unwrap().path, path_a); + assert_eq!(image(&s, b).link.unwrap().path, path_b); + assert_eq!(image(&s, linked).link.unwrap().path, linked_path, "a linked image is left as it is"); + assert_eq!((bounds(&s, a), bounds(&s, b)), (bounds_a, bounds_b)); + assert_eq!(s.doc().unwrap().history.undo.len(), undo_before + 1, "one undo step"); + run(&mut s, "edit.undo", json!({})); + assert!(image(&s, a).link.is_none() && image(&s, b).link.is_none(), "both embedded again"); + assert_eq!(files_in(&out).len(), 3, "undo leaves the files"); + // `ids` of one image without `folder` is `id`: the bytes, and nothing changes. + let one = run(&mut s, "links.unembed", json!({"ids": [a.0]})); + assert_eq!(one, run(&mut s, "links.unembed", json!({"id": a.0}))); + assert!(one["dataBase64"].is_string(), "{one}"); + assert!(image(&s, a).link.is_none()); + // With no ids, the selected embedded images. + s.doc_mut().unwrap().selection.objects = vec![b, linked]; + let r = run(&mut s, "links.unembed", json!({"folder": out})); + assert_eq!(r, json!({"unembedded": [{"id": b.0, "path": file_in(&out, "photo 4.png")}], "skipped": []})); + assert_eq!(std::fs::read(file_in(&out, "photo 4.png")).unwrap(), blue); + // `id` with `folder` is `ids` of that one image. + let r = run(&mut s, "links.unembed", json!({"id": a.0, "folder": out})); + assert_eq!(r, json!({"unembedded": [{"id": a.0, "path": file_in(&out, "photo 5.png")}], "skipped": []})); + assert_eq!(image(&s, a).link.unwrap().path, file_in(&out, "photo 5.png")); +} + +/// A batch that fails part way writes no file and changes nothing; requests that don't fit the +/// command are refused before anything is written. +#[test] +fn unembed_to_a_folder_that_fails_leaves_no_file_and_no_change() { + let dir = Folder::new("unembed-folder-fail"); + let out = dir.file("out"); + std::fs::create_dir_all(&out).unwrap(); + write(&dir.file("one.png"), &png(60, 30, RED)); + write(&dir.file("two.png"), &png(60, 30, BLUE)); + let mut s = session(); + let a = place_embedded(&mut s, &dir.file("one.png")); + let b = place_embedded(&mut s, &dir.file("two.png")); + // The second image's pixels can't be read: the first one's file is removed again. + let key = image(&s, b).key; + let saved = s.doc().unwrap().doc.images.get(&key).cloned().unwrap(); + std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).images.insert(key.clone(), vectorcraft_doc::ImageBlob::png(png_header(60, 30))); + let undo_before = s.doc().unwrap().history.undo.len(); + let e = s.execute("links.unembed", &json!({"ids": [a.0, b.0], "folder": out})).unwrap_err(); + assert!(e.to_string().ends_with("the image's pixels can't be read"), "{e}"); + assert!(files_in(&out).is_empty(), "no file left behind"); + assert!(image(&s, a).link.is_none() && image(&s, b).link.is_none()); + assert_eq!(s.doc().unwrap().history.undo.len(), undo_before); + std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).images.insert(key, saved); + + let refused = |s: &mut Session, p: Value| s.execute("links.unembed", &p).unwrap_err().to_string(); + let both = "give `path` or `folder`, not both"; + assert!(refused(&mut s, json!({"ids": [a.0, a.0], "folder": out})).ends_with("`ids` names an object twice")); + assert!(refused(&mut s, json!({"id": a.0, "path": file_in(&out, "x.png"), "folder": out})).ends_with(both)); + assert!(refused(&mut s, json!({"ids": [a.0], "path": file_in(&out, "x.png"), "folder": out})).ends_with(both)); + assert!(refused(&mut s, json!({"ids": [a.0, b.0]})).ends_with("missing `folder`")); + assert!(refused(&mut s, json!({"ids": []})).ends_with("missing `folder`")); + assert!(refused(&mut s, json!({"id": a.0, "ids": [b.0], "folder": out})).ends_with("give `id` or `ids`, not both")); + assert!(refused(&mut s, json!({"id": a.0, "ids": [b.0]})).ends_with("give `id` or `ids`, not both")); + assert!(refused(&mut s, json!({"ids": [a.0], "folder": 5})).ends_with("`folder` must be a string")); + assert!(refused(&mut s, json!({"ids": [], "folder": out})).ends_with("select an image")); + let file = dir.file("one.png"); + assert!(refused(&mut s, json!({"ids": [a.0], "folder": file})).ends_with(&format!("{file} is not a folder"))); + run(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})); + let rect = s.doc().unwrap().selection.objects[0]; + assert!(refused(&mut s, json!({"ids": [a.0, rect.0], "folder": out})).ends_with(&format!("object {} is not an image", rect.0))); + assert!(files_in(&out).is_empty(), "nothing written for a refused request"); + run(&mut s, "links.unembed", json!({"ids": [a.0], "folder": out})); + assert!(refused(&mut s, json!({"ids": [a.0], "folder": out})).ends_with(&format!("image {} is linked already", a.0))); + assert_eq!(files_in(&out), ["one.png"]); +} + +/// Under automation write roots, a folder outside them takes no file. +#[test] +fn unembed_to_a_folder_outside_the_write_roots_is_refused() { + use crate::file_access::{AutomationRoots, confine}; + let dir = Folder::new("unembed-folder-roots"); + let (inside, outside) = (dir.file("inside"), dir.file("outside")); + std::fs::create_dir_all(&inside).unwrap(); + std::fs::create_dir_all(&outside).unwrap(); + write(&file_in(&inside, "pic.png"), &png(60, 30, RED)); + let mut s = session(); + let id = place_embedded(&mut s, &file_in(&inside, "pic.png")); + let roots = AutomationRoots::new(&[dir.0.as_path()], &[std::path::Path::new(&inside)]).unwrap(); + let p = json!({"ids": [id.0], "folder": outside}); + let e = confine(roots.as_ref(), || s.execute("links.unembed", &p)).unwrap_err().to_string(); + assert!(e.contains("outside the write root"), "{e}"); + assert!(files_in(&outside).is_empty()); + assert!(image(&s, id).link.is_none()); + let p = json!({"ids": [id.0], "folder": inside}); + confine(roots.as_ref(), || s.execute("links.unembed", &p)).unwrap(); + assert!(image(&s, id).link.is_some()); +} + #[test] fn go_to_selects_the_image() { let dir = Folder::new("goto"); diff --git a/crates/engine/src/tests/package.rs b/crates/engine/src/tests/package.rs index 13464b24d7..e5483d1889 100644 --- a/crates/engine/src/tests/package.rs +++ b/crates/engine/src/tests/package.rs @@ -405,6 +405,66 @@ fn a_confined_package_refuses_a_linked_javascript_file_outside_the_read_root() { assert_eq!(r["links"], 1, "{r}"); } +/// A confined request packages no linked file it would copy as it is (a PDF with Preserve Editing, +/// or a native document it does not rewrite) whose native document keeps an Export for Screens +/// folder outside its read roots: the package is refused before anything is written, with an error +/// that names no file or folder. A native document the package rewrites leaves the folder out, a +/// folder inside the roots is packaged, and the person's package copies every file. +#[test] +fn a_confined_package_refuses_a_linked_file_that_keeps_an_export_folder_outside_the_read_root() { + let away = Folder::new("package-folder-away"); + let home = Folder::new("package-folder-home"); + let roots = crate::file_access::AutomationRoots::new(&[&home.0], &[&home.0]).unwrap().unwrap(); + let hidden = [away.0.to_string_lossy().into_owned(), home.0.to_string_lossy().into_owned()]; + let out = home.file("out"); + let package = |s: &mut Session, p: Value| crate::file_access::confine(Some(&roots), || s.execute("file.package", &p)); + let refused = |s: &mut Session, p: Value| { + let e = package(s, p.clone()).expect_err("refused"); + assert!(matches!(e, EngineError::BadParams { .. }), "{p}: {e:?}"); + let e = e.to_string(); + assert!(e.contains("a linked file's export folder is outside the read roots"), "{p}: {e}"); + for h in &hidden { + assert!(!e.contains(h.as_str()), "{p} names {h}: {e}"); + } + assert!(!std::path::Path::new(&out).exists(), "{p}"); + }; + let mut part = session(); + run(&mut part, "shape.rectangle", json!({"x": 10, "y": 10, "width": 30, "height": 30})); + std::fs::create_dir_all(home.0.join("art")).unwrap(); + let native = home.file("art/part.vectorcraft"); + let pdf = home.file("art/part.pdf"); + let keep = |part: &mut Session, folder: &str| { + std::sync::Arc::make_mut(&mut part.doc_mut().unwrap().doc).export_settings = serde_json::from_value(json!({"folder": folder})).unwrap(); + save(part, &native); + let r = run(part, "document.serialize", json!({"format": "pdf"})); + write(&pdf, &vectorcraft_format::base64_decode(r["dataBase64"].as_str().unwrap()).unwrap()); + }; + keep(&mut part, &away.0.to_string_lossy()); + let poster = |placed: &str| { + let mut s = session(); + let r = run(&mut s, "file.place", json!({"path": placed, "link": true})); + assert_eq!(r["linked"], true, "{r}"); + save(&mut s, &home.file("poster.vectorcraft")); + s + }; + let mut s = poster(&pdf); + refused(&mut s, json!({"folder": out})); + refused(&mut s, json!({"relink": false})); + assert_eq!(run(&mut s, "file.package", json!({}))["links"], 1, "the person's package"); + let mut s = poster(&native); + refused(&mut s, json!({"folder": out, "relink": false})); + // Rewritten, the copy leaves the folder out. + let r = package(&mut s, json!({"folder": out})).unwrap(); + assert_eq!(r["links"], 1, "{r}"); + let copied = std::fs::read(std::path::Path::new(&out).join("poster Folder/Links/part.vectorcraft")).unwrap(); + assert_eq!(vectorcraft_format::load_file(&copied).unwrap().doc.export_settings.get("folder"), None); + std::fs::remove_dir_all(&out).unwrap(); + // A folder inside the read roots. + keep(&mut part, &home.file("screens")); + let mut s = poster(&pdf); + assert_eq!(package(&mut s, json!({"folder": out})).unwrap()["links"], 1); +} + /// A missing link stored as a path relative to the document names a file inside a confined /// request's read root: the package report and Document Info give its stored path. #[test] diff --git a/crates/engine/src/tests/prefs.rs b/crates/engine/src/tests/prefs.rs index 521d2eabde..81cea5fd59 100644 --- a/crates/engine/src/tests/prefs.rs +++ b/crates/engine/src/tests/prefs.rs @@ -447,6 +447,37 @@ fn gpu_preference_defaults_to_automatic_and_validates() { assert_eq!(s.prefs.gpu_preference, "automatic"); } +/// Performance › Low-Latency Drawing (#6013): off by default and for preference files written +/// before it, a boolean only, kept through a save/load round trip, listed under Performance and +/// reset with it. +#[test] +fn low_latency_drawing_defaults_off_and_takes_only_a_boolean() { + let mut s = Session::new(); + assert!(!s.prefs.low_latency_drawing); + assert_eq!(s.execute("prefs.get", &json!({"key": "lowLatencyDrawing"})).unwrap(), json!(false)); + s.execute("prefs.set", &json!({"key": "lowLatencyDrawing", "value": true})).unwrap(); + assert!(s.prefs.low_latency_drawing); + for bad in [json!(1), json!(null), json!("on"), json!("yes"), json!([true])] { + assert!(s.execute("prefs.set", &json!({"key": "lowLatencyDrawing", "value": bad})).is_err(), "{bad}"); + assert!(s.prefs.low_latency_drawing); + } + // Booleans may be given as "true" and "false", as for every boolean preference. + s.execute("prefs.set", &json!({"key": "lowLatencyDrawing", "value": "false"})).unwrap(); + assert!(!s.prefs.low_latency_drawing); + s.execute("prefs.set", &json!({"key": "lowLatencyDrawing", "value": "true"})).unwrap(); + assert_eq!(s.prefs.to_json()["lowLatencyDrawing"], json!(true)); + let back: Prefs = serde_json::from_value(s.prefs.to_json()).unwrap(); + assert!(back.low_latency_drawing); + let old: Prefs = serde_json::from_value(json!({"gpuPerformance": true})).unwrap(); + assert!(!old.low_latency_drawing); + let l = s.execute("prefs.list", &json!({})).unwrap(); + let row = l.as_array().unwrap().iter().find(|e| e["key"] == "lowLatencyDrawing").unwrap().clone(); + assert_eq!(row["category"], "Performance"); + assert_eq!(row["label"], "Low-Latency Drawing"); + s.execute("prefs.reset", &json!({"category": "Performance"})).unwrap(); + assert!(!s.prefs.low_latency_drawing); +} + /// Performance › Linux Display Server (#1151): automatic by default, X11 by value or label, and /// anything else is an error that changes nothing. #[test] @@ -2606,6 +2637,35 @@ fn settling_typing_for_a_tool_shows_its_preview_warning() { s.pointer(&PointerEvent::new(PointerKind::Up, 50.0, 380.0).with_mods(cmd), ViewInfo::default()).unwrap(); } +/// Typing kept as its own step when a dialog or a panel begins its preview, or when the font menus +/// end the typing session, returns its applied preview's warning for the status bar. A preview +/// without a warning returns none, and with no typing in progress nothing is kept and no step is +/// added. +#[test] +fn settling_typing_for_a_dialog_returns_its_preview_warning() { + let warned = |w: &[String]| w.iter().any(|m| m.contains("type")); + let steps = |s: &Session| s.doc().unwrap().history.undo.len(); + let mut s = deferred_bloat("Typing", true, "selection"); + let before = steps(&s); + let w = s.begin_interaction_warned("Offset Path").unwrap(); + assert!(warned(&w), "{w:?}"); + assert_eq!(steps(&s), before + 1, "the typing is a step of its own"); + assert_eq!(s.doc().unwrap().interaction.as_ref().map(|it| it.label.as_str()), Some("Offset Path")); + + let mut s = deferred_bloat("Typing", true, "selection"); + let w = s.keep_typing().unwrap(); + assert!(warned(&w), "{w:?}"); + assert!(!s.in_interaction()); + assert_eq!(steps(&s), before + 1); + let w = s.keep_typing().unwrap(); + assert!(w.is_empty(), "{w:?}"); + assert_eq!(steps(&s), before + 1, "nothing in progress adds no step"); + + let mut s = deferred_bloat("Typing", false, "selection"); + let w = s.begin_interaction_warned("Offset Path").unwrap(); + assert!(w.is_empty(), "{w:?}"); +} + /// File Handling › Use Low Resolution Proxy for Linked EPS (#394): off by default; toggling it does /// not replace full-resolution pixels already in the document. #[test] diff --git a/crates/engine/src/tests/recolor.rs b/crates/engine/src/tests/recolor.rs index 4bb0bdf3fe..dae6a1729f 100644 --- a/crates/engine/src/tests/recolor.rs +++ b/crates/engine/src/tests/recolor.rs @@ -489,6 +489,17 @@ fn edit_group_relinks_art_and_apply_rewrites_the_group_with_the_art() { run(&mut s, "recolor.apply", json!({"map": [], "group": "Theme", "groupColors": ["#010203", "cmyk 0 0 0 20"]})); let g = s.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Theme").unwrap().clone(); assert_eq!(g.swatches.iter().map(|w| w.paint.color().unwrap()).collect::>(), [Color::rgb8(1, 2, 3), Color::cmyk(0.0, 0.0, 0.0, 0.2)]); + // "keep" leaves a swatch its color, without the Global Adjust that the other colors take. + let adjust = json!({"brightness": -50}); + run(&mut s, "recolor.apply", json!({"map": [], "group": "Theme", "groupColors": ["keep", "#ffffff"], "globalAdjust": adjust})); + let g = s.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Theme").unwrap().clone(); + let colors: Vec = g.swatches.iter().map(|w| w.paint.color().unwrap()).collect(); + assert_eq!(colors[0], Color::rgb8(1, 2, 3)); + assert_ne!(colors[1].to_hex(), "#ffffff", "the other color takes the Global Adjust"); + // Past the group's swatches it adds nothing. + run(&mut s, "recolor.apply", json!({"map": [], "group": "Theme", "groupColors": ["keep", "keep", "keep"]})); + let g = s.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Theme").unwrap().clone(); + assert_eq!(g.swatches.iter().map(|w| w.paint.color().unwrap()).collect::>(), colors); } /// Art linked to a global swatch of the group that `recolor.apply` rewrites stays linked when the diff --git a/crates/engine/src/tests/swatchcmds.rs b/crates/engine/src/tests/swatchcmds.rs index af059e5e33..306d6b71ad 100644 --- a/crates/engine/src/tests/swatchcmds.rs +++ b/crates/engine/src/tests/swatchcmds.rs @@ -423,6 +423,71 @@ fn edit_color_group_numbers_extra_colors_after_the_names_it_keeps() { assert_eq!(*doc(&s), before); } +/// `swatch.editGroup` with the group's own colors, in order, and its own name (or a blank one) +/// records no undo step; a new order, a new color or a new name records one. +#[test] +fn edit_color_group_with_its_own_colors_records_no_undo_step() { + let mut s = session(); + run(&mut s, "swatch.newGroup", json!({"name": "Mine", "colors": ["#ff0000", "#00ff00"], "keepModel": true})); + let undo = undo_len(&s); + for p in [ + json!({"group": "Mine", "colors": ["#ff0000", "#00ff00"]}), + json!({"group": "Mine", "colors": ["#ff0000", "#00ff00"], "rename": "Mine"}), + json!({"group": "Mine", "colors": ["#ff0000", "#00ff00"], "rename": " "}), + ] { + let r = run(&mut s, "swatch.editGroup", p.clone()); + assert_eq!(r, json!({"name": "Mine", "swatches": ["R=255 G=0 B=0", "R=0 G=255 B=0"], "relinked": 0}), "{p}"); + assert_eq!(undo_len(&s), undo, "{p}: no undo step"); + } + run(&mut s, "swatch.editGroup", json!({"group": "Mine", "colors": ["#00ff00", "#ff0000"]})); + assert_eq!(undo_len(&s), undo + 1, "a new order is a step"); + run(&mut s, "swatch.editGroup", json!({"group": "Mine", "colors": ["#00ff00", "#ff0000"], "rename": "Yours"})); + assert_eq!(undo_len(&s), undo + 2, "a new name is a step"); +} + +/// `swatch.editGroup` with the color keys of the group's own colors records no undo step when a +/// color lies between the keys' steps, and a rename keeps that color unrounded; a color given as a +/// value is taken as it is. +#[test] +fn edit_color_group_with_its_own_color_keys_keeps_the_colors() { + let mut s = session(); + run(&mut s, "swatch.newGroup", json!({"name": "Mine", "colors": [{"c": 60.005, "m": 0, "y": 0, "k": 0}, "#00ff00"], "keepModel": true})); + let colors = |s: &Session| -> Vec { + doc(s).swatch_groups.iter().find(|g| g.name == "Mine" || g.name == "Yours").unwrap().swatches.iter().filter_map(|w| w.paint.color()).collect() + }; + let own = colors(&s); + let keys: Vec = own.iter().map(|c| vectorcraft_color::recolor::ColorKey::of(c).to_string()).collect(); + assert_ne!(crate::cmd::color_value(&json!(keys[0])), Some(own[0]), "the key rounds the color"); + let undo = undo_len(&s); + run(&mut s, "swatch.editGroup", json!({"group": "Mine", "colors": keys})); + assert_eq!(undo_len(&s), undo, "the group's own colors record no step"); + run(&mut s, "swatch.editGroup", json!({"group": "Mine", "colors": keys, "rename": "Yours"})); + assert_eq!(undo_len(&s), undo + 1, "a new name is a step"); + assert_eq!(colors(&s), own, "the colors are kept unrounded"); + // A color given as a value, not a key, is taken exactly, also within a key's step. + let Color::Cmyk { c, .. } = own[0] else { panic!("a CMYK swatch: {:?}", own[0]) }; + let nudged = Color::cmyk(c - 0.000_002, 0.0, 0.0, 0.0); + assert_eq!(vectorcraft_color::recolor::ColorKey::of(&nudged), vectorcraft_color::recolor::ColorKey::of(&own[0])); + let p = json!({"group": "Yours", "colors": [{"c": c - 0.000_002, "m": 0, "y": 0, "k": 0}, "#00ff00"], "keepModel": true}); + run(&mut s, "swatch.editGroup", p); + assert_eq!(undo_len(&s), undo + 2, "a new value is a step"); + assert_eq!(colors(&s)[0], nudged); +} + +#[test] +fn edit_color_group_with_a_null_removes_that_swatch() { + let mut s = session(); + run(&mut s, "swatch.newGroup", json!({"name": "Mine", "colors": ["#ff0000", "#00ff00", "#0000ff"], "keepModel": true})); + let undo = undo_len(&s); + let r = run(&mut s, "swatch.editGroup", json!({"group": "Mine", "colors": ["#ff0000", null, "#0000ff"]})); + assert_eq!(r["swatches"], json!(["R=255 G=0 B=0", "R=0 G=0 B=255"])); + assert_eq!(names(&s, Some("Mine")), ["R=255 G=0 B=0", "R=0 G=0 B=255"]); + assert_eq!(undo_len(&s), undo + 1, "a removed swatch is a step"); + run(&mut s, "swatch.editGroup", json!({"group": "Mine", "colors": ["#ff0000", "#0000ff", null]})); + assert_eq!(undo_len(&s), undo + 1, "a null past the swatches removes nothing and records no step"); + assert!(s.execute("swatch.editGroup", &json!({"group": "Mine", "colors": ["#ff0000", "nope"]})).is_err()); +} + #[test] fn unused_leaves_out_linked_colours_gradients_and_patterns_in_use() { let mut s = session(); diff --git a/crates/engine/src/tests/swatchlib.rs b/crates/engine/src/tests/swatchlib.rs index dbf32eba7c..fdcd554991 100644 --- a/crates/engine/src/tests/swatchlib.rs +++ b/crates/engine/src/tests/swatchlib.rs @@ -300,6 +300,191 @@ fn another_documents_swatches_load_as_a_library() { assert!(s.execute("swatch.library.load", &json!({"data": "hello", "name": "x.txt"})).is_err()); } +/// Three pattern swatches of another document that paint one pattern, one of them turned, load as +/// three library swatches and come into a document as three swatches of one pattern, each with its +/// own name and placement. +#[test] +fn another_documents_pattern_swatches_of_one_pattern_add_as_separate_swatches() { + use std::sync::Arc; + let turned = vectorcraft_geom::Affine::rotate(0.5); + let mut s = session(); + s.edit("Pattern", |d, _| { + let path = vectorcraft_geom::shapes::ellipse(vectorcraft_geom::Rect::new(0.0, 0.0, 4.0, 4.0)); + let dot = vectorcraft_doc::Node::path(d.alloc_id(), path, vectorcraft_doc::Appearance::default_art()); + let tile = vectorcraft_geom::Rect::new(0.0, 0.0, 8.0, 8.0); + d.patterns.push(vectorcraft_doc::PatternDef { tile, ..vectorcraft_doc::PatternDef::new("Dots", vec![Arc::new(dot)]) }); + let swatch = |name: &str, xf| vectorcraft_color::Swatch { + name: name.into(), + paint: Paint::Pattern { pattern: "Dots".into(), xf }, + global: false, + spot: false, + }; + d.swatches.push(swatch("Tiles", vectorcraft_geom::Affine::IDENTITY)); + d.swatches.push(swatch("More tiles", vectorcraft_geom::Affine::IDENTITY)); + d.swatches.push(swatch("Turned tiles", turned)); + Ok(()) + }) + .unwrap(); + let b64 = run(&mut s, "document.serialize", json!({}))["dataBase64"].as_str().unwrap().to_string(); + let id = run(&mut s, "swatch.library.load", json!({"dataBase64": b64, "name": "Dots.vectorcraft"}))["library"].clone(); + run(&mut s, "file.new", json!({"width": 100, "height": 100})); + let r = run(&mut s, "swatch.library.add", json!({"library": id, "names": ["Tiles", "More tiles", "Turned tiles"]})); + assert_eq!(r["added"], json!(["Tiles", "More tiles", "Turned tiles"]), "{r}"); + let d = doc(&s); + assert_eq!(d.patterns.iter().filter(|p| p.name.starts_with("Dots")).count(), 1, "one pattern"); + let xf = |name: &str| match d.swatch(name).map(|w| &w.paint) { + Some(Paint::Pattern { pattern, xf }) if pattern == "Dots" => Some(*xf), + _ => None, + }; + assert_eq!((xf("Tiles"), xf("Turned tiles")), (Some(vectorcraft_geom::Affine::IDENTITY), Some(turned))); + let again = run(&mut s, "swatch.library.add", json!({"library": id})); + assert_eq!(again["added"], json!([]), "{again}"); +} + +/// A library swatch named after its pattern, added in one call after another swatch of that pattern +/// with the same placement, stands for the swatch just added: it is listed as existing, not added +/// again. +#[test] +fn a_pattern_swatch_named_after_its_pattern_reuses_one_added_in_the_same_call() { + use std::sync::Arc; + let mut s = session(); + s.edit("Pattern", |d, _| { + let path = vectorcraft_geom::shapes::ellipse(vectorcraft_geom::Rect::new(0.0, 0.0, 4.0, 4.0)); + let dot = vectorcraft_doc::Node::path(d.alloc_id(), path, vectorcraft_doc::Appearance::default_art()); + let tile = vectorcraft_geom::Rect::new(0.0, 0.0, 8.0, 8.0); + d.patterns.push(vectorcraft_doc::PatternDef { tile, ..vectorcraft_doc::PatternDef::new("Dots", vec![Arc::new(dot)]) }); + for name in ["Tiles", "Dots"] { + let paint = Paint::Pattern { pattern: "Dots".into(), xf: vectorcraft_geom::Affine::IDENTITY }; + d.swatches.push(vectorcraft_color::Swatch { name: name.into(), paint, global: false, spot: false }); + } + Ok(()) + }) + .unwrap(); + let b64 = run(&mut s, "document.serialize", json!({}))["dataBase64"].as_str().unwrap().to_string(); + let id = run(&mut s, "swatch.library.load", json!({"dataBase64": b64, "name": "Dots.vectorcraft"}))["library"].clone(); + run(&mut s, "file.new", json!({"width": 100, "height": 100})); + let r = run(&mut s, "swatch.library.add", json!({"library": id, "names": ["Tiles", "Dots"]})); + assert_eq!((&r["added"], &r["existing"]), (&json!(["Tiles"]), &json!(["Tiles"])), "{r}"); + let d = doc(&s); + assert_eq!(d.swatches_iter().filter(|w| matches!(&w.paint, Paint::Pattern { pattern, .. } if pattern == "Dots")).count(), 1, "{r}"); +} + +/// A library pattern painted with another pattern is not taken for a document pattern with the +/// same art when the pattern its art paints with differs: it comes in as a numbered copy with its +/// own inner pattern, and adding it again reuses that copy. +#[test] +fn a_pattern_painted_with_another_pattern_is_not_matched_by_the_inner_patterns_name() { + use std::sync::Arc; + use vectorcraft_doc::pattern::pattern_paint; + // `Inner` with a tile of `inner` points, `Dots` painted with it, and swatch `Tiles` painting `Dots`. + let make = |d: &mut vectorcraft_doc::Document, inner: f64| { + let dot = vectorcraft_geom::shapes::ellipse(vectorcraft_geom::Rect::new(0.0, 0.0, 2.0, 2.0)); + let dot = vectorcraft_doc::Node::path(d.alloc_id(), dot, vectorcraft_doc::Appearance::default_art()); + let tile = vectorcraft_geom::Rect::new(0.0, 0.0, inner, inner); + d.patterns.push(vectorcraft_doc::PatternDef { tile, ..vectorcraft_doc::PatternDef::new("Inner", vec![Arc::new(dot)]) }); + let square = vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(0.0, 0.0, 6.0, 6.0)); + let square = vectorcraft_doc::Node::path(d.alloc_id(), square, vectorcraft_doc::Appearance::basic(pattern_paint("Inner"), Paint::None, 0.0)); + let tile = vectorcraft_geom::Rect::new(0.0, 0.0, 8.0, 8.0); + d.patterns.push(vectorcraft_doc::PatternDef { tile, ..vectorcraft_doc::PatternDef::new("Dots", vec![Arc::new(square)]) }); + d.swatches.push(vectorcraft_color::Swatch { name: "Tiles".into(), paint: pattern_paint("Dots"), global: false, spot: false }); + }; + let mut s = session(); + s.edit("Pattern", |d, _| { + make(d, 4.0); + Ok(()) + }) + .unwrap(); + let b64 = run(&mut s, "document.serialize", json!({}))["dataBase64"].as_str().unwrap().to_string(); + let id = run(&mut s, "swatch.library.load", json!({"dataBase64": b64, "name": "Dots.vectorcraft"}))["library"].clone(); + run(&mut s, "file.new", json!({"width": 100, "height": 100})); + s.edit("Pattern", |d, _| { + make(d, 5.0); + Ok(()) + }) + .unwrap(); + let r = run(&mut s, "swatch.library.add", json!({"library": id, "names": ["Tiles"]})); + assert_eq!((&r["added"], &r["existing"]), (&json!(["Tiles 2"]), &json!([])), "{r}"); + let d = doc(&s); + let Some(Paint::Pattern { pattern, .. }) = d.swatch("Tiles 2").map(|w| &w.paint) else { panic!("no pattern swatch Tiles 2: {r}") }; + let inner = d.pattern(pattern).and_then(|p| p.art.first()).map(|n| n.appearance.fill_paint()); + let Some(Paint::Pattern { pattern: inner, .. }) = inner else { panic!("the added pattern is not painted with a pattern: {r}") }; + assert_eq!(d.pattern(&inner).map(|p| p.tile), Some(vectorcraft_geom::Rect::new(0.0, 0.0, 4.0, 4.0)), "the library's inner pattern"); + let again = run(&mut s, "swatch.library.add", json!({"library": id, "names": ["Tiles"]})); + assert_eq!((&again["added"], &again["existing"]), (&json!([]), &json!(["Tiles 2"])), "{again}"); +} + +/// A global color that a library pattern's art links to, added in the same call after the pattern +/// swatch, is the swatch the pattern brought with it: it is added once, not again as a numbered +/// copy, and goes into the library swatch's color group. +#[test] +fn a_color_a_pattern_brings_is_not_added_twice_in_one_call() { + use std::sync::Arc; + use vectorcraft_doc::pattern::pattern_paint; + let mut s = session(); + run(&mut s, "swatch.new", json!({"name": "Ink", "color": "#123456", "global": true})); + s.edit("Pattern", |d, _| { + let ink = Paint::Solid { color: Color::rgb8(0x12, 0x34, 0x56), swatch: Some("Ink".into()), tint: 1.0 }; + let square = vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(0.0, 0.0, 6.0, 6.0)); + let square = vectorcraft_doc::Node::path(d.alloc_id(), square, vectorcraft_doc::Appearance::basic(ink, Paint::None, 0.0)); + let tile = vectorcraft_geom::Rect::new(0.0, 0.0, 8.0, 8.0); + d.patterns.push(vectorcraft_doc::PatternDef { tile, ..vectorcraft_doc::PatternDef::new("Squares", vec![Arc::new(square)]) }); + d.swatches.push(vectorcraft_color::Swatch { name: "Tiles".into(), paint: pattern_paint("Squares"), global: false, spot: false }); + // `Ink` goes into a color group of its own. + let i = d.swatches.iter().position(|w| w.name == "Ink").unwrap(); + let ink = d.swatches.remove(i); + d.swatch_groups.push(vectorcraft_color::SwatchGroup { name: "Inks".into(), swatches: vec![ink] }); + Ok(()) + }) + .unwrap(); + let b64 = run(&mut s, "document.serialize", json!({}))["dataBase64"].as_str().unwrap().to_string(); + let id = run(&mut s, "swatch.library.load", json!({"dataBase64": b64, "name": "Squares.vectorcraft"}))["library"].clone(); + run(&mut s, "file.new", json!({"width": 100, "height": 100})); + let r = run(&mut s, "swatch.library.add", json!({"library": id, "names": ["Tiles", "Inks"]})); + let d = doc(&s); + let inks: Vec<&str> = d.swatches_iter().filter(|w| w.name.starts_with("Ink")).map(|w| w.name.as_str()).collect(); + assert_eq!(inks, ["Ink"], "{r}"); + assert_eq!((&r["added"], &r["existing"]), (&json!(["Tiles", "Ink"]), &json!([])), "{r}"); + let group = d.swatch_groups.iter().find(|g| g.name == "Inks").map(|g| g.swatches.iter().map(|w| w.name.as_str()).collect::>()); + assert_eq!(group, Some(vec!["Ink"]), "{r}"); + assert!(d.swatches.iter().all(|w| w.name != "Ink"), "{r}"); +} + +/// A library pattern whose art links to a global color that the document has under the same name +/// in another color keeps the library's color: the color comes in under a free name ("Ink 2") and +/// the pattern links to it, as the color added in the same call does, and the document's own color +/// is left as it was. Adding the pattern again finds it. +#[test] +fn a_library_pattern_keeps_its_global_color_when_the_document_has_that_name_in_another_color() { + use std::sync::Arc; + use vectorcraft_doc::pattern::pattern_paint; + let mut s = session(); + run(&mut s, "swatch.new", json!({"name": "Ink", "color": "#0000ff", "global": true})); + s.edit("Pattern", |d, _| { + let ink = Paint::Solid { color: Color::rgb8(0, 0, 0xff), swatch: Some("Ink".into()), tint: 1.0 }; + let square = vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(0.0, 0.0, 6.0, 6.0)); + let square = vectorcraft_doc::Node::path(d.alloc_id(), square, vectorcraft_doc::Appearance::basic(ink, Paint::None, 0.0)); + let tile = vectorcraft_geom::Rect::new(0.0, 0.0, 8.0, 8.0); + d.patterns.push(vectorcraft_doc::PatternDef { tile, ..vectorcraft_doc::PatternDef::new("Squares", vec![Arc::new(square)]) }); + d.swatches.push(vectorcraft_color::Swatch { name: "Tiles".into(), paint: pattern_paint("Squares"), global: false, spot: false }); + Ok(()) + }) + .unwrap(); + let b64 = run(&mut s, "document.serialize", json!({}))["dataBase64"].as_str().unwrap().to_string(); + let id = run(&mut s, "swatch.library.load", json!({"dataBase64": b64, "name": "Squares.vectorcraft"}))["library"].clone(); + run(&mut s, "file.new", json!({"width": 100, "height": 100})); + run(&mut s, "swatch.new", json!({"name": "Ink", "color": "#ff0000", "global": true})); + let r = run(&mut s, "swatch.library.add", json!({"library": id, "names": ["Tiles", "Ink"]})); + assert_eq!((&r["added"], &r["existing"]), (&json!(["Tiles", "Ink 2"]), &json!([])), "{r}"); + let d = doc(&s); + let hex = |n: &str| d.swatch(n).and_then(|w| w.paint.color()).map(|c| c.to_hex()); + assert_eq!((hex("Ink"), hex("Ink 2")), (Some("#ff0000".to_string()), Some("#0000ff".to_string())), "{r}"); + let fill = d.pattern("Squares").unwrap().art[0].appearance.fill_paint(); + let Paint::Solid { color, swatch, .. } = &fill else { panic!("the tile is filled with a color: {fill:?}") }; + assert_eq!((swatch.as_deref(), color.to_hex()), (Some("Ink 2"), "#0000ff".to_string()), "{r}"); + let again = run(&mut s, "swatch.library.add", json!({"library": id, "names": ["Tiles"]})); + assert_eq!((&again["added"], &again["existing"]), (&json!([]), &json!(["Tiles"])), "{again}"); +} + #[test] fn swatch_exchange_files_load_add_and_list_as_user_libraries() { let bytes = vectorcraft_testkit::ase::sample(); diff --git a/crates/engine/src/tests/textedit.rs b/crates/engine/src/tests/textedit.rs index 4f1edcc62a..58f98237a6 100644 --- a/crates/engine/src/tests/textedit.rs +++ b/crates/engine/src/tests/textedit.rs @@ -3173,6 +3173,41 @@ fn a_previewed_transform_while_typing_keeps_the_typing() { assert!((left(&s, id) - 400.0).abs() < 1e-6); } +/// With Performance › Real-time Drawing and Editing off, the typing is applied when its session +/// ends. Ending it for another edit applies it first, as a step of its own: a dialog or a panel +/// beginning its preview, the font menus ([`Session::keep_typing`]), a paint for the selected +/// characters. +#[test] +fn ending_deferred_typing_for_another_edit_keeps_the_typing() { + let typed = |end: &dyn Fn(&mut Session)| { + let mut s = session(); + s.prefs.real_time_drawing = false; + let v = ViewInfo::default(); + let id = text(&mut s, "Hello"); + s.select_tool("type", v).unwrap(); + let b = s.doc().unwrap().doc.bounds_of(&[id], false).unwrap(); + click(&mut s, b.x1 - 1.0, b.center().y); + s.tool_text(" world", v).unwrap(); + assert_eq!(obj(&s, id).plain_text(), "Hello", "the typing waits for its session to end"); + let steps = undo_labels(&s).len(); + end(&mut s); + assert_eq!(obj(&s, id).plain_text(), "Hello world"); + assert_eq!(undo_labels(&s)[steps], "Typing", "{:?}", undo_labels(&s)); + }; + typed(&|s| { + assert!(s.begin_interaction_warned("Fill Color").unwrap().is_empty()); + s.preview("paint.setFill", &json!({"color": "#00a000"})).unwrap(); + s.commit_interaction().unwrap(); + }); + typed(&|s| { + assert!(s.keep_typing().unwrap().is_empty()); + assert!(!s.in_interaction()); + }); + typed(&|s| { + s.execute("paint.setFill", &json!({"color": "#00a000"})).unwrap(); + }); +} + /// #1950: a colour previewed while typing (the Color Picker, a Color panel slider) colours the /// typed text: its interaction used to join the typing session and preview from the document /// before the typing, so the new type came back as its placeholder text. diff --git a/crates/engine/src/tests/variables.rs b/crates/engine/src/tests/variables.rs index a50485f3f8..705d654adc 100644 --- a/crates/engine/src/tests/variables.rs +++ b/crates/engine/src/tests/variables.rs @@ -2062,8 +2062,8 @@ fn datasets_csv_export_imports_back_to_the_same_data_sets() { } /// The export's `warning` names the variables whose column a document without the variables -/// refuses, so it doesn't import the file: a `%` header, a `#` header whose values aren't true or -/// false, and a header that names a variable an earlier column defined with another kind. A +/// refuses, so it doesn't import the file: a `%` header over values, a `#` header whose values +/// aren't true or false, and a header that names a variable an earlier column defined with another kind. A /// header that names such a variable with its kind is read with that kind, and is listed as one /// read back with another kind. #[test] @@ -2081,7 +2081,9 @@ fn datasets_csv_export_warns_of_headers_a_new_document_refuses() { let refuses = |names: &str| format!("a new document refuses this file because of these variables: {names}"); let loses = |names: &str| format!("a new document won't read these variables back with their kind: {names}"); - assert_eq!(export(&[("%Rate", "text"), ("Chart", "graph")], json!({})), (refuses("`%Rate`"), true)); + // A `%` header's cells are read as paths of graph data files. + assert_eq!(export(&[("%Rate", "text"), ("Chart", "graph")], json!({"%Rate": "5"})), (refuses("`%Rate`"), true)); + assert_eq!(export(&[("%Rate", "text"), ("Chart", "graph")], json!({})), (loses("`%Rate`, `Chart`"), false)); assert_eq!(export(&[("#Tag", "text")], json!({"#Tag": "hello"})), (refuses("`#Tag`"), true)); assert_eq!(export(&[("#Tag", "text")], json!({"#Tag": "yes"})), (loses("`#Tag`"), false)); assert_eq!(export(&[("#Seen", "text"), ("Seen", "image")], json!({})), (refuses("`Seen`"), true)); @@ -2109,18 +2111,190 @@ fn datasets_csv_export_refuses_a_header_that_names_another_variable() { } } -/// A `%` header cell that isn't a variable's name (graph data files) is refused with its column, -/// and the import defines nothing. +/// The data `graph.setData` reports for the graph `g`: series, categories and rows. +fn graph_data(s: &mut Session, g: NodeId) -> Value { + let v = s.execute("graph.setData", &json!({"id": g.0})).unwrap(); + json!({"series": v["series"], "categories": v["categories"], "rows": v["rows"]}) +} + +/// A `%` header defines a graph variable, and each of its cells is the path of a graph data file, +/// as the set-up page's five-column example has them. A relative path is taken from the CSV file's +/// folder. Selecting a data set gives the bound graph the data that Graph Data's Import Data and +/// Apply give it for the same file: tab- or comma-separated, the first row the series labels and the +/// first column the category labels, in UTF-16 too. An empty cell is no value. #[test] -fn datasets_csv_refuses_graph_data_file_columns() { +fn datasets_csv_reads_graph_data_files_in_percent_columns() { + let dir = Folder::new("vars-csv-graph-files"); + let tabs: &[u8] = b"\t2024\t2025\nQ1\t3\t4\nQ2\t5\t6\n"; + let commas: &[u8] = b",North\nJan,7\nFeb,8\n"; + let utf16: Vec = [0xFF, 0xFE].into_iter().chain(",A\r\nX,9\r\n".encode_utf16().flat_map(u16::to_le_bytes)).collect(); + write(&dir.file("graphs/bill.txt"), tabs); + write(&dir.file("dat.csv"), commas); + write(&dir.file("ruiz.txt"), &utf16); + let absolute = dir.file("dat.csv"); + let csv = format!( + "Name,Age,@Photos,%Graphs,#Visibility\nBill,36,b.jpg,graphs/bill.txt,true\nDat,53,d.jpg,{absolute},true\nMaria,26,r.jpg,ruiz.txt,false\nNone,1,n.jpg,,true\n" + ); + let path = dir.file("data.csv"); + write(&path, csv.as_bytes()); + let mut s = session(); - let error = |s: &mut Session, csv: &str| s.execute("dataset.import", &json!({"csv": csv})).unwrap_err().to_string(); - let named = error(&mut s, "Name,Title,%Sales\nA,x,sales.txt"); - assert!(named.contains("column 3:") && named.contains("`%Sales`"), "{named}"); - let unnamed = error(&mut s, "%Sales\tTitle\nsales.txt\tx"); - assert!(unnamed.contains("column 1:") && unnamed.contains("`%Sales`"), "{unnamed}"); + let graph = s.execute("graph.create", &json!({"type": "column", "x": 10, "y": 10, "width": 100, "height": 80, "csv": ",B\nY,1"})).unwrap(); + let g = NodeId(graph["id"].as_u64().unwrap()); + let imp = s.execute("dataset.import", &json!({"path": path})).unwrap(); + assert_eq!(imp["defined"], json!(["Name", "Age", "Photos", "Graphs", "Visibility"])); + assert_eq!(imp["imported"], 4); + let listed = s.execute("variable.list", &json!({})).unwrap(); + assert_eq!(listed["variables"][3], json!({"name": "Graphs", "kind": "graph", "bindings": 0})); + s.execute("variable.bind", &json!({"variable": "Graphs", "ids": [g.0]})).unwrap(); + + // What Import Data and Apply give the graph for each file. + let sheet = |bytes: &[u8]| { + let data = crate::cmd::graph_data_from_grid(&crate::cmd::graph_grid_from_text(&crate::cmd::graph_data_text(bytes))); + let mut probe = session(); + let p = json!({"type": "column", "x": 10, "y": 10, "width": 100, "height": 80, "csv": ",B\nY,1"}); + let id = NodeId(probe.execute("graph.create", &p).unwrap()["id"].as_u64().unwrap()); + let mut set = data.clone(); + set["id"] = json!(id.0); + probe.execute("graph.setData", &set).unwrap(); + graph_data(&mut probe, id) + }; + for (set, bytes) in ["Data Set 1", "Data Set 2", "Data Set 3"].into_iter().zip([tabs, commas, utf16.as_slice()]) { + s.execute("dataset.select", &json!({"name": set})).unwrap(); + assert_eq!(graph_data(&mut s, g), sheet(bytes), "{set}"); + } + assert_eq!(graph_data(&mut s, g), json!({"series": ["A"], "categories": ["X"], "rows": [[9.0]]})); let vars = &s.doc().unwrap().doc.variables; - assert!(vars.variables.is_empty() && vars.datasets.is_empty()); + assert_eq!(vars.datasets[3].values.get("Graphs"), None, "an empty cell is no value"); + + // A `%` header names a graph variable the document has, and `base` sets the folder of + // relative paths when the CSV comes as text. + let mut t = session(); + t.execute("variable.define", &json!({"name": "Sales", "kind": "graph"})).unwrap(); + let base = dir.0.to_string_lossy().into_owned(); + let imp = t.execute("dataset.import", &json!({"csv": "% Sales\ndat.csv", "base": base})).unwrap(); + assert_eq!(imp["defined"], json!([])); + let value = t.doc().unwrap().doc.variables.datasets[0].values.get("Sales").cloned(); + assert!(matches!(&value, Some(vectorcraft_doc::DataValue::Graph(c)) if c.contains("North") && c.contains("Feb")), "{value:?}"); +} + +/// A graph data file whose rows hold more values than its first row has series labels gives the +/// bound graph the series labels that Graph Data's Import Data and Apply give it: up to the last one +/// given, with no blank label for the series after it. +#[test] +fn datasets_csv_graph_data_file_keeps_the_given_series_labels() { + let dir = Folder::new("vars-csv-graph-wide"); + let wide: &[u8] = b"\tA\t\nX\t1\t2\n"; + write(&dir.file("wide.txt"), wide); + let path = dir.file("data.csv"); + write(&path, b"Name,%Chart\na,wide.txt\n"); + + let mut s = session(); + let p = json!({"type": "column", "x": 10, "y": 10, "width": 100, "height": 80, "csv": ",B\nY,1"}); + let g = NodeId(s.execute("graph.create", &p).unwrap()["id"].as_u64().unwrap()); + s.execute("dataset.import", &json!({"path": path})).unwrap(); + s.execute("variable.bind", &json!({"variable": "Chart", "ids": [g.0]})).unwrap(); + s.execute("dataset.select", &json!({"name": "Data Set 1"})).unwrap(); + + let data = crate::cmd::graph_data_from_grid(&crate::cmd::graph_grid_from_text(&crate::cmd::graph_data_text(wide))); + let mut probe = session(); + let id = NodeId(probe.execute("graph.create", &p).unwrap()["id"].as_u64().unwrap()); + let mut set = data.clone(); + set["id"] = json!(id.0); + probe.execute("graph.setData", &set).unwrap(); + assert_eq!(graph_data(&mut s, g), graph_data(&mut probe, id)); + assert_eq!(graph_data(&mut s, g), json!({"series": ["A"], "categories": ["X"], "rows": [[1.0, 2.0]]})); +} + +/// A `%` column's file that is missing, a folder, larger than 1 MB, or gives a graph value longer +/// than 256 KB, a relative path with no +/// folder to take it from, a `base` that isn't a folder path, and a `%` header whose name is a +/// variable of another kind refuse the import with the line and column, and leave the variables and +/// data sets as they were. A file of exactly 1 MB is read, and a file named by many cells is read +/// once. +#[test] +fn datasets_csv_refuses_unreadable_graph_data_files() { + let dir = Folder::new("vars-csv-graph-refused"); + write(&dir.file("ok.txt"), b"\tA\nX\t1\n"); + write(&dir.file("big.txt"), &vec![b'1'; crate::cmd::MAX_GRAPH_DATA_FILE + 1]); + let at_limit = [b"\tA\nX\t2\n".as_slice(), &vec![b' '; crate::cmd::MAX_GRAPH_DATA_FILE - 7]].concat(); + write(&dir.file("limit.txt"), &at_limit); + std::fs::create_dir_all(dir.file("folder.txt")).unwrap(); + // 10,000 categories with long labels: under 1 MB, but a graph value over 256 KB. + let long: String = (0..10_000).map(|i| format!("category label number {i:05}\t{i}\n")).collect(); + write(&dir.file("long.txt"), format!("\tA\n{long}").as_bytes()); + let base = dir.0.to_string_lossy().into_owned(); + + let mut s = session(); + s.execute("variable.define", &json!({"name": "Title", "kind": "text"})).unwrap(); + s.execute("dataset.import", &json!({"csv": "Title\nkept"})).unwrap(); + let before = s.doc().unwrap().doc.variables.clone(); + let undo = s.doc().unwrap().history.undo.len(); + let cases = [ + (json!({"csv": "Name,%Chart\na,ok.txt\nb,missing.txt", "base": base}), "line 3, column 2: the graph data file for `Chart` can't be read"), + (json!({"csv": "Name,%Chart\na,folder.txt", "base": base}), "line 2, column 2: the graph data file for `Chart` can't be read"), + (json!({"csv": "%Chart\nbig.txt", "base": base}), "line 2, column 1: the graph data file `big.txt` for `Chart` is larger than 1048576 bytes"), + ( + json!({"csv": "Name,%Chart\na,long.txt", "base": base}), + "line 2, column 2: the graph data file `long.txt` for `Chart` gives a graph value longer than 262144 bytes", + ), + (json!({"csv": "%Chart\nok.txt"}), "line 2, column 1: the graph data file `ok.txt` for `Chart` is a relative path"), + (json!({"csv": "%Chart\nok.txt", "base": ""}), "`base` is empty"), + (json!({"csv": "%Chart\nok.txt", "base": 3}), "`base` must be a string"), + (json!({"csv": "%Title\nok.txt", "base": base}), "column 1: `%Title` names `Title`, which is a text variable"), + ]; + for (p, want) in cases { + let e = s.execute("dataset.import", &p).unwrap_err().to_string(); + assert!(e.contains(want), "{p}: {e}"); + assert_eq!(s.doc().unwrap().doc.variables, before, "{p}"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "{p}"); + } + + let rows: String = (0..300).map(|_| "limit.txt\n").collect(); + let imp = s.execute("dataset.import", &json!({"csv": format!("%Chart\n{rows}"), "base": base})).unwrap(); + assert_eq!(imp["imported"], 300, "a 1 MB file named by 300 cells counts once against the import's limit"); + let value = s.doc().unwrap().doc.variables.datasets[299].values.get("Chart").cloned(); + assert!(matches!(&value, Some(vectorcraft_doc::DataValue::Graph(c)) if c.contains('2')), "{value:?}"); +} + +/// A `%` column's path is followed as an image variable's path is: a path on another computer (a +/// UNC path or a `file:` URL with a host) or a URL other than `file:` refuses the import with the +/// line and column and the reason, before any file is read, and leaves the variables and data sets +/// as they were. A relative path inside the CSV's folder is still read, and so is a `file:` URL +/// without a host when no folder is given. +#[test] +fn datasets_csv_refuses_graph_data_files_on_other_computers() { + let dir = Folder::new("vars-csv-graph-network"); + write(&dir.file("sub/ok.txt"), b"\tA\nX\t1\n"); + let path = dir.file("data.csv"); + write(&path, b"Name,%Chart\na,sub/ok.txt\n"); + let base = dir.0.to_string_lossy().into_owned(); + + let mut s = session(); + let imp = s.execute("dataset.import", &json!({"path": path})).unwrap(); + assert_eq!(imp["imported"], 1); + let value = s.doc().unwrap().doc.variables.datasets[0].values.get("Chart").cloned(); + assert!(matches!(&value, Some(vectorcraft_doc::DataValue::Graph(c)) if c.contains('A')), "{value:?}"); + // A `file:` URL without a host is a path on this computer, read without a folder to take it from. + let file = dir.file("sub/ok.txt").replace('\\', "/"); + let url = if file.starts_with('/') { format!("file://{file}") } else { format!("file:///{file}") }; + let imp = s.execute("dataset.import", &json!({"csv": format!("%Chart\n{url}")})).unwrap(); + assert_eq!(imp["imported"], 1, "{url}"); + let before = s.doc().unwrap().doc.variables.clone(); + let undo = s.doc().unwrap().history.undo.len(); + for (cell, reason) in [ + (r"\\server\share\ok.txt", "the path is on another computer"), + ("//server/share/ok.txt", "the path is on another computer"), + ("file://server/share/ok.txt", "the path is on another computer"), + ("https://example.com/ok.txt", "the link is not a file path"), + ] { + let want = format!("line 3, column 2: the graph data file `{cell}` for `Chart` isn't followed: {reason}"); + let p = json!({"csv": format!("Name,%Chart\na,sub/ok.txt\nb,{cell}"), "base": base}); + let e = s.execute("dataset.import", &p).unwrap_err().to_string(); + assert!(e.contains(&want), "{cell}: {e}"); + assert_eq!(s.doc().unwrap().doc.variables, before, "{cell}"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "{cell}"); + } } /// Two header cells that name one variable, by the same name or by a name and its prefix, are diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 8dd7125d30..0ffcae2e5f 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -126,6 +126,12 @@ impl Session { self.tool.id() } + /// The selection tool chosen last (Selection, Direct Selection or Group Selection), which + /// `tool.selectLastSelection` chooses: the Selection tool until one is chosen. + pub fn last_selection_tool(&self) -> &'static str { + self.last_selection_tool.unwrap_or("selection") + } + /// How many times switching or closing documents, or replacing the active one (File › Revert), /// has started the tool afresh, also inside a `command.batch` or `action.batch`. A frontend /// compares it before and after a command. @@ -151,7 +157,8 @@ impl Session { crate::cmd::distortcmds::silent(self, |g| g.visible = true)?; } // When the tool already active, or the tool lent a selection tool for a drag, is chosen again, - // `select_tool` calls its [`Tool::chosen_again`] (the Blend tool finishes its blend). + // `select_tool` calls its [`Tool::chosen_again`] (the Blend tool finishes its blend, the Pen + // ends its path). let again = self.lender.as_ref().unwrap_or(&self.tool).id() == id; self.switch_tool(id, view)?; // `switch_tool` returns early for the tool already active. diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index fd1edc9b77..ebedb3ee6a 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -1058,6 +1058,12 @@ fn structured_junk() { ("addon.type.releasePath", json!({"mode": "text", "keepOriginal": false, "id": 2})), ("addon.type.releasePath", json!({"mode": ["both"], "keepOriginal": "no", "ids": "all", "id": -1})), ("addon.type.releasePath", json!({"mode": "nope", "keepOriginal": 1e308, "ids": [1.5, null, "x"]})), + // Unit Converter add-on. + ("addon.units.convert", json!({"value": f64::MAX, "unit": "yards"})), + ("addon.units.convert", json!({"value": "1e308m*1e308", "unit": "q"})), + ("addon.units.convert", json!({"value": "-2p6/0", "unit": ["mm"]})), + ("addon.units.convert", json!({"value": [1], "unit": 5})), + ("addon.units.selectionSize", json!({"ids": [u64::MAX]})), // Cutting Tools add-on: Stencil Bridges. ("addon.cutting.bridges", json!({"width": 0.01, "count": 16, "direction": "shortest", "keepOriginal": true})), ("addon.cutting.bridges", json!({"width": 1000, "count": 1, "direction": "horizontal", "keepOriginal": false})), diff --git a/crates/mcp/src/headless.rs b/crates/mcp/src/headless.rs index 9bae531706..cbd2e8ca87 100644 --- a/crates/mcp/src/headless.rs +++ b/crates/mcp/src/headless.rs @@ -45,6 +45,11 @@ const HOST_COMMANDS: &[(&str, &str, &str)] = &[ "{folder?, zip?, artboards? | range? | fullDocument? | assets?, includeBleed?, includeArtboardFill?, subfolders?, preset?, formats?, settings?, prefix?} = document.exportForScreens (no folder → the files, or one zip, as dataBase64)", ), ("tool.select", "Select Tool", "{tool} e.g. selection, directSelection, pen, rectangle, ellipse, polygon, star, lineSegment"), + ( + "tool.selectLastSelection", + "Select Last Selection Tool", + "{} choose the selection tool chosen last (Selection, Direct Selection or Group Selection; none yet: the Selection tool) → {tool}", + ), ( "tool.setOption", "Tool Option", @@ -165,6 +170,7 @@ impl Headless { "file.export" => self.export(params), "file.exportForScreens" => self.session.execute("document.exportForScreens", params).map_err(|e| e.to_string()), "tool.select" => self.select_tool(params), + "tool.selectLastSelection" => self.select_last_selection_tool(), "tool.setOption" => self.session.set_tool_option_cmd(params), _ => self.session.execute(id, params).map_err(|e| e.to_string()), } @@ -208,6 +214,15 @@ impl Headless { Ok(json!({"tool": self.session.tool_id()})) } + /// `tool.selectLastSelection`: the selection tool chosen last, kept when it is already active. + fn select_last_selection_tool(&mut self) -> Result { + let id = self.session.last_selection_tool(); + if self.session.tool_id() != id { + self.session.select_tool(id, self.view).map_err(|e| e.to_string())?; + } + Ok(json!({"tool": self.session.tool_id()})) + } + fn apply_ui_requests(&mut self, reqs: Vec, out: &mut Vec) -> Result<(), String> { for r in reqs { match r { diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index aa2cbb69d7..7aba7acc78 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -1894,6 +1894,30 @@ fn e_during_a_marquee_gesture_selects_only_the_objects_inside() { assert_eq!(serde_json::from_str::(&text_of(&r)).unwrap()["handledBy"], "tool.select", "{r}"); } +/// `run_command tool.selectLastSelection` headless: the Selection tool before any selection tool +/// is chosen, then the selection tool chosen last; Magic Wand doesn't count. `list_commands` +/// lists it as a command the headless backend runs. +#[test] +fn select_last_selection_tool_runs_headless() { + let mut s = server(); + let mut id = 0; + let mut run = |s: &mut Server, command: &str, params: Value| { + id += 1; + let r = call(s, id, "run_command", json!({"command": command, "params": params})); + assert_eq!(r["isError"], false, "{command}: {r}"); + serde_json::from_str::(&text_of(&r)).unwrap() + }; + run(&mut s, "tool.select", json!({"tool": "pen"})); + assert_eq!(run(&mut s, "tool.selectLastSelection", json!({})), json!({"tool": "selection"})); + run(&mut s, "tool.select", json!({"tool": "groupSelection"})); + run(&mut s, "tool.select", json!({"tool": "magicWand"})); + assert_eq!(run(&mut s, "tool.selectLastSelection", json!({})), json!({"tool": "groupSelection"})); + let r = call(&mut s, 99, "list_commands", json!({"filter": "selectLastSelection"})); + let v: Value = serde_json::from_str(&text_of(&r)).unwrap(); + let listed = v["commands"].as_array().unwrap().iter().find(|c| c["id"] == "tool.selectLastSelection").cloned().unwrap_or_default(); + assert_eq!((listed["host"].clone(), listed["label"].clone()), (json!(true), json!("Select Last Selection Tool")), "{v}"); +} + /// `press_key {key: "c"}` and `{key: "f"}` while an arc is being dragged go to the Arc tool, and /// the release draws one arc. With nothing dragged, C is a shortcut again. #[test] diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 310c72cb3b..83774980cc 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -239,7 +239,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} toggle drawing the gaps of the selected Live Paint groups (those livePaint.info lists) in each group's Gap Preview Color while edges show → true when on", ), - ("type.hiddenCharacters", "Show Hidden Characters", "Cmd+Alt+I", "{} toggle markers for spaces, paragraph ends and story ends"), + ( + "type.hiddenCharacters", + "Show Hidden Characters", + "Cmd+Alt+I", + "{} toggle markers for spaces, tabs, nonbreaking and fixed-width spaces, discretionary hyphens, forced line breaks, paragraph ends and story ends", + ), ("type.alignLeft", "Align left", "Cmd+Shift+L", "{} align the selected type's paragraphs (or those the Type tool's selection touches) left"), ( "type.alignCenter", @@ -266,7 +271,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.bulletsAndNumbering", "Bullets and Numbering…", "", - "{tab?: \"bullets\"|\"numbers\"} open Bullets and Numbering (More Options in the Paragraph panel's Bullets and Numbered List presets) on the paragraphs the Paragraph panel acts on, filled in with the values it shows, on that tab (without it, Numbers when the paragraphs are a numbered list, else Bullets) (dialog `bulletsAndNumbering`: tab (bullets|numbers), list (none|bullet|number: the kind of the preset picked), bullet (dot|dash|circle|square), number (arabic|upperLetters|lowerLetters|upperRoman|lowerRoman|twoDigits|threeDigits), listAlign (left|right), listLevel (1..9; 1 for paragraphs in no list), leftIndent, firstLineIndent (pt)): the type shows the dialog's values while it is open, OK runs text.setFormat with the values that changed (and the indents it shows when a preset puts the paragraphs in a list), as one undo step, and Cancel puts the type back; a preset picked for paragraphs in no list whose indents are 0 fills in 18 and -18 pt; an error with no type selected or an unknown tab", + "{tab?: \"bullets\"|\"numbers\"} open Bullets and Numbering (More Options in the Paragraph panel's Bullets and Numbered List presets) on the paragraphs the Paragraph panel acts on, filled in with the values it shows, on that tab (without it, Numbers when the paragraphs are a numbered list, else Bullets) (dialog `bulletsAndNumbering`: tab (bullets|numbers), list (none|bullet|number: the kind of the preset picked), bullet (dot|dash|circle|square), number (arabic|upperLetters|lowerLetters|upperRoman|lowerRoman|twoDigits|threeDigits), listAlign (left|right), listLevel (1..9; 1 for paragraphs in no list), leftIndent, firstLineIndent (pt), startAt (bool: the Numbers tab's Start at box, on when the paragraphs have the same number of their own, blank when those differ; on sends startNumber, off sends restartNumbering false), startNumber (1..999999999: its number, 1 until one is typed)): the type shows the dialog's values while it is open, OK runs text.setFormat with the values that changed (and the indents it shows when a preset puts the paragraphs in a list), as one undo step, and Cancel puts the type back; a preset picked for paragraphs in no list whose indents are 0 fills in 18 and -18 pt; an error with no type selected or an unknown tab", ), ( "type.convertListToText", @@ -382,6 +387,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "Cmd+Alt+Shift+F", "{} show the Character panel if it is hidden and open its font family menu, whose search field takes the keyboard focus: type to search, Enter applies the highlighted font → {field: \"fontName\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first", ), + ( + "type.highlightFontSize", + "Highlight Font Size", + "", + "{} (Type › Size › Other…) show the Character panel if it is hidden and give its Font Size field the keyboard focus with its value selected (blank where the selected sizes differ): type a size and press Enter → {field: \"fontSize\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first", + ), ( "type.highlightKerning", "Highlight Kerning", @@ -512,7 +523,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "window.toolsBesideCanvas", "Keep Tools Beside the Canvas", "", - "{on?: bool} dock the Tools panel between the left-side panels and the canvas (true) or at the window's left edge (false, the default), or toggle (omitted or null; any other value is an error); a floating Tools panel stays floating and docks at the chosen place when it is docked again. Kept with the workspace; a workspace saved without it docks Tools at the window's edge. Returns the new state", + "{on?: bool} dock the Tools panel between the left-side panels and the canvas (true) or at the window's left edge (false, the default), or toggle (omitted or null; any other value is an error); a floating Tools panel stays floating and docks at the chosen place when it is docked again. Dropping a floating Tools panel on the canvas's left edge, right of panels docked on the left, turns it on, and on the window's left edge turns it off; with no panels docked on the left, or in the column both edges share beside panels collapsed to icons, a drop leaves it as it is. Kept with the workspace; a workspace saved without it docks Tools at the window's edge. Returns the new state", ), ( "window.floatTools", @@ -831,6 +842,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "{} make the open document before the current one in tab order the current one, as a click on its tab does (before the first document it goes to the last, and from the Home screen to the last); each view window.newWindow opened is a step of its own; returns {index}, with `view` for a document with more than one view", ), ("tool.select", "Select Tool", "", "{tool: id} (see tools) → {tool}; a tool that cannot be chosen returns the error"), + ( + "tool.selectLastSelection", + "Select Last Selection Tool", + "Cmd+~", + "{} choose the selection tool chosen last (Selection, Direct Selection or Group Selection; none yet: the Selection tool), keeping the active tool when it is that tool; choosing Magic Wand, Lasso or any other tool does not change which one it chooses → {tool}. Default shortcut Ctrl+` on Windows and Linux, none on macOS, where Cmd+` switches windows", + ), ( "tool.setOption", "Tool Option", @@ -1270,7 +1287,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.expandDialog", "Expand…", "", - "{} open Expand for the selection (dialog `expand`, fields object, fill, stroke (all on; one the selection has nothing for is disabled, see object.expand.info), gradient: objects|mesh, steps 1..1000 (255)): OK runs object.expand with them as one undo step; dimmed, and an error, while the selection has an appearance effect.expandAppearance expands (object.expand.info's appearance)", + "{immediate?: bool (false)} open Expand for the selection (dialog `expand`, fields object, fill, stroke (all on; one the selection has nothing for is disabled, see object.expand.info), gradient: objects|mesh, steps 1..1000 (255), or the choices OK last expanded with since the app started): OK runs object.expand with them as one undo step and keeps them until the app quits; immediate: true (the menu item chosen with Alt/Option) runs object.expand at once with those choices (the defaults before any OK), and opens the dialog instead when none of them has something to expand in the selection; dimmed, and an error, while the selection has an appearance effect.expandAppearance expands (object.expand.info's appearance)", ), ( "attributes.openUrl", @@ -1641,6 +1658,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{path? | data?: the file's text} read an action set file (.vcactions) at path, else a picked one, and add its set after the Actions panel's sets; a set named like one in the panel gets the next free number (Print 2), and the other sets stay. Files of another version, over 8 MiB, with more than 1,000 actions or with an action of more than 10,000 steps are refused, and so is any set, .aia ones too, that Save Actions… would write larger than 8 MiB (a file with less white space, or a name that gets a number); the panel menu's Load Actions… (disabled where there is no open dialog, the web) → {set: index, name, actions: n}. An action set another app saved as text (.aia, starting /version; read with actionSet.read) comes in with its actions. A step with a label and no recorded values comes in when exactly one menu command has that label (in English or the interface language, any case, no final …), and that command is directly in a top menu, can be recorded in actions, is what its menu bar item runs with no values and opens no dialog (never a submenu's item, a file or document command, Paste, Undo, Redo or an add-on's command), with no params and excluded from playback when it is off in the file. A Set Selection step (found by its internal name, whatever its label) comes in as select.byNote {note, caseSensitive, wholeWord} when it has exactly three recorded values: text (ustring, UTF-8; 1 to 1,024 bytes once trimmed), word and case (boolean, 0 or 1); with any other values it is left out. The other steps, every other step with no label and every other step recorded with values (a recorded menu item too) among them, are left out → {set, name, actions, skipped: [{action, step: its label, else its name}] (the first 1,000), leftOut: n}, and the status bar says how many were left out; a set with no name takes the file's name, else Actions; a file actionSet.read marks truncated is refused, and text that starts /version and isn't an action set gives \"not an action set file\"", ), + ( + "ui.actionSet.replace", + "Replace Actions…", + "", + "{path? | data?: the file's text} read an action set file at path, else a picked one, as ui.actionSet.load reads it (.vcactions and .aia, with the same limits, errors and reports of left-out steps and unknown commands), and replace every set in the Actions panel, the built-in Default Actions set included, with the file's set, which keeps its name. The set becomes current and selected, the panel's selected action and step and its expanded actions are cleared, and an open Set Options, New Action, Batch or step dialog that names a set closes; when the panel already holds only a set that saves alike, in that state, nothing changes, the set keeps its ids and changed is false. Omitted params count as {}. Params of another type, another key, a path or data that is not a string, a file that can't be read or is refused, a canceled pick, or a replace while an action records or plays (also while it waits at a stop) is an error and changes nothing. No undo step is recorded. The panel menu's Replace Actions… (disabled where there is no open dialog, the web, and while an action records or plays) → {changed, set: 0, name, actions: n, unknownCommands?, unknownCount?, skipped?, leftOut?}", + ), ( "ui.actionSet.delete", "Delete Action Sets", @@ -1670,7 +1693,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.epsOptionsDialog", "EPS Options Dialog", "", - "{path?, useArtboards?, range?, …document.exportEps options} open EPS Options (dialog `epsOptions`: fields = these options over the ones used last); OK checks them, remembers them and writes path (else asks). Export As… → EPS opens it too", + "{path?, useArtboards?, range?, …document.exportEps options} open EPS Options (dialog `epsOptions`: fields = these options over the ones used last; Custom… sets `flattener`, which a flattenerPreset given without it drops); OK checks them, remembers them and writes path (else asks). Export As… → EPS opens it too", ), ( "file.saveForWeb", diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index ec2ed6b8be..50030475c6 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -283,7 +283,8 @@ pub trait Tool: Send { vec![] } /// The tool, already active, is chosen again (its toolbar button, its shortcut, `tool.select`). - /// Most tools keep their state; the Blend tool finishes the blend it is adding to. + /// Most tools keep their state; the Blend tool finishes the blend it is adding to, and the Pen + /// ends the path it is drawing. fn chosen_again(&mut self, _cx: &ToolContext) -> Vec { vec![] } diff --git a/crates/tools/src/pen.rs b/crates/tools/src/pen.rs index 24a21d08ca..ada9754c1d 100644 --- a/crates/tools/src/pen.rs +++ b/crates/tools/src/pen.rs @@ -458,6 +458,12 @@ impl Tool for PenTool { _ => vec![], } } + /// Choosing the Pen again (P, its toolbar button, `tool.select`) ends the path being drawn as + /// Escape does: the path stays open, the Pen stays chosen, and the next click starts a new + /// path. With no path being drawn it changes nothing. + fn chosen_again(&mut self, cx: &ToolContext) -> Vec { + self.deactivate(cx) + } /// A dropped press drops only the anchor it was placing, a handle it was dragging or the /// close it was making: the path being drawn goes on with the next click. fn drop_press(&mut self, _cx: &ToolContext) -> Vec { diff --git a/crates/tools/src/pen/tests.rs b/crates/tools/src/pen/tests.rs index badb8193a7..be8468e379 100644 --- a/crates/tools/src/pen/tests.rs +++ b/crates/tools/src/pen/tests.rs @@ -570,6 +570,98 @@ fn ending_during_a_pen_gesture_commits_and_clears_it() { } } +/// Choosing the Pen again ends the path being drawn as Escape does, with the rubber band on or off +/// and for a one-anchor path: the preview goes, nothing is added to the document, and the next +/// click starts a new path. Mid-drag it commits the anchor being placed first. With no path being +/// drawn it changes nothing. +#[test] +fn choosing_the_pen_again_ends_the_path() { + let p = paint(); + let created = |acts: &[Action]| matches!(acts, [Action::Begin(_), Action::Preview(c, _)] if c == "path.create"); + let preview = |o: &[Overlay]| o.iter().any(|o| matches!(o, Overlay::Path { .. } | Overlay::Measure { .. })); + for pts in [vec![Point::new(100.0, 300.0), Point::new(200.0, 300.0)], vec![Point::new(100.0, 300.0)]] { + let (d, _, s) = drawing(vectorcraft_geom::SubPath::polyline(&pts, false)); + for band in [true, false] { + let cx = ToolContext { pen_rubber_band: band, ..cx(&d, &s, &p) }; + let mut t = PenTool { drawing: true, ..PenTool::default() }; + t.pointer(&cx, &PointerEvent::new(PointerKind::Move, 300.0, 410.0)); + assert!(preview(&t.overlays(&cx)), "band {band}"); + assert_eq!(t.cursor(&cx, Point::new(300.0, 410.0), Mods::default()), Cursor::PenDrawing); + assert!(t.chosen_again(&cx).is_empty(), "nothing to commit"); + assert!(!preview(&t.overlays(&cx)), "band {band}"); + assert_eq!(t.cursor(&cx, Point::new(300.0, 410.0), Mods::default()), Cursor::Pen); + let acts = click(&mut t, &cx, 300.0, 410.0, Mods::default()); + assert!(created(&acts), "{} anchors, band {band}: {acts:?}", pts.len()); + } + // Chosen again (through `tool.select`) while a drag places an anchor: it is committed. + let cx = cx(&d, &s, &p); + let mut t = PenTool { drawing: true, ..PenTool::default() }; + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 300.0, 410.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 320.0, 440.0)); + assert_eq!(t.chosen_again(&cx), vec![Action::Commit]); + assert!(!t.busy()); + assert!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 320.0, 440.0)).is_empty()); + assert!(created(&click(&mut t, &cx, 300.0, 500.0, Mods::default()))); + } + let (d, _, s) = drawing(vectorcraft_geom::SubPath::polyline(&[Point::new(100.0, 300.0), Point::new(200.0, 300.0)], false)); + let cx = cx(&d, &s, &p); + let mut t = PenTool::default(); + assert!(t.chosen_again(&cx).is_empty()); + assert_eq!(t.cursor(&cx, Point::new(300.0, 410.0), Mods::default()), Cursor::Pen); +} + +/// Choosing the Pen again while it draws a path inside a compound path ends that path as Escape +/// and Enter do: the compound path is selected, the path is not closed, no undo step is added, +/// and the next click starts a new path. Ending a path outside any compound path sends no +/// selection change. +#[test] +fn choosing_the_pen_again_selects_the_compound_parent_of_the_path_being_drawn() { + let (mut d, _) = doc_with_rect(); + let l = d.layers[0].id; + let (a, b, compound) = (d.alloc_id(), d.alloc_id(), d.alloc_id()); + let open = |x: f64| { + vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(x, 300.0), Point::new(x + 100.0, 300.0)], false)) + }; + let path = |id, x| std::sync::Arc::new(vectorcraft_doc::Node::path(id, open(x), vectorcraft_doc::Appearance::default_art())); + let mut node = vectorcraft_doc::Node::new( + compound, + NodeKind::Compound { children: vec![path(a, 10.0), path(b, 300.0)], rule: vectorcraft_geom::FillRule::NonZero }, + ); + node.appearance = vectorcraft_doc::Appearance::default_art().into(); + d.insert(Some(l), 1, node).unwrap(); + let p = paint(); + // The member path alone is the selection while the Pen draws it. + let mut s = Selection::default(); + s.set([a]); + let inside = cx(&d, &s, &p); + // The selection once the engine ran `select.set`: the compound path. + let mut sc = Selection::default(); + sc.set([compound]); + let after = cx(&d, &sc, &p); + let select_compound = vec![Action::Exec("select.set".into(), json!({"ids": [compound.0]}))]; + for key in [None, Some(ToolKey::Escape), Some(ToolKey::Enter)] { + let mut t = PenTool { drawing: true, path: Some(a), subpath: Some(0), ..PenTool::default() }; + assert_eq!(t.cursor(&inside, Point::new(250.0, 450.0), Mods::default()), Cursor::PenDrawing, "{key:?}"); + let acts = match key { + Some(k) => t.key(&inside, k, Mods::default()), + None => t.chosen_again(&inside), + }; + assert_eq!(acts, select_compound, "{key:?}: only the selection changes, with no close and no undo step"); + assert!(!t.busy() && t.active(&after).is_none(), "{key:?}: the path is done"); + assert_eq!(t.cursor(&after, Point::new(250.0, 450.0), Mods::default()), Cursor::Pen, "{key:?}"); + let next = click(&mut t, &after, 250.0, 450.0, Mods::default()); + assert!( + matches!(next.as_slice(), [Action::Begin(_), Action::Preview(c, _)] if c == "path.create"), + "{key:?}: the next click starts a new path: {next:?}" + ); + } + let (d, id, s) = drawing(vectorcraft_geom::SubPath::polyline(&[Point::new(100.0, 300.0), Point::new(200.0, 300.0)], false)); + let plain = cx(&d, &s, &p); + let mut t = PenTool { drawing: true, path: Some(id), subpath: Some(0), ..PenTool::default() }; + assert!(t.chosen_again(&plain).is_empty()); + assert!(!t.busy() && t.active(&plain).is_none()); +} + /// #501: a press on the first anchor closes the path, however far the drag then goes: the /// closing preview leaves the path closed (so not one the pen extends), and each move still /// previews the close with the incoming handle mirroring the pointer (Alt keeps the outgoing one diff --git a/crates/ui-egui/src/addons.rs b/crates/ui-egui/src/addons.rs index ec1207ad46..b22f6cb939 100644 --- a/crates/ui-egui/src/addons.rs +++ b/crates/ui-egui/src/addons.rs @@ -16,6 +16,7 @@ pub mod polygonal_lasso; pub mod select; pub mod shapes; pub mod typetools; +pub mod units; use crate::menus::Item; @@ -38,6 +39,7 @@ pub fn plugin_menu() -> Vec { Item::Sub("Selection Tools", select::menu()), Item::Sub("Smart Pen", pen::menu()), Item::Sub("Type Tools", typetools::menu()), + Item::Sub("Unit Converter", units::menu()), Item::Sep, ] } diff --git a/crates/ui-egui/src/addons/units.rs b/crates/ui-egui/src/addons/units.rs new file mode 100644 index 0000000000..8822b70167 --- /dev/null +++ b/crates/ui-egui/src/addons/units.rs @@ -0,0 +1,199 @@ +//! Unit Converter in the interface: its submenu (Object › Plug-ins › Unit Converter), which opens +//! the panel, and the panel. The panel shows one length in every unit of +//! [`Unit::EAST_ASIAN`], one number field each. A value typed in any field (units and arithmetic, +//! as every number field reads them) updates the others as it is typed; text that does not read +//! leaves them as they were. From Selection reads the selection's width and height +//! (`addon.units.selectionSize`), and Width or Height picks which of the two the fields show; the +//! size read is dropped when the document, its selection or the bounds measure changes. Apply gives the selection that +//! width or height through `object.setBounds` as the Transform panel's W or H field does (its +//! reference point, Constrain Width and Height Proportions and Transform Object Only, Pattern +//! Only or Both), as one undo step. Each field's copy button puts its value on the clipboard, with +//! its unit when Copy with Units is on. + +use egui::Ui; +use serde_json::json; +use vectorcraft_doc::{Unit, finite_in_every_unit}; + +use crate::VectorcraftApp; +use crate::menus::Item; +use crate::panels::transform; +use crate::panels::{pstate, set_pstate}; +use crate::widgets; + +/// The panel's id (`window.panel {panel: "unitConverter"}`). +pub const ID: &str = "unitConverter"; +/// The command that measures the selection. +pub const SELECTION_SIZE: &str = "addon.units.selectionSize"; + +/// Where the panel keeps its length and choices (panel state). +const STATE: &str = "unit-converter"; +/// A row (label, field, copy button and two gaps) is 214 pt wide, inside the 240 pt body of the +/// default 260 pt floating panel with room for its scroll bar. +const LABEL_W: f32 = 90.0; +const FIELD_W: f32 = 90.0; + +/// Object › Plug-ins › Unit Converter. +pub fn menu() -> Vec { + vec![Item::Cmd("Unit Converter Panel", "window.panel", json!({ "panel": ID }))] +} + +/// The selection's side the fields show and Apply sets. +#[derive(Clone, Copy, Default, Debug, PartialEq)] +pub(crate) enum Side { + #[default] + Width, + Height, +} + +impl Side { + /// `object.setBounds`'s param for this side. + fn key(self) -> &'static str { + match self { + Side::Width => "width", + Side::Height => "height", + } + } +} + +/// The panel's length and choices. +#[derive(Clone, Default, Debug, PartialEq)] +pub(crate) struct Converter { + /// The length (points), none until one is typed or read from the selection. + pub points: Option, + /// The selection's width and height (points) From Selection last read. + pub size: Option<(f64, f64)>, + /// The active document's uid and revision, and the bounds measure (Use Preview Bounds, + /// glyph bounds), when [`Converter::size`] was read. + pub read_at: Option, + /// Which of them the fields show, and the side Apply sets. + pub side: Side, + /// Copy puts the unit after the number. + pub with_units: bool, +} + +impl Converter { + /// Show `side`: the fields take that side of the size From Selection read, if any. + pub fn pick(&mut self, side: Side) { + self.side = side; + if let Some((w, h)) = self.size { + self.points = Some(if side == Side::Width { w } else { h }); + } + } + + /// A length typed in a field: after From Selection it replaces the side shown, so picking the + /// other side and back keeps it. + pub fn set(&mut self, pt: f64) { + self.points = Some(pt); + if let Some((w, h)) = &mut self.size { + *(if self.side == Side::Width { w } else { h }) = pt; + } + } + + /// Drop the size From Selection read when the active document is no longer the one it was + /// read from or is measured another way (`now`: its uid and revision, which a change to the + /// selection also moves, and the bounds measure). The length the fields show stays. + pub fn follow(&mut self, now: Option) { + if self.size.is_some() && self.read_at != now { + self.size = None; + self.read_at = None; + } + } + + /// What the copy button of the field in `unit` puts on the clipboard. + pub fn copied(&self, unit: Unit) -> Option { + self.points.map(|pt| if self.with_units { unit.format(pt) } else { unit.number(pt) }) + } +} + +/// A document's uid and revision, and the bounds measure. +pub(crate) type ReadAt = (u64, u64, vectorcraft_effects::preview::Measure); + +/// The active document's uid and revision, and the bounds measure. +pub(crate) fn document_now(app: &VectorcraftApp) -> Option { + app.session.active().map(|st| (st.uid, st.revision, app.session.bounds_measure())) +} + +/// From Selection: read the selection's width and height into `st`, and show the side picked. +pub(crate) fn from_selection(app: &mut VectorcraftApp, st: &mut Converter) -> Result<(), String> { + let r = app.run(SELECTION_SIZE, json!({}))?; + if let (Some(w), Some(h)) = (r["width"]["points"].as_f64(), r["height"]["points"].as_f64()) { + st.size = Some((w, h)); + st.read_at = document_now(app); + st.pick(st.side); + } + Ok(()) +} + +/// Apply: give the selection the length as its width or height, as the Transform panel's W or H +/// field does: from its reference point (a symbol instance's registration point with Use +/// Registration Point for Symbol on), with the other side following under Constrain Width and +/// Height Proportions, and with the panel menu's Transform Object Only, Pattern Only or Both. +/// Without a length it does nothing. +pub(crate) fn apply(app: &mut VectorcraftApp, ui: &Ui, st: &Converter) -> Result<(), String> { + let Some(pt) = st.points else { return Ok(()) }; + let reference = app.selection_box().map_or_else(|| transform::reference_index(ui), |b| transform::panel_reference(app, ui, &b).index); + let params = json!({ st.side.key(): pt, "reference": reference, "proportional": transform::proportional(app, ui) }); + let params = transform::with_pattern_switches(app, params); + app.run("object.setBounds", params)?; + Ok(()) +} + +pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { + let mut st: Converter = pstate(ui.ctx(), STATE); + st.follow(document_now(app)); + // A number typed without a unit is in its row's unit, so 2 in the Picas row is 2 picas, also + // with Preferences › Units › Numbers Without Units Are Points on; other panels' fields keep it. + let bare_points = widgets::typed_unit(ui.ctx(), Unit::Picas) == Unit::Points; + widgets::set_bare_numbers_are_points(ui.ctx(), false); + for unit in Unit::EAST_ASIAN { + widgets::label_row(ui, unit.label(), LABEL_W, |ui| { + // A length too large to show in one of the units (near the largest number, in Q and + // Ha) leaves the others as they were, as text that does not read does. + if let Some(pt) = widgets::num_field_live(ui, ("unit-converter", unit.key()), st.points, unit, FIELD_W) + && finite_in_every_unit(pt) + { + st.set(pt); + } + // The button's name and tip carry the row's unit ("Copy Millimeters"). + let tip = format!("{} {}", tl!("Copy"), tl!(unit.label())); + let copy = widgets::icon_button_enabled(ui, "copy", &tip, false, st.points.is_some(), 22.0); + if copy.clicked() + && let Some(text) = st.copied(unit) + { + ui.ctx().copy_text(text); + } + }); + } + widgets::set_bare_numbers_are_points(ui.ctx(), bare_points); + if widgets::check(ui, "Copy with Units", st.with_units, true) { + st.with_units = !st.with_units; + } + ui.add_space(6.0); + widgets::subheader(ui, tl!("Selection")); + let selected = app.session.active().is_some_and(|d| !d.selection.is_empty()); + ui.horizontal(|ui| { + for (side, label) in [(Side::Width, "Width"), (Side::Height, "Height")] { + if widgets::radio(ui, label, st.side == side, true) { + st.pick(side); + } + } + }); + ui.horizontal(|ui| { + let read = ui.add_enabled_ui(selected, |ui| widgets::flat_button(ui, tl!("From Selection"), 110.0)).inner; + if read.clicked() + && let Err(e) = from_selection(app, &mut st) + { + app.status(e); + } + let set = ui.add_enabled_ui(selected && st.points.is_some(), |ui| widgets::flat_button(ui, tl!("Apply"), 70.0)).inner; + if set.clicked() + && let Err(e) = apply(app, ui, &st) + { + app.status(e); + } + }); + set_pstate(ui.ctx(), STATE, st); +} + +#[cfg(test)] +mod tests; diff --git a/crates/ui-egui/src/addons/units/tests.rs b/crates/ui-egui/src/addons/units/tests.rs new file mode 100644 index 0000000000..3959157032 --- /dev/null +++ b/crates/ui-egui/src/addons/units/tests.rs @@ -0,0 +1,329 @@ +//! Unit Converter's submenu and panel: one field per unit, typing in one updates the others and +//! text that does not read leaves them alone, From Selection reads the selection's size, Apply +//! sets the side picked as one undo step and adds none when nothing changes, and Copy writes the +//! value with or without its unit. + +use egui::{Event, Key, Modifiers, Pos2, Rect, vec2}; +use serde_json::json; +use vectorcraft_doc::Unit; +use vectorcraft_engine::Session; + +use super::{Converter, ID, STATE, Side, apply, document_now, from_selection, show}; +use crate::panels::{pstate, set_pstate}; +use crate::tests_labels::{painted_text, shapes_text}; +use crate::{VectorcraftApp, menus}; + +/// An app with a selected 72 × 36 pt rectangle. +fn app() -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 72, "height": 36})).unwrap(); + app +} + +fn near(a: f64, b: f64) -> bool { + (a - b).abs() < 1e-6 +} + +fn undo_steps(app: &VectorcraftApp) -> usize { + app.session.active().unwrap().history.undo.len() +} + +/// The selection's width and height. +fn size(app: &mut VectorcraftApp) -> (f64, f64) { + let r = app.run("addon.units.selectionSize", json!({})).unwrap(); + (r["width"]["points"].as_f64().unwrap(), r["height"]["points"].as_f64().unwrap()) +} + +#[test] +fn the_submenu_opens_the_panel() { + let mut app = app(); + let entries = menus::menu_entries(&app); + let item = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Unit Converter"] && e.label == "Unit Converter Panel").expect("listed"); + menus::invoke(&mut app, "window.panel", item.params.clone()); + assert!(crate::panel_docking::showing(&app.ui, ID), "the panel opens"); +} + +#[test] +fn the_panel_has_a_field_for_every_unit_and_its_buttons() { + let mut app = app(); + let text = painted_text(&mut app, |app, ui| { + set_pstate(ui.ctx(), STATE, Converter { points: Some(720.0 / 25.4), ..Converter::default() }); + show(app, ui); + }); + for u in Unit::EAST_ASIAN { + assert!(text.lines().any(|l| l == u.label()), "{} in {text}", u.label()); + } + for s in ["10 mm", "1 cm", "0.3937 in", "28.346 pt", "40 Q", "40 H"] { + assert!(text.lines().any(|l| l == s), "{s} in {text}"); + } + for s in ["Copy with Units", "Selection", "Width", "Height", "From Selection", "Apply"] { + assert!(text.lines().any(|l| l == s), "{s} in {text}"); + } +} + +#[test] +fn typing_in_a_field_updates_the_others_and_text_that_does_not_read_leaves_them() { + let mut app = app(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let mut time = 0.0; + let mut frame = |app: &mut VectorcraftApp, events: Vec| { + time += 0.05; + let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(400.0, 800.0))); + let mut out = ctx.run_ui(egui::RawInput { events, time: Some(time), screen_rect, focused: true, ..Default::default() }, |ui| show(app, ui)); + out.textures_delta.clear(); + (pstate::(&ctx, STATE), shapes_text(&out)) + }; + let tab = Event::Key { key: Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }; + frame(&mut app, vec![]); + frame(&mut app, vec![]); + // Tab reaches the first field, Points, which selects its text so typing replaces it. + frame(&mut app, vec![tab]); + frame(&mut app, vec![]); + let (st, _) = frame(&mut app, vec![Event::Text("1in/2".into())]); + assert!(st.points.is_some_and(|pt| near(pt, 36.0)), "{st:?}"); + let (st, text) = frame(&mut app, vec![]); + assert!(near(st.points.unwrap(), 36.0)); + for s in ["0.5 in", "3 p", "12.7 mm", "1.27 cm"] { + assert!(text.lines().any(|l| l == s), "{s} in {text}"); + } + // Text that does not read keeps the length the other fields show. + let (st, text) = frame(&mut app, vec![Event::Text("x".into())]); + assert!(near(st.points.unwrap(), 36.0), "{st:?}"); + assert!(text.lines().any(|l| l == "12.7 mm"), "{text}"); + // So does a length too large to show in Q and Ha. + let select_all = Event::Key { key: Key::A, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND }; + frame(&mut app, vec![select_all]); + // 1.7e308 pt: finite in points. + let (st, _) = frame(&mut app, vec![Event::Text(format!("17{}", "0".repeat(307)))]); + assert!(near(st.points.unwrap(), 36.0), "{st:?}"); +} + +#[test] +fn a_number_typed_without_a_unit_in_the_picas_row_is_in_picas() { + let mut app = app(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + // Numbers Without Units Are Points is on (its default), and stays on for other fields. + crate::widgets::set_bare_numbers_are_points(&ctx, true); + let mut time = 0.0; + let mut frame = |app: &mut VectorcraftApp, events: Vec| { + time += 0.05; + let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(400.0, 800.0))); + let mut out = ctx.run_ui(egui::RawInput { events, time: Some(time), screen_rect, focused: true, ..Default::default() }, |ui| show(app, ui)); + out.textures_delta.clear(); + pstate::(&ctx, STATE) + }; + let tab = Event::Key { key: Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }; + frame(&mut app, vec![]); + frame(&mut app, vec![]); + // Tab reaches the Points field, then the Picas field (the copy buttons are off with no length). + for _ in 0..2 { + frame(&mut app, vec![tab.clone()]); + frame(&mut app, vec![]); + } + let st = frame(&mut app, vec![Event::Text("2".into())]); + assert!(st.points.is_some_and(|pt| near(pt, 24.0)), "{st:?}"); + assert_eq!(crate::widgets::typed_unit(&ctx, Unit::Picas), Unit::Points, "other fields still read points"); +} + +#[test] +fn picking_a_side_shows_that_side_of_the_size_read() { + let mut st = Converter { size: Some((72.0, 36.0)), ..Converter::default() }; + st.pick(Side::Height); + assert_eq!((st.side, st.points), (Side::Height, Some(36.0))); + st.pick(Side::Width); + assert_eq!(st.points, Some(72.0)); + // A length typed after From Selection replaces the side shown, and picking the other side and + // back keeps it. + st.set(100.0); + st.pick(Side::Height); + assert_eq!(st.points, Some(36.0)); + st.pick(Side::Width); + assert_eq!((st.points, st.size), (Some(100.0), Some((100.0, 36.0)))); + // Before From Selection a side keeps the length typed. + let mut st = Converter::default(); + st.set(5.0); + st.pick(Side::Height); + assert_eq!((st.points, st.size), (Some(5.0), None)); +} + +#[test] +fn copy_writes_the_value_with_or_without_its_unit() { + let mut st = Converter { points: Some(72.0), ..Converter::default() }; + assert_eq!(st.copied(Unit::Inches).as_deref(), Some("1")); + st.with_units = true; + assert_eq!(st.copied(Unit::Inches).as_deref(), Some("1 in")); + assert_eq!(st.copied(Unit::Millimeters), Some(Unit::Millimeters.format(72.0))); + assert_eq!(Converter::default().copied(Unit::Points), None, "nothing to copy before a length"); +} + +/// Apply `st` in a frame whose shared reference point (the Transform panel's) is `reference`. +fn apply_at(app: &mut VectorcraftApp, st: &Converter, reference: usize) { + try_apply_at(app, st, reference).unwrap(); +} + +/// [`apply_at`], with its result. +fn try_apply_at(app: &mut VectorcraftApp, st: &Converter, reference: usize) -> Result<(), String> { + let ctx = egui::Context::default(); + ctx.data_mut(|d| d.insert_temp(egui::Id::unique("refpt"), reference)); + let mut result = Ok(()); + ctx.run_ui(Default::default(), |ui| result = apply(app, ui, st)).textures_delta.clear(); + result +} + +/// The selection's bounding box. +fn bounds(app: &mut VectorcraftApp) -> vectorcraft_geom::Rect { + app.selection_box().unwrap().rect +} + +#[test] +fn from_selection_reads_the_size_and_apply_sets_the_side_picked() { + let mut app = app(); + let mut st = Converter::default(); + from_selection(&mut app, &mut st).unwrap(); + assert_eq!((st.size, st.points), (Some((72.0, 36.0)), Some(72.0))); + st.pick(Side::Height); + assert_eq!(st.points, Some(36.0)); + // Apply: 1 in high, from the centre, as one undo step. + let steps = undo_steps(&app); + st.points = Some(72.0); + apply_at(&mut app, &st, 4); + let (w, h) = size(&mut app); + assert!(near(w, 72.0) && near(h, 72.0), "{w} × {h}"); + assert_eq!(undo_steps(&app), steps + 1); + // The same length again changes nothing and adds no step. + apply_at(&mut app, &st, 4); + assert_eq!(undo_steps(&app), steps + 1); + // Without a length Apply does nothing. + apply_at(&mut app, &Converter::default(), 4); + assert_eq!(undo_steps(&app), steps + 1); + // Width, kept at the left edge (reference 3). + let x0 = bounds(&mut app).x0; + let st = Converter { points: Some(144.0), side: Side::Width, ..Converter::default() }; + apply_at(&mut app, &st, 3); + let b = bounds(&mut app); + assert!(near(b.width(), 144.0) && near(b.x0, x0), "{b:?}"); + assert_eq!(undo_steps(&app), steps + 2); +} + +/// Apply follows the Transform panel's W and H fields: Constrain Width and Height Proportions +/// scales the other side too, and Transform Pattern Only leaves the object's size alone. +#[test] +fn apply_follows_the_transform_panels_proportions_and_pattern_choice() { + let mut app = app(); + app.run("prefs.set", json!({"key": "constrainProportions", "value": true})).unwrap(); + apply_at(&mut app, &Converter { points: Some(144.0), side: Side::Width, ..Converter::default() }, 4); + let (w, h) = size(&mut app); + assert!(near(w, 144.0) && near(h, 72.0), "{w} × {h}"); + app.run("prefs.set", json!({"key": "constrainProportions", "value": false})).unwrap(); + app.run("prefs.set", json!({"key": "transformPanelPatterns", "value": "pattern"})).unwrap(); + // The object has no pattern to transform: whether the command reports that or not, the + // object keeps its size. + let _ = try_apply_at(&mut app, &Converter { points: Some(10.0), side: Side::Width, ..Converter::default() }, 4); + let (w, h) = size(&mut app); + assert!(near(w, 144.0) && near(h, 72.0), "the object keeps its size: {w} × {h}"); + app.run("prefs.set", json!({"key": "transformPanelPatterns", "value": "both"})).unwrap(); + apply_at(&mut app, &Converter { points: Some(10.0), side: Side::Width, ..Converter::default() }, 4); + assert!(near(size(&mut app).0, 10.0)); +} + +/// With Use Registration Point for Symbol on and one symbol instance selected, Apply keeps the +/// symbol's registration point (here its top-left corner) in place, as the Transform panel does, +/// instead of the shared reference point (the centre). +#[test] +fn apply_keeps_a_symbol_instances_registration_point() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + app.run("shape.rectangle", json!({"x": 100, "y": 50, "width": 80, "height": 40})).unwrap(); + let id = app.run("symbol.new", json!({"name": "Corner", "registration": 0})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [id]})).unwrap(); + app.run("prefs.set", json!({"key": "useRegistrationPointForSymbol", "value": true})).unwrap(); + apply_at(&mut app, &Converter { points: Some(160.0), side: Side::Width, ..Converter::default() }, 4); + assert_eq!(bounds(&mut app), vectorcraft_geom::Rect::new(100.0, 50.0, 260.0, 90.0)); +} + +/// The size From Selection read belongs to the selection it was read from: after the selection +/// changes, picking a side keeps the length shown instead of showing the old object's side, and +/// Apply sets that length. +#[test] +fn a_size_read_from_another_selection_is_dropped() { + let mut app = app(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let frame = |app: &mut VectorcraftApp| { + ctx.run_ui(Default::default(), |ui| show(app, ui)).textures_delta.clear(); + pstate::(&ctx, STATE) + }; + let mut st = Converter::default(); + from_selection(&mut app, &mut st).unwrap(); + set_pstate(&ctx, STATE, st); + // Drawing the panel again with nothing changed keeps it. + assert_eq!(frame(&mut app).size, Some((72.0, 36.0))); + // Another object selected. + app.run("shape.rectangle", json!({"x": 200, "y": 100, "width": 20, "height": 50})).unwrap(); + let mut st = frame(&mut app); + assert_eq!((st.size, st.points), (None, Some(72.0)), "{st:?}"); + st.pick(Side::Height); + assert_eq!(st.points, Some(72.0), "not the first object's height"); + apply_at(&mut app, &st, 4); + let (w, h) = size(&mut app); + assert!(near(w, 20.0) && near(h, 72.0), "{w} × {h}"); + // So does a change to the document. + let mut st = Converter::default(); + from_selection(&mut app, &mut st).unwrap(); + app.run("object.rotate", json!({"angle": 30})).unwrap(); + st.follow(document_now(&app)); + assert_eq!(st.size, None); + // And a change to how the selection is measured (Use Preview Bounds), which leaves the + // document as it is. + let mut st = Converter::default(); + from_selection(&mut app, &mut st).unwrap(); + st.follow(document_now(&app)); + assert!(st.size.is_some()); + app.run("prefs.set", json!({"key": "usePreviewBounds", "value": true})).unwrap(); + st.follow(document_now(&app)); + assert_eq!(st.size, None); +} + +/// Each row's copy button reads as copying that row's unit, so a screen reader tells the twelve +/// apart, and the fields are named by their rows. +#[test] +fn each_copy_button_and_field_is_named_with_its_unit() { + let mut app = app(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + set_pstate(&ctx, STATE, Converter { points: Some(72.0), ..Converter::default() }); + ctx.run_ui(Default::default(), |ui| show(&mut app, ui)).textures_delta.clear(); + let mut out = ctx.run_ui(Default::default(), |ui| show(&mut app, ui)); + out.textures_delta.clear(); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + // A label node carries its text as its value. + let label_of = |id: egui::accesskit::NodeId| nodes.iter().find(|(n, _)| *n == id).and_then(|(_, n)| n.label().or(n.value())).map(str::to_string); + let buttons: Vec = + nodes.iter().filter(|(_, n)| n.role() == egui::accesskit::Role::Button).filter_map(|(_, n)| n.label().map(str::to_string)).collect(); + for u in Unit::EAST_ASIAN { + let name = format!("Copy {}", u.label()); + assert_eq!(buttons.iter().filter(|b| **b == name).count(), 1, "{name} in {buttons:?}"); + // The row fits the 240 pt body of the default 260 pt floating panel, with 10 pt left for + // its scroll bar. + let button = nodes.iter().find(|(_, n)| n.label() == Some(name.as_str())).and_then(|(_, n)| n.bounds()).unwrap(); + assert!(button.x1 <= 230.0, "{name} ends at {}", button.x1); + // The field of the row is labeled by the row's label. + let field = nodes + .iter() + .find(|(_, n)| n.role() != egui::accesskit::Role::Button && n.labelled_by().iter().any(|l| label_of(*l).as_deref() == Some(u.label()))); + assert!(field.is_some(), "a field labeled {}", u.label()); + } +} + +#[test] +fn from_selection_with_nothing_selected_reports_it_and_keeps_the_length() { + let mut app = app(); + app.run("select.none", json!({})).unwrap(); + let mut st = Converter { points: Some(10.0), ..Converter::default() }; + assert!(from_selection(&mut app, &mut st).is_err()); + assert_eq!((st.points, st.size), (Some(10.0), None)); +} diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index e3d2a13d64..59efe943d0 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -602,10 +602,6 @@ impl VectorcraftApp { if self.ui.toolbar && self.ui.screen_mode < 3 { tools_float::set_window_dock_zone(&ctx, ui.available_rect_before_wrap()); } - if !self.ui.tools_beside_canvas { - // A canvas-edge target left from before the setting was turned off docks nothing. - tools_float::clear_canvas_dock_zone(&ctx); - } // Beside the canvas, docked Tools draws inside the canvas panel (`toolbar::show_beside_canvas`). // So does Tools docked on the right, left of the panels. if self.ui.toolbar && self.ui.screen_mode < 3 && ((!self.ui.tools_beside_canvas && !self.ui.toolbar_right) || self.ui.toolbar_pos.is_some()) { diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 6c31668533..ace75d9749 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -484,4 +484,30 @@ impl VectorcraftApp { self.ui.status = s.into(); self.ui.status_sets = self.ui.status_sets.wrapping_add(1); } + + /// Begin the interaction a dialog or a panel previews on. Typing in progress is kept as its own + /// undo step first, and the warning of the preview that keeping it applied shows in the status + /// bar, as it does when a tool's drag begins. On an error no interaction begins, so the caller + /// runs no preview. + pub(crate) fn begin_interaction(&mut self, label: &str) -> Result<(), String> { + let warnings = self.session.begin_interaction_warned(label).map_err(|e| e.to_string())?; + self.show_warnings(warnings); + Ok(()) + } + + /// Keep typing in progress as one undo step and end the Type tool's typing session, with the + /// typing that Real-time Drawing off left unapplied applied first; its warning shows in the + /// status bar. + pub(crate) fn keep_typing(&mut self) -> Result<(), String> { + let warnings = self.session.keep_typing().map_err(|e| e.to_string())?; + self.show_warnings(warnings); + Ok(()) + } + + /// Each warning in the status bar in turn, as the tool's status requests show; the last stays. + fn show_warnings(&mut self, warnings: Vec) { + for w in warnings { + self.status(w); + } + } } diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 70c8834c2d..3a05c68b7d 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -175,7 +175,7 @@ enum Drag { }, /// A Selection tool move over a panel or toolbar: the art waits where it last moved on the /// canvas, and the panels get it ([`widgets::PanelDrag::Art`]) if it is released there. Back - /// on the canvas the move goes on, as in Illustrator (#2826). + /// on the canvas the move goes on (#2826). Art, /// Fingers making a touch gesture ([`crate::touch`]): the first one's press does nothing. Gesture, @@ -832,7 +832,7 @@ fn frame_options( // Type › Highlight Substituted Fonts: pink behind text in a substitute font. highlight_substituted_fonts: app.session.prefs.highlight_substituted_fonts, // General › Anti-aliased Artwork: off, edges are hard on screen (raster effects and - // pattern tiles stay smooth), as in Illustrator. + // pattern tiles stay smooth). anti_alias: if app.session.prefs.anti_aliased_artwork { vectorcraft_render::AntiAlias::Art } else { vectorcraft_render::AntiAlias::None }, progressive_placed: true, trace_views: true, diff --git a/crates/ui-egui/src/canvas/grid.rs b/crates/ui-egui/src/canvas/grid.rs index 84adb0d861..001b2e31f7 100644 --- a/crates/ui-egui/src/canvas/grid.rs +++ b/crates/ui-egui/src/canvas/grid.rs @@ -432,7 +432,7 @@ pub(super) fn rulers(ui: &Ui, full: egui::Rect, xf: &Xf, hover: Option, s let sy = left.top() + d; clip_left.line_segment([pos2(left.right() - len, sy), pos2(left.right(), sy)], Stroke::new(1.0, t.ruler_tick)); if let Some(text) = label { - // Vertical labels read top-to-bottom, one digit per line like Illustrator. + // Vertical labels read top-to-bottom, one digit per line. let top = sy + 2.0; if top < filled_to { return; diff --git a/crates/ui-egui/src/canvas/home.rs b/crates/ui-egui/src/canvas/home.rs index bffab8f06c..c103c4b7ea 100644 --- a/crates/ui-egui/src/canvas/home.rs +++ b/crates/ui-egui/src/canvas/home.rs @@ -25,7 +25,7 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { /// The Home screen's column: welcome, New / Open, Recent Files, Learn, presets and community links. fn home_content(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); - // The welcome and the New / Open buttons sit centred, as PhotoCraft's Home screen does (#4684). + // The welcome and the New / Open buttons sit centred (#4684). ui.vertical_centered(|ui| { ui.label(egui::RichText::new(tl!("Welcome to VectorCraft")).font(theme::semibold(26.0)).color(t.text)); ui.add_space(4.0); diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index e82c950446..5812f6a191 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -1647,6 +1647,37 @@ fn switch_selection_and_drawing_modes_command() { } } +/// Select Last Selection Tool: the Selection tool before any selection tool is chosen, then the +/// one of Selection, Direct Selection and Group Selection chosen last; Magic Wand and Lasso don't +/// count. Running it again keeps that tool, and it changes no art, selection or undo history. +#[test] +fn select_last_selection_tool_command() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + let id = app.session.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 40})).unwrap()["id"].clone(); + app.session.execute("select.set", &json!({"ids": [id]})).unwrap(); + let last = |app: &mut VectorcraftApp| app.run("tool.selectLastSelection", json!({})).unwrap(); + let state = |app: &VectorcraftApp| { + let st = app.session.active().unwrap(); + (st.doc.clone(), st.selection.clone(), st.history.undo.len()) + }; + app.select_tool("pen"); + let before = state(&app); + assert_eq!((last(&mut app), app.session.tool_id()), (json!({"tool": "selection"}), "selection"), "none chosen yet: Selection"); + for id in ["directSelection", "groupSelection", "selection"] { + app.select_tool(id); + app.select_tool("pen"); + assert_eq!(last(&mut app), json!({"tool": id}), "{id}"); + } + app.select_tool("directSelection"); + for other in ["magicWand", "lasso", "rectangle", "hand"] { + app.select_tool(other); + } + assert_eq!(last(&mut app), json!({"tool": "directSelection"}), "Magic Wand and Lasso are not remembered"); + assert_eq!(last(&mut app), json!({"tool": "directSelection"}), "again: the same tool, no cycling"); + assert!(state(&app) == before, "no art, selection or undo step changes"); +} + /// A Switch Selection and Drawing Modes whose tool choice fails returns the error, in both /// directions: the tool stays, the drawing tool to return to stays, and no undo step is added. #[test] @@ -6980,10 +7011,136 @@ fn hidden_char_marks(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec c.fill == blue || c.stroke.color == blue, + Shape::Text(t) => t.fallback_color == blue, + Shape::LineSegment { stroke, .. } => stroke.color == blue, + Shape::Path(p) => p.stroke.color == egui::epaint::ColorMode::Solid(blue), + _ => false, + }) .collect() } +/// Show Hidden Characters marks each tab, nonbreaking space, narrow nonbreaking space, space of +/// a set width and discretionary hyphen with a mark of its kind, a plain space with a dot, and +/// a tab's arrow spans the tab's advance to its stop. +#[test] +fn hidden_characters_mark_tabs_nonbreaking_spaces_and_discretionary_hyphens() { + use super::tool_overlays::CharMark::*; + let text = "a b\tc\u{00A0}d\u{202F}e\u{2003}f\u{2009}g\u{200A}h\u{00AD}i"; + let t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::new(10.0, 50.0), text, vectorcraft_doc::CharStyle::default()); + let marks = HiddenMarks::of(&t); + let kinds: Vec<_> = marks.chars.iter().map(|c| c.0).collect(); + assert_eq!(kinds, [Tab, NoBreakSpace, NarrowNoBreakSpace, FixedSpace, FixedSpace, FixedSpace, DiscretionaryHyphen]); + assert_eq!(marks.spaces.len(), 1, "only the plain space has a dot"); + let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t); + let tab = lay.glyphs.iter().find(|g| text[g.byte..].starts_with('\t')).unwrap(); + assert!(tab.advance > 1.0, "{}", tab.advance); + let (_, a, b) = marks.chars[0]; + let start = t.xf * vectorcraft_geom::Point::new(tab.origin.x, tab.origin.y - 3.0); + assert!((a - start).hypot() < 1e-9 && (b.x - a.x - tab.advance).abs() < 1e-9 && b.y == a.y, "{a:?} {b:?} {start:?}"); +} + +/// Show Hidden Characters marks a line that a forced line break (U+2028) ends with a bent arrow +/// and no ¶; the line a paragraph return ends gets ¶, and the story's end #. +#[test] +fn hidden_characters_mark_forced_line_breaks() { + let t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::ZERO, "ab\u{2028}cd\nef", vectorcraft_doc::CharStyle::default()); + let marks = HiddenMarks::of(&t); + let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t); + assert_eq!(lay.lines.len(), 3); + assert_eq!(marks.breaks.len(), 1); + let (at, along, up) = marks.breaks[0]; + let first = &lay.lines[0]; + assert_eq!(at, vectorcraft_geom::Point::new(first.x1 + 1.0, first.baseline)); + assert_eq!((along - at, up - at), (vectorcraft_geom::Vec2::new(1.0, 0.0), vectorcraft_geom::Vec2::new(0.0, -1.0))); + let ends: Vec<_> = marks.ends.iter().map(|e| (e.1, e.0.y)).collect(); + assert_eq!(ends, [("¶", lay.lines[1].baseline), ("#", lay.lines[2].baseline)]); + // A story that ends with a forced line break: the arrow, and # on the empty line after it. + let t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::ZERO, "ab\u{2028}", vectorcraft_doc::CharStyle::default()); + let marks = HiddenMarks::of(&t); + assert_eq!((marks.breaks.len(), marks.ends.iter().map(|e| e.1).collect::>()), (1, vec!["#"])); +} + +/// A discretionary hyphen gets one ¬ also where the line breaks at it and the layout draws a +/// hyphen there, which stands for no character of the text. +#[test] +fn hidden_characters_mark_a_discretionary_hyphen_at_a_break_once() { + let style = vectorcraft_doc::CharStyle::default(); + let db = vectorcraft_text::FontDb::global(); + let word = vectorcraft_text::layout(db, &vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::ZERO, "coco-", style.clone())); + let width = word.lines[0].x1 - word.lines[0].x0 + 2.0; + let mut t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::ZERO, "coco\u{00AD}co", style); + t.kind = vectorcraft_doc::text::TextKind::Area { + frame: vectorcraft_geom::PathData::from_bezpath(&vectorcraft_geom::Rect::new(0.0, 0.0, width, 400.0).to_path(0.1)), + }; + let lay = vectorcraft_text::layout(db, &t); + assert_eq!(lay.lines.len(), 2, "the line breaks at the discretionary hyphen"); + assert!(lay.glyphs.iter().any(|g| g.len == 0), "the layout draws a hyphen at the break"); + let marks = HiddenMarks::of(&t); + assert_eq!(marks.chars.iter().map(|c| c.0).collect::>(), [super::tool_overlays::CharMark::DiscretionaryHyphen]); +} + +/// In vertical type the marks follow the column: a space's dot sits beside the column, halfway +/// down the space, and ¶ goes below the column's last character. +#[test] +fn hidden_characters_follow_vertical_type() { + let mut t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::ZERO, "a b\nc", vectorcraft_doc::CharStyle::default()); + t.vertical = true; + let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t); + let space = lay.glyphs.iter().find(|g| g.byte == 1).unwrap(); + let marks = HiddenMarks::of(&t); + let dot = marks.spaces[0]; + assert!((dot - vectorcraft_geom::Point::new(space.origin.x + 3.0, space.origin.y + space.advance / 2.0)).hypot() < 1e-9, "{dot:?} {space:?}"); + let (at, glyph, align) = marks.ends[0]; + assert_eq!((glyph, align), ("¶", egui::Align2::CENTER_TOP)); + let b = lay.glyphs.iter().find(|g| g.byte == 2).unwrap(); + assert!(at.y > b.origin.y, "{at:?} below {:?}", b.origin); +} + +/// In a right-to-left paragraph ¶ goes at the line's left end, where the paragraph ends. +#[test] +fn hidden_characters_end_a_right_to_left_line_at_its_left() { + let t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::ZERO, "אב גד\nהו", vectorcraft_doc::CharStyle::default()); + let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t); + assert!(lay.lines[0].rtl); + let marks = HiddenMarks::of(&t); + let (at, glyph, align) = marks.ends[0]; + assert_eq!((glyph, align), ("¶", egui::Align2::RIGHT_BOTTOM)); + assert_eq!(at.x, lay.lines[0].x0 - 1.0); +} + +/// Type on a path has the marks over its characters and # after its last one. +#[test] +fn hidden_characters_mark_type_on_a_path() { + let mut t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::ZERO, "a b\tc", vectorcraft_doc::CharStyle::default()); + let path = vectorcraft_geom::Line::new((0.0, 100.0), (600.0, 100.0)).to_path(0.1); + t.kind = vectorcraft_doc::text::TextKind::OnPath { path: vectorcraft_geom::PathData::from_bezpath(&path), start: 0.0, end: None }; + let marks = HiddenMarks::of(&t); + assert_eq!(marks.spaces.len(), 1); + assert_eq!(marks.chars.iter().map(|c| c.0).collect::>(), [super::tool_overlays::CharMark::Tab]); + assert_eq!(marks.ends.iter().map(|e| e.1).collect::>(), ["#"]); +} + +/// The overlay draws each kind of mark: a dot, two rings, the tab's arrow, a tick, ¬, the forced +/// line break's bent arrow, ¶ and #. +#[test] +fn show_hidden_characters_draws_every_kind_of_mark() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + let text = "a b\tc\u{00A0}d\u{202F}e\u{2003}f\u{00AD}g\u{2028}h\ni"; + app.session.execute("text.create", &json!({"x": 20, "y": 60, "text": text})).unwrap(); + let ctx = egui::Context::default(); + let xf = Xf { rect: egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0)), zoom: 1.0, center: Point::new(200.0, 150.0), rot: 0.0 }; + let shapes = hidden_chars(&mut app, &ctx, &xf); + let count = |f: &dyn Fn(&Shape) -> bool| shapes.iter().filter(|s| f(s)).count(); + assert_eq!(count(&|s| matches!(s, Shape::Circle(c) if c.fill != Color32::TRANSPARENT)), 1, "{shapes:?}"); + assert_eq!(count(&|s| matches!(s, Shape::Circle(c) if c.fill == Color32::TRANSPARENT)), 2, "{shapes:?}"); + assert_eq!(count(&|s| matches!(s, Shape::LineSegment { .. })), 2, "the tab's shaft and the tick: {shapes:?}"); + assert_eq!(count(&|s| matches!(s, Shape::Path(_))), 3, "the tab's head and the break's arrow: {shapes:?}"); + assert_eq!(count(&|s| matches!(s, Shape::Text(_))), 3, "¬, ¶ and #: {shapes:?}"); +} + /// Show Hidden Characters puts a dot over each space of a list paragraph and none over its /// bullet, which stands for no character. #[test] @@ -7001,7 +7158,7 @@ fn hidden_characters_mark_no_space_at_a_bullet() { fn show_hidden_characters_off_releases_the_text_nodes() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); - let text = json!({"x": 20, "y": 60, "text": "one two\nthree four"}); + let text = json!({"x": 20, "y": 60, "text": "one\ttwo\u{00A0}x\nthree\u{2028}four"}); let id = vectorcraft_doc::NodeId(app.session.execute("text.create", &text).unwrap()["id"].as_u64().unwrap()); let ctx = egui::Context::default(); app.run("type.hiddenCharacters", json!({})).unwrap(); diff --git a/crates/ui-egui/src/canvas/tool_overlays.rs b/crates/ui-egui/src/canvas/tool_overlays.rs index bc94f19e2b..5ccf5e4b9a 100644 --- a/crates/ui-egui/src/canvas/tool_overlays.rs +++ b/crates/ui-egui/src/canvas/tool_overlays.rs @@ -2,12 +2,14 @@ use super::grid::{clip_segment, pref_color}; use super::outline::{OVERLAY_MAX_ANCHORS, c32, stroke_path}; use super::{Color32, CornerRadius, Node, NodeKind, Overlay, Point, Pos2, Rect, Shape, Stroke, StrokeKind, Tokens, VectorcraftApp, Xf, pos2, vec2}; -/// Type → Show Hidden Characters: spaces as dots, ¶ at paragraph ends, # at the end of a story. -/// The marks of each text object are kept from one frame to the next ([`HiddenChars`]). +/// Type → Show Hidden Characters: the characters that print no ink, and the ends of paragraphs, +/// lines and stories ([`HiddenMarks`]). The marks of each text object are kept from one frame to +/// the next ([`HiddenChars`]). pub(super) fn hidden_chars_overlay(app: &mut VectorcraftApp, p: &egui::Painter, xf: &Xf) { let Some(st) = app.session.active() else { return }; let clip = p.clip_rect(); let color = Color32::from_rgb(0x4f, 0x9d, 0xff); + let stroke = Stroke::new(1.0, color); let font = egui::FontId::proportional(((10.0 * xf.zoom) as f32).clamp(7.0, 18.0)); let kept = &mut app.canvas.hidden_chars; // `last` holds the marks of the last frame. The marks of the objects this frame doesn't draw @@ -43,13 +45,62 @@ pub(super) fn hidden_chars_overlay(app: &mut VectorcraftApp, p: &egui::Painter, for &at in &marks.spaces { p.circle_filled(xf.to_screen(at), 1.2, color); } - for &(at, glyph) in &marks.ends { - p.text(xf.to_screen(at), egui::Align2::LEFT_BOTTOM, glyph, font.clone(), color); + for &(mark, a, b) in &marks.chars { + draw_char_mark(p, mark, xf.to_screen(a), xf.to_screen(b), stroke, &font); + } + for &(at, along, up) in &marks.breaks { + let at = xf.to_screen(at); + let u = unit_or(xf.to_screen(along) - at, vec2(1.0, 0.0)); + let n = unit_or(xf.to_screen(up) - at, vec2(0.0, -1.0)); + // A bent arrow: down from above the line's end, then back along the line. + let corner = at + u * 7.0 + n * 2.0; + let tip = at + u + n * 2.0; + p.add(Shape::line(vec![at + u * 7.0 + n * 8.0, corner, tip], stroke)); + p.add(Shape::line(vec![tip + u * 3.0 + n * 3.0, tip, tip + u * 3.0 - n * 3.0], stroke)); + } + for &(at, glyph, align) in &marks.ends { + p.text(xf.to_screen(at), align, glyph, font.clone(), color); } kept.marks.insert(n.id, (n.clone(), marks)); }); } +/// `v` scaled to length 1, or `or` when `v` has no length. +fn unit_or(v: egui::Vec2, or: egui::Vec2) -> egui::Vec2 { + let len = v.length(); + if len > 1e-3 { v / len } else { or } +} + +/// Draws the mark of one character on screen. `a` and `b` are the start and end of the +/// character's advance, in the direction the text reads, above its baseline. +fn draw_char_mark(p: &egui::Painter, mark: CharMark, a: Pos2, b: Pos2, stroke: Stroke, font: &egui::FontId) { + let u = unit_or(b - a, vec2(1.0, 0.0)); + let mid = a + (b - a) * 0.5; + match mark { + CharMark::Tab => { + // An arrow across the tab's advance, at least 6 px long. + let end = if (b - a).length() < 6.0 { a + u * 6.0 } else { b }; + let n = vec2(u.y, -u.x); + p.line_segment([a, end], stroke); + p.add(Shape::line(vec![end - u * 3.0 + n * 2.5, end, end - u * 3.0 - n * 2.5], stroke)); + } + CharMark::NoBreakSpace => { + p.circle_stroke(mid, 2.0, stroke); + } + CharMark::NarrowNoBreakSpace => { + p.circle_stroke(mid, 1.4, stroke); + } + CharMark::FixedSpace => { + // A short tick across the baseline's direction. + let n = vec2(u.y, -u.x) * 2.5; + p.line_segment([mid - n, mid + n], stroke); + } + CharMark::DiscretionaryHyphen => { + p.text(mid, egui::Align2::CENTER_BOTTOM, "¬", font.clone(), stroke.color); + } + } +} + /// The Show Hidden Characters marks of the text objects drawn in the last frame /// ([`crate::CanvasCache::hidden_chars`]). Each is kept with the object it was laid out from: an /// edited object is a new `Arc` and is laid out again, and all type is laid out again when the @@ -63,12 +114,51 @@ pub struct HiddenChars { pub(super) marks: std::collections::HashMap, std::sync::Arc)>, } -/// One text object's marks in document space: a dot over each space, and ¶ or # after the lines -/// that end a paragraph or the story. Type on a path has none. +/// The mark Show Hidden Characters draws over a character other than a plain space. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(super) enum CharMark { + /// A tab (U+0009): an arrow across its advance, to the tab stop. + Tab, + /// A nonbreaking space (U+00A0): a ring. + NoBreakSpace, + /// A narrow nonbreaking space (U+202F): a smaller ring. + NarrowNoBreakSpace, + /// The spaces of a set width (U+2000 to U+200A, U+205F, U+3000): a short tick. + FixedSpace, + /// A discretionary hyphen (U+00AD): ¬, where the word can break. + DiscretionaryHyphen, +} + +impl CharMark { + /// The mark of `c`, `None` for a character with no mark of its own. + pub(super) fn of(c: char) -> Option { + Some(match c { + '\t' => Self::Tab, + '\u{00A0}' => Self::NoBreakSpace, + '\u{202F}' => Self::NarrowNoBreakSpace, + '\u{2000}'..='\u{200A}' | '\u{205F}' | '\u{3000}' => Self::FixedSpace, + '\u{00AD}' => Self::DiscretionaryHyphen, + _ => return None, + }) + } +} + +/// One text object's marks in document space: a dot over each space, a [`CharMark`] over each +/// tab, nonbreaking space, space of a set width and discretionary hyphen, a bent arrow after +/// each line a forced line break (U+2028) ends, and ¶ or # after the lines that end a paragraph +/// or the story. Type on a path has the marks over characters, ¶ and the bent arrow at its +/// breaks, and # after its last character when all of its text is drawn. #[derive(Default)] pub(super) struct HiddenMarks { pub(super) spaces: Vec, - ends: Vec<(Point, &'static str)>, + /// Each mark over a character, with the start and end of the character's advance 3 pt above + /// its baseline, in the direction the text reads. + pub(super) chars: Vec<(CharMark, Point, Point)>, + /// Each forced line break: where its arrow starts, a point 1 pt further along the line and a + /// point 1 pt above the baseline from there. + pub(super) breaks: Vec<(Point, Point, Point)>, + /// ¶ and #, where they are drawn and how the text is aligned to that point. + pub(super) ends: Vec<(Point, &'static str, egui::Align2)>, } impl HiddenMarks { @@ -76,29 +166,71 @@ impl HiddenMarks { pub(super) fn of(tx: &vectorcraft_doc::TextObject) -> Self { let mut marks = Self::default(); let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), tx); - if lay.on_path { - return marks; - } let text = tx.plain_text(); let to = |q: Point| tx.xf * q; - // A list marker's glyphs (length 0) stand for no character. - for g in lay.glyphs.iter().filter(|g| g.len > 0) { - if text.get(g.byte..).is_some_and(|s| s.starts_with(' ')) { - marks.spaces.push(to(Point::new(g.origin.x + g.advance / 2.0, g.origin.y - 3.0))); + // The direction a glyph's baseline runs, and up from it (y points down). + let along = |angle: f64| vectorcraft_geom::Vec2::new(angle.cos(), angle.sin()); + let up = |angle: f64| { + let d = along(angle); + vectorcraft_geom::Vec2::new(d.y, -d.x) + }; + // A list marker's glyphs and a hyphen the layout adds at a break (length 0) stand for no + // character. Glyphs before the start of an open path draw nothing. A character drawn with + // several glyphs gets one mark. + let mut marked = None; + for g in lay.glyphs.iter().filter(|g| g.len > 0 && !g.off_path) { + let Some(c) = text.get(g.byte..).and_then(|s| s.chars().next()) else { continue }; + if marked == Some(g.byte) { + continue; } + let (d, n) = (along(g.angle), up(g.angle)); + let start = g.origin + n * 3.0; + let end = start + d * g.advance; + if c == ' ' { + marks.spaces.push(to(start + d * (g.advance / 2.0))); + } else if let Some(mark) = CharMark::of(c) { + let (a, b) = if g.rtl { (end, start) } else { (start, end) }; + marks.chars.push((mark, to(a), to(b))); + } else if lay.on_path && (c == '\n' || c == '\u{2028}') { + // Type on a path is one line: its breaks are marked where their glyphs are. + if c == '\n' { + marks.ends.push((to(g.origin), "¶", egui::Align2::LEFT_BOTTOM)); + } else { + marks.breaks.push((to(g.origin), to(g.origin + d), to(g.origin + d + n))); + } + } else { + continue; + } + marked = Some(g.byte); } + if lay.on_path { + // # after the last character, when the path holds all of the text. + let last = lay.glyphs.iter().filter(|g| g.len > 0 && !g.off_path).max_by_key(|g| g.byte + g.len); + if let Some(g) = last.filter(|g| g.byte + g.len >= text.len() && !lay.overflow) { + let d = along(g.angle); + let at = if g.rtl { g.origin - d } else { g.origin + d * (g.advance + 1.0) }; + marks.ends.push((to(at), "#", egui::Align2::LEFT_BOTTOM)); + } + return marks; + } + // Lines are in line space: `physical_point` turns them into columns in vertical type. + let at = |x: f64, y: f64| to(lay.physical_point(Point::new(x, y))); for (i, line) in lay.lines.iter().enumerate() { let last = i + 1 == lay.lines.len(); - let breaks = text.get(line.end..).is_some_and(|s| s.starts_with('\n')); - let (glyph, at) = if last && line.end >= text.len() { - ("#", true) - } else if breaks { - ("¶", true) - } else { - ("", false) + // A right-to-left line ends at its left edge. + let (x, dx) = if line.rtl { (line.x0 - 1.0, -1.0) } else { (line.x1 + 1.0, 1.0) }; + let align = match (lay.vertical, line.rtl) { + (true, _) => egui::Align2::CENTER_TOP, + (false, true) => egui::Align2::RIGHT_BOTTOM, + (false, false) => egui::Align2::LEFT_BOTTOM, }; - if at { - marks.ends.push((to(Point::new(line.x1 + 1.0, line.baseline)), glyph)); + let soft = text.get(line.start..line.end).is_some_and(|s| s.ends_with('\u{2028}')); + if last && line.end >= text.len() { + marks.ends.push((at(x, line.baseline), "#", align)); + } else if soft { + marks.breaks.push((at(x, line.baseline), at(x + dx, line.baseline), at(x, line.baseline - 1.0))); + } else if text.get(line.end..).is_some_and(|s| s.starts_with('\n')) { + marks.ends.push((at(x, line.baseline), "¶", align)); } } marks diff --git a/crates/ui-egui/src/canvas/view.rs b/crates/ui-egui/src/canvas/view.rs index 4443f12997..e0e5cc9f75 100644 --- a/crates/ui-egui/src/canvas/view.rs +++ b/crates/ui-egui/src/canvas/view.rs @@ -94,7 +94,7 @@ pub(super) const HOLD_DELAY: f32 = 0.3; /// …and how fast it zooms then (as `exp(seconds × HOLD_ZOOM)`: twice as close each second). pub(super) const HOLD_ZOOM: f64 = std::f64::consts::LN_2; -/// Performance › Animated Zoom, which needs GPU Performance as in Illustrator: the Zoom tool zooms +/// Performance › Animated Zoom, which needs GPU Performance: the Zoom tool zooms /// as it is dragged sideways or held, instead of zooming to the area dragged across, and a wheel /// notch's zoom glides in ([`wheel`]). pub(crate) fn animated_zoom(p: &vectorcraft_engine::Prefs) -> bool { diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index dc9f9fa848..f114528b7e 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -36,7 +36,7 @@ use tabs::{CLOSE_BEFORE_TITLE, first_tab_shown, tab_drop, tab_groups, tab_title} pub use tabs::{doc_tabs, isolation_bar, step_document}; pub(crate) use tabs::{document_window_title, show_document, window_tab}; -/// The application bar's height, in points (compact, as in PhotoCraft). +/// The application bar's height, in points (compact). pub const APP_BAR_HEIGHT: f32 = 32.0; /// The brand mark's side. const MARK: f32 = 18.0; diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index 71b737dbfc..2df5067aa9 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -886,7 +886,7 @@ fn gripper(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect, d } } -/// The Control bar (Window → Control), context-sensitive like Illustrator's, docked to the top or +/// The Control bar (Window → Control), context-sensitive, docked to the top or /// the bottom of the window, or floating over the window below the menu bar, where it takes no room /// from the canvas. A floating bar is [`FLOAT_WIDTH`] wide, or as wide as the window when that is /// narrower, and is kept inside the window when the window shrinks. diff --git a/crates/ui-egui/src/community.rs b/crates/ui-egui/src/community.rs index 034807b8b7..97f7dffdba 100644 --- a/crates/ui-egui/src/community.rs +++ b/crates/ui-egui/src/community.rs @@ -33,7 +33,7 @@ pub fn discord_button(app: &mut VectorcraftApp, ui: &mut Ui, large: bool) -> egu let ir = egui::Rect::from_center_size(r.left_center() + vec2(h * 0.35 + icon / 2.0, 0.0), vec2(icon, icon)); if large { // The theme's accent, as the primary buttons use it, so the call to action matches the - // rest of the window (and PhotoCraft's, #4684); Discord's colour stays on the app-bar icon. + // rest of the window (#4684); Discord's colour stays on the app-bar icon. let t = Tokens::get(ui.ctx()); let fill = if resp.hovered() { t.accent } else { t.accent_strong }; ui.painter().rect_filled(r, CornerRadius::same((h / 2.0) as u8), fill); @@ -77,7 +77,7 @@ pub fn links(app: &mut VectorcraftApp, ui: &mut Ui) { links_in(app, ui, false); } -/// [`links`] for a centred column (the Home screen's, as PhotoCraft's, #4684): the Discord button +/// [`links`] for a centred column (the Home screen's, #4684): the Discord button /// and the links, each in the middle. pub fn links_centered(app: &mut VectorcraftApp, ui: &mut Ui) { links_in(app, ui, true); diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index a2c29fadc4..3e26ff37ec 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -240,6 +240,7 @@ fn wrap(r: Result) -> Outcome { pub fn all_commands(app: &VectorcraftApp) -> Value { let mut v: Vec = app.session.commands().into_iter().map(|c| serde_json::to_value(c).unwrap_or_default()).collect(); for (id, label, sc, params) in crate::menus::UI_COMMANDS { + let sc = crate::shortcut_editor::ui_command_default(id, sc, crate::keymap::platform()); v.push(json!({"id": id, "label": label, "shortcut": sc, "params": params, "enabled": crate::menus::enabled(app, id), "ui": true})); } Value::Array(v) diff --git a/crates/ui-egui/src/control/tests.rs b/crates/ui-egui/src/control/tests.rs index 7aa73e8a7e..96c4880d39 100644 --- a/crates/ui-egui/src/control/tests.rs +++ b/crates/ui-egui/src/control/tests.rs @@ -1426,3 +1426,19 @@ fn dialog_set_refuses_a_field_the_dialog_does_not_have() { app.ui.dialog = None; assert_eq!(input_request(&mut app, "ui.dialog.set", json!({"field": "name", "value": "A"}))["error"], "no dialog open"); } + +/// `engine.commands` lists each UI command's default shortcut on this platform: Select Last +/// Selection Tool shows Ctrl+` (`Cmd+~`) on Windows and Linux and none on macOS. +#[test] +fn the_command_list_shows_this_platforms_default_shortcut() { + let mut app = VectorcraftApp::new(Session::new(), Services::default()); + let r = input_request(&mut app, "engine.commands", json!({})); + let row = r["result"].as_array().unwrap().iter().find(|c| c["id"] == "tool.selectLastSelection").cloned(); + let row = row.unwrap_or_else(|| panic!("listed: {r}")); + assert_eq!(row["shortcut"], if crate::keymap::platform().is_mac() { "" } else { "Cmd+~" }, "{row}"); + for p in [craft_keymap::Platform::Windows, craft_keymap::Platform::Linux] { + assert_eq!(crate::shortcut_editor::ui_command_default("tool.selectLastSelection", "Cmd+~", p), "Cmd+~", "{p:?}"); + } + assert_eq!(crate::shortcut_editor::ui_command_default("tool.selectLastSelection", "Cmd+~", craft_keymap::Platform::Mac), ""); + assert_eq!(crate::shortcut_editor::ui_command_default("view.zoomIn", "Cmd+=", craft_keymap::Platform::Mac), "Cmd+="); +} diff --git a/crates/ui-egui/src/cursors.rs b/crates/ui-egui/src/cursors.rs index 4db2e5cb45..83db707642 100644 --- a/crates/ui-egui/src/cursors.rs +++ b/crates/ui-egui/src/cursors.rs @@ -1,5 +1,5 @@ //! Tool cursors drawn as vector glyphs (egui only offers system cursors). Black shapes with a white -//! halo, hotspot at `p`, Illustrator's visual grammar: solid arrow (Selection), hollow arrow (Direct +//! halo, hotspot at `p`, one shape per tool: solid arrow (Selection), hollow arrow (Direct //! Selection), pen nib with state badges, crosshair for drawing tools, curved arrows for rotate. //! //! The desktop app shows them as OS cursors ([`Images`]): the system moves those itself, at once, diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 9e54eb12f6..38dbf3eb4e 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -167,7 +167,7 @@ pub(crate) use export_for_screens::{ open_assets as open_export_for_screens_assets, preset_list as screen_preset_list, saved_options as screen_saved_options, saved_rows as screen_saved_rows, settings_format as screen_settings_format, }; -pub(crate) use form::{humanize, number_list_text, plugin_color_button, read_number_list, unit_suffix}; +pub(crate) use form::{humanize, number_list_text, plugin_color_button, ppi_suffix, read_number_list, unit_suffix}; pub use new_document::{create_without_dialog as new_document_without_dialog, open as open_new_document, preset_card}; pub(crate) use new_document::{popup_open as new_document_popup_open, preset_name}; pub use png_options::open as open_raster_options; @@ -419,6 +419,7 @@ registry! { SliceOptions: [slices::OPTIONS] => slices::OPTIONS_SPEC, DivideSlices: [slices::DIVIDE] => slices::DIVIDE_SPEC, EpsOptions: [eps_options::KIND] => eps_options::SPEC, + EpsFlattenerOptions: [eps_options::CUSTOM_KIND] => eps_options::CUSTOM_SPEC, Recovery: [crate::recovery::KIND] => recovery::SPEC, PluginStopped: [safe_mode::STOPPED] => safe_mode::STOPPED_SPEC, SafeMode: [safe_mode::KIND] => safe_mode::SPEC, @@ -656,18 +657,27 @@ pub(crate) fn parent(d: &Dialog) -> Option { } /// `ui.dialog.set` changed `field` of the open dialog from `old`: a choice that sets other fields -/// sets them as choosing it in the dialog does (Export for Screens' `exportPreset`), a change +/// sets them as choosing it in the dialog does (Export for Screens' `exportPreset`, EPS Options' +/// `flattenerPreset`, which drops the Custom… options), a change /// to Export for Screens' sub-folder controls ends an applied preset's item folders, as it does in -/// the dialog, and Transform Each's Relative / Absolute keeps the Scale fields' size. A value +/// the dialog, Transform Each's Relative / Absolute keeps the Scale fields' size, and Recolor +/// Artwork's `group` selects that color group and its `groupAction` runs the button at once. A value /// Composite Fonts' Show Sample can't take is refused. pub(crate) fn field_set(app: &mut VectorcraftApp, field: &str, old: Option<&Value>) -> Result<(), String> { if app.ui.dialog.as_ref().is_some_and(|d| d.kind == transform_each::KIND) { transform_each::field_set(app, field, old); return Ok(()); } + if app.ui.dialog.as_ref().is_some_and(|d| d.kind == recolor::KIND) { + return recolor::field_set(app, field); + } if let Some(d) = app.ui.dialog.as_ref().filter(|d| d.kind == composite_fonts::KIND) { return composite_fonts::field_set(d, field); } + if let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == eps_options::KIND) { + eps_options::field_set(d, field); + return Ok(()); + } let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == export_for_screens::KIND) else { return Ok(()) }; match field { "exportPreset" => export_for_screens::preset_set(app), @@ -832,6 +842,9 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { if after_panel && !ctx.input(|i| i.key_down(egui::Key::Enter) || i.key_pressed(egui::Key::Enter)) { d.fields.remove(AFTER_PANEL); } + // A body can open another dialog in its place (EPS Options' Custom…): this frame's Enter + // doesn't confirm that one. + let opened = d.kind.clone(); let heading = (spec.heading)(&d); let revolves = revolve_gizmo::active(&d); if revolves { @@ -931,7 +944,7 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { if ok_clicked && !rejected && !refused_during_click { ok = true; } - if spec.ok.is_some() && ok_enabled && !after_panel && !rejected && crate::shortcuts::pressed_anew(ctx, egui::Key::Enter) { + if spec.ok.is_some() && ok_enabled && !after_panel && !rejected && d.kind == opened && crate::shortcuts::pressed_anew(ctx, egui::Key::Enter) { ok = true; } if discard { diff --git a/crates/ui-egui/src/dialogs/brush_replace_art.rs b/crates/ui-egui/src/dialogs/brush_replace_art.rs index cc1a08b251..f1ebf1083f 100644 --- a/crates/ui-egui/src/dialogs/brush_replace_art.rs +++ b/crates/ui-egui/src/dialogs/brush_replace_art.rs @@ -44,7 +44,7 @@ pub fn replace(app: &mut VectorcraftApp, name: &str, ids: &[u64]) { return; } // A preview on a copy of the document checks the art without changing anything. - if !app.session.in_interaction() && app.session.begin_interaction("Replace Brush Art").is_ok() { + if !app.session.in_interaction() && app.begin_interaction("Replace Brush Art").is_ok() { let checked = app.session.preview("brush.replaceArt", ¶ms); // The interaction began above, on the active document: ending it puts that document back // as it was, and can fail only when no document is open, when there is nothing to put back. diff --git a/crates/ui-egui/src/dialogs/bullets_numbering.rs b/crates/ui-egui/src/dialogs/bullets_numbering.rs index 43f15edbb8..3eb9b38547 100644 --- a/crates/ui-egui/src/dialogs/bullets_numbering.rs +++ b/crates/ui-egui/src/dialogs/bullets_numbering.rs @@ -12,14 +12,20 @@ //! preset picked), `bullet` (`dot`, `dash`, `circle` or `square`), `number` (`arabic`, //! `upperLetters`, `lowerLetters`, `upperRoman`, `lowerRoman`, `twoDigits` or `threeDigits`), //! `listAlign` (`left` or `right`), `listLevel` (1 to 9; 1 for paragraphs in no list), -//! `leftIndent` and `firstLineIndent` (pt), as `text.setFormat` takes them, with `__initial` (the -//! values it opened with) and `__targets` (the type and range it acts on). +//! `leftIndent` and `firstLineIndent` (pt), as `text.setFormat` takes them, `startAt` (the Numbers +//! tab's Start At box) and `startNumber` (its number, 1 to 999999999), with `__initial` (the values +//! it opened with) and `__targets` (the type and range it acts on). +//! +//! Start At is VectorCraft's own: on, OK gives the first numbered paragraph the number in the +//! field (`text.setFormat` `startNumber`), and the numbered paragraphs after it count on from it; +//! off, the paragraphs count on from the paragraph before (`restartNumbering` false). The box is on +//! when the paragraphs have a number of their own, off when none has, and blank when they differ. //! //! Behavior reference (public documentation): //! . use serde_json::{Map, Value, json}; -use vectorcraft_doc::text::{LIST_HANGING_INDENT, LIST_LEVELS, NumberStyle, ParaList}; +use vectorcraft_doc::text::{LIST_HANGING_INDENT, LIST_LEVELS, MAX_LIST_START, NumberStyle, ParaList}; use super::swatch_options::label; use super::{DialogSpec, form}; @@ -52,7 +58,7 @@ const ARROWS: egui::EventFilter = egui::EventFilter { tab: false, horizontal_arr /// The fields `ui.dialog.set` can set while the dialog does not hold them: the dialog leaves a /// field out where the paragraphs differ, and holds no `bullet` or `number` for paragraphs in no /// list or in another kind of list. -const INPUTS: [&str; 7] = ["list", "bullet", "number", "listAlign", "listLevel", "leftIndent", "firstLineIndent"]; +const INPUTS: [&str; 9] = ["list", "bullet", "number", "listAlign", "listLevel", "leftIndent", "firstLineIndent", "startAt", "startNumber"]; pub(super) const SPEC: DialogSpec = DialogSpec { heading: |_| tl!("Bullets and Numbering").into(), @@ -85,8 +91,7 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { crate::panels::character::text_style(app).ok_or("select some type first")?; // While typing, the dialog acts on the paragraphs of the text being edited. let mut targets = json!({}); - if let Some((id, a, b)) = crate::panels::character::text_editing(app) { - crate::panels::character::end_typing(app); + if let Some((id, a, b)) = crate::panels::character::text_editing_kept(app)? { targets = json!({"ids": [id.0], "start": a, "end": b}); } let mut values = Map::new(); @@ -114,6 +119,13 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { if let Some(v) = shared_para_field(app, |p| p.first_line_indent) { values.insert("firstLineIndent".into(), json!(v)); } + // …and Start At: on with the number when the paragraphs share one, off when none has one. + if let Some(start) = shared_para(app, |p| p.list.and_then(|l| l.start)) { + values.insert("startAt".into(), json!(start.is_some())); + if let Some(n) = start { + values.insert("startNumber".into(), json!(n)); + } + } let tab = tab.unwrap_or(if list == Some("number") { "numbers" } else { "bullets" }); let mut fields = Value::Object(values.clone()); fields[INITIAL] = Value::Object(values); @@ -210,6 +222,29 @@ fn number_tab(ui: &mut egui::Ui, d: &mut Dialog) { } None => {} } + ui.add_space(8.0); + start_at(ui, d); +} + +/// The Start At box and its number, 1 to [`MAX_LIST_START`]: the box shows a dash while the +/// paragraphs' numbers differ, and a click then turns it on; the number field is dimmed unless the +/// box is on, and shows 1 until a number is typed. +fn start_at(ui: &mut egui::Ui, d: &mut Dialog) { + ui.horizontal(|ui| { + let on = d.fields.get("startAt").and_then(Value::as_bool); + if widgets::check3(ui, tl!("Start at:"), on, true) { + d.fields.insert("startAt".into(), json!(on != Some(true))); + } + let value = d.fields.get("startNumber").and_then(Value::as_f64).unwrap_or(1.0); + ui.add_enabled_ui(on == Some(true), |ui| { + let name = Some(tl!("Start at:")); + if let Some(v) = + widgets::range_field_named(ui, ("bullets-numbering", "startNumber"), name, value, 1.0..=f64::from(MAX_LIST_START), "", 0, 90.0) + { + d.fields.insert("startNumber".into(), json!(v)); + } + }); + }); } /// A row of preset buttons named `names`, `current` selected, each drawn by `paint` (painter, @@ -367,6 +402,20 @@ fn params(d: &Dialog) -> Map { { p.insert("listLevel".into(), json!(l)); } + // …and Start At, unless the paragraphs are made bulleted or taken out of their list: on, the + // number shown; off, the paragraphs count on from the one before. + if let Some(on) = d.fields.get("startAt").and_then(Value::as_bool) + && !matches!(field("list"), Some("none" | "bullet")) + { + let n = d.fields.get("startNumber").and_then(Value::as_f64).unwrap_or(1.0); + let was_on = initial.and_then(|m| m.get("startAt")).and_then(Value::as_bool); + let was_n = initial.and_then(|m| m.get("startNumber")).and_then(Value::as_f64); + if on && (was_on != Some(true) || was_n != Some(n)) { + p.insert("startNumber".into(), json!(n)); + } else if !on && was_on != Some(false) { + p.insert("restartNumbering".into(), json!(false)); + } + } // For paragraphs in a list and paragraphs in none, an indent left as it was is not sent: // `text.setFormat` then gives each paragraph that joins the list its hanging indent. let mixed = initial.is_some_and(|m| !m.contains_key("list")); @@ -690,7 +739,8 @@ mod tests { app.run("text.setFormat", json!({"ids": [id], "listAlign": "right", "listLevel": 2, "start": 0, "end": 0})).unwrap(); app.run("ui.bulletsAndNumbering", json!({})).unwrap(); let held = app.ui.dialog.as_ref().unwrap().fields.clone(); - for key in INPUTS { + // Neither paragraph has a number of its own, so Start at is off, not blank. + for key in INPUTS.into_iter().filter(|k| !["startAt", "startNumber"].contains(k)) { assert!(!held.contains_key(key), "{key} is blank"); } let fields = json!([ @@ -737,6 +787,67 @@ mod tests { assert_eq!((first(&app, id).0.map(|l| l.level), paras(&app, id).1.list.map(|l| l.level)), (Some(2), Some(2))); } + /// Start at: the box opens off for paragraphs without a number of their own and on with the + /// number for one that has it; a change shows on the type at once, OK keeps it as one undo + /// step, Cancel puts the type back, and turning the box off sends `restartNumbering` false. + #[test] + fn start_at_gives_the_first_numbered_paragraph_its_number() { + let (mut app, id) = app(); + app.run("text.setFormat", json!({"number": "arabic"})).unwrap(); + let undo = app.session.active().unwrap().history.undo.len(); + app.run("ui.bulletsAndNumbering", json!({})).unwrap(); + let d = app.ui.dialog.clone().unwrap(); + assert_eq!((d.fields.get("startAt"), d.fields.get("startNumber")), (Some(&json!(false)), None)); + set(&mut app, "startAt", json!(true)); + set(&mut app, "startNumber", json!(4)); + frame(&mut app); + let starts = |app: &VectorcraftApp| { + let (one, two) = paras(app, id); + (one.list.and_then(|l| l.start), two.list.and_then(|l| l.start)) + }; + assert_eq!(starts(&app), (Some(4), None), "previewed on the type"); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "the preview adds no undo step"); + super::super::cancel(&mut app); + assert_eq!(starts(&app), (None, None), "Cancel puts it back"); + app.run("ui.bulletsAndNumbering", json!({})).unwrap(); + set(&mut app, "startAt", json!(true)); + set(&mut app, "startNumber", json!(4)); + super::super::confirm(&mut app).unwrap(); + assert_eq!((starts(&app), app.session.active().unwrap().history.undo.len()), ((Some(4), None), undo + 1)); + // One paragraph with a number and one without: the box is blank, and OK sends nothing for it. + app.run("ui.bulletsAndNumbering", json!({})).unwrap(); + let d = app.ui.dialog.clone().unwrap(); + assert!(!d.fields.contains_key("startAt") && !changes(¶ms(&d))); + // The blank box shows a dash, not an empty box. + use egui::accesskit::{Role, Toggled}; + let mut shown = d.clone(); + let tree = crate::widgets::accessibility_tests::tree(|ui| start_at(ui, &mut shown)); + let check = tree.iter().find(|n| n.label() == Some("Start at:") && n.role() == Role::CheckBox).map(|n| n.toggled()); + assert_eq!(check, Some(Some(Toggled::Mixed))); + // A preset that makes the paragraphs bulleted sends no number. + set(&mut app, "startAt", json!(true)); + pick_preset(&mut app, "bullet", Some("dot")); + let p = params(app.ui.dialog.as_ref().unwrap()); + assert!(!p.contains_key("startNumber") && !p.contains_key("restartNumbering")); + super::super::cancel(&mut app); + // A paragraph with a number opens the box on with it, and off sends it back to counting on. + let solo = app.run("text.create", json!({"x": 10, "y": 200, "text": "Solo"})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [solo]})).unwrap(); + app.run("text.setFormat", json!({"number": "arabic", "startNumber": 9})).unwrap(); + app.run("ui.bulletsAndNumbering", json!({})).unwrap(); + let d = app.ui.dialog.clone().unwrap(); + assert_eq!((d.fields.get("startAt"), d.f64("startNumber", 0.0)), (Some(&json!(true)), 9.0)); + assert!(!changes(¶ms(&d)), "nothing changed yet"); + set(&mut app, "startAt", json!(false)); + assert_eq!(params(app.ui.dialog.as_ref().unwrap()).get("restartNumbering"), Some(&json!(false))); + super::super::confirm(&mut app).unwrap(); + let start = match &app.session.active().unwrap().doc.node(NodeId(solo)).unwrap().kind { + NodeKind::Text(t) => t.para_at(0).list.map(|l| l.start), + _ => panic!("not text"), + }; + assert_eq!(start, Some(None), "still numbered, with no number of its own"); + } + /// `text.setFormat` sets `listLevel` only on paragraphs in a list, so a Level change alone on /// paragraphs in no list sends nothing and adds no undo step; with a preset it applies. #[test] diff --git a/crates/ui-egui/src/dialogs/color_picker.rs b/crates/ui-egui/src/dialogs/color_picker.rs index f86ee17f51..0bd287cc31 100644 --- a/crates/ui-egui/src/dialogs/color_picker.rs +++ b/crates/ui-egui/src/dialogs/color_picker.rs @@ -495,13 +495,18 @@ fn preview(app: &mut VectorcraftApp, d: &mut Dialog) { if unchanged || !selected { return; } - let _ = app.session.begin_interaction(if artboard { + let label = if artboard { "Artboard Options" } else if d.bool("stroke") { "Stroke Color" } else { "Fill Color" - }); + }; + // A failure to begin (typing that can't be kept) shows, and nothing previews. + if let Err(e) = app.begin_interaction(label) { + app.status(e); + return; + } if let Err(e) = app.session.preview(cmd, ¶ms) { app.status(e.to_string()); } diff --git a/crates/ui-egui/src/dialogs/command.rs b/crates/ui-egui/src/dialogs/command.rs index 9cb59853a6..904096fb3c 100644 --- a/crates/ui-egui/src/dialogs/command.rs +++ b/crates/ui-egui/src/dialogs/command.rs @@ -433,6 +433,47 @@ mod tests { assert!(p[0] == p[1] && p[1] == p[2] && p[0] < 128, "red in grayscale: {p:?}"); } + /// Object › Rasterize… opens this dialog with its options as parameter labels (#7991): in + /// French the heading, every field label and the resolution's unit ("ppp") are drawn in French. + #[test] + fn rasterize_dialog_is_drawn_in_the_ui_language() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + let id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [id]})).unwrap(); + let entries = crate::menus::menu_entries(&app); + let item = entries.iter().find(|e| e.path == ["Object"] && e.label == "Rasterize…").expect("listed"); + let (cmd, p) = crate::menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params); + crate::menus::invoke(&mut app, &cmd, p); + assert_eq!(app.ui.dialog.as_ref().unwrap().str("__label"), "Rasterize"); + let keys: Vec = app.ui.dialog.as_ref().unwrap().fields.keys().filter(|k| !k.starts_with("__")).cloned().collect(); + assert_eq!(keys.len(), 6, "{keys:?}"); + assert_eq!(form::humanize("ppi"), "Resolution:"); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").unwrap()); + let shown = crate::tests_labels::painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx())); + let heading = heading_label(app.ui.dialog.as_ref().unwrap()); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert_eq!(heading, "Pixelliser"); + let french = ["Ajouter autour de l’objet", "Lissage", "Arrière-plan", "Masque d’écrêtage", "Modèle colorimétrique", "Résolution", "ppp"]; + for s in french { + assert!(shown.contains(s), "{s} in {shown}"); + } + for s in ["Rasterize", "Add Around", "Anti Alias", "Background", "Clipping Mask", "Color Model", "Resolution", "Ppi", "ppi"] { + assert!(!shown.contains(s), "{s} left in English: {shown}"); + } + // Every language with complete menus heads the dialog as the menu item that opened it + // reads, and has a row for each label, the unit and the Color Model choices. + for lang in crate::i18n::Lang::all().filter(|l| l.complete_menus()) { + let menu = crate::i18n::tr(lang, &item.label); + assert_ne!(menu, item.label, "{}: menu item", lang.code()); + assert_eq!(heading_in(lang, "Rasterize"), menu.trim_end_matches('…').trim_end(), "{}: heading", lang.code()); + let labels = keys.iter().map(|k| form::humanize(k).trim_end_matches(':').to_string()); + for label in labels.chain(["{n} ppi", "Grayscale", "Bitmap"].map(String::from)) { + assert!(crate::i18n::has(lang, &label), "{}: {label}", lang.code()); + } + } + } + /// Object › Path › Clean Up… opens this dialog headed "Clean Up", which most catalogs hold only /// as the menu label "Clean Up…" (#7991). In French the heading and every option are translated. #[test] @@ -530,6 +571,56 @@ mod tests { assert_eq!(cols(&app), 2, "one Undo takes the whole change back"); } + /// Grid Repeat Options labels its column fields Columns and Flip Columns, as the Rows and Flip + /// Rows fields beside them are spelled out. + #[test] + fn grid_repeat_options_spell_out_columns() { + let mut app = grid_options_app(); + let shown = crate::tests_labels::painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx())); + for s in ["Rows:", "Columns:", "Flip Rows:", "Flip Columns:"] { + assert!(shown.contains(s), "{s} in {shown}"); + } + assert!(!shown.contains("Cols"), "no Cols label: {shown}"); + } + + /// Object › Create Gradient Mesh… opens this dialog with the menu's rows, cols, appearance and + /// highlight. In French the heading and the four labels are translated, and "cols" is labeled + /// Columns (#7991). + #[test] + fn create_gradient_mesh_dialog_is_drawn_in_the_ui_language() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + let entries = crate::menus::menu_entries(&app); + let item = entries.iter().find(|e| e.path == ["Object"] && e.label == "Create Gradient Mesh…").expect("listed"); + let (cmd, p) = crate::menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params); + crate::menus::invoke(&mut app, &cmd, p); + assert_eq!(app.ui.dialog.as_ref().unwrap().str("__label"), "Create Gradient Mesh"); + assert_eq!(form::humanize("cols"), "Columns:"); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").unwrap()); + let shown = crate::tests_labels::painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx())); + let heading = heading_label(app.ui.dialog.as_ref().unwrap()); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert_eq!(heading, "Créer un filet de dégradé"); + for s in ["Créer un filet de dégradé", "Lignes", "Colonnes", "Aspect"] { + assert!(shown.contains(s), "{s} in {shown}"); + } + for s in ["Create Gradient Mesh", "Rows", "Cols", "Columns", "Appearance", "Highlight"] { + assert!(!shown.contains(s), "{s} left in English: {shown}"); + } + // Every language with complete menus heads the dialog as the menu item reads and has the + // four labels. + for lang in crate::i18n::Lang::all().filter(|l| l.complete_menus()) { + let menu = crate::i18n::tr(lang, &item.label); + assert_ne!(menu, item.label, "{}: menu item", lang.code()); + assert_eq!(heading_in(lang, "Create Gradient Mesh"), menu.trim_end_matches('…').trim_end(), "{}: heading", lang.code()); + for key in ["rows", "cols", "appearance", "highlight"] { + let label = form::humanize(key); + assert!(crate::i18n::has(lang, label.trim_end_matches(':')), "{}: {label}", lang.code()); + } + } + } + /// Radial and Mirror Repeat Options have no Preview (their public pages list none): their /// fields apply on OK only, and the dialog takes no `preview`. #[test] diff --git a/crates/ui-egui/src/dialogs/effect.rs b/crates/ui-egui/src/dialogs/effect.rs index ac2798ec40..e9ffdc681e 100644 --- a/crates/ui-egui/src/dialogs/effect.rs +++ b/crates/ui-egui/src/dialogs/effect.rs @@ -41,7 +41,7 @@ fn three_d_refusal(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog, } else if !app.session.in_interaction() && d.fields.get(TRIED) != Some(¶ms) { // Waits for another interaction to end: trying inside it would replace its preview and // cancel it. A failure to begin leaves no interaction: the preview below then reports it. - let _ = app.session.begin_interaction(&d.str("__label")); + let _ = app.begin_interaction(&d.str("__label")); match app.session.preview(cmd, ¶ms) { Ok(_) => { d.fields.remove(form::REFUSED); @@ -255,9 +255,14 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { d.fields.insert("preview".into(), json!(pv)); if pv && (changed || pv_changed || !app.session.in_interaction()) { let label = d.str("__label"); - let _ = app.session.begin_interaction(&label); - let (cmd, p) = command(d); - let _ = app.session.preview(cmd, &p); + // A failure to begin (typing that can't be kept) shows, and nothing previews. + match app.begin_interaction(&label) { + Ok(()) => { + let (cmd, p) = command(d); + let _ = app.session.preview(cmd, &p); + } + Err(e) => app.status(e), + } } else if !pv && pv_changed { let _ = app.session.cancel_interaction(); } diff --git a/crates/ui-egui/src/dialogs/effect_gallery.rs b/crates/ui-egui/src/dialogs/effect_gallery.rs index fe0de205fc..39c2dc6c7c 100644 --- a/crates/ui-egui/src/dialogs/effect_gallery.rs +++ b/crates/ui-egui/src/dialogs/effect_gallery.rs @@ -1,4 +1,4 @@ -//! Effect → Effect Gallery: browse Photoshop-style raster filters by category, build a stack, and +//! Effect → Effect Gallery: browse raster filters by category, build a stack, and //! apply it as separate appearance effects in one undo step. //! //! Each filter has a thumbnail, and the dialog has its own preview, as the @@ -29,7 +29,7 @@ const PREVIEW_H: usize = 84; /// Dialog kind for the Effect Gallery. pub const KIND: &str = "effectGallery"; -/// Raster effect submenus in the gallery (the six Photoshop-style folders it holds). +/// Raster effect submenus in the gallery (the six raster filter folders it holds). const CATEGORIES: [(&str, &[&str]); 6] = [ ("Artistic", &["Effect", "Artistic"]), ("Brush Strokes", &["Effect", "Brush Strokes"]), @@ -313,11 +313,20 @@ fn stack_batch_params(stack: &[StackEntry]) -> Value { } /// Live canvas preview of the stack (`command.batch` would settle the dialog interaction each frame). +/// Typing in progress is kept as its own undo step first; only the gallery's own earlier preview is +/// canceled. fn preview_stack_on_canvas(app: &mut VectorcraftApp, stack: &[StackEntry]) { + if let Err(e) = app.keep_typing() { + app.status(e); + return; + } if app.session.in_interaction() { let _ = app.session.cancel_interaction(); } - let _ = app.session.begin_interaction("Effect Gallery"); + if let Err(e) = app.begin_interaction("Effect Gallery") { + app.status(e); + return; + } for (i, entry) in stack.iter().enumerate() { let params = Value::Object(entry.params.clone()); if app.run("effect.apply", json!({ "effect": entry.effect, "params": params })).is_err() { @@ -425,7 +434,7 @@ fn sample_drawing(w: usize, h: usize) -> Vec { out } -/// Run one Photoshop-style filter on a premultiplied RGBA buffer. Leaves it unchanged when `id` +/// Run one raster filter on a premultiplied RGBA buffer. Leaves it unchanged when `id` /// is not one of those filters or the buffer is the wrong size. fn apply_pixel(id: &str, params: &Map, data: &mut [u8], w: usize, h: usize) { let Some(n) = w.checked_mul(h).and_then(|n| n.checked_mul(4)) else { return }; @@ -766,6 +775,39 @@ mod tests { assert!(app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().appearance.effects.is_empty()); } + /// With Real-time Drawing off, typing in progress when the stack previews is kept as a step of + /// its own, not canceled with the gallery's earlier preview. + #[test] + fn stack_preview_keeps_typing_in_progress() { + use vectorcraft_tools::{PointerEvent, PointerKind}; + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 400})).unwrap(); + app.run("prefs.set", json!({"key": "realTimeDrawing", "value": false})).unwrap(); + let id = app.run("text.create", json!({"x": 100, "y": 100, "text": "Hello", "size": 20})).unwrap()["id"].as_u64().unwrap(); + let id = vectorcraft_doc::NodeId(id); + let v = vectorcraft_engine::ViewInfo::default(); + app.session.select_tool("type", v).unwrap(); + let b = app.session.active().unwrap().doc.bounds_of(&[id], false).unwrap(); + for k in [PointerKind::Down, PointerKind::Up] { + app.session.pointer(&PointerEvent::new(k, b.x1 - 1.0, b.center().y), v).unwrap(); + } + app.session.tool_text(" world", v).unwrap(); + let plain = |app: &VectorcraftApp| match &app.session.active().unwrap().doc.node(id).unwrap().kind { + vectorcraft_doc::NodeKind::Text(t) => t.plain_text(), + _ => panic!("not text"), + }; + assert_eq!(plain(&app), "Hello", "the typing waits"); + let steps = app.session.active().unwrap().history.undo.len(); + app.run("ui.effectGalleryDialog", json!({})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("stack".into(), json!([{ "effect": "artistic.cutout", "visible": true, "params": { "levels": 3 } }])); + frame(&mut app); + let st = app.session.active().unwrap(); + assert_eq!(st.interaction.as_ref().map(|it| it.label.as_str()), Some("Effect Gallery")); + assert_eq!(st.history.undo.len(), steps + 1, "the typing is a step of its own"); + assert_eq!(plain(&app), "Hello world"); + } + #[test] fn stack_ok_is_one_undo_step() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); diff --git a/crates/ui-egui/src/dialogs/eps_options.rs b/crates/ui-egui/src/dialogs/eps_options.rs index 8d34706df4..0eb1853065 100644 --- a/crates/ui-egui/src/dialogs/eps_options.rs +++ b/crates/ui-egui/src/dialogs/eps_options.rs @@ -6,14 +6,20 @@ //! Fields: `document.export` params (`format: eps`, `path?`, the artboard choice) and the EPS //! options of `document.exportEps`. OK remembers the options for next time and writes the file //! (asking where when there is no path); bad options keep the dialog open. +//! +//! Custom… beside the flattener preset opens Custom Transparency Flattener Options over the +//! dialog: its OK sets every flattener option as `flattener` (the preset then shows [Custom]) and +//! goes back to EPS Options; Cancel goes back with the options as they were. Choosing a preset +//! drops the custom options. use serde_json::{Map, Value, json}; -use vectorcraft_engine::cmd::{FlattenOptions, fileio}; +use vectorcraft_engine::cmd::{FlattenOptions, FlattenerPreset, fileio}; use vectorcraft_eps::{Level, Overprint, Preview}; use super::DialogSpec; use super::document_setup::{LABEL, check, choice}; use crate::state::Dialog; +use crate::theme::Tokens; use crate::{VectorcraftApp, io, widgets}; pub(super) const KIND: &str = "epsOptions"; @@ -25,7 +31,18 @@ pub(super) const SPEC: DialogSpec = DialogSpec { ok: Some("Export"), min_width: 420.0, max_width: Some(460.0), - inputs: |_| &["path"], + inputs: |_| &["path", "flattener"], + ..DialogSpec::FORM +}; + +/// Custom Transparency Flattener Options, opened over EPS Options by Custom…. +pub(super) const CUSTOM_KIND: &str = "epsFlattenerOptions"; + +pub(super) const CUSTOM_SPEC: DialogSpec = DialogSpec { + heading: |_| tl!("Custom Transparency Flattener Options").into(), + body: custom_body, + confirm: custom_confirm, + min_width: 420.0, ..DialogSpec::FORM }; @@ -61,11 +78,12 @@ pub fn open(app: &mut VectorcraftApp, params: &Value) { fields.extend(o.iter().map(|(k, v)| (k.clone(), v.clone()))); } } - fields.insert("format".into(), json!("eps")); - // A built-in preset named by id (`medium`) shows as its name. - if let Some(label) = fields.get("flattenerPreset").and_then(Value::as_str).and_then(|p| FlattenOptions::preset_label(&p.to_ascii_lowercase())) { - fields.insert("flattenerPreset".into(), json!(label)); + // A preset asked for without options of its own replaces the custom options used last. + if params.get("flattenerPreset").is_some() && params.get("flattener").is_none() { + fields.remove("flattener"); } + fields.insert("format".into(), json!("eps")); + builtin_label(&mut fields); app.ui.dialog = Some(Dialog::new(KIND, Value::Object(fields))); } @@ -90,8 +108,19 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { let overprints: Vec<(&str, &str)> = Overprint::ALL.iter().map(|o| (o.id(), o.label())).collect(); choice(ui, d, "overprints", tl!("Overprints:"), &overprints); let presets = app.session.flattener_presets(); - let names: Vec<(&str, &str)> = presets.iter().map(|p| (p.name.as_str(), p.name.as_str())).collect(); - choice(ui, d, "flattenerPreset", tl!("Preset:"), &names); + let current = flattener(d, &app.session.prefs.flattener_presets).ok(); + let mut custom = false; + widgets::label_row(ui, tl!("Preset:"), LABEL, |ui| { + if let Some(p) = super::flatten::preset_dropdown(ui, "eps-flattener-preset", &presets, &d.str("flattenerPreset"), current.as_ref(), 180.0) { + d.fields.insert("flattenerPreset".into(), json!(p.name)); + d.fields.remove("flattener"); + } + custom = widgets::flat_button_fit(ui, tl!("Custom…"), 72.0).clicked(); + }); + if custom { + *d = over(d, &app.session.prefs.flattener_presets); + return false; + } ui.add_space(8.0); widgets::subheader(ui, tl!("Fonts")); // Type is written as glyph outlines, which need no fonts. @@ -122,6 +151,81 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { false } +/// `ui.dialog.set` changed `field` of EPS Options `d`: a preset set there drops the Custom… +/// options, as choosing it in the dropdown does, and a built-in one named by id shows as its name. +pub(super) fn field_set(d: &mut Dialog, field: &str) { + if field == "flattenerPreset" { + d.fields.remove("flattener"); + builtin_label(&mut d.fields); + } +} + +/// A built-in preset named by id (`medium`) in `fields` shows as its name. +fn builtin_label(fields: &mut Map) { + if let Some(label) = fields.get("flattenerPreset").and_then(Value::as_str).and_then(|p| FlattenOptions::preset_label(&p.to_ascii_lowercase())) { + fields.insert("flattenerPreset".into(), json!(label)); + } +} + +/// The flattener options EPS Options `d` exports with: its preset, with the Custom… options over it. +fn flattener(d: &Dialog, saved: &[FlattenerPreset]) -> Result { + FlattenOptions::for_export(d.fields.get("flattenerPreset").and_then(Value::as_str), d.fields.get("flattener"), saved) +} + +/// Custom Transparency Flattener Options over EPS Options `parent`, on the options it exports with +/// (the default preset's while those are not valid), without alpha: EPS has none. +pub(super) fn over(parent: &Dialog, saved: &[FlattenerPreset]) -> Dialog { + let mut o = flattener(parent, saved).unwrap_or_default(); + o.preserve_alpha = false; + let mut d = Dialog::new(CUSTOM_KIND, json!({})); + super::flatten::put_options(&mut d.fields, &o); + d.fields.insert(super::PARENT.into(), serde_json::to_value(parent).unwrap_or_default()); + d +} + +/// The options Custom Transparency Flattener Options `d` holds. +fn custom_options(d: &Dialog) -> Result { + FlattenOptions::from_params_with(&Value::Object(d.fields.clone()), &[]) +} + +/// Whether the EPS Options under `d` keep overprints (Overprints: Preserve). +fn overprints_kept(d: &Dialog) -> bool { + super::parent(d).is_none_or(|p| Overprint::from_id(&p.str("overprints")) != Some(Overprint::Discard)) +} + +/// The flattener options; the two Preserve switches show what the export does and are set by the +/// format (no alpha) and by EPS Options' Overprints. +fn custom_body(_app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { + let current = custom_options(d); + // Values refused stay as entered, so that changing another option keeps them. The Preserve + // switches can't be set here, so the fields keep their own values of them. + let (mut o, unread) = super::flatten::shown_options(&d.fields, ¤t); + o.preserve_alpha = false; + o.preserve_overprints &= overprints_kept(d); + super::flatten::fields_editor(ui, "eps-flattener", &mut d.fields, &mut o, &unread, true); + if let Err(e) = ¤t { + ui.label(egui::RichText::new(e).color(Tokens::get(ui.ctx()).text_dim).size(11.5)); + } + ui.add_space(8.0); + super::form::caption(ui, tl!("EPS has no alpha transparency, and Overprints sets whether overprints are kept.")); + false +} + +/// OK: EPS Options again, exporting with these options (a built-in preset under them, so that +/// deleting a saved preset leaves them whole); bad options keep the dialog open. +fn custom_confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { + let mut o = custom_options(d)?; + o.preserve_alpha = false; + let mut parent = super::parent(d).ok_or("the dialog it was opened over is no longer open")?; + if FlattenOptions::preset(&parent.str("flattenerPreset")).is_none() { + let medium = FlattenOptions::preset_label(FlattenOptions::PRESETS[1]).unwrap_or_default(); + parent.fields.insert("flattenerPreset".into(), json!(medium)); + } + parent.fields.insert("flattener".into(), serde_json::to_value(&o).map_err(|e| e.to_string())?); + app.ui.dialog = Some(parent); + Ok(Value::Null) +} + /// Check the options, remember them, and write the file(s). fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { let params = fileio::eps::resolve(&super::form::params(d), &app.session.prefs.flattener_presets)?; diff --git a/crates/ui-egui/src/dialogs/expand.rs b/crates/ui-egui/src/dialogs/expand.rs index 383ea567df..cda98afada 100644 --- a/crates/ui-egui/src/dialogs/expand.rs +++ b/crates/ui-egui/src/dialogs/expand.rs @@ -1,7 +1,9 @@ //! Object → Expand: what to expand (Object: live shapes, type and effects; Fill: gradient and pattern fills; //! Stroke: strokes into filled outlines) and what gradient fills become (a gradient mesh, or a //! number of objects). Options the selection has nothing for are disabled. OK runs -//! `object.expand` as one undo step. +//! `object.expand` as one undo step and keeps its choices for the rest of the app's run: the dialog +//! opens on them, and Object › Expand… chosen with Alt (Option) expands with them at once +//! ([`expand_now`]). //! //! Fields: `object`, `fill`, `stroke`, `gradient` (`objects` | `mesh`), `steps` (1..1000), and //! `__object`, `__fill`, `__stroke` (that option has something to expand: `object.expand.info`), @@ -31,15 +33,51 @@ pub(crate) fn appearance_first() -> &'static str { tl!("Expand Appearance first (Object › Expand Appearance)") } -/// Open Expand for the selection, every option on (as `object.expand {}` does). A selection with -/// appearance attributes (effects, several fills or strokes…) refuses with [`appearance_first`]: -/// the menu item is dimmed for it. +/// Open Expand for the selection, on the choices OK last expanded with in this run of the app, or +/// every option on (as `object.expand {}` does) before that. A selection with appearance attributes +/// (effects, several fills or strokes…) refuses with [`appearance_first`]: the menu item is dimmed +/// for it. pub fn open(app: &mut VectorcraftApp) -> Result { + let fields = fields(app)?; + app.ui.dialog = Some(Dialog::new(KIND, fields)); + Ok(Value::Null) +} + +/// Object › Expand… chosen with Alt (Option): expand the selection at once, in one undo step, with +/// the choices OK last expanded with in this run of the app (the dialog's defaults before that), as +/// OK in the dialog opened on them would. When none of those choices has something to expand in the +/// selection, the dialog opens on them instead, and nothing changes. A selection with appearance +/// attributes refuses with [`appearance_first`], as [`open`] does. +pub fn expand_now(app: &mut VectorcraftApp) -> Result { + let d = Dialog::new(KIND, fields(app)?); + if !OPTIONS.iter().any(|(key, _)| d.bool(key) && option_enabled(&d, key)) { + app.ui.dialog = Some(d); + return Ok(Value::Null); + } + app.run(CMD, params(&d)) +} + +/// The choices OK last expanded with (`app.ui.expand_options`), when each one holds a value the +/// dialog shows: a switch for Object, Fill and Stroke, `objects` or `mesh`, and 1 to 1000 steps. +fn remembered(app: &VectorcraftApp) -> Option<&Value> { + let o = &app.ui.expand_options; + let switches = OPTIONS.iter().all(|(key, _)| o[key].is_boolean()); + let gradient = matches!(o["gradient"].as_str(), Some("objects" | "mesh")); + let steps = o["steps"].as_f64().is_some_and(|n| (1.0..=MAX_STEPS as f64).contains(&n.round())); + (switches && gradient && steps).then_some(o) +} + +/// The dialog's fields for the selection: the remembered choices (or the defaults) and what each +/// option has to expand. +fn fields(app: &mut VectorcraftApp) -> Result { let info = app.session.execute("object.expand.info", &json!({})).map_err(|e| e.to_string())?; if info["appearance"] == json!(true) { return Err(appearance_first().into()); } - let mut fields = json!({"object": true, "fill": true, "stroke": true, "gradient": "objects", "steps": DEFAULT_STEPS}); + let mut fields = match remembered(app) { + Some(o) => json!({"object": o["object"], "fill": o["fill"], "stroke": o["stroke"], "gradient": o["gradient"], "steps": o["steps"]}), + None => json!({"object": true, "fill": true, "stroke": true, "gradient": "objects", "steps": DEFAULT_STEPS}), + }; for (key, _) in OPTIONS { fields[format!("__{key}")] = info[key].clone(); } @@ -47,8 +85,7 @@ pub fn open(app: &mut VectorcraftApp) -> Result { for key in ["fill", "stroke", "gradient"] { fields[format!("__{key}_symbol")] = json!(info["symbolArt"][key] == json!(true)); } - app.ui.dialog = Some(Dialog::new(KIND, fields)); - Ok(Value::Null) + Ok(fields) } fn body(_: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { @@ -112,8 +149,12 @@ fn params(d: &Dialog) -> Value { }) } +/// OK: expand, and keep the choices once the expansion succeeded. fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { - run_and_close(app, CMD, params(d)) + let choices = params(d); + let r = run_and_close(app, CMD, choices.clone())?; + app.ui.expand_options = choices; + Ok(r) } #[cfg(test)] @@ -253,4 +294,140 @@ mod tests { app.run("select.none", json!({})).unwrap(); assert!(!crate::menus::enabled(&app, "ui.expandDialog")); } + + /// A rectangle with a linear gradient fill and no stroke is selected. + fn gradient_rectangle(app: &mut VectorcraftApp) { + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 100, "height": 60})).unwrap(); + app.run("paint.setFill", json!({"gradient": {"kind": "linear"}})).unwrap(); + app.run("paint.setStroke", json!({"none": true})).unwrap(); + } + + /// Object › Expand… from the in-window menu, with Alt held or not. + fn choose_expand(app: &mut VectorcraftApp, alt: bool) { + let entries = crate::menus::menu_entries(app); + let e = entries.iter().find(|e| e.path == ["Object"] && e.label == "Expand…").expect("Object › Expand…"); + assert!(e.enabled, "Expand… is available"); + let target = crate::menus::click_target(&e.label, e.command.as_deref().unwrap(), &e.params); + let held = if alt { egui::Modifiers::ALT } else { egui::Modifiers::NONE }; + let (cmd, p) = crate::menus::with_held_keys(target, held); + crate::menus::invoke(app, &cmd, p); + } + + /// Whether the selected object is a clip group holding a gradient mesh (Expand Gradient To › + /// Gradient Mesh) rather than solid objects. + fn expanded_to_a_mesh(app: &VectorcraftApp) -> bool { + let st = app.session.doc().unwrap(); + let g = st.doc.node(st.selection.objects[0]).unwrap(); + let NodeKind::Group { children, clip: true } = &g.kind else { panic!("a clip group: {:?}", g.kind) }; + children.iter().any(|c| matches!(c.kind, NodeKind::Mesh(_))) + } + + #[test] + fn the_dialog_opens_on_the_choices_ok_last_expanded_with() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + gradient_rectangle(&mut app); + choose_expand(&mut app, false); + let d = app.ui.dialog.as_mut().expect("the Expand dialog"); + d.fields.insert("gradient".into(), json!("mesh")); + d.fields.insert("steps".into(), json!(12)); + d.fields.insert("stroke".into(), json!(false)); + super::super::confirm(&mut app).unwrap(); + assert!(expanded_to_a_mesh(&app)); + app.run("edit.undo", json!({})).unwrap(); + let kept = json!({"object": true, "fill": true, "stroke": false, "gradient": "mesh", "steps": 12.0}); + choose_expand(&mut app, false); + assert_eq!(params(app.ui.dialog.as_ref().unwrap()), kept, "it opens on the choices OK expanded with"); + // Cancel leaves them as they were. + app.ui.dialog.as_mut().unwrap().fields.insert("gradient".into(), json!("objects")); + super::super::cancel(&mut app); + assert_eq!(app.ui.expand_options, kept); + // So does an OK that fails, and nothing changes. + choose_expand(&mut app, false); + app.ui.dialog.as_mut().unwrap().fields.insert("steps".into(), json!(5000)); + let before = app.session.doc().unwrap().doc.clone(); + assert!(super::super::confirm(&mut app).is_err()); + assert_eq!(app.session.doc().unwrap().doc, before); + assert_eq!(app.ui.expand_options, kept); + choose_expand(&mut app, false); + assert_eq!(params(app.ui.dialog.as_ref().unwrap()), kept); + } + + #[test] + fn alt_expands_at_once_with_the_choices_ok_last_expanded_with() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + gradient_rectangle(&mut app); + choose_expand(&mut app, false); + app.ui.dialog.as_mut().unwrap().fields.insert("gradient".into(), json!("mesh")); + super::super::confirm(&mut app).unwrap(); + app.run("edit.undo", json!({})).unwrap(); + let undo = app.session.doc().unwrap().history.undo.len(); + choose_expand(&mut app, true); + assert!(app.ui.dialog.is_none(), "no dialog"); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + assert!(expanded_to_a_mesh(&app), "the kept Gradient Mesh choice"); + } + + #[test] + fn alt_before_any_ok_expands_with_the_defaults() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + gradient_rectangle(&mut app); + let undo = app.session.doc().unwrap().history.undo.len(); + choose_expand(&mut app, true); + assert!(app.ui.dialog.is_none(), "no dialog"); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1); + assert!(!expanded_to_a_mesh(&app), "the gradient becomes objects, the default"); + assert!(app.ui.expand_options.is_null(), "Alt keeps no choices of its own"); + } + + #[test] + fn alt_opens_the_dialog_when_the_kept_choices_expand_nothing_in_the_selection() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.run("shape.rectangle", json!({"x": 20, "y": 20, "width": 100, "height": 60})).unwrap(); + // Fill alone was kept, and a plain rectangle has no gradient or pattern fill. + app.ui.expand_options = json!({"object": false, "fill": true, "stroke": false, "gradient": "objects", "steps": 255.0}); + let before = app.session.doc().unwrap().doc.clone(); + let undo = app.session.doc().unwrap().history.undo.len(); + choose_expand(&mut app, true); + let d = app.ui.dialog.as_ref().expect("the Expand dialog"); + assert_eq!(params(d), app.ui.expand_options, "it opens on the kept choices"); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo, "nothing recorded"); + assert_eq!(app.session.doc().unwrap().doc, before); + } + + #[test] + fn alt_refuses_a_selection_with_appearance_attributes_and_a_bad_immediate() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + zig_zag_line(&mut app); + let before = app.session.doc().unwrap().doc.clone(); + assert_eq!(app.run("ui.expandDialog", json!({"immediate": true})).unwrap_err(), appearance_first()); + assert!(app.ui.dialog.is_none()); + assert_eq!(app.session.doc().unwrap().doc, before, "the line is left as it was"); + app.run("effect.expandAppearance", json!({})).unwrap(); + assert!(app.run("ui.expandDialog", json!({"immediate": "yes"})).is_err()); + assert!(app.ui.dialog.is_none()); + app.run("ui.expandDialog", json!({"immediate": false})).unwrap(); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND)); + } + + #[test] + fn kept_choices_with_a_value_the_dialog_does_not_show_are_left_out() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + gradient_rectangle(&mut app); + for bad in [ + json!({"object": "yes", "fill": true, "stroke": true, "gradient": "mesh", "steps": 12}), + json!({"object": true, "fill": true, "stroke": true, "gradient": "strips", "steps": 12}), + json!({"object": true, "fill": true, "stroke": true, "gradient": "mesh", "steps": 0}), + json!({"object": true, "fill": true, "stroke": true, "gradient": "mesh"}), + ] { + app.ui.expand_options = bad; + app.run("ui.expandDialog", json!({})).unwrap(); + assert_eq!( + params(app.ui.dialog.as_ref().unwrap()), + json!({"object": true, "fill": true, "stroke": true, "gradient": "objects", "steps": 255.0}) + ); + app.ui.dialog = None; + } + } } diff --git a/crates/ui-egui/src/dialogs/export_for_screens.rs b/crates/ui-egui/src/dialogs/export_for_screens.rs index 026f477a0e..298e6d2c45 100644 --- a/crates/ui-egui/src/dialogs/export_for_screens.rs +++ b/crates/ui-egui/src/dialogs/export_for_screens.rs @@ -1,4 +1,4 @@ -//! File → Export → Export for Screens, laid out as Illustrator's: on the left the Artboards and +//! File → Export → Export for Screens: on the left the Artboards and //! Assets tabs (thumbnails with checkboxes, in a grid or a list), Clear Selection and the prefix; //! on the right Select (All, a range or Full Document, Include Bleed, Include Artboard Fill), the destination (folder //! picker, Open Location after Export, Create Sub-folders by scale or by format; the web downloads @@ -721,7 +721,7 @@ fn tiles( ui.painter().galley(label_pos, galley, t.text); false }; - // The checkbox sits on the thumbnail's lower left corner, as Illustrator's. + // The checkbox sits on the thumbnail's lower left corner. let bx = egui::Rect::from_min_size(egui::pos2(pic.left() + 4.0, pic.bottom() - 18.0), egui::vec2(14.0, 14.0)); let mut child = ui.new_child(egui::UiBuilder::new().max_rect(bx)); if widgets::check_box(&mut child, &name, checked, true) || resp.clicked() || caption_clicked { diff --git a/crates/ui-egui/src/dialogs/flatten.rs b/crates/ui-egui/src/dialogs/flatten.rs index 0c5bc7dbee..a22631c8e2 100644 --- a/crates/ui-egui/src/dialogs/flatten.rs +++ b/crates/ui-egui/src/dialogs/flatten.rs @@ -48,6 +48,53 @@ pub(crate) fn put_options(fields: &mut Map, o: &FlattenOptions) { } } +/// The options `fields` hold over `base` as they were entered, values out of range included, for +/// the editor to show while [`FlattenOptions::from_params_with`] refuses them, and the keys of the +/// values of the wrong type, which take `base`'s value here and show blank in the editor. +pub(crate) fn entered_options(fields: &Map, base: &FlattenOptions) -> (FlattenOptions, Vec) { + let Ok(Value::Object(mut v)) = serde_json::to_value(base) else { return (base.clone(), Vec::new()) }; + let mut unread = Vec::new(); + for (k, val) in fields { + let Some(slot) = v.get_mut(k) else { continue }; + let old = std::mem::replace(slot, val.clone()); + if serde_json::from_value::(Value::Object(v.clone())).is_err() { + v.insert(k.clone(), old); + unread.push(k.clone()); + } + } + (serde_json::from_value(Value::Object(v)).unwrap_or_else(|_| base.clone()), unread) +} + +/// The options a dialog's `fields` hold, for [`fields_editor`]: `current` when they are valid, else +/// the values entered over the default preset's, with the keys of the values of the wrong type. +pub(crate) fn shown_options(fields: &Map, current: &Result) -> (FlattenOptions, Vec) { + match current { + Ok(o) => (o.clone(), Vec::new()), + Err(_) => entered_options(fields, &FlattenOptions::default()), + } +} + +/// [`options_editor`] on the option fields of a dialog: `o` and `unread` from [`shown_options`]. +/// Each option whose control was set is written into `fields`, also when it equals the value shown, +/// so that it replaces a value of the wrong type; the other fields stay as they were entered. With +/// `fixed_preserve`, the two Preserve switches show but can't be changed. +pub(crate) fn fields_editor( + ui: &mut egui::Ui, + id: &str, + fields: &mut Map, + o: &mut FlattenOptions, + unread: &[String], + fixed_preserve: bool, +) { + let set = editor(ui, id, o, true, fixed_preserve, unread); + let Ok(Value::Object(m)) = serde_json::to_value(&*o) else { return }; + for k in set { + if let Some(v) = m.get(k) { + fields.insert(k.into(), v.clone()); + } + } +} + /// The options the fields hold (a `preset` not loaded yet: its own). fn options(d: &Dialog, saved: &[FlattenerPreset]) -> Result { if d.str("preset") != d.str(APPLIED) { @@ -101,10 +148,9 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { save_row(app, ui, d); } ui.add_space(10.0); - let mut o = current.clone().unwrap_or_default(); - if options_editor(ui, "flatten-dialog", &mut o, true) { - put_options(&mut d.fields, &o); - } + // Values refused stay as entered, so that changing another option keeps them. + let (mut o, unread) = shown_options(&d.fields, ¤t); + fields_editor(ui, "flatten-dialog", &mut d.fields, &mut o, &unread, false); if let Err(e) = ¤t { ui.label(egui::RichText::new(e).color(Tokens::get(ui.ctx()).text_dim).size(11.5)); } @@ -180,8 +226,19 @@ const FIELD: f32 = 56.0; /// panel edit them: the raster/vector balance, both resolutions and the six switches. Returns true /// when one changed. pub(crate) fn options_editor(ui: &mut egui::Ui, id: &str, o: &mut FlattenOptions, enabled: bool) -> bool { - let t = Tokens::get(ui.ctx()); let before = o.clone(); + editor(ui, id, o, enabled, false, &[]); + *o != before +} + +/// The option controls, with the value fields of the options named in `unread` blank. With +/// `fixed_preserve`, Preserve Alpha Transparency and Preserve Overprints and Spot Colors show but +/// can't be changed (the file format or another control sets them). Returns the keys of the +/// options whose controls were set, also to the value they showed. +fn editor(ui: &mut egui::Ui, id: &str, o: &mut FlattenOptions, enabled: bool, fixed_preserve: bool, unread: &[String]) -> Vec<&'static str> { + let t = Tokens::get(ui.ctx()); + let mut set = Vec::new(); + let field_value = |key: &str, v: f64| (!unread.iter().any(|k| k == key)).then_some(v); let dim = |ui: &mut egui::Ui, s: &str| { ui.label(egui::RichText::new(tl!(s)).color(t.text_dim).size(11.5)); }; @@ -203,44 +260,51 @@ pub(crate) fn options_editor(ui: &mut egui::Ui, id: &str, o: &mut FlattenOptions ); if let Some(b) = x.map(|x| (x as f64 * 100.0).round()).or(keyed) { o.balance = b; + set.push("balance"); } dim(ui, tl!("Vectors")); + let value = field_value("balance", o.balance); if let Some(v) = - widgets::range_field_named(ui, (id, "balance"), Some(tl!("Raster/Vector Balance:")), o.balance, 0.0..=100.0, "", 0, FIELD - 12.0) + widgets::range_field_named(ui, (id, "balance"), Some(tl!("Raster/Vector Balance:")), value, 0.0..=100.0, "", 0, FIELD - 12.0) { o.balance = v; + set.push("balance"); } }); ui.add_space(4.0); egui::Grid::new((id, "resolutions")).num_columns(2).spacing([8.0, 4.0]).show(ui, |ui| { - for (label, key) in [(tl!("Line Art and Text Resolution:"), 0), (tl!("Gradient and Mesh Resolution:"), 1)] { + for (label, key, name) in + [(tl!("Line Art and Text Resolution:"), 0, "lineArtPpi"), (tl!("Gradient and Mesh Resolution:"), 1, "gradientPpi")] + { widgets::dim_label(ui, label); ui.horizontal(|ui| { let v = if key == 0 { &mut o.line_art_ppi } else { &mut o.gradient_ppi }; - if let Some(n) = widgets::range_field_named(ui, (id, key), Some(label), *v, 1.0..=2400.0, "", 0, FIELD) { + if let Some(n) = widgets::range_field_named(ui, (id, key), Some(label), field_value(name, *v), 1.0..=2400.0, "", 0, FIELD) { *v = n; + set.push(name); } - dim(ui, "ppi"); + dim(ui, super::ppi_suffix().trim()); }); ui.end_row(); } }); ui.add_space(4.0); - let switches: [(&str, &mut bool); 6] = [ - (tl!("Convert All Text to Outlines"), &mut o.text_to_outlines), - (tl!("Convert All Strokes to Outlines"), &mut o.strokes_to_outlines), - (tl!("Clip Complex Regions"), &mut o.clip_complex_regions), - (tl!("Anti-alias Rasters"), &mut o.anti_alias), - (tl!("Preserve Alpha Transparency"), &mut o.preserve_alpha), - (tl!("Preserve Overprints and Spot Colors"), &mut o.preserve_overprints), + let switches: [(&str, &mut bool, bool, &'static str); 6] = [ + (tl!("Convert All Text to Outlines"), &mut o.text_to_outlines, false, "textToOutlines"), + (tl!("Convert All Strokes to Outlines"), &mut o.strokes_to_outlines, false, "strokesToOutlines"), + (tl!("Clip Complex Regions"), &mut o.clip_complex_regions, false, "clipComplexRegions"), + (tl!("Anti-alias Rasters"), &mut o.anti_alias, false, "antiAlias"), + (tl!("Preserve Alpha Transparency"), &mut o.preserve_alpha, fixed_preserve, "preserveAlpha"), + (tl!("Preserve Overprints and Spot Colors"), &mut o.preserve_overprints, fixed_preserve, "preserveOverprints"), ]; - for (label, v) in switches { - if widgets::check(ui, label, *v, enabled) { + for (label, v, fixed, key) in switches { + if widgets::check(ui, label, *v, enabled && !fixed) { *v = !*v; + set.push(key); } } }); - *o != before + set } #[cfg(test)] @@ -394,4 +458,42 @@ mod tests { assert!(super::super::confirm(&mut app).unwrap_err().contains("resolutions")); assert!(app.ui.dialog.is_some()); } + + /// Changing a switch beside a value out of range keeps the values entered. + #[test] + fn a_switch_changed_beside_a_bad_value_keeps_the_values_entered() { + let mut app = scene(); + app.run("ui.flattenTransparencyDialog", json!({})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("balance".into(), json!(20)); + d.fields.insert("gradientPpi".into(), json!(9000)); + d.fields.insert("lineArtPpi".into(), json!("many")); + let mut f = super::super::tests_eps::Frames::new(); + let (_, at) = f.control(&mut app, "Convert All Text to Outlines", egui::accesskit::Role::CheckBox); + let before = app.ui.dialog.as_ref().unwrap().bool("textToOutlines"); + f.click(&mut app, at); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!(d.bool("textToOutlines"), !before, "the switch changes"); + assert_eq!((d.f64("balance", 0.0), d.f64("gradientPpi", 0.0)), (20.0, 9000.0), "the other values stay as entered"); + assert_eq!(d.fields["lineArtPpi"], json!("many"), "a value of the wrong type stays to be refused"); + assert!(super::super::confirm(&mut app).is_err()); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("lineArtPpi".into(), json!(300)); + assert!(super::super::confirm(&mut app).unwrap_err().contains("resolutions")); + } + + /// A value of the wrong type shows blank, and typing the default preset's value into its + /// field replaces it, so OK flattens. + #[test] + fn the_default_value_typed_over_a_value_of_the_wrong_type_replaces_it() { + let mut app = scene(); + app.run("ui.flattenTransparencyDialog", json!({})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("lineArtPpi".into(), json!("many")); + let default = FlattenOptions::default().line_art_ppi; + let mut f = super::super::tests_eps::Frames::new(); + f.type_into(&mut app, "Line Art and Text Resolution:", &default.to_string()); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["lineArtPpi"], json!(default)); + super::super::confirm(&mut app).unwrap(); + assert!(app.ui.dialog.is_none() && !transparent_left(&app)); + } } diff --git a/crates/ui-egui/src/dialogs/form.rs b/crates/ui-egui/src/dialogs/form.rs index d386c1f028..733ff22398 100644 --- a/crates/ui-egui/src/dialogs/form.rs +++ b/crates/ui-egui/src/dialogs/form.rs @@ -503,7 +503,9 @@ pub(super) fn param_fields( } } Value::Number(n) => { - if let Some(x) = crate::widgets::plain_field(ui, ("fx-num", &k), n.as_f64().unwrap_or(0.0), "", 3, 140.0) { + // A resolution (Object › Rasterize's `ppi`) shows its unit in the UI language. + let suffix = if k == "ppi" { crate::i18n::fill_once(tl!("{n} ppi"), &[("n", "")]) } else { String::new() }; + if let Some(x) = crate::widgets::plain_field(ui, ("fx-num", &k), n.as_f64().unwrap_or(0.0), &suffix, 3, 140.0) { d.fields.insert(k.clone(), typed_number(x)); changed = true; } @@ -778,6 +780,12 @@ pub(crate) fn unit_suffix(unit: &str) -> String { if unit.is_empty() || unit.starts_with(['°', '%', '′', '″']) { unit.to_string() } else { format!(" {unit}") } } +/// What a resolution field shows after its value in the interface language: the `{n} ppi` row +/// without its number (" ppi", French " ppp"). +pub(crate) fn ppi_suffix() -> String { + crate::i18n::fill_once(tl!("{n} ppi"), &[("n", "")]) +} + /// A number of a list as [`value_field`] shows it: at most 4 decimals, without trailing zeros. fn number_text(x: f64) -> String { let s = format!("{x:.4}"); @@ -798,6 +806,7 @@ pub(crate) fn humanize(k: &str) -> String { } } match s.as_str() { + "Ppi" => "Resolution:".into(), "Dx" => "Horizontal".into(), "Dy" => "Vertical".into(), "Sx" => "Horizontal %".into(), @@ -828,6 +837,8 @@ pub(crate) fn humanize(k: &str) -> String { "Create" => "Create New Fields by:".into(), "Height Width" => "Height/Width:".into(), "Traps With Process Color" => "Traps with Process Color:".into(), + "Cols" => "Columns:".into(), + "Flip Cols" => "Flip Columns:".into(), _ => format!("{s}:"), } } @@ -1040,7 +1051,12 @@ fn preview_or_rollback(app: &mut crate::VectorcraftApp, d: &mut Dialog, label: & pub(super) fn preview_now(app: &mut crate::VectorcraftApp, d: &mut Dialog, label: &str, cmd: &str, params: Value) -> Option { let mut result = None; if d.fields.get(PREVIEWED) != Some(¶ms) || !app.session.in_interaction() { - let _ = app.session.begin_interaction(label); + // A failure to begin (typing that can't be kept) shows, and nothing previews on the + // interaction still in progress. + if let Err(e) = app.begin_interaction(label) { + app.status(e); + return None; + } match app.session.preview(cmd, ¶ms) { Ok(r) => { d.fields.remove(REFUSED); @@ -1154,6 +1170,27 @@ mod plugin_field_tests { assert_eq!([shown("mm"), shown("°"), shown("%"), shown("1/min"), shown("µm")], ["5 mm", "5°", "5%", "5 1/min", "5 µm"]); } + /// A resolution field's unit is the `{n} ppi` row without its number. + #[test] + fn the_ppi_unit_is_translated() { + assert_eq!(ppi_suffix(), " ppi"); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").unwrap()); + let fr = ppi_suffix(); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert_eq!(fr, " ppp"); + } + + /// [`ppi_suffix`] drops the number from the `{n} ppi` row, so every catalog writes the number + /// first and then a space before the unit. + #[test] + fn every_catalog_writes_the_ppi_unit_after_the_number() { + for lang in crate::i18n::Lang::all() { + let row = crate::i18n::tr(lang, "{n} ppi"); + let unit = row.strip_prefix("{n}").unwrap_or_default(); + assert!(unit.starts_with(char::is_whitespace) && !unit.trim().is_empty(), "{}: {row:?}", lang.code()); + } + } + #[test] fn number_lists_read_as_typed_within_their_limits() { let spec = ParamSpec::NumberList { min: 0.0, max: 360.0, default: vec![45.0], min_items: 1, max_items: 3 }; @@ -1167,6 +1204,98 @@ mod plugin_field_tests { } } +#[cfg(test)] +mod settled_typing_tests { + use super::*; + use vectorcraft_engine::{Session, ViewInfo}; + use vectorcraft_tools::{PointerEvent, PointerKind}; + + /// An app with Real-time Drawing off and " world" typed after "Hello", not yet applied → the + /// type's id. + fn typing(app: &mut crate::VectorcraftApp) -> u64 { + app.run("file.new", json!({"width": 400, "height": 400})).unwrap(); + app.run("prefs.set", json!({"key": "realTimeDrawing", "value": false})).unwrap(); + let id = app.run("text.create", json!({"x": 100, "y": 100, "text": "Hello", "size": 20})).unwrap()["id"].as_u64().unwrap(); + let v = ViewInfo::default(); + app.session.select_tool("type", v).unwrap(); + let b = app.session.active().unwrap().doc.bounds_of(&[vectorcraft_doc::NodeId(id)], false).unwrap(); + for k in [PointerKind::Down, PointerKind::Up] { + app.session.pointer(&PointerEvent::new(k, b.x1 - 1.0, b.center().y), v).unwrap(); + } + app.session.tool_text(" world", v).unwrap(); + id + } + + fn plain(app: &crate::VectorcraftApp, id: u64) -> String { + match &app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().kind { + vectorcraft_doc::NodeKind::Text(t) => t.plain_text(), + _ => panic!("not text"), + } + } + + /// A dialog's preview while typing is in progress keeps the typing as its own step and starts + /// from it; the status bar shows the warning of the typing's preview that keeping it applied. + #[test] + fn a_dialog_preview_keeps_the_typing_and_shows_its_warning() { + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + let id = typing(&mut app); + assert_eq!(plain(&app, id), "Hello", "the typing waits"); + let steps = app.session.active().unwrap().history.undo.len(); + let mut d = Dialog::new("test", json!({})); + assert!(preview_now(&mut app, &mut d, "Fill Color", "paint.setFill", json!({"color": "#00a000"})).is_some()); + assert_eq!(plain(&app, id), "Hello world"); + let st = app.session.active().unwrap(); + assert_eq!(st.history.undo.len(), steps + 1, "the typing is a step of its own"); + assert_eq!(st.interaction.as_ref().map(|it| it.label.as_str()), Some("Fill Color")); + + // The typing's deferred preview warns that type is skipped (as Bloat does with type selected). + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 400})).unwrap(); + let rect = app.run("shape.rectangle", json!({"x": 100, "y": 100, "width": 200, "height": 200})).unwrap(); + let text = app.run("text.create", json!({"x": 300, "y": 200, "text": "Hi"})).unwrap(); + app.run("select.set", json!({"ids": [rect["id"], text["id"]]})).unwrap(); + app.run("prefs.set", json!({"key": "realTimeDrawing", "value": false})).unwrap(); + app.session.begin_interaction("Typing").unwrap(); + let p = json!({"tool": "bloat", "points": [[290.0, 200.0]], "width": 200.0, "height": 200.0}); + app.session.doc_mut().unwrap().interaction.as_mut().unwrap().preview = Some(("object.liquify".into(), p)); + app.ui.status.clear(); + let mut d = Dialog::new("test", json!({})); + assert!(preview_now(&mut app, &mut d, "Fill Color", "paint.setFill", json!({"color": "#00a000"})).is_some()); + assert!(app.ui.status.contains("type"), "{:?}", app.ui.status); + } + + /// The font menus end the typing session before their preview: the typing Real-time Drawing + /// off left unapplied is kept as a step of its own. + #[test] + fn ending_typing_for_the_font_menus_keeps_the_typing() { + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + let id = typing(&mut app); + let steps = app.session.active().unwrap().history.undo.len(); + crate::panels::character::end_typing(&mut app); + assert_eq!(plain(&app, id), "Hello world"); + let st = app.session.active().unwrap(); + assert_eq!(st.history.undo.len(), steps + 1); + assert!(st.interaction.is_none()); + assert_ne!(app.session.tool_options().get("typing").and_then(Value::as_bool), Some(true), "the typing session is over"); + } + + /// A Character panel change keeps the typing first and acts on the characters the Type tool + /// selected in the typed text, not on a selection cut short to the text before the typing. + #[test] + fn a_character_change_acts_on_characters_selected_in_the_typing() { + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + let id = typing(&mut app); + app.session.set_tool_option("select", &json!({"start": 6, "end": 11})); + crate::panels::character::range_style(&mut app, json!({"underline": true})); + assert_eq!(plain(&app, id), "Hello world"); + let vectorcraft_doc::NodeKind::Text(t) = &app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().kind else { + panic!("not text") + }; + let underlined: String = t.runs.iter().filter(|r| r.style.underline).map(|r| r.text.as_str()).collect(); + assert_eq!(underlined, "world"); + } +} + #[cfg(test)] mod typed_number_tests { use super::*; diff --git a/crates/ui-egui/src/dialogs/graph_data.rs b/crates/ui-egui/src/dialogs/graph_data.rs index 90cc7d9f55..ab46dbd82c 100644 --- a/crates/ui-egui/src/dialogs/graph_data.rs +++ b/crates/ui-egui/src/dialogs/graph_data.rs @@ -28,14 +28,13 @@ use crate::{VectorcraftApp, widgets}; pub const KIND: &str = "graphData"; /// The sheet's size: a row of labels over a graph's categories, a column of labels before its -/// series; the least it shows; a cell's longest text. +/// series; the least it shows. const MAX_ROWS: usize = MAX_GRAPH_CATEGORIES + 1; const MAX_COLS: usize = MAX_GRAPH_SERIES + 1; const MIN_ROWS: usize = 8; const MIN_COLS: usize = 6; -const MAX_CELL: usize = 256; /// The largest file Import Data reads, 1 MB (1,048,576 bytes), the same as Import Data Sets'. -const MAX_IMPORT_BYTES: usize = 1 << 20; +const MAX_IMPORT_BYTES: usize = vectorcraft_engine::cmd::MAX_GRAPH_DATA_FILE; /// The Cell Style limits (Adjust column width and decimal digits). const MAX_DECIMALS: u64 = 10; const MAX_WIDTH: u64 = 20; @@ -105,75 +104,25 @@ pub(crate) fn grid_from_data(v: &Value) -> Grid { grid } -/// The sheet as `graph.setData` takes it: series labels, category labels (none when all are blank) -/// and the values (a blank cell, or text that isn't a number, has none), without the empty rows and -/// columns past the data. +/// The sheet as `graph.setData` takes it ([`vectorcraft_engine::cmd::graph_data_from_grid`]), +/// which Import Data Sets' `%` columns also use. pub(crate) fn data_from_grid(grid: &Grid) -> Value { - let filled = |s: &String| !s.trim().is_empty(); - // At most a graph's rows and columns, as a file gives (`grid_from_text`): a grid sent by - // automation is any size, and the values are their product. - let grid = &grid[..grid.len().min(MAX_ROWS)]; - let rows = grid.iter().rposition(|r| r.iter().take(MAX_COLS).any(filled)).map_or(1, |i| i + 1).max(1); - let cols = grid.iter().take(rows).filter_map(|r| r.iter().take(MAX_COLS).rposition(filled)).max().map_or(1, |i| i + 1).max(1); - let label = |s: &str| { - let s = s.trim(); - // A label typed in straight quotes (as the CSV form takes a number as a label) is the text inside. - s.strip_prefix('"').and_then(|t| t.strip_suffix('"')).unwrap_or(s).to_string() - }; - // Series labels up to the last one given (none when all are blank). - let mut series: Vec = (1..cols).map(|c| label(&cell(grid, 0, c))).collect(); - while series.last().is_some_and(String::is_empty) { - series.pop(); - } - let mut categories: Vec = (1..rows).map(|r| label(&cell(grid, r, 0))).collect(); - if categories.iter().all(String::is_empty) { - categories.clear(); - } - let values: Vec> = (1..rows) - .map(|r| { - (1..cols) - .map(|c| { - let t = cell(grid, r, c); - t.trim().parse::().ok().filter(|v| v.is_finite() && !t.trim().starts_with('"')).map_or(Value::Null, |v| json!(v)) - }) - .collect() - }) - .collect(); - json!({ "series": series, "categories": categories, "rows": values }) + vectorcraft_engine::cmd::graph_data_from_grid(grid) } -/// Text from a file or the clipboard as cells: tab-separated when any line holds a tab, else -/// comma-separated (decided once, so a label with a comma in a tab-separated file stays whole), at -/// most a graph's rows and columns. +/// Text from a file or the clipboard as cells ([`vectorcraft_engine::cmd::graph_grid_from_text`]). pub(crate) fn grid_from_text(text: &str) -> Grid { - let sep = if text.contains('\t') { '\t' } else { ',' }; - text.lines().take(MAX_ROWS).map(|l| l.trim_end_matches('\r').split(sep).take(MAX_COLS).map(|c| clean(c.trim())).collect()).collect() + vectorcraft_engine::cmd::graph_grid_from_text(text) } -/// A text file's bytes as text: UTF-16 with its byte-order mark (spreadsheets' "Unicode Text"), -/// else UTF-16 without one when the bytes hold NUL bytes and Import Data Sets' rule gives them a -/// byte order ([`vectorcraft_engine::cmd::utf16_order_without_mark`]), else UTF-8 with or without -/// one. UTF-16 is read as it is after a byte-order mark: an odd last byte is left out, and an -/// unpaired surrogate reads as U+FFFD. +/// A text file's bytes as text ([`vectorcraft_engine::cmd::graph_data_text`]). pub(crate) fn decode(bytes: &[u8]) -> String { - let utf16 = |rest: &[u8], le: bool| { - let units: Vec = rest.as_chunks::<2>().0.iter().map(|p| if le { u16::from_le_bytes(*p) } else { u16::from_be_bytes(*p) }).collect(); - String::from_utf16_lossy(&units) - }; - match bytes { - [0xFF, 0xFE, rest @ ..] => utf16(rest, true), - [0xFE, 0xFF, rest @ ..] => utf16(rest, false), - [0xEF, 0xBB, 0xBF, rest @ ..] => String::from_utf8_lossy(rest).into_owned(), - _ => match bytes.contains(&0).then(|| vectorcraft_engine::cmd::utf16_order_without_mark(bytes)).flatten() { - Some(le) => utf16(bytes, le), - None => String::from_utf8_lossy(bytes).into_owned(), - }, - } + vectorcraft_engine::cmd::graph_data_text(bytes) } -/// A cell's text: one line (tabs and line breaks become spaces), at most MAX_CELL characters. +/// A cell's text ([`vectorcraft_engine::cmd::graph_cell_text`]). fn clean(s: &str) -> String { - s.chars().map(|c| if matches!(c, '\t' | '\r' | '\n') { ' ' } else { c }).take(MAX_CELL).collect() + vectorcraft_engine::cmd::graph_cell_text(s) } fn cell(grid: &[Vec], r: usize, c: usize) -> String { diff --git a/crates/ui-egui/src/dialogs/justification.rs b/crates/ui-egui/src/dialogs/justification.rs index 168f5cfda1..c10e5b00bc 100644 --- a/crates/ui-egui/src/dialogs/justification.rs +++ b/crates/ui-egui/src/dialogs/justification.rs @@ -92,8 +92,7 @@ pub fn open(app: &mut VectorcraftApp) -> Result { // While typing, the dialog acts on the paragraphs of the text being edited. let mut targets = json!({}); let mut story = None; - if let Some((id, a, b)) = crate::panels::character::text_editing(app) { - crate::panels::character::end_typing(app); + if let Some((id, a, b)) = crate::panels::character::text_editing_kept(app)? { targets = json!({"ids": [id.0], "start": a, "end": b}); // After Select All in threaded text: every paragraph of every frame ([`params`]). story = crate::panels::character::text_story(app).map(|_| id.0); diff --git a/crates/ui-egui/src/dialogs/png_options.rs b/crates/ui-egui/src/dialogs/png_options.rs index 8965564430..4fc66757ac 100644 --- a/crates/ui-egui/src/dialogs/png_options.rs +++ b/crates/ui-egui/src/dialogs/png_options.rs @@ -155,7 +155,7 @@ fn body(_: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { d.fields.insert("__otherPpi".into(), json!(i == 3)); } if preset.is_none() - && let Some(v) = widgets::range_field(ui, "ro-ppi-other", ppi, 1.0..=4608.0, " ppi", 0, 80.0) + && let Some(v) = widgets::range_field(ui, "ro-ppi-other", ppi, 1.0..=4608.0, &super::ppi_suffix(), 0, 80.0) { d.fields.insert("ppi".into(), json!(v)); } diff --git a/crates/ui-egui/src/dialogs/raster_effects.rs b/crates/ui-egui/src/dialogs/raster_effects.rs index cc7ed96f44..d28c30b041 100644 --- a/crates/ui-egui/src/dialogs/raster_effects.rs +++ b/crates/ui-egui/src/dialogs/raster_effects.rs @@ -59,7 +59,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } } if preset.is_none() - && let Some(v) = widgets::plain_field(ui, "raster-ppi", ppi, " ppi", 0, 80.0) + && let Some(v) = widgets::plain_field(ui, "raster-ppi", ppi, &super::ppi_suffix(), 0, 80.0) { d.fields.insert("resolution".into(), json!(v)); } @@ -124,7 +124,7 @@ pub(super) fn effect_fields(app: &VectorcraftApp, ui: &mut egui::Ui, d: &mut Dia } if !document && preset.is_none() - && let Some(v) = widgets::plain_field(ui, "rasterize-ppi", ppi, " ppi", 0, 80.0) + && let Some(v) = widgets::plain_field(ui, "rasterize-ppi", ppi, &super::ppi_suffix(), 0, 80.0) { d.fields.insert("resolution".into(), json!(v)); } diff --git a/crates/ui-egui/src/dialogs/recolor.rs b/crates/ui-egui/src/dialogs/recolor.rs index e3829f92b5..ff57bd6817 100644 --- a/crates/ui-egui/src/dialogs/recolor.rs +++ b/crates/ui-egui/src/dialogs/recolor.rs @@ -46,6 +46,22 @@ //! Opened on colours alone (the Color Guide's Edit or Apply Colors without art), OK saves the new //! colours as a colour group named `groupName`. //! +//! The Color Groups list on the right (under the tabs in a window too narrow for both; the Show +//! Color Groups button beside the tabs shows or hides it, and it opens shown) lists the document's color groups with their colors. A click on one makes it +//! the group being edited, as opening on it would: with art the art is reduced to as many rows as +//! it has colors, which become their new colors, and without art the rows are its colors. Save +//! Changes rewrites the selected group with the rows' new colors (`swatch.editGroup`, renamed by +//! `groupName`), New Color Group saves them as a new group (`swatch.newGroup`), and Delete removes +//! the selected group with its swatches (`swatch.delete`); each is a step of its own, which the +//! Swatches panel shows. When the art has colors of the group, Save Changes keeps the group's +//! swatches in order: a swatch whose color a row lists takes that row's new color (its own color +//! when the row is excluded), and every other swatch keeps its color. After a save with art the +//! rows' new colors take the Global Adjust, which goes back to 0%. When the save recolors art +//! linked to the group's global swatches, the rows are read from the art again (a color the save +//! gave the art is excluded, and a color the art had before keeps its row's new color). Until the +//! rows or the Global Adjust change, OK changes the saved group only by its name. After a Delete +//! without art, OK saves the rows as a new color group. +//! //! The Color Theme Picker button beside the tabs turns on picking from the canvas: a click on an //! object takes the palette of the object a Selection tool click takes, a drag takes the palette //! of the art inside its marquee, and Shift adds to the picks so far (`recolor.pickTheme`). The @@ -68,8 +84,11 @@ //! show hue and brightness; `hueSaturation`, unset or any other value: hue and saturation), `themePicker` (the Color Theme Picker is on), `themePicks` (its picks, as //! `recolor.pickTheme`'s `picks`; a new list recolors the rows), `weights` (one per row, as //! `recolor.weigh`'s; a new list moves the rows' current colors toward them), `findColors` (Find is -//! on; it shows the art so on the Assign tab, with art and rows selected). Changing `colors`, a -//! preserve flag or `limitTo` reduces the rows again (and drops `weights`). +//! on; it shows the art so on the Assign tab, with art and rows selected), `groupStorage` (the +//! Color Groups list is shown), `groupAction` (`save`, `new` or `delete`: the list's buttons, +//! checked as the field is set and run by the next frame, or by OK first). Setting `group` to a color group's name selects it in the list, and null +//! selects none. Changing `colors`, a preserve flag or `limitTo` reduces the rows again (and drops +//! `weights`). use egui::{Rect, Sense, Ui, pos2, vec2}; use serde_json::{Value, json}; @@ -96,10 +115,25 @@ pub(super) const SPEC: DialogSpec = DialogSpec { confirm, preview: true, min_width: 540.0, - max_width: Some(560.0), + max_width: Some(MAIN_W + STORAGE_GAP + STORAGE_W), + inputs: |_| &[GROUP_ACTION], ..DialogSpec::FORM }; +/// Widths of the dialog's main part (the tabs), of the Color Groups list and of the gap between +/// them; the height of a group's row in the list. +const MAIN_W: f32 = 560.0; +const STORAGE_W: f32 = 170.0; +const STORAGE_GAP: f32 = 12.0; +const GROUP_ROW_H: f32 = 34.0; +/// The fields of the Color Groups list: whether it is shown, a request from its buttons, and the +/// group whose colors the rows were last given. +const GROUP_STORAGE: &str = "groupStorage"; +const GROUP_ACTION: &str = "groupAction"; +const GROUP_LOADED: &str = "__groupLoaded"; +/// The `recolor.reduce` parameters the art's rows were last reduced with. +const REDUCED: &str = "__reduced"; + const CMD: &str = "recolor.apply"; /// Width of the current colours of a row. const CURRENT_W: f32 = 250.0; @@ -182,6 +216,7 @@ pub fn open(app: &mut VectorcraftApp, p: &Value) -> Result { "preserveGrays": kept("preserveGrays", false), "limitTo": limit, "group": group, "groupName": if new_group { Some(NEW_GROUP) } else { group }, "tab": "assign", "rule": Harmony::Complementary.id(), "linked": true, "preview": true, THEME_PICKER: false, THEME_PICKS: [], WEIGHTS: null, FIND: false, "__art": art, "__assign": assign, "__newGroup": new_group, + GROUP_STORAGE: true, GROUP_LOADED: group, }); let mut d = Dialog::new(KIND, fields); // Without art the rows are there from the start: limit them now (art's rows snap as they reduce). @@ -215,7 +250,7 @@ fn reduce_params(d: &Dialog) -> Value { /// Reduce the art's colours into rows again when the count, preserve flags or library changed /// (assigning a group's colours or the opener's colours as the new colours). fn sync(app: &mut VectorcraftApp, d: &mut Dialog) { - const DONE: &str = "__reduced"; + const DONE: &str = REDUCED; let sig = reduce_params(d); if !d.bool("__art") || d.fields.get(DONE) == Some(&sig) { return; @@ -397,7 +432,7 @@ fn group_colors<'a>(app: &VectorcraftApp, d: &Dialog, rs: impl Iterator from_colors(r).first().map(key), - Some(_) if adjust.is_identity() => Some(r["to"].clone()), + Some(_) if adjust.is_identity() && palette.is_none() => Some(r["to"].clone()), Some(c) => { let c = adjust.apply(c); Some(key(&palette.as_ref().map_or(c, |p| p.nearest(c)))) @@ -410,7 +445,7 @@ fn group_colors<'a>(app: &VectorcraftApp, d: &Dialog, rs: impl Iterator Result<(), String> { let rs = rows(d); let order: Vec = match which { "prominent" => prominent_parts(d, &rs).into_iter().map(|p| p.0).collect(), @@ -418,12 +453,483 @@ fn save_group(app: &mut VectorcraftApp, d: &mut Dialog, which: &str) { }; let colors = group_colors(app, d, order.iter().filter_map(|&i| rs.get(i))); if colors.is_empty() { - return; + return Ok(()); } // The group is added to the document itself, not to the preview, which runs again afterwards. cancel_preview(app, d); - if let Err(e) = app.run("swatch.newGroup", json!({"colors": colors, "keepModel": true})) { - app.status(e); + app.run("swatch.newGroup", json!({"colors": colors, "keepModel": true})).map(|_| ()) +} + +/// The colors of the document's color groups, by name, in the Swatches panel's order. +fn doc_groups(app: &VectorcraftApp) -> Vec<(String, Vec)> { + let Some(st) = app.session.active() else { return vec![] }; + st.doc.swatch_groups.iter().map(|g| (g.name.clone(), g.swatches.iter().filter_map(|w| w.paint.color()).collect())).collect() +} + +/// Make the `group` field's color group (none when it is null) the group being edited, when its +/// colors aren't the rows' yet: with art the art is reduced again to as many rows as the group has +/// colors, which become their new colors (as [`open`] does); without art the rows are its colors. +/// A name no color group has is refused, and the field goes back to the group being edited. +fn select_group(app: &mut VectorcraftApp, d: &mut Dialog) -> Result<(), String> { + let want = d.fields.get("group").cloned().unwrap_or(Value::Null); + let loaded = d.fields.get(GROUP_LOADED).cloned().unwrap_or(Value::Null); + if want == loaded { + return Ok(()); + } + // The preview gives the group being edited the name in `groupName`, which the list shows: unless + // the document (without the preview) has another group of that name, it is the same group. + if let Value::String(n) = &want + && loaded.is_string() + && *n == d.str("groupName") + && d.fields.contains_key(super::form::PREVIEWED) + { + cancel_preview(app, d); + if !doc_groups(app).iter().any(|(g, _)| g == n) { + d.fields.insert("group".into(), loaded); + return Ok(()); + } + } + let art = d.bool("__art"); + let name = match &want { + Value::Null => { + // No group: without art OK saves the rows as a new color group. + d.fields.insert(GROUP_LOADED.into(), Value::Null); + if !art { + d.fields.insert("__newGroup".into(), json!(true)); + d.fields.insert("groupName".into(), json!(NEW_GROUP)); + } + return Ok(()); + } + Value::String(n) => n.clone(), + v => { + d.fields.insert("group".into(), loaded); + return Err(format!("`group` must be a color group name, not {v}")); + } + }; + // The group's own colors, not those the preview (which rewrites the group being edited) shows. + if doc_groups(app).iter().any(|(n, _)| *n == name) { + cancel_preview(app, d); + } + let Some((_, colors)) = doc_groups(app).into_iter().find(|(n, _)| *n == name) else { + d.fields.insert("group".into(), loaded); + return Err(format!("no colour group `{name}`")); + }; + let assign: Vec = colors.iter().map(key).collect(); + d.fields.insert(GROUP_LOADED.into(), json!(name)); + d.fields.insert("groupName".into(), json!(name)); + d.fields.insert("__newGroup".into(), json!(false)); + // The group's colors take the place of colors picked with the Color Theme Picker, and the same + // picks made again apply to its rows. + d.fields.insert(THEME_PICKS.into(), json!([])); + d.fields.remove(THEME_DONE); + d.fields.remove(SAVED_ROWS); + d.fields.remove(SAVED_COLORS); + d.fields.remove(SWATCH_ROWS); + if art { + // The art is reduced again (`sync`) into a row per color of the group. + d.fields.insert("colors".into(), json!(assign.len().max(1))); + d.fields.remove(REDUCED); + } else { + let mut rs: Vec = assign.iter().map(|k| json!({"from": [k], "to": k})).collect(); + snap(app, d, &mut rs); + d.fields.insert("rows".into(), Value::Array(rs)); + d.fields.insert("__sel".into(), json!([])); + d.fields.remove(COMPS); + } + d.fields.insert("__assign".into(), Value::Array(assign)); + Ok(()) +} + +/// Run a button of the Color Groups list: `save` rewrites the selected group with the rows' new +/// colors as OK gives them to it (with art, followed by the group's colors no row took) and the +/// name in `groupName`; `new` saves the new colors of the rows that aren't excluded as a new group; +/// `delete` removes the selected group and its swatches. Each is an undo step of its own on the +/// document, not on the preview, which runs again afterwards. +fn group_action(app: &mut VectorcraftApp, d: &mut Dialog, action: &Value) -> Result<(), String> { + check_group_action(app, d, action)?; + let group = d.fields.get("group").and_then(Value::as_str).map(str::to_owned); + // The rows as OK reads them (a group just selected reduces the art again). + sync(app, d); + sync_theme(app, d); + sync_weights(app, d); + match action.as_str() { + Some("new") => save_group(app, d, "all"), + Some("save") if unchanged_since_save(d) => { + // Nothing changed since the last save but perhaps the name. + let name = d.str("groupName"); + if name.trim().is_empty() || group.as_deref() == Some(name.as_str()) { + return Ok(()); + } + cancel_preview(app, d); + let colors: Vec = doc_groups(app) + .into_iter() + .find(|(n, _)| group.as_deref() == Some(n.as_str())) + .map(|g| g.1.iter().map(key).collect()) + .unwrap_or_default(); + let r = app.run("swatch.editGroup", json!({"group": group, "colors": colors, "rename": name}))?; + let name = r["name"].clone(); + d.fields.insert("group".into(), name.clone()); + d.fields.insert(GROUP_LOADED.into(), name.clone()); + d.fields.insert("groupName".into(), name); + Ok(()) + } + Some("save") => { + let rs = rows(d); + let p = apply_params(d); + // With art, the group's colors no row took follow, adjusted and snapped as OK gives them, + // then the colors added on the Edit tab; a row made with New Row that holds no current + // colors gives the group no color. + cancel_preview(app, d); + let own: Vec = doc_groups(app) + .into_iter() + .find(|(n, _)| group.as_deref() == Some(n.as_str())) + .map(|g| g.1.iter().map(key).collect()) + .unwrap_or_default(); + // An excluded row leaves its swatch the color it has now, as OK's `"keep"` does: with + // art, the swatch's color in `__assign`; without art, the swatch's color in the group, + // which an earlier Save Changes may have changed. + let filled: Vec<&Value> = rs.iter().filter(|r| !no_current(r)).collect(); + let rest: Vec = + p["groupColors"].as_array().map(|a| a.iter().skip(filled.len()).map(|k| json!({"from": [k], "to": k})).collect()).unwrap_or_default(); + let assign: Vec = + if d.bool("__art") { d.fields.get("__assign").and_then(Value::as_array).cloned().unwrap_or_default() } else { own.clone() }; + let mut colors: Vec = filled + .iter() + .enumerate() + .filter_map(|(i, r)| if excluded(r) { Some(kept_color(&assign, i)) } else { saved_color(app, d, r) }) + .chain(group_colors(app, d, rest.iter())) + .collect(); + // With art in a color of the group, the group keeps its swatch order: a swatch whose row + // ([`swatch_row`]) is found takes that row's new color (its own color when the row is + // excluded), so the art linked to it takes the color its row shows, and every other + // swatch keeps its color. The colors added on the Edit tab follow. + let found: Vec> = (0..own.len()).map(|i| swatch_row(d, &rs, &own, i)).collect(); + let mut links = None; + if d.bool("__art") && found.iter().any(Option::is_some) { + let added = rs.iter().filter(|r| no_current(r) && is_added(r) && !excluded(r) && !r["to"].is_null()); + let mut saved_links = vec![]; + colors = vec![]; + for (k, f) in own.iter().zip(&found) { + let c = match f { + Some((_, r)) if !excluded(r) => saved_color(app, d, r).unwrap_or_else(|| k.clone()), + _ => k.clone(), + }; + // A removed swatch leaves the saved group. + if !c.is_null() { + saved_links.push(f.as_ref().map_or(Value::Null, |f| f.0.clone())); + } + colors.push(c); + } + let added = group_colors(app, d, added); + saved_links.extend(added.iter().map(|_| Value::Null)); + colors.extend(added); + links = Some(saved_links); + } + let before = art_colors(app); + let r = app.run("swatch.editGroup", json!({"group": group, "colors": colors, "keepModel": true, "rename": p["rename"]}))?; + let name = r["name"].clone(); + d.fields.insert("group".into(), name.clone()); + d.fields.insert(GROUP_LOADED.into(), name.clone()); + d.fields.insert("groupName".into(), name); + // The rows follow the saved group, so a later edit or OK does not remove or add a color + // again: a removed color's row goes (its art keeps its colors). Without art, a color added + // on the Edit tab becomes a row of its own color, after the rows of the group's other + // colors; with art, its row goes and the color is one of the group's colors no row takes. + let art = d.bool("__art"); + let joins = |r: &Value| no_current(r) && is_added(r) && !excluded(r) && !r["to"].is_null(); + let gone: Vec = + rows(d).iter().filter(|r| color_removed(r)).flat_map(|r| r["from"].as_array().cloned().unwrap_or_default()).collect(); + let (mut joined, mut rs): (Vec, Vec) = rows(d).into_iter().filter(|r| !color_removed(r)).partition(|r| joins(r)); + if art { + joined.clear(); + } + for r in &mut joined { + r["from"] = json!([r["to"].clone()]); + if let Some(o) = r.as_object_mut() { + o.remove("added"); + } + } + // The save added them after the group's other colors, whatever the rows' order. + rs.extend(joined); + if rs != rows(d) { + d.fields.insert("__sel".into(), json!([])); + } + d.fields.insert("rows".into(), Value::Array(rs)); + if art { + // The group's colors no row takes are those of the saved group. + let saved: Vec = doc_groups(app) + .into_iter() + .find(|(n, _)| Some(n.as_str()) == r["name"].as_str()) + .map(|g| g.1.iter().map(key).collect()) + .unwrap_or_default(); + d.fields.insert("__assign".into(), Value::Array(saved)); + match links { + Some(l) => d.fields.insert(SWATCH_ROWS.into(), Value::Array(l)), + None => d.fields.remove(SWATCH_ROWS), + }; + // The saved group holds the Global Adjust: the rows' new colors take it, and it goes + // back to 0%, so neither the preview nor OK applies it again. + bake_adjust(app, d); + let rs = rows(d); + if art_colors(app) == before { + mark_saved(app, d); + } else { + reread_rows(app, d, &rs, &before, &gone); + } + } + Ok(()) + } + Some("delete") => { + cancel_preview(app, d); + app.run("swatch.delete", json!({"names": [group]}))?; + d.fields.insert("group".into(), Value::Null); + select_group(app, d) + } + _ => Ok(()), + } +} + +/// The color Save Changes gives the group's swatch for `row`: `null` when the row's color was +/// removed, which removes the swatch as OK does, otherwise its new color as OK gives it. +fn saved_color(app: &VectorcraftApp, d: &Dialog, row: &Value) -> Option { + if color_removed(row) { Some(Value::Null) } else { group_colors(app, d, std::iter::once(row)).into_iter().next() } +} + +/// After Save Changes recolored the art linked to the group's global swatches, read the rows from +/// the art again. A row that lists a color the save gave the art (a paint of a selected object +/// that differs from `before`, [`art_colors`] before the save) is excluded with its first color, +/// so the art keeps it, also when other art has that color: `recolor.apply` recolors every use +/// of a color alike, so the row cannot keep that art's earlier new color without undoing the save. Any other row whose first current color one of the `old` rows listed takes +/// that row's new color and exclusion (art the save left as it was keeps its recolor); the rest +/// are excluded too. A row that lists only `gone` colors (those of swatches the save removed) is +/// left out: its art keeps its colors, and the row gives the group no color. +fn reread_rows(app: &mut VectorcraftApp, d: &mut Dialog, old: &[Value], before: &[Vec], gone: &[Value]) { + let given: Vec = + art_colors(app).iter().zip(before).flat_map(|(now, was)| now.iter().zip(was).filter(|(n, w)| n != w).map(|(n, _)| n.clone())).collect(); + // A swatch whose color the save gave the art is found by that color again: the row its old + // color found lists other art now. + let group = d.fields.get("group").and_then(Value::as_str).map(str::to_owned); + let saved: Vec = + doc_groups(app).into_iter().find(|(n, _)| group.as_deref() == Some(n.as_str())).map(|g| g.1.iter().map(key).collect()).unwrap_or_default(); + if let Some(Value::Array(links)) = d.fields.get_mut(SWATCH_ROWS) { + for (l, c) in links.iter_mut().zip(&saved) { + if given.contains(c) { + *l = Value::Null; + } + } + } + d.fields.insert(THEME_PICKS.into(), json!([])); + d.fields.remove(REDUCED); + sync(app, d); + let mut rs = rows(d); + for r in &mut rs { + let Some(first) = r["from"].as_array().and_then(|f| f.first()).cloned() else { continue }; + let from_save = r["from"].as_array().is_some_and(|f| f.iter().any(|c| given.contains(c))); + match row_listing(old, &first).filter(|_| !from_save) { + Some(o) => { + r["to"] = o["to"].clone(); + r["exclude"] = json!(excluded(o)); + } + None => { + r["to"] = first; + r["exclude"] = json!(true); + } + } + } + rs.retain(|r| r["from"].as_array().is_none_or(|f| f.is_empty() || !f.iter().all(|c| gone.contains(c)))); + d.fields.insert("rows".into(), Value::Array(rs)); + mark_saved(app, d); +} + +/// Give each row's new color the Global Adjust (and Limit to Library) as OK would, and set the +/// Global Adjust back to 0%; nothing changes when it is 0%. +fn bake_adjust(app: &VectorcraftApp, d: &mut Dialog) { + if global_adjust(adjust_values(d)).is_identity() { + return; + } + let mut rs = rows(d); + for r in &mut rs { + if to_color(r).is_some() + && let Some(c) = group_colors(app, d, std::iter::once(&*r)).into_iter().next() + { + r["to"] = c; + } + } + d.fields.insert("rows".into(), Value::Array(rs)); + d.fields.insert("globalAdjust".into(), Value::Object(ADJUSTS.iter().map(|k| (k.to_string(), json!(0.0))).collect())); +} + +/// After Save Changes with art: until the rows or the Global Adjust change, OK and the preview +/// leave the selected group's colors as they were saved. +fn mark_saved(app: &VectorcraftApp, d: &mut Dialog) { + let group = d.fields.get("group").and_then(Value::as_str).map(str::to_owned); + let saved: Vec = + doc_groups(app).into_iter().find(|(n, _)| group.as_deref() == Some(n.as_str())).map(|g| g.1.iter().map(key).collect()).unwrap_or_default(); + d.fields.insert(SAVED_COLORS.into(), Value::Array(saved)); + d.fields.insert(SAVED_ROWS.into(), Value::Array(rows(d))); + d.fields.insert(SAVED_ADJUST.into(), json!(adjust_values(d))); +} + +/// Whether the rows and the Global Adjust are as [`mark_saved`] recorded them. +fn unchanged_since_save(d: &Dialog) -> bool { + d.fields.get(SAVED_ROWS).and_then(Value::as_array).is_some_and(|s| *s == rows(d)) + && d.fields.get(SAVED_ADJUST).is_some_and(|a| *a == json!(adjust_values(d))) +} + +/// The Global Adjust amounts [`mark_saved`] recorded. +const SAVED_ADJUST: &str = "__savedAdjust"; + +/// The colors of each selected object and what is inside it, as row keys, in paint order. +fn art_colors(app: &VectorcraftApp) -> Vec> { + let Some(st) = app.session.active() else { return vec![] }; + st.selection + .objects + .iter() + .map(|id| { + let mut cs = vec![]; + if let Some(n) = st.doc.node(*id) { + vectorcraft_doc::swatches::node_colors(n, &mut |c, _| cs.push(key(c))); + } + cs + }) + .collect() +} + +/// The rows [`mark_saved`] recorded after Save Changes; while the rows are these, OK and the preview +/// leave the group's colors as saved ([`SAVED_COLORS`]) and change only its name. +const SAVED_ROWS: &str = "__savedRows"; + +/// The selected group's colors after Save Changes. OK with a new name keeps the color of each of +/// those swatches (`"keep"`). +const SAVED_COLORS: &str = "__savedColors"; + +/// With art, for each swatch of the selected group after Save Changes, the color that found the row +/// that gave it its new color (`null` for a swatch no row gave one), so a later Save Changes or OK +/// finds that row again when the row still lists its old current color. +const SWATCH_ROWS: &str = "__swatchRows"; + +/// The row that gives the swatch at place `i` of `own` (the group's colors) its new color, with the +/// color that finds it: the row listing the color [`SWATCH_ROWS`] holds for that swatch, else the +/// first row listing the swatch's own color. +fn swatch_row<'a>(d: &Dialog, rs: &'a [Value], own: &[Value], i: usize) -> Option<(Value, &'a Value)> { + let links = d.fields.get(SWATCH_ROWS).and_then(Value::as_array).filter(|l| l.len() == own.len()); + let link = links.and_then(|l| l.get(i)).filter(|l| !l.is_null()); + link.and_then(|l| row_listing(rs, l).map(|r| (l.clone(), r))).or_else(|| own.get(i).and_then(|k| row_listing(rs, k).map(|r| (k.clone(), r)))) +} + +/// The color an excluded row leaves its swatch, the row being the `i`th of the rows with current +/// colors: the swatch's own color in `assign` (the group's colors), else `null`, which adds no +/// swatch past the group's, as OK's `"keep"` does. +fn kept_color(assign: &[Value], i: usize) -> Value { + assign.get(i).cloned().unwrap_or(Value::Null) +} + +/// Refuse a `groupAction` other than `save`, `new` or `delete`, `save` or `delete` with no group +/// selected, and `save` on a group with a swatch that is not a color (a gradient, pattern or None +/// swatch): the rows hold only the group's colors, so the save would replace or remove it. +fn check_group_action(app: &VectorcraftApp, d: &Dialog, action: &Value) -> Result<(), String> { + let group = d.fields.get("group").and_then(Value::as_str); + match (action.as_str(), group) { + (Some("new"), _) => Ok(()), + (Some("save"), Some(g)) if holds_other_paints(app, g) => { + Err(format!("color group `{g}` holds swatches that are not colors, which Save Changes can't keep")) + } + (Some("save" | "delete"), Some(_)) => Ok(()), + (Some("save" | "delete"), None) => Err("missing `group`".into()), + _ => Err(format!("`{GROUP_ACTION}` must be \"save\", \"new\" or \"delete\", not {action}")), + } +} + +/// Whether color group `group` has a swatch that is not a color, in the document as it is without +/// the preview (which can rewrite or rename the group). +fn holds_other_paints(app: &VectorcraftApp, group: &str) -> bool { + let Some(st) = app.session.active() else { return false }; + let doc = st.interaction.as_ref().map_or(&st.doc, |it| &it.doc); + doc.swatch_groups.iter().any(|g| g.name == group && g.swatches.iter().any(|w| w.paint.color().is_none())) +} + +/// Run the button of the Color Groups list that `groupAction` holds, if any. +fn run_group_action(app: &mut VectorcraftApp, d: &mut Dialog) -> Result<(), String> { + match d.fields.remove(GROUP_ACTION) { + Some(a) => group_action(app, d, &a), + None => Ok(()), + } +} + +/// `ui.dialog.set` of `group`, `groupStorage` or `groupAction`: select the group, or check the +/// button, which the next frame (or OK) runs. +pub(super) fn field_set(app: &mut VectorcraftApp, field: &str) -> Result<(), String> { + let Some(mut d) = app.ui.dialog.take() else { return Ok(()) }; + let r = match field { + "group" => select_group(app, &mut d), + GROUP_ACTION => match d.fields.get(GROUP_ACTION).cloned() { + Some(a) => check_group_action(app, &d, &a), + None => Ok(()), + }, + GROUP_STORAGE if !d.fields.get(GROUP_STORAGE).is_some_and(Value::is_boolean) => Err(format!("`{GROUP_STORAGE}` must be true or false")), + _ => Ok(()), + }; + app.ui.dialog = Some(d); + r +} + +/// The Color Groups list: a row per color group of the document with its name and colors (a click +/// selects it), and the Save Changes, New Color Group and Delete buttons under it. +fn group_storage(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog, max_h: f32) { + let t = Tokens::get(ui.ctx()); + let groups = doc_groups(app); + let mut current = d.fields.get("group").and_then(Value::as_str).map(str::to_owned); + // While the art previews, the group being edited shows under its new name. + if current.is_some() && d.fields.contains_key(super::form::PREVIEWED) && !groups.iter().any(|(n, _)| Some(n) == current.as_ref()) { + current = Some(d.str("groupName")); + } + let mut picked = None; + egui::ScrollArea::vertical().id_salt("recolor-groups").max_height(max_h).auto_shrink([false, true]).show(ui, |ui| { + for (name, colors) in &groups { + let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), GROUP_ROW_H), Sense::click()); + let on = current.as_deref() == Some(name.as_str()); + if on { + ui.painter().rect_filled(r, 2.0, t.row_selected); + } else if resp.hovered() { + ui.painter().rect_filled(r, 2.0, t.hover); + } + let inner = r.shrink2(vec2(4.0, 3.0)); + ui.painter().text(inner.left_top(), egui::Align2::LEFT_TOP, name, egui::FontId::proportional(12.0), t.text); + let fit = ((inner.width() + 2.0) / 12.0).floor().max(0.0) as usize; + for (n, c) in colors.iter().take(fit).enumerate() { + let x = inner.left() + n as f32 * 12.0; + chip(ui, Rect::from_min_size(pos2(x, inner.bottom() - 10.0), vec2(10.0, 10.0)), *c, false); + } + let resp = resp.on_hover_text(name); + resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::ListItem, ui.is_enabled(), on, name)); + if resp.clicked() { + picked = Some(name.clone()); + } + } + }); + if let Some(name) = picked { + d.fields.insert("group".into(), json!(name)); + if let Err(e) = select_group(app, d) { + app.status(e); + } + } + ui.add_space(4.0); + let selected = current.is_some(); + let any = rows(d).iter().any(|r| !excluded(r)); + let mut action = None; + ui.horizontal(|ui| { + if widgets::icon_button_enabled(ui, "save", tl!("Save Changes"), false, selected, 24.0).clicked() { + action = Some("save"); + } + if widgets::icon_button_enabled(ui, "dc-folder", tl!("New Color Group"), false, any, 24.0).clicked() { + action = Some("new"); + } + if widgets::icon_button_enabled(ui, "trash-2", tl!("Delete"), false, selected, 24.0).clicked() { + action = Some("delete"); + } + }); + if let Some(a) = action { + d.fields.insert(GROUP_ACTION.into(), json!(a)); } } @@ -580,6 +1086,12 @@ fn no_current(row: &Value) -> bool { row["from"].as_array().is_none_or(Vec::is_empty) } +/// Whether `row` holds current colors and its new color was removed (`to: null`) and isn't excluded: +/// its swatch in the color group is removed. +fn color_removed(row: &Value) -> bool { + !excluded(row) && !no_current(row) && row["to"].is_null() +} + /// Whether `row` is a color added on the Edit tab (`added`), which joins the color group. fn is_added(row: &Value) -> bool { row["added"].as_bool().unwrap_or(false) @@ -609,21 +1121,47 @@ fn selection(d: &Dialog) -> Vec { /// `recolor.apply` parameters: the rows, method, library and the group with its new name and /// colors: the new colors of the rows with current colors, each in its swatch's place (`null` -/// for a row whose new color was removed, which removes its swatch), then (with art) the group's -/// colors no row took, then the colors added on the Edit tab. +/// for a row whose new color was removed, which removes its swatch, and `"keep"` for an excluded +/// row, which leaves its swatch its color), then (with art) the group's colors no row took, then the +/// colors added on the Edit tab. With art in a color of the group, each swatch whose row +/// ([`swatch_row`]) is found takes that row's new color instead, and every other swatch keeps its +/// color, as Save Changes gives them. fn apply_params(d: &Dialog) -> Value { let rs = rows(d); - let group = d.fields.get("group").and_then(Value::as_str).map(|g| { - // A row made with New Row that holds no current colors gives the group no color; a color - // added on the Edit tab (`added`) joins it after the others. - let took: Vec<&Value> = rs.iter().filter(|r| !no_current(r)).map(|r| &r["to"]).collect(); - let assign = d.fields.get("__assign").and_then(Value::as_array).filter(|_| d.bool("__art")); - let rest = assign.map_or(&[][..], |a| a.get(took.len()..).unwrap_or_default()); - let added = rs.iter().filter(|r| no_current(r) && is_added(r) && !excluded(r)).map(|r| &r["to"]).filter(|c| !c.is_null()); - let colors: Vec<&Value> = took.into_iter().chain(rest).chain(added).collect(); + // The rows and Global Adjust unchanged since Save Changes: the group keeps its saved colors. + let saved = unchanged_since_save(d); + let assign = d.fields.get("__assign").and_then(Value::as_array).filter(|_| d.bool("__art")).map_or(&[][..], Vec::as_slice); + let found: Vec> = (0..assign.len()).map(|i| swatch_row(d, &rs, assign, i)).collect(); + let keep = json!("keep"); + let group = d.fields.get("group").and_then(Value::as_str).and_then(|g| { let name = d.str("groupName"); let rename = (!name.trim().is_empty() && name != g).then_some(name); - json!({"group": g, "groupColors": colors, "rename": rename}) + let colors: Vec<&Value> = if saved { + // Only a new name changes the group: each swatch keeps its exact color. + rename.as_ref()?; + d.fields.get(SAVED_COLORS).and_then(Value::as_array).map(|a| a.iter().map(|_| &keep).collect())? + } else { + // A row made with New Row that holds no current colors gives the group no color; a color + // added on the Edit tab (`added`) joins it after the others. + let added = rs.iter().filter(|r| no_current(r) && is_added(r) && !excluded(r)).map(|r| &r["to"]).filter(|c| !c.is_null()); + // A swatch that keeps its color takes no Global Adjust. + if found.iter().any(Option::is_some) { + found + .iter() + .map(|f| match f { + Some((_, r)) if !excluded(r) => &r["to"], + _ => &keep, + }) + .chain(added) + .collect() + } else { + let filled: Vec<&Value> = rs.iter().filter(|r| !no_current(r)).collect(); + let rest = assign.get(filled.len()..).unwrap_or_default(); + let took = filled.iter().map(|r| if excluded(r) { &keep } else { &r["to"] }); + took.chain(rest).chain(added).collect() + } + }; + Some(json!({"group": g, "groupColors": colors, "rename": rename})) }); // A row edited with the sliders carries `model: "new"`: its art takes the mode they showed. let mut p = json!({"map": rs, "method": d.str("method"), "limitTo": d.str("limitTo")}); @@ -661,6 +1199,26 @@ fn find_entry(k: &Value) -> Option { } } +/// The first of `rows` that lists the color entry `k`, as `recolor.apply` reads entries: rows that +/// list it as an exact color (by key, whatever its case or spacing) come before rows whose +/// "#rrggbb" entry matches it by its hex. Rows that give the color a new color (not excluded, `to` +/// not `null`) come first, since `recolor.apply` maps the color with them; an excluded row or one +/// that removes the color is found only when no such row lists it. +fn row_listing<'a>(rows: &'a [Value], k: &Value) -> Option<&'a Value> { + let want = find_entry(k)?; + let hex = |e: &FindEntry| e.as_ref().map_or_else(Clone::clone, |k| k.color().to_hex()); + let lists = |r: &Value, by_hex: bool| { + r["from"].as_array().is_some_and(|f| { + f.iter().filter_map(find_entry).any(|e| match (&e, &want) { + (Ok(a), Ok(b)) => !by_hex && a == b, + _ => by_hex && hex(&e) == hex(&want), + }) + }) + }; + let find = |live: bool, by_hex: bool| rows.iter().filter(|r| !live || (!excluded(r) && !r["to"].is_null())).find(|r| lists(r, by_hex)); + find(true, false).or_else(|| find(true, true)).or_else(|| find(false, false)).or_else(|| find(false, true)) +} + /// While Find is on, on the Assign tab with art and rows selected: what the art previews instead of /// [`apply_params`], as `command.batch` parameters. A first `recolor.apply` gives each current color /// of the rows that aren't selected, and each preserved color, its [`FIND_DIM`] tint, or the nearest lighter one when that is a @@ -734,10 +1292,57 @@ fn find_params(d: &Dialog) -> Option { (!commands.is_empty()).then(|| json!({"commands": commands})) } +/// The tabs, and the Color Groups list on their right while it is shown. fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool { + if let Err(e) = select_group(app, d) { + app.status(e); + } + let room = ui.available_width(); + // Without the room for both side by side (a narrow window), the list goes under the tabs. + let beside = room >= SPEC.min_width + STORAGE_GAP + STORAGE_W; + // The Color Picker that a double-click on a new color or Pick from Swatches asks for opens over + // the dialog after the list is drawn, so the window keeps its size while the picker is open. + let mut picker = None; + if !d.bool(GROUP_STORAGE) || !beside { + ui.vertical(|ui| { + ui.set_width(room.min(MAIN_W)); + picker = main(app, ui, d); + if d.bool(GROUP_STORAGE) { + ui.add_space(6.0); + group_storage(app, ui, d, 3.0 * GROUP_ROW_H); + } + }); + } else { + ui.horizontal_top(|ui| { + ui.vertical(|ui| { + ui.set_width((room - STORAGE_GAP - STORAGE_W).clamp(0.0, MAIN_W)); + picker = main(app, ui, d); + }); + ui.add_space(STORAGE_GAP); + ui.vertical(|ui| { + ui.set_width(STORAGE_W); + group_storage(app, ui, d, TAB_H - 30.0); + }); + }); + } + if let Some((i, swatches)) = picker + && let Some(row) = rows(d).get(i) + { + let c = to_color(row).or_else(|| from_colors(row).first().copied()).unwrap_or_default(); + *d = super::color_picker::over_recolor(d, c, i, swatches); + } + false +} + +/// The tabs and the controls under them. Returns the row whose new color a double-click or Pick +/// from Swatches asked to pick in the Color Picker, with `true` for Pick from Swatches. +fn main(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> Option<(usize, bool)> { sync(app, d); sync_theme(app, d); sync_weights(app, d); + if let Err(e) = run_group_action(app, d) { + app.status(e); + } let t = Tokens::get(ui.ctx()); let picking = d.bool(THEME_PICKER); ui.horizontal(|ui| { @@ -751,6 +1356,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool { if widgets::icon_button(ui, "pipette", tl!("Color Theme Picker"), picking, 24.0).clicked() { d.fields.insert(THEME_PICKER.into(), json!(!picking)); } + let storage = d.bool(GROUP_STORAGE); + if widgets::icon_button(ui, "library", tl!("Show Color Groups"), storage, 24.0).clicked() { + d.fields.insert(GROUP_STORAGE.into(), json!(!storage)); + } ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { // The label is drawn after the menu (right-to-left), so it cannot name it by adjacency. if let Some(i) = widgets::dropdown_named(ui, "recolor-preset", Some(tl!("Preset:")), PRESETS[preset_of(d)], &PRESETS, 130.0) { @@ -782,8 +1391,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool { d.fields.insert("rows".into(), Value::Array(rs)); } sync_weights(app, d); - if let Some(which) = d.fields.remove(SAVE_GROUP) { - save_group(app, d, which.as_str().unwrap_or_default()); + if let Some(which) = d.fields.remove(SAVE_GROUP) + && let Err(e) = save_group(app, d, which.as_str().unwrap_or_default()) + { + app.status(e); } if d.fields.get("group").is_some_and(Value::is_string) || d.bool("__newGroup") { ui.add_space(6.0); @@ -804,13 +1415,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, d: &mut Dialog) -> bool { None => form::preview(app, ui, d, "Recolor Artwork", CMD, apply_params(d)), } } - if let Some((i, swatches)) = pick - && let Some(row) = rows(d).get(i) - { - let c = to_color(row).or_else(|| from_colors(row).first().copied()).unwrap_or_default(); - *d = super::color_picker::over_recolor(d, c, i, swatches); - } - false + pick } /// `d` with row `i`'s new colour set to `c` (the Color Picker's OK), snapped to Limit to Library. @@ -829,9 +1434,19 @@ pub(super) fn with_new_color(app: &VectorcraftApp, mut d: Dialog, i: usize, c: C /// save colours opened alone as a new colour group). fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { let mut d = d.clone(); + select_group(app, &mut d)?; sync(app, &mut d); sync_theme(app, &mut d); sync_weights(app, &mut d); + // A Color Groups button set with OK in one request runs first, once: the open dialog takes + // its result, so an OK that fails afterwards does not run it again. + if d.fields.contains_key(GROUP_ACTION) { + let r = run_group_action(app, &mut d); + if let Some(live) = app.ui.dialog.as_mut().filter(|x| x.kind == KIND) { + *live = d.clone(); + } + r?; + } if d.bool("__newGroup") { let colors = group_colors(app, &d, rows(&d).iter().filter(|r| in_group(r))); return form::commit_preview(app, "swatch.newGroup", json!({"name": d.str("groupName"), "colors": colors, "keepModel": true})); @@ -2000,14 +2615,14 @@ mod tests { } /// Opened on a color group, OK rewrites it with the new colors of the rows that hold current - /// colors, then the group's colors no such row took: an empty row gives it no color. + /// colors, and the group's color no such row lists keeps its color: an empty row gives it no color. #[test] fn an_empty_row_gives_the_group_no_color() { let mut r = rows(); new_row(&mut r, &[]); let fields = json!({"rows": r, "group": "Trio", "__art": true, "__assign": ["rgb 255 0 0", "rgb 0 0 255", "rgb 0 255 0", "rgb 9 9 9"]}); let p = apply_params(&Dialog::new("recolor", fields)); - assert_eq!(p["groupColors"], json!(["rgb 255 0 0", "rgb 0 0 255", "rgb 0 255 0", "rgb 9 9 9"])); + assert_eq!(p["groupColors"], json!(["rgb 255 0 0", "rgb 0 0 255", "rgb 0 255 0", "keep"])); } /// Opened on colors alone, OK saves the new colors of the rows that hold current colors as the @@ -2032,6 +2647,37 @@ mod tests { } /// Randomize after a seed past `u64::MAX` keeps the largest seed. + /// A row that lists a color exactly comes before an earlier row whose "#rrggbb" entry matches + /// it, as `recolor.apply` reads them; a hex entry matches a key of the same hex. + #[test] + fn a_row_listing_a_color_exactly_comes_before_a_hex_match() { + let rs = + [json!({"from": ["#0000ff"], "to": "rgb 0 255 0"}), json!({"from": ["RGB 0 0 255"], "to": "rgb 255 0 0"}), json!({"from": ["#ff0000"]})]; + assert_eq!(row_listing(&rs, &json!("rgb 0 0 255")), Some(&rs[1])); + assert_eq!(row_listing(&rs, &json!("rgb 255 0 0")), Some(&rs[2])); + assert_eq!(row_listing(&rs, &json!("#ff0000")), Some(&rs[2])); + assert_eq!(row_listing(&rs, &json!("rgb 0 255 0")), None); + assert_eq!(row_listing(&rs, &json!("cmyk 0 0 0 0")), None); + } + + /// A row that gives a color a new color comes before an earlier row that removes it or is + /// excluded, exact or by hex, as `recolor.apply` maps the color with it; those rows are found + /// only when no such row lists the color. + #[test] + fn a_row_giving_a_color_a_new_color_comes_before_one_removing_it() { + let rs = [ + json!({"from": ["rgb 0 0 255"], "to": null}), + json!({"from": ["rgb 0 0 255"], "to": "rgb 0 0 0", "exclude": true}), + json!({"from": ["#0000ff"], "to": "rgb 0 255 0"}), + json!({"from": ["rgb 0 0 255"], "to": "rgb 255 0 0"}), + json!({"from": ["rgb 255 255 0"], "to": null}), + ]; + assert_eq!(row_listing(&rs, &json!("rgb 0 0 255")), Some(&rs[3])); + assert_eq!(row_listing(&rs[..3], &json!("rgb 0 0 255")), Some(&rs[2]), "by hex"); + assert_eq!(row_listing(&rs[..2], &json!("rgb 0 0 255")), Some(&rs[0])); + assert_eq!(row_listing(&rs, &json!("rgb 255 255 0")), Some(&rs[4])); + } + #[test] fn next_seed_holds_at_the_largest() { assert_eq!(next_seed(&Dialog::new("recolor", json!({}))), 1); @@ -2801,4 +3447,844 @@ mod tests { let g = app.session.doc().unwrap().doc.swatch_groups.last().expect("a new color group"); assert_eq!(g.swatches.iter().filter_map(|w| w.paint.color()).collect::>(), [Color::rgb8(255, 128, 0)]); } + + /// Sets `field` of the open dialog to `value` as `ui.dialog.set` does: a refused value leaves + /// the dialog as it was. + fn set(app: &mut VectorcraftApp, field: &str, value: Value) -> Result<(), String> { + let before = app.ui.dialog.clone(); + let old = app.ui.dialog.as_ref().and_then(|d| d.fields.get(field).cloned()); + if let Some(d) = app.ui.dialog.as_mut() { + crate::dialogs::set_field(d, field.into(), value); + } + let r = crate::dialogs::field_set(app, field, old.as_ref()); + if r.is_err() { + app.ui.dialog = before; + } + r + } + + fn group_hex(app: &VectorcraftApp, name: &str) -> Option> { + let doc = &app.session.doc().unwrap().doc; + doc.swatch_groups.iter().find(|g| g.name == name).map(|g| g.swatches.iter().filter_map(|w| w.paint.color()).map(|c| c.to_hex()).collect()) + } + + fn undo_len(app: &VectorcraftApp) -> usize { + app.session.doc().unwrap().history.undo.len() + } + + /// Sets `groupAction` to `a` as `ui.dialog.set` does and draws the frame that runs it. + fn act(app: &mut VectorcraftApp, ctx: &egui::Context, t: f64, a: &str) -> Result<(), String> { + set(app, GROUP_ACTION, json!(a))?; + frame(app, ctx, t, vec![], 0); + Ok(()) + } + + /// Without art: a group picked in the Color Groups list (the `group` field) gives the rows its + /// colors, and a name no group has is refused. Save Changes rewrites the selected group with the + /// rows' new colors and the name field, as one step, and records none when nothing changes; + /// Delete removes it, after which OK saves the rows as a new group; New Color Group adds one. + #[test] + fn the_color_groups_list_selects_saves_and_deletes_groups() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "A", "colors": ["#ff0000", "#00ff00"], "keepModel": true})).unwrap(); + app.run("swatch.newGroup", json!({"name": "B", "colors": ["#0000ff", "#ffff00", "#ffffff"], "keepModel": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "A"})).unwrap(); + assert_eq!(new_colors(&app), [json!("rgb 255 0 0"), json!("rgb 0 255 0")]); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields[GROUP_STORAGE], true, "the list opens shown"); + + set(&mut app, "group", json!("B")).unwrap(); + assert_eq!(new_colors(&app), [json!("rgb 0 0 255"), json!("rgb 255 255 0"), json!("rgb 255 255 255")]); + assert_eq!(app.ui.dialog.as_ref().unwrap().str("groupName"), "B"); + assert_eq!(set(&mut app, "group", json!("Nope")), Err("no colour group `Nope`".into())); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["group"], "B", "a refused name leaves B selected"); + assert!(set(&mut app, GROUP_STORAGE, json!("yes")).is_err()); + assert!(set(&mut app, GROUP_ACTION, json!("rename")).is_err()); + + let undo = undo_len(&app); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + rs[0]["to"] = json!("rgb 0 0 0"); + d.fields.insert("rows".into(), Value::Array(rs)); + d.fields.insert("groupName".into(), json!("Night")); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(group_hex(&app, "Night"), Some(vec!["#000000".into(), "#ffff00".into(), "#ffffff".into()])); + assert_eq!(group_hex(&app, "B"), None, "renamed"); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["group"], "Night"); + assert_eq!(undo_len(&app), undo + 1, "one step"); + act(&mut app, &ctx, 0.2, "save").unwrap(); + assert_eq!(undo_len(&app), undo + 1, "saving the same colors again records no step"); + + act(&mut app, &ctx, 0.3, "delete").unwrap(); + assert_eq!(group_hex(&app, "Night"), None); + assert_eq!(undo_len(&app), undo + 2); + let d = app.ui.dialog.as_ref().unwrap(); + assert!(d.fields["group"].is_null() && d.bool("__newGroup"), "{:?}", d.fields); + assert_eq!(act(&mut app, &ctx, 0.4, "delete"), Err("missing `group`".into())); + assert_eq!(act(&mut app, &ctx, 0.5, "save"), Err("missing `group`".into())); + assert_eq!(undo_len(&app), undo + 2, "a refused button records no step"); + + let n = app.session.doc().unwrap().doc.swatch_groups.len(); + act(&mut app, &ctx, 0.6, "new").unwrap(); + let doc = &app.session.doc().unwrap().doc; + assert_eq!(doc.swatch_groups.len(), n + 1); + let last: Vec = doc.swatch_groups.last().unwrap().swatches.iter().filter_map(|w| w.paint.color()).map(|c| c.to_hex()).collect(); + assert_eq!(last, ["#000000", "#ffff00", "#ffffff"]); + assert_eq!(group_hex(&app, "A"), Some(vec!["#ff0000".into(), "#00ff00".into()]), "other groups are left as they are"); + } + + /// Without art: after a group is picked in the list, the same Color Theme Picker picks that gave + /// the group before it its colors give the new group's rows the palette of the art picked too. + #[test] + fn theme_picks_apply_again_after_another_group_is_picked() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + square(&mut app, 100.0, "#00ff00"); + app.run("select.set", json!({"ids": []})).unwrap(); + app.run("swatch.newGroup", json!({"name": "A", "colors": ["#ff0000", "#0000ff"], "keepModel": true})).unwrap(); + app.run("swatch.newGroup", json!({"name": "B", "colors": ["#0000ff", "#ffff00", "#ffffff"], "keepModel": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "A"})).unwrap(); + frame(&mut app, &ctx, 0.0, vec![], 0); + let picks = json!([{"at": [107, 17]}]); + app.ui.dialog.as_mut().unwrap().fields.insert(THEME_PICKS.into(), picks.clone()); + frame(&mut app, &ctx, 0.1, vec![], 0); + assert_eq!(new_colors(&app), [json!("rgb 0 255 0"), json!("rgb 0 255 0")]); + set(&mut app, "group", json!("B")).unwrap(); + frame(&mut app, &ctx, 0.2, vec![], 0); + assert_eq!(new_colors(&app), [json!("rgb 0 0 255"), json!("rgb 255 255 0"), json!("rgb 255 255 255")]); + app.ui.dialog.as_mut().unwrap().fields.insert(THEME_PICKS.into(), picks); + frame(&mut app, &ctx, 0.3, vec![], 0); + assert_eq!(new_colors(&app), [json!("rgb 0 255 0"), json!("rgb 0 255 0"), json!("rgb 0 255 0")], "the picks apply to B's rows"); + } + + /// Save Changes on a group with a swatch that is not a color is refused, renamed or not, and + /// leaves the group as it is: the rows hold only its colors. + #[test] + fn saving_a_group_with_a_swatch_that_is_not_a_color_is_refused() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Mixed", "colors": ["#ff0000", "#00ff00"], "keepModel": true})).unwrap(); + let doc = std::sync::Arc::make_mut(&mut app.session.doc_mut().unwrap().doc); + let g = doc.swatch_groups.iter_mut().find(|g| g.name == "Mixed").unwrap(); + g.swatches.insert(1, fade_swatch()); + app.run("ui.recolorDialog", json!({"group": "Mixed"})).unwrap(); + assert_eq!(new_colors(&app), [json!("rgb 255 0 0"), json!("rgb 0 255 0")]); + let undo = undo_len(&app); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + rs[0]["to"] = json!("rgb 0 0 0"); + d.fields.insert("rows".into(), Value::Array(rs)); + let refused: Result<(), String> = Err("color group `Mixed` holds swatches that are not colors, which Save Changes can't keep".into()); + assert_eq!(act(&mut app, &ctx, 0.1, "save"), refused); + app.ui.dialog.as_mut().unwrap().fields.insert("groupName".into(), json!("Renamed")); + assert_eq!(act(&mut app, &ctx, 0.2, "save"), refused); + // OK first runs a save set together with it, and the dialog stays open. + app.ui.dialog.as_mut().unwrap().fields.insert(GROUP_ACTION.into(), json!("save")); + assert!(crate::dialogs::confirm(&mut app).is_err()); + assert!(app.ui.dialog.is_some()); + let g = app.session.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Mixed").unwrap(); + assert_eq!(g.swatches[1], fade_swatch(), "the swatch is kept"); + assert_eq!(group_hex(&app, "Mixed"), Some(vec!["#ff0000".into(), "#00ff00".into()])); + assert_eq!(undo_len(&app), undo, "no step"); + } + + /// A gradient swatch, for a color group. + fn fade_swatch() -> vectorcraft_color::Swatch { + let paint = vectorcraft_color::Paint::Gradient(Box::new(vectorcraft_color::GradientPaint::new(Default::default()))); + vectorcraft_color::Swatch { name: "Fade".into(), paint, global: false, spot: false } + } + + /// With art, the preview rewrites the group being edited, its other swatch included; Save + /// Changes is still refused, as the group is without the preview, and Cancel leaves it as it was. + #[test] + fn saving_a_group_with_a_swatch_that_is_not_a_color_is_refused_while_previewing() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Mixed", "colors": ["#ff0000", "#0000ff"], "keepModel": true})).unwrap(); + let doc = std::sync::Arc::make_mut(&mut app.session.doc_mut().unwrap().doc); + let g = doc.swatch_groups.iter_mut().find(|g| g.name == "Mixed").unwrap(); + g.swatches.push(fade_swatch()); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Mixed"})).unwrap(); + frame(&mut app, &ctx, 0.0, vec![], 0); + let undo = undo_len(&app); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + rs[0]["to"] = json!("rgb 0 0 0"); + d.fields.insert("rows".into(), Value::Array(rs)); + frame(&mut app, &ctx, 0.1, vec![], 0); + assert!(app.session.in_interaction(), "the art previews"); + let previewed = app.session.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Mixed").map(|g| g.swatches.len()); + assert_eq!(previewed, Some(2), "the preview's rewrite of the group leaves out its other swatch"); + let refused: Result<(), String> = Err("color group `Mixed` holds swatches that are not colors, which Save Changes can't keep".into()); + assert_eq!(act(&mut app, &ctx, 0.2, "save"), refused); + crate::dialogs::cancel(&mut app); + let g = app.session.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Mixed").unwrap(); + assert_eq!(g.swatches.last(), Some(&fade_swatch()), "the swatch is kept"); + assert_eq!(group_hex(&app, "Mixed"), Some(vec!["#ff0000".into(), "#0000ff".into()])); + assert_eq!(undo_len(&app), undo, "no step"); + } + + /// Save Changes on a group whose global swatches the selected art is linked to: the art takes + /// the group's new colors, and the rows are read from the art again, so they list its colors as + /// they are now. A color the art had before keeps its row's new color; a color the save gave + /// it stays as it is. + #[test] + fn saving_a_group_the_art_links_to_reads_the_rows_again() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + if r["from"].as_array().is_some_and(|f| f.contains(&json!("rgb 255 0 0"))) { + r["to"] = json!("rgb 0 128 0"); + } + } + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + frame(&mut app, &ctx, 0.2, vec![], 0); + // The rows took the group's colors in their order, so one of the swatches is now green. + let saved = group_hex(&app, "Linked").unwrap(); + assert!(saved.len() == 2 && saved.contains(&"#008000".to_string()), "{saved:?}"); + let mut want = saved.clone(); + want.sort(); + assert_eq!(fill_hex(&app, red), "#008000", "the red square keeps the new color its row gave it"); + for r in super::rows(app.ui.dialog.as_ref().unwrap()) { + if !from_colors(&r).iter().any(|c| ["#ff0000", "#0000ff"].contains(&c.to_hex().as_str())) { + assert!(excluded(&r) && r["to"] == r["from"][0], "a color the save gave the art stays: {r}"); + } + } + let mut froms: Vec = super::rows(app.ui.dialog.as_ref().unwrap()).iter().flat_map(from_colors).map(|c| c.to_hex()).collect(); + froms.sort(); + assert_eq!(froms, want, "the rows list the art's colors as they are now"); + assert!(apply_params(app.ui.dialog.as_ref().unwrap()).get("group").is_none(), "OK leaves the saved group as it is"); + // OK with only a new name keeps the preview as one step and renames the group, keeping its + // saved colors. + let undo = undo_len(&app); + let mut d = app.ui.dialog.clone().unwrap(); + d.fields.insert("groupName".into(), json!("Renamed")); + confirm(&mut app, &d).unwrap(); + assert_eq!(group_hex(&app, "Renamed"), Some(saved)); + assert_eq!(group_hex(&app, "Linked"), None); + assert_eq!(fill_hex(&app, red), "#008000"); + assert_eq!(undo_len(&app), undo + 1); + } + + /// OK with only a new name after Save Changes leaves every swatch of the group its exact color: + /// a CMYK swatch no row lists keeps components finer than a hundredth of a percent. + #[test] + fn renaming_a_saved_group_keeps_its_exact_colors() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + let fine = Color::cmyk(0.123_456, 0.654_321, 0.0, 0.010_101); + let doc = std::sync::Arc::make_mut(&mut app.session.doc_mut().unwrap().doc); + let g = doc.swatch_groups.iter_mut().find(|g| g.name == "Linked").unwrap(); + g.swatches.push(vectorcraft_color::Swatch { name: "Fine".into(), paint: vectorcraft_color::Paint::solid(fine), global: false, spot: false }); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + if r["from"].as_array().is_some_and(|f| f.contains(&json!("rgb 255 0 0"))) { + r["to"] = json!("rgb 0 128 0"); + } + } + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + frame(&mut app, &ctx, 0.2, vec![], 0); + let swatches = |app: &VectorcraftApp, name: &str| { + let doc = &app.session.doc().unwrap().doc; + doc.swatch_groups.iter().find(|g| g.name == name).map(|g| g.swatches.iter().map(|w| w.paint.color()).collect::>()) + }; + let saved = swatches(&app, "Linked").unwrap(); + assert_eq!(saved.last(), Some(&Some(fine)), "Save Changes keeps the swatch no row lists"); + let mut d = app.ui.dialog.clone().unwrap(); + d.fields.insert("groupName".into(), json!("Renamed")); + confirm(&mut app, &d).unwrap(); + assert_eq!(swatches(&app, "Renamed"), Some(saved), "the rename keeps every color exactly"); + } + + /// Save Changes where one row's new color is another row's current color: the art linked to the + /// group keeps the colors the save gave it, and is not recolored again by the other row; a + /// Global Adjust set afterwards gives OK the group again. + #[test] + fn saving_a_group_keeps_the_colors_it_gave_the_linked_art() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + let from = from_colors(r).first().map(|c| c.to_hex()); + r["to"] = match from.as_deref() { + Some("#ff0000") => json!("rgb 0 0 255"), + _ => json!("rgb 0 128 0"), + }; + } + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + frame(&mut app, &ctx, 0.2, vec![], 0); + let mut group = group_hex(&app, "Linked").unwrap(); + group.sort(); + let mut fills = vec![fill_hex(&app, red), fill_hex(&app, blue)]; + fills.sort(); + assert_eq!(fills, group, "the art shows the saved group's colors, not a second recolor"); + assert!(apply_params(app.ui.dialog.as_ref().unwrap()).get("group").is_none()); + app.ui.dialog.as_mut().unwrap().fields.insert("globalAdjust".into(), json!({"brightness": -50.0})); + assert!(apply_params(app.ui.dialog.as_ref().unwrap()).get("group").is_some(), "a new Global Adjust rewrites the group at OK"); + } + + /// Save Changes with art in only some colors of the group: the swatches keep their order, and a + /// swatch no row lists keeps its color. + #[test] + fn saving_a_group_keeps_the_swatches_the_art_does_not_use() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let red = square(&mut app, 10.0, "#ff0000"); + let blue = square(&mut app, 40.0, "#0000ff"); + let yellow = square(&mut app, 70.0, "#ffff00"); + app.run("select.set", json!({"ids": [red, blue, yellow]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + let order = group_hex(&app, "Linked").unwrap(); + app.run("select.set", json!({"ids": [blue, yellow]})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + let to = match from_colors(r).first().map(|c| c.to_hex()).as_deref() { + Some("#0000ff") => json!("rgb 0 128 0"), + _ => r["from"][0].clone(), + }; + r["to"] = to; + } + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + let want: Vec = order.iter().map(|h| if h == "#0000ff" { "#008000".into() } else { h.clone() }).collect(); + assert_eq!(group_hex(&app, "Linked"), Some(want), "the swatches keep their order and the red one its color"); + assert_eq!(fill_hex(&app, red), "#ff0000", "art linked to a swatch no row lists is left as it is"); + } + + /// Save Changes with art in colors of the group keeps the Edit tab's changes: a removed color's + /// swatch is removed, and a color added on the Edit tab joins the group after the others. + #[test] + fn saving_a_group_keeps_added_and_removed_colors() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let red = square(&mut app, 10.0, "#ff0000"); + let blue = square(&mut app, 40.0, "#0000ff"); + let yellow = square(&mut app, 70.0, "#ffff00"); + app.run("select.set", json!({"ids": [red, blue, yellow]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + let order = group_hex(&app, "Linked").unwrap(); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + let to = match from_colors(r).first().map(|c| c.to_hex()).as_deref() { + Some("#0000ff") => Value::Null, + _ => r["from"][0].clone(), + }; + r["to"] = to; + } + rs.push(json!({"from": [], "to": "rgb 0 128 0", "added": true})); + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + let mut want: Vec = order.into_iter().filter(|h| h != "#0000ff").collect(); + want.push("#008000".into()); + assert_eq!(group_hex(&app, "Linked"), Some(want.clone()), "the removed swatch goes and the added color follows the others"); + assert_eq!(fill_hex(&app, blue), "#0000ff", "art linked to a removed swatch keeps its color"); + let rs = super::rows(app.ui.dialog.as_ref().unwrap()); + assert!(rs.iter().all(|r| !r["to"].is_null() && !is_added(r)), "the rows follow the saved group: {rs:?}"); + let assign = app.ui.dialog.as_ref().unwrap().fields["__assign"].clone(); + let assign: Vec = assign.as_array().unwrap().iter().filter_map(color_value).map(|c| c.to_hex()).collect(); + assert_eq!(Some(assign), group_hex(&app, "Linked"), "a later edit gives the group no removed swatch back"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(group_hex(&app, "Linked"), Some(want), "OK removes and adds nothing more"); + } + + /// Save Changes that recolors linked art reads the rows from the art again; a color added on the + /// Edit tab stays one of the group's colors and a removed one does not come back, so OK after a + /// further edit keeps them as saved. + #[test] + fn saving_a_group_that_reads_the_rows_again_keeps_an_added_color() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let red = square(&mut app, 10.0, "#ff0000"); + let blue = square(&mut app, 40.0, "#0000ff"); + let lime = square(&mut app, 70.0, "#00ff00"); + app.run("select.set", json!({"ids": [red, blue, lime]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + let to = match from_colors(r).first().map(|c| c.to_hex()).as_deref() { + Some("#ff0000") => json!("rgb 0 128 0"), + Some("#00ff00") => Value::Null, + _ => r["from"][0].clone(), + }; + r["to"] = to; + } + rs.push(json!({"from": [], "to": "rgb 255 255 0", "added": true})); + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(fill_hex(&app, red), "#008000", "the save recolored the linked art"); + assert_eq!(fill_hex(&app, lime), "#00ff00", "art linked to the removed swatch keeps its color"); + let group = group_hex(&app, "Linked").unwrap(); + assert!(group.contains(&"#ffff00".to_string()) && !group.contains(&"#00ff00".to_string()), "{group:?}"); + let mut d = app.ui.dialog.clone().unwrap(); + let mut rs = super::rows(&d); + assert!(rs.iter().all(|r| !is_added(r)), "{rs:?}"); + if let Some(r) = rs.last_mut() { + r["to"] = json!("rgb 10 10 10"); + } + d.fields.insert("rows".into(), Value::Array(rs)); + let colors = sent_by(&app, &d); + assert_eq!(colors.iter().filter(|c| *c == "#ffff00").count(), 1, "OK after a further edit keeps the added color once: {colors:?}"); + assert!(!colors.contains(&"#00ff00".to_string()), "nor brings the removed color back: {colors:?}"); + } + + /// Save Changes where the rows list their current colors as "#rrggbb": a row matches the swatch + /// of the same color, so the swatches keep their order and the one a row lists takes its new + /// color; read again afterwards, a row whose old entry was a hex keeps its new color. + #[test] + fn saving_a_group_matches_rows_that_list_hex_colors() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let red = square(&mut app, 10.0, "#ff0000"); + let blue = square(&mut app, 40.0, "#0000ff"); + let yellow = square(&mut app, 70.0, "#ffff00"); + app.run("select.set", json!({"ids": [red, blue, yellow]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + let order = group_hex(&app, "Linked").unwrap(); + let orange = square(&mut app, 100.0, "#ff8000"); + app.run("select.set", json!({"ids": [blue, yellow, orange]})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + let hex: Vec = from_colors(r).iter().map(|c| c.to_hex()).collect(); + r["to"] = match hex.first().map(String::as_str) { + Some("#0000ff") => json!("rgb 0 128 0"), + Some("#ff8000") => json!("rgb 128 0 128"), + _ => r["from"][0].clone(), + }; + r["from"] = json!(hex); + } + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + let want: Vec = order.iter().map(|h| if h == "#0000ff" { "#008000".into() } else { h.clone() }).collect(); + assert_eq!(group_hex(&app, "Linked"), Some(want), "the blue swatch takes the green, the red one keeps its color"); + assert_eq!((fill_hex(&app, red), fill_hex(&app, blue)), ("#ff0000".into(), "#008000".into())); + let rs = super::rows(app.ui.dialog.as_ref().unwrap()); + let o = rs.iter().find(|r| from_colors(r).iter().any(|c| c.to_hex() == "#ff8000")).unwrap(); + assert!(!excluded(o) && o["to"] == json!("rgb 128 0 128"), "the orange row keeps its new color: {o}"); + } + + /// Save Changes with art in the group's colors that is not linked to its swatches: the art is + /// left to the preview, and OK leaves the saved group as it is until the rows change. + #[test] + fn saving_a_group_with_unlinked_art_keeps_the_saved_group_at_ok() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000", "#0000ff"], "keepModel": true})).unwrap(); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + let to = match from_colors(r).first().map(|c| c.to_hex()).as_deref() { + Some("#0000ff") => json!("rgb 0 128 0"), + _ => r["from"][0].clone(), + }; + r["to"] = to; + } + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#ff0000".into(), "#008000".into()])); + frame(&mut app, &ctx, 0.2, vec![], 0); + assert_eq!(fill_hex(&app, blue), "#008000", "the art previews its row's new color"); + assert!(apply_params(app.ui.dialog.as_ref().unwrap()).get("group").is_none(), "OK leaves the saved group as it is"); + } + + /// The colors `d`'s OK gives the selected group, as hex, `"keep"` read as the color the swatch + /// at its place has. + fn sent_by(app: &VectorcraftApp, d: &Dialog) -> Vec { + let own = group_hex(app, &d.str("group")).unwrap_or_default(); + let p = apply_params(d); + let hex = |(i, k): (usize, &Value)| if *k == json!("keep") { own.get(i).cloned() } else { color_value(k).map(|c| c.to_hex()) }; + p["groupColors"].as_array().unwrap().iter().enumerate().filter_map(hex).collect() + } + + /// The colors OK gives the selected group, as [`sent_by`] reads them. + fn sent_hex(app: &VectorcraftApp) -> Vec { + sent_by(app, app.ui.dialog.as_ref().unwrap()) + } + + /// Sets the new color of the rows whose first current color is `hex` to `to`. + fn set_row(app: &mut VectorcraftApp, hex: &str, to: Value) { + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + if from_colors(r).first().map(|c| c.to_hex()).as_deref() == Some(hex) { + r["to"] = to.clone(); + } + } + d.fields.insert("rows".into(), Value::Array(rs)); + } + + /// With unlinked art in some of the group's colors, a second Save Changes after a further edit of + /// a row gives the swatch the first save gave that row's color the row's new color, and OK does + /// too; the swatch no row lists keeps its color both times. + #[test] + fn saving_a_group_twice_with_unlinked_art_gives_a_row_its_swatch_again() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000", "#0000ff", "#ffff00"], "keepModel": true})).unwrap(); + let (blue, yellow) = (square(&mut app, 10.0, "#0000ff"), square(&mut app, 40.0, "#ffff00")); + app.run("select.set", json!({"ids": [blue, yellow]})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + set_row(&mut app, "#0000ff", json!("rgb 0 128 0")); + set_row(&mut app, "#ffff00", json!("rgb 255 255 0")); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#ff0000".into(), "#008000".into(), "#ffff00".into()])); + frame(&mut app, &ctx, 0.2, vec![], 0); + set_row(&mut app, "#0000ff", json!("rgb 128 0 128")); + let sent = sent_hex(&app); + assert_eq!(sent, ["#ff0000", "#800080", "#ffff00"], "OK gives the blue row's swatch its new color"); + act(&mut app, &ctx, 0.3, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#ff0000".into(), "#800080".into(), "#ffff00".into()]), "the second save does too"); + } + + /// Without art, an excluded row leaves its swatch its own color at Save Changes and at OK, even + /// when its new color was changed before it was excluded. + #[test] + fn saving_a_group_without_art_keeps_an_excluded_rows_color() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000", "#0000ff"], "keepModel": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + if from_colors(r).first().map(|c| c.to_hex()).as_deref() == Some("#ff0000") { + r["to"] = json!("rgb 0 128 0"); + r["exclude"] = json!(true); + } + } + d.fields.insert("rows".into(), Value::Array(rs)); + let sent = sent_hex(&app); + assert_eq!(sent, ["#ff0000", "#0000ff"], "OK keeps the excluded row's swatch"); + let p = apply_params(app.ui.dialog.as_ref().unwrap()); + assert_eq!(p["groupColors"][0], "keep", "so the Global Adjust leaves it as it is too: {p}"); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#ff0000".into(), "#0000ff".into()]), "so does Save Changes"); + } + + /// With art in more colors than the group has swatches, an excluded row past the swatches adds + /// no color at Save Changes, as at OK. + #[test] + fn saving_a_group_with_art_adds_no_color_for_an_excluded_row_past_its_swatches() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000"], "keepModel": true})).unwrap(); + let (blue, yellow) = (square(&mut app, 10.0, "#0000ff"), square(&mut app, 40.0, "#ffff00")); + app.run("select.set", json!({"ids": [blue, yellow]})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("method".into(), json!(Method::Exact.id())); + d.fields.insert("colors".into(), json!(2)); + d.fields.remove(REDUCED); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + assert_eq!(rs.len(), 2, "a row for each color of the art: {rs:?}"); + for r in &mut rs { + r["exclude"] = json!(true); + } + d.fields.insert("rows".into(), Value::Array(rs)); + // `recolor.apply` adds nothing for a "keep" past the group's swatches. + assert_eq!(apply_params(app.ui.dialog.as_ref().unwrap())["groupColors"], json!(["keep", "keep"]), "OK adds no color"); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#ff0000".into()]), "Save Changes adds none either"); + } + + /// Without art, a row excluded after Save Changes gave its swatch a new color leaves the swatch + /// that saved color at a second Save Changes, as OK does. + #[test] + fn saving_a_group_without_art_keeps_a_saved_color_when_its_row_is_excluded() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000", "#0000ff"], "keepModel": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + frame(&mut app, &ctx, 0.0, vec![], 0); + set_row(&mut app, "#ff0000", json!("rgb 0 128 0")); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#008000".into(), "#0000ff".into()])); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + if r["to"] == json!("rgb 0 128 0") { + r["exclude"] = json!(true); + } + } + d.fields.insert("rows".into(), Value::Array(rs)); + assert_eq!(sent_hex(&app), ["#008000", "#0000ff"], "OK keeps the saved color"); + act(&mut app, &ctx, 0.2, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#008000".into(), "#0000ff".into()]), "so does a second Save Changes"); + } + + /// Save Changes that recolors linked art so that one swatch takes another swatch's old color: + /// read again, the row of the second swatch's new color gives that swatch a later new color. + #[test] + fn saving_a_group_twice_with_linked_art_finds_the_row_of_a_swatchs_new_color() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Linked", "fromArtwork": true, "toGlobal": true})).unwrap(); + assert_eq!(group_hex(&app, "Linked"), Some(vec!["#ff0000".into(), "#0000ff".into()])); + app.run("ui.recolorDialog", json!({"group": "Linked"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + set_row(&mut app, "#ff0000", json!("rgb 0 0 255")); + set_row(&mut app, "#0000ff", json!("rgb 0 128 0")); + act(&mut app, &ctx, 0.1, "save").unwrap(); + frame(&mut app, &ctx, 0.2, vec![], 0); + assert_eq!(group_hex(&app, "Linked"), Some(vec!["#0000ff".into(), "#008000".into()])); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + if from_colors(r).first().map(|c| c.to_hex()).as_deref() == Some("#008000") { + r["to"] = json!("rgb 128 0 128"); + r["exclude"] = json!(false); + } + } + d.fields.insert("rows".into(), Value::Array(rs)); + assert_eq!(sent_hex(&app), ["#0000ff", "#800080"], "OK gives the green swatch the green row's new color"); + act(&mut app, &ctx, 0.3, "save").unwrap(); + assert_eq!(group_hex(&app, "Linked"), Some(vec!["#0000ff".into(), "#800080".into()]), "so does Save Changes"); + } + + /// Save Changes with a Global Adjust: the saved group holds it, the rows' new colors take it and + /// it goes back to 0%, so OK with a new name renames the group without adjusting it again. + #[test] + fn saving_a_group_with_a_global_adjust_applies_it_once() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000", "#0000ff"], "keepModel": true})).unwrap(); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("method".into(), json!(Method::Exact.id())); + d.fields.insert("globalAdjust".into(), json!({"brightness": -50.0})); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + act(&mut app, &ctx, 0.1, "save").unwrap(); + let saved = group_hex(&app, "Plain").unwrap(); + assert!(!saved.contains(&"#ff0000".to_string()), "the save darkened the group: {saved:?}"); + frame(&mut app, &ctx, 0.2, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + assert_eq!(adjust_values(d), [0.0; 4]); + d.fields.insert("groupName".into(), json!("Dark")); + let p = apply_params(app.ui.dialog.as_ref().unwrap()); + assert!(p.get("globalAdjust").is_none(), "{p}"); + assert_eq!(p["groupColors"], json!(vec!["keep"; saved.len()]), "OK keeps each saved color"); + let d = app.ui.dialog.clone().unwrap(); + confirm(&mut app, &d).unwrap(); + assert_eq!(group_hex(&app, "Dark"), Some(saved), "OK renames the group with its saved colors"); + } + + /// Without art, Save Changes with a Global Adjust gives the group the rows' new colors with the + /// adjustment, and OK gives it the same colors again: the adjustment applies to the rows' new + /// colors, not to the saved group. + #[test] + fn saving_a_group_without_art_with_a_global_adjust_applies_it_once() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000", "#0000ff"], "keepModel": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("globalAdjust".into(), json!({"brightness": -50.0})); + frame(&mut app, &ctx, 0.0, vec![], 0); + act(&mut app, &ctx, 0.1, "save").unwrap(); + let saved = group_hex(&app, "Plain").unwrap(); + assert!(!saved.contains(&"#ff0000".to_string()), "the save darkened the group: {saved:?}"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(group_hex(&app, "Plain").unwrap(), saved, "OK does not darken the group again"); + } + + /// With Limit to Library, Save Changes gives the group the library's nearest color to a row's + /// new color, as OK does, also when the rows were set without being snapped. + #[test] + fn saving_a_group_snaps_its_colors_to_the_library() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + let doc = &app.session.doc().unwrap().doc; + let names: Vec<_> = doc + .swatches + .iter() + .filter(|s| !s.is_reserved()) + .map(|s| s.name.clone()) + .chain(doc.swatch_groups.iter().map(|g| g.name.clone())) + .collect(); + app.run("swatch.delete", json!({"names": names})).unwrap(); + app.run("swatch.new", json!({"name": "Only Yellow", "color": "#ffff00"})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ffff00"], "keepModel": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("limitTo".into(), json!("document")); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + rs[0]["to"] = json!("rgb 250 250 10"); + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(vec!["#ffff00".into()]), "the saved color is the library's"); + } + + /// Without art, Save Changes removes a removed color's swatch and adds a color added on the Edit + /// tab, and OK afterwards gives the group the same colors: it removes and adds nothing more. + #[test] + fn saving_a_group_without_art_with_added_and_removed_colors_keeps_them_at_ok() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Plain", "colors": ["#ff0000", "#00ff00", "#0000ff"], "keepModel": true})).unwrap(); + app.run("ui.recolorDialog", json!({"group": "Plain"})).unwrap(); + frame(&mut app, &ctx, 0.0, vec![], 0); + let d = app.ui.dialog.as_mut().unwrap(); + let mut rs = super::rows(d); + for r in &mut rs { + if from_colors(r).first().map(|c| c.to_hex()).as_deref() == Some("#00ff00") { + r["to"] = Value::Null; + } + } + // The added color's row was moved ahead of the others. + rs.insert(0, json!({"from": [], "to": "rgb 255 255 0", "added": true})); + d.fields.insert("rows".into(), Value::Array(rs)); + act(&mut app, &ctx, 0.1, "save").unwrap(); + let want: Vec = ["#ff0000", "#0000ff", "#ffff00"].map(String::from).to_vec(); + assert_eq!(group_hex(&app, "Plain"), Some(want.clone()), "the save removes green and adds yellow"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(group_hex(&app, "Plain"), Some(want), "OK gives the group the same colors"); + } + + /// With art: a group picked in the list reduces the art to a row per color of the group, which + /// become the rows' new colors, and the art previews them; the list draws beside the tabs and + /// hides with `groupStorage`. + #[test] + fn a_group_picked_in_the_list_recolors_the_art() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let ctx = egui::Context::default(); + app.run("file.new", json!({"width": 300, "height": 100})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Warm", "colors": ["#ffff00", "#00ff00"], "keepModel": true})).unwrap(); + app.run("swatch.newGroup", json!({"name": "Cool", "colors": ["#0000ff"], "keepModel": true})).unwrap(); + let (red, blue) = (square(&mut app, 10.0, "#ff0000"), square(&mut app, 40.0, "#0000ff")); + app.run("select.set", json!({"ids": [red, blue]})).unwrap(); + app.run("ui.recolorDialog", json!({})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("method".into(), json!(Method::Exact.id())); + crate::theme::install_fonts(&ctx); + frame(&mut app, &ctx, 0.0, vec![], 0); + assert_eq!(fill_hex(&app, red), "#ff0000"); + // A button set with the group, before a frame, saves the rows the group gives the art. + let n = app.session.doc().unwrap().doc.swatch_groups.len(); + set(&mut app, "group", json!("Warm")).unwrap(); + act(&mut app, &ctx, 0.1, "new").unwrap(); + let doc = &app.session.doc().unwrap().doc; + let mut saved: Vec = doc.swatch_groups.last().unwrap().swatches.iter().filter_map(|w| w.paint.color()).map(|c| c.to_hex()).collect(); + saved.sort(); + assert_eq!((doc.swatch_groups.len(), saved), (n + 1, vec!["#00ff00".to_string(), "#ffff00".to_string()])); + frame(&mut app, &ctx, 0.2, vec![], 0); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!(super::rows(d).len(), 2); + assert_eq!(d.str("groupName"), "Warm"); + let mut shown = [fill_hex(&app, red), fill_hex(&app, blue)]; + shown.sort(); + assert_eq!(shown, ["#00ff00", "#ffff00"], "the art previews the group's colors"); + // The name the preview gives the group being edited picks that group in the list. + app.ui.dialog.as_mut().unwrap().fields.insert("groupName".into(), json!("Sunny")); + frame(&mut app, &ctx, 0.21, vec![], 0); + set(&mut app, "group", json!("Sunny")).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((&d.fields["group"], &d.fields[GROUP_LOADED], d.str("groupName")), (&json!("Warm"), &json!("Warm"), "Sunny".into())); + // A group the document has under that name is picked instead. + app.ui.dialog.as_mut().unwrap().fields.insert("groupName".into(), json!("Cool")); + frame(&mut app, &ctx, 0.22, vec![], 0); + set(&mut app, "group", json!("Cool")).unwrap(); + frame(&mut app, &ctx, 0.23, vec![], 0); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((&d.fields[GROUP_LOADED], super::rows(d).len()), (&json!("Cool"), 1)); + set(&mut app, GROUP_STORAGE, json!(false)).unwrap(); + frame(&mut app, &ctx, 0.3, vec![], 0); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields[GROUP_STORAGE], false); + } } diff --git a/crates/ui-egui/src/dialogs/save_pdf.rs b/crates/ui-egui/src/dialogs/save_pdf.rs index af047a4cc2..111d400a3b 100644 --- a/crates/ui-egui/src/dialogs/save_pdf.rs +++ b/crates/ui-egui/src/dialogs/save_pdf.rs @@ -590,9 +590,10 @@ fn image_rows(ui: &mut egui::Ui, d: &mut Dialog, key: &str, title: &str) { ui.horizontal(|ui| { pick::(ui, d, &format!("{base}.downsample"), 150.0, |_| true); ui.label(tl!("to")); - number(ui, d, &format!("{base}.ppi"), " ppi", on); + let ppi = super::ppi_suffix(); + number(ui, d, &format!("{base}.ppi"), &ppi, on); ui.label(tl!("above")); - number(ui, d, &format!("{base}.abovePpi"), " ppi", on); + number(ui, d, &format!("{base}.abovePpi"), &ppi, on); }); ui.horizontal(|ui| { ui.label(tl!("Compression:")); diff --git a/crates/ui-egui/src/dialogs/simplify_slider.rs b/crates/ui-egui/src/dialogs/simplify_slider.rs index 88838585ee..4257c15177 100644 --- a/crates/ui-egui/src/dialogs/simplify_slider.rs +++ b/crates/ui-egui/src/dialogs/simplify_slider.rs @@ -87,7 +87,7 @@ impl Strip { /// The open strip `d` moves to the level `cmd {auto: true}` picks for the selection, and the /// canvas previews it → {level}. pub fn auto(&self, app: &mut VectorcraftApp, mut d: Dialog) -> Result { - let _ = app.session.begin_interaction(self.label); + app.begin_interaction(self.label)?; let r = app.session.preview(self.cmd, &json!({ "auto": true })).map_err(|e| e.to_string())?; let level = r["level"].as_f64().unwrap_or(self.default_level); d.fields.insert("level".into(), json!(level)); diff --git a/crates/ui-egui/src/dialogs/swatch_options.rs b/crates/ui-egui/src/dialogs/swatch_options.rs index 9583b893ef..913a9126a8 100644 --- a/crates/ui-egui/src/dialogs/swatch_options.rs +++ b/crates/ui-egui/src/dialogs/swatch_options.rs @@ -123,8 +123,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { d.fields.insert("preview".into(), json!(pv)); } if pv && (changed || pv_changed || !app.session.in_interaction()) { - let _ = app.session.begin_interaction("Swatch Options"); - if let Err(e) = app.session.preview("swatch.edit", &edit_params(d)) { + // A failure to begin (typing that can't be kept) shows, and nothing previews. + if let Err(e) = app.begin_interaction("Swatch Options") { + app.status(e); + } else if let Err(e) = app.session.preview("swatch.edit", &edit_params(d)) { app.status(e.to_string()); } } else if !pv && pv_changed { diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index 08968d5e93..b8d6a59887 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -3654,3 +3654,94 @@ fn color_halftones_max_radius_stays_in_pixels_whatever_the_units() { assert!(shows, "{typed} shows as {shown}, not in centimetres"); } } + +/// The resolution fields of Flatten Transparency, Document Raster Effects Settings, Effect › +/// Rasterize, the PNG options and the PDF save dialog's Compression section show their unit in the interface +/// language (French "ppp"), as the `{n} ppi` row writes it. +#[test] +fn resolution_fields_show_the_ppi_unit_in_the_interface_language() { + fn texts(s: &egui::Shape, out: &mut Vec) { + match s { + egui::Shape::Text(t) => out.push(t.galley.text().to_string()), + egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)), + _ => {} + } + } + fn shown(app: &mut VectorcraftApp) -> Vec { + let ctx = egui::Context::default(); + theme::install_fonts(&ctx); + theme::apply(&ctx, Default::default()); + let raw = + || egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 1000.0))), ..Default::default() }; + // A window is measured in its first frame and drawn from the second. + ctx.run_ui(raw(), |ui| show(app, ui.ctx())).textures_delta.clear(); + let mut out = ctx.run_ui(raw(), |ui| show(app, ui.ctx())); + out.textures_delta.clear(); + let mut all = vec![]; + out.shapes.iter().for_each(|s| texts(&s.shape, &mut all)); + all + } + type Open = fn(&mut VectorcraftApp); + let dialogs: [(&str, Open, &str); 5] = [ + ( + "Flatten Transparency", + |app| { + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + app.run("transparency.set", json!({"opacity": 50})).unwrap(); + app.run("ui.flattenTransparencyDialog", json!({})).unwrap(); + }, + "ppp", + ), + ( + "Document Raster Effects Settings", + |app| { + crate::menus::invoke(app, "document.rasterEffectsSettings", json!({})); + app.ui.dialog.as_mut().unwrap().fields.insert("resolution".into(), json!(200)); + }, + "200 ppp", + ), + ( + "Rasterize", + |app| { + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + crate::menus::invoke(app, "effect.dialog", json!({"effect": "rasterize"})); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("useDocumentResolution".into(), json!(false)); + d.fields.insert("resolution".into(), json!(200)); + }, + "200 ppp", + ), + ( + "PNG Options", + |app| { + png_options::open(app, vectorcraft_engine::cmd::fileio::format("png").unwrap(), json!({"format": "png", "path": "/out/a.png"})); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("ppi".into(), json!(200)); + d.fields.insert("__otherPpi".into(), json!(true)); + }, + "200 ppp", + ), + ( + "Save PDF", + |app| { + app.run("ui.savePdfDialog", json!({"path": "/tmp/ppi.pdf"})).unwrap(); + app.ui.dialog.as_mut().unwrap().fields.insert("__section".into(), json!("Compression")); + }, + " ppp", + ), + ]; + let mut bad = vec![]; + for (name, open, want) in dialogs { + let mut app = app(); + open(&mut app); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").unwrap()); + let texts = shown(&mut app); + crate::i18n::set_current(crate::i18n::Lang::EN); + let translated = texts.iter().any(|t| t.trim() == want.trim() || (want.starts_with(' ') && t.ends_with(want))); + let english = texts.iter().any(|t| t.trim() == "ppi" || t.ends_with(" ppi")); + if !translated || english { + bad.push(format!("{name}: {texts:?}")); + } + } + assert!(bad.is_empty(), "{}", bad.join("\n")); +} diff --git a/crates/ui-egui/src/dialogs/tests_eps.rs b/crates/ui-egui/src/dialogs/tests_eps.rs index bebe8a1407..5cd2efe24c 100644 --- a/crates/ui-egui/src/dialogs/tests_eps.rs +++ b/crates/ui-egui/src/dialogs/tests_eps.rs @@ -67,6 +67,224 @@ fn eps_options_take_saved_flattener_presets_and_refuse_bad_ones() { assert!(written.borrow()[0].1.starts_with(b"%!PS-Adobe-3.0 EPSF-3.0"), "{:?}", &written.borrow()[0].1[..8]); } +/// Two overlapping squares, the second half transparent, so that an EPS export flattens them. +fn transparent_art(app: &mut VectorcraftApp) { + for (x, color) in [(5, "#ff0000"), (20, "#0000ff")] { + app.run("select.none", json!({})).unwrap(); + app.run("paint.setFill", json!({"color": color})).unwrap(); + app.run("shape.rectangle", json!({"x": x, "y": 5, "width": 30, "height": 30})).unwrap(); + } + app.run("transparency.set", json!({"opacity": 50})).unwrap(); +} + +/// Custom… over EPS Options, as its button opens it. +fn open_custom(app: &mut VectorcraftApp) { + let parent = app.ui.dialog.clone().expect("EPS Options are open"); + app.ui.dialog = Some(eps_options::over(&parent, &app.session.prefs.flattener_presets)); + frame(app); +} + +#[test] +fn custom_flattener_options_start_from_the_preset_and_cancel_goes_back_unchanged() { + let (mut app, _) = app(1); + app.run("ui.epsOptionsDialog", json!({"path": "/out/a.eps", "flattenerPreset": "high"})).unwrap(); + frame(&mut app); + let before = app.ui.dialog.as_ref().unwrap().fields.clone(); + open_custom(&mut app); + assert_eq!(kind(&app), Some(eps_options::CUSTOM_KIND)); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((d.f64("balance", 0.0), d.f64("lineArtPpi", 0.0), d.bool("clipComplexRegions")), (100.0, 1200.0, true), "High Resolution's"); + assert!(!d.bool("preserveAlpha"), "EPS has no alpha"); + set(&mut app, "balance", json!(10)); + cancel(&mut app); + assert_eq!(kind(&app), Some("epsOptions")); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields, before, "Cancel leaves EPS Options as they were"); +} + +#[test] +fn custom_flattener_options_are_exported_and_remembered_until_a_preset_is_chosen() { + let (mut app, written) = app(1); + transparent_art(&mut app); + app.run("flattener.presets.save", json!({"name": "Mine", "balance": 100})).unwrap(); + let opts = json!({"path": "/out/a.eps", "flattenerPreset": "Mine", "previewFormat": "none", "thumbnails": false}); + app.run("ui.epsOptionsDialog", opts).unwrap(); + frame(&mut app); + open_custom(&mut app); + assert_eq!(app.ui.dialog.as_ref().unwrap().f64("balance", 0.0), 100.0, "the saved preset's"); + set(&mut app, "balance", json!(0)); + confirm(&mut app).unwrap(); + assert_eq!(kind(&app), Some("epsOptions"), "OK goes back to EPS Options"); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((d.fields["flattener"]["balance"].as_f64(), d.fields["flattener"]["preserveAlpha"].as_bool()), (Some(0.0), Some(false))); + assert_eq!(d.str("flattenerPreset"), "Medium Resolution", "a built-in preset under options that set everything"); + frame(&mut app); + // The custom options don't need the saved preset they started from. + app.run("flattener.presets.delete", json!({"name": "Mine"})).unwrap(); + confirm(&mut app).unwrap(); + assert!(ps(&written.borrow()[0].1).contains("image"), "balance 0 rasterizes the flattened art"); + // The next EPS Options start from them; a preset asked for without options drops them. + crate::menus::invoke(&mut app, "ui.epsOptionsDialog", json!({})); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["flattener"]["balance"].as_f64(), Some(0.0)); + cancel(&mut app); + app.run("ui.epsOptionsDialog", json!({"path": "/out/b.eps", "flattenerPreset": "medium"})).unwrap(); + assert!(!app.ui.dialog.as_ref().unwrap().fields.contains_key("flattener")); + confirm(&mut app).unwrap(); + assert!(!ps(&written.borrow()[1].1).contains("image"), "Medium Resolution keeps the squares vector"); +} + +#[test] +fn a_flattener_preset_set_from_outside_drops_the_custom_options() { + let (mut app, _) = app(1); + app.run("ui.epsOptionsDialog", json!({"path": "/out/a.eps"})).unwrap(); + frame(&mut app); + open_custom(&mut app); + set(&mut app, "balance", json!(20)); + confirm(&mut app).unwrap(); + assert!(app.ui.dialog.as_ref().unwrap().fields.contains_key("flattener")); + // `ui.dialog.set {flattenerPreset: "low"}`, as the control channel sets it. + let old = app.ui.dialog.as_ref().unwrap().fields.get("flattenerPreset").cloned(); + set(&mut app, "flattenerPreset", json!("low")); + field_set(&mut app, "flattenerPreset", old.as_ref()).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert!(!d.fields.contains_key("flattener"), "the preset replaces the custom options"); + assert_eq!(d.str("flattenerPreset"), "Low Resolution"); +} + +#[test] +fn bad_custom_flattener_options_keep_the_dialog_open() { + let (mut app, _) = app(1); + app.run("ui.epsOptionsDialog", json!({"path": "/out/a.eps", "overprints": "discard"})).unwrap(); + frame(&mut app); + open_custom(&mut app); + set(&mut app, "gradientPpi", json!(9000)); + frame(&mut app); + let e = confirm(&mut app).unwrap_err(); + assert!(e.contains("resolutions"), "{e}"); + assert_eq!(kind(&app), Some(eps_options::CUSTOM_KIND)); + // Overprints decides whether overprints are kept, so OK keeps the option as it was. + set(&mut app, "gradientPpi", json!(150)); + set(&mut app, "preserveAlpha", json!(true)); + confirm(&mut app).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((d.fields["flattener"]["preserveOverprints"].as_bool(), d.fields["flattener"]["preserveAlpha"].as_bool()), (Some(true), Some(false))); +} + +/// Headless frames of the dialog layer with screen-reader output, input events and a clock. +pub(super) struct Frames { + ctx: egui::Context, + time: f64, +} + +impl Frames { + pub(super) fn new() -> Self { + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + Self { ctx, time: 0.0 } + } + + fn run(&mut self, app: &mut VectorcraftApp, events: Vec) -> egui::FullOutput { + self.time += 0.1; + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1280.0, 900.0)); + let input = egui::RawInput { events, time: Some(self.time), screen_rect: Some(screen), ..Default::default() }; + let mut out = self.ctx.run_ui(input, |ui| show(app, ui.ctx())); + out.textures_delta.clear(); + out + } + + /// The screen-reader node of the control of `role` named `label`, with its center. + pub(super) fn control(&mut self, app: &mut VectorcraftApp, label: &str, role: egui::accesskit::Role) -> (egui::accesskit::NodeId, egui::Pos2) { + self.run(app, vec![]); + let out = self.run(app, vec![]); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let (id, n) = + nodes.iter().find(|(_, n)| n.label() == Some(label) && n.role() == role).unwrap_or_else(|| panic!("no {role:?} named {label:?}")); + let b = n.bounds().expect("bounds"); + (*id, egui::pos2((b.x0 + b.x1) as f32 * 0.5, (b.y0 + b.y1) as f32 * 0.5)) + } + + pub(super) fn click(&mut self, app: &mut VectorcraftApp, at: egui::Pos2) { + for pressed in [true, false] { + let button = egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + self.run(app, vec![egui::Event::PointerMoved(at), button]); + } + } + + /// Click the text field named `label`, type `text` over its text and press Tab. + pub(super) fn type_into(&mut self, app: &mut VectorcraftApp, label: &str, text: &str) { + let (_, at) = self.control(app, label, egui::accesskit::Role::TextInput); + self.click(app, at); + self.run(app, vec![egui::Event::Text(text.into())]); + let tab = |pressed| egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed, repeat: false, modifiers: Default::default() }; + self.run(app, vec![tab(true)]); + self.run(app, vec![tab(false)]); + self.run(app, vec![]); + } +} + +/// Enter on the focused Custom… button opens the custom options and does not also confirm them. +#[test] +fn enter_on_the_custom_button_opens_the_custom_options() { + use egui::accesskit::{Action, ActionRequest, Role, TreeId}; + let (mut app, _) = app(1); + app.run("flattener.presets.save", json!({"name": "Mine", "balance": 0})).unwrap(); + app.run("ui.epsOptionsDialog", json!({"path": "/out/a.eps", "flattenerPreset": "Mine"})).unwrap(); + let mut f = Frames::new(); + let (node, _) = f.control(&mut app, "Custom…", Role::Button); + f.run( + &mut app, + vec![egui::Event::AccessKitActionRequest(ActionRequest { action: Action::Focus, target_node: node, target_tree: TreeId::ROOT, data: None })], + ); + let enter = |pressed| egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed, repeat: false, modifiers: Default::default() }; + f.run(&mut app, vec![enter(true)]); + f.run(&mut app, vec![enter(false)]); + assert_eq!(kind(&app), Some(eps_options::CUSTOM_KIND), "the custom options stay open"); + let parent = super::parent(app.ui.dialog.as_ref().unwrap()).unwrap(); + assert_eq!(parent.str("flattenerPreset"), "Mine", "EPS Options keep their preset"); +} + +/// With a value out of range, the editor shows the values entered, and changing a switch keeps +/// them, so OK still refuses the bad value. +#[test] +fn a_switch_changed_beside_a_bad_value_keeps_the_values_entered() { + let (mut app, _) = app(1); + app.run("ui.epsOptionsDialog", json!({"path": "/out/a.eps"})).unwrap(); + frame(&mut app); + open_custom(&mut app); + set(&mut app, "balance", json!(20)); + set(&mut app, "gradientPpi", json!(9000)); + set(&mut app, "lineArtPpi", json!("many")); + let mut f = Frames::new(); + let (_, at) = f.control(&mut app, "Convert All Text to Outlines", egui::accesskit::Role::CheckBox); + let before = app.ui.dialog.as_ref().unwrap().bool("textToOutlines"); + f.click(&mut app, at); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!(d.bool("textToOutlines"), !before, "the switch changes"); + assert_eq!((d.f64("balance", 0.0), d.f64("gradientPpi", 0.0)), (20.0, 9000.0), "the other values stay as entered"); + assert_eq!(d.fields["lineArtPpi"], json!("many"), "a value of the wrong type stays to be refused"); + assert!(confirm(&mut app).is_err()); + set(&mut app, "lineArtPpi", json!(300)); + assert!(confirm(&mut app).unwrap_err().contains("resolutions")); +} + +/// A value of the wrong type shows blank, and typing the default preset's value into its field +/// replaces it, so OK takes the options. +#[test] +fn the_default_value_typed_over_a_value_of_the_wrong_type_replaces_it() { + let (mut app, _) = app(1); + app.run("ui.epsOptionsDialog", json!({"path": "/out/a.eps"})).unwrap(); + frame(&mut app); + open_custom(&mut app); + set(&mut app, "lineArtPpi", json!("many")); + let default = vectorcraft_engine::cmd::FlattenOptions::default().line_art_ppi; + let mut f = Frames::new(); + f.type_into(&mut app, "Line Art and Text Resolution:", &default.to_string()); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["lineArtPpi"], json!(default)); + confirm(&mut app).unwrap(); + assert_eq!(kind(&app), Some("epsOptions")); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["flattener"]["lineArtPpi"].as_f64(), Some(default)); +} + #[test] fn the_eps_options_dialog_needs_a_document() { let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); diff --git a/crates/ui-egui/src/font_menu.rs b/crates/ui-egui/src/font_menu.rs index d5368d1fa4..499446d4f0 100644 --- a/crates/ui-egui/src/font_menu.rs +++ b/crates/ui-egui/src/font_menu.rs @@ -2057,7 +2057,8 @@ pub(crate) fn apply(app: &mut VectorcraftApp, ctx: &egui::Context, pick: FontPic FontPick::Preview(f, style) => { if !previewing { crate::panels::character::end_typing(app); - if app.session.begin_interaction("Font").is_err() { + if let Err(e) = app.begin_interaction("Font") { + app.status(e); return; } crate::panels::set_pstate(ctx, PREVIEWING, true); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 0b61596b21..5e04ae4917 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -105,6 +105,7 @@ Add Anchor Point Добавяне на опорна точка Add Anchor Point Tool Инструмент „Добавяне на опорна точка“ Add Anchor Points Добавяне на опорни точки + Add Around Добавяне около обекта Add Effect Добавяне на ефект Add Freeform Line Добавяне на свободна линия Add Freeform Point Добавяне на свободна точка @@ -182,6 +183,7 @@ Angle: Ъгъл: Angles Ъгли Animated Zoom Анимирано мащабиране + Anti Alias Заглаждане Anti-alias Заглаждане Anti-Alias Заглаждане Anti-alias Rasters Заглаждане на растери @@ -539,6 +541,7 @@ font-technology Variable Променливи Color Mixer (Shift-click the chip) Цветов смесител (Shift-щракване върху блокчето) Color Mode Цветен режим Color Mode: Цветен режим: + Color Model Цветен модел Color Model: Цветен модел: Color Models Цветни модели Color Picker Палитра с цвят @@ -565,6 +568,7 @@ font-technology Variable Променливи Colors Цветове Colors: Цветове: Column Graph Tool Инструмент „Колонна диаграма“ + Columns Колони Columns: Колони: Column… Колона… Combine Slices Обединяване на парчетата @@ -1040,6 +1044,7 @@ font-technology Variable Променливи Enable text access for screen readers Разрешаване на достъп до текст за екранни четци Enable Touch Gestures Разрешаване на докосващи жестове Switch Selection and Drawing Modes Превключване между режим на селекция и рисуване + Select Last Selection Tool Избор на последния инструмент за селекция Enable Touch Workspace Разрешаване на работно пространство за докосване Encoding Кодиране Encoding: Кодиране: @@ -2454,6 +2459,8 @@ font-technology Variable Променливи Other Library… Друга библиотека… Some scripts were not listed Някои скриптове не са изброени The Scripts folder cannot be read Папката Scripts не може да бъде прочетена + Loading scripts… Зареждане на скриптовете… + The Scripts folder is still being read Папката Scripts все още се чете Other Script… Друг скрипт… Out of Gamut Warning Предупреждение за излизане извън цветовата гама Out of Web Color Warning Предупреждение за цвят извън уеб палитрата @@ -2482,6 +2489,9 @@ font-technology Variable Променливи Overprint Напечатване върху друго Overprint and Transparency Flattener Сплескване на надпечатването и прозрачността Overprint and Transparency Flattener Options Опции за сплескване на надпечатването и прозрачността + Custom… Потребителски… + Custom Transparency Flattener Options Потребителски опции за сплескване на прозрачността + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS няма алфа прозрачност, а „Надпечати“ определя дали надпечатванията се запазват. Overprint Black… Напечатване на черното върху друго… Overprint Fill Напечатване на запълването върху друго Overprint Preview Преглед на напечатването върху друго @@ -2586,6 +2596,7 @@ font-technology Variable Променливи Play Current Selection Изпълнение на текущия избор Save Actions… Запазване на действия… Load Actions… Зареждане на действия… + Replace Actions… Замяна на действия… Reset Actions Нулиране на действия Replace the current actions with the default set? Да се заменят ли текущите действия с набора по подразбиране? Append adds the default set after the current sets instead. С „Добавяне“ наборът по подразбиране се добавя след текущите набори. @@ -2951,6 +2962,8 @@ digits Malayalam Малаялам Reselect Избиране отново Reset Нулиране Reset Bounding Box Нулиране на ограничителната рамка + Rotate Bounding Box Завъртане на ограничителната рамка + Rotate Bounding Box… Завъртане на ограничителната рамка… Reset Envelope Mesh Нулиране на мрежата на обвивката Reset Envelope Shape Нулиране на формата на обвивката Reset Essentials Нулиране на основните @@ -2991,6 +3004,7 @@ digits Malayalam Малаялам Reshape Segment Преоформяне на сегмент Reshape Tool Инструмент „Преоформяне“ Reshape Type Area Преоформяне на текстова област + Resolution Разделителна способност Resolution: Разделителна способност: Responsive Адаптивен Restore Възстановяване @@ -3047,6 +3061,29 @@ digits Malayalam Малаялам The unit for East Asian type measurements, which no field uses yet. Единицата за мерките на източноазиатски текст, която засега не се използва от нито едно поле. When on, a number typed without a unit into a field in picas is read in points. Когато е включено, число, въведено без единица в поле в пики, се чете в точки. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. При XML ID имената на обектите се показват като XML ID в Слоеве, Променливи и Опции за слоя. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Стъпката за размер на текста и междуредие: Cmd/Ctrl+Shift+. и Cmd/Ctrl+Shift+, променят размера с една стъпка, а с Alt – с пет; в хоризонтален текст Alt със стрелка нагоре или надолу променя междуредието с една стъпка, а с Cmd/Ctrl – с пет. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Стъпката за разредка и кернинг в хилядни от em: в хоризонтален текст Alt със стрелка наляво или надясно променя кернинга при курсора или разредката на избрания текст с една стъпка, а с Cmd/Ctrl – с пет. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Стъпката за изместване на базовата линия: в хоризонтален текст Alt и Shift със стрелка нагоре или надолу преместват базовата линия с една стъпка, а с Cmd/Ctrl – с пет. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Показва опциите за японски и друг източноазиатски текст в панелите Знак, Абзац, OpenType и Глифи, както и командата Съставни шрифтове. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Показва опциите за арабски, иврит и индийски текст в панелите Знак и Абзац, например посока на абзаца, кашиди и цифри. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Инструментите за селекция избират текст само по базовата му линия, рамката на текста в област или пътя му, а не навсякъде в кутията му. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Менютата за шрифтове показват всеки шрифт с английското му име; ако е изключено, шрифт, който има име и на собствения си език, показва това име. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Новият текст в област започва с включен автоматичен размер, така че правоъгълна рамка с хоризонтален текст става по-висока или по-ниска според текста си. + Font lists and the Type › Font menu show a sample of each font beside its name. Списъците с шрифтове и менюто Шрифт показват мостра на всеки шрифт до името му. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Мострите на шрифтовете се рисуват с тъмен текст на бяло независимо от яркостта на интерфейса; това важи само докато визуализациите на шрифтове в менюто са включени. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Колко висок е всеки ред в списъците на полетата за шрифт, например в панела Знак, и съответно колко голяма е всяка мостра. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Колко от последно използваните шрифтове, от 1 до 15, показват Скорошни шрифтове и списъците с шрифтове, най-новите първи. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Когато смените шрифта или стила на шрифта на текст, знаците, за които новият шрифт няма глиф, запазват предишния си шрифт. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Розово открояване върху платното отбелязва глифите, заменени от функции на OpenType, например лигатури; то не се отпечатва и не се експортира. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. С инструмента Текст избирането на един знак показва до него върху платното ред с алтернативните му глифи за избор. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Розово открояване върху платното отбелязва текст, изобразен със заместващ шрифт, защото шрифтът му липсва; то не се отпечатва и не се експортира. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Новият текст, създаден с инструмент за текст, започва с избран примерен текст, който въвеждането заменя. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Въвеждането на знак за списък, например 1. или *, и след това интервал в началото на абзац превръща абзаца в списък. + Fonts in this folder show in the font menus and can be used without being installed. Шрифтовете в тази папка се показват в менютата за шрифтове и могат да се използват, без да са инсталирани. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Прилагането на графичен стил към текст премахва собствените запълване или контур на знаците, където стилът има такива, така че се вижда боята на стила. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Подравняване и Разпределяне измерват точковия текст по мастилото на глифите му вместо по em-кутията му. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Подравняване и Разпределяне измерват текста в област по мастилото на глифите му вместо по рамката му. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Ограничаващата рамка и панелът Трансформиране измерват точковия текст по мастилото на глифите му вместо по em-кутията му. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Прилепва рисуването, преместването и мащабирането към подразделенията на мрежата, дори когато мрежата е скрита; докато е включено, „Прилепване към пиксел“ не действа. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Цветът на водачите, които не са избрани; работна област с „Етикет на водачите“ рисува своите водачи в цвета на етикета. Draws guides as solid lines or as dots, including the guides already in the document. Рисува водачите като плътни линии или като точки, включително водачите, които вече са в документа. @@ -3128,6 +3165,7 @@ digits Malayalam Малаялам Rounded Rectangle Tool Инструмент „Закръглен правоъгълник“ Rounded Rectangle… Закръглен правоъгълник… Row Size: Размер на реда: + Rows Ленти Rows: Ленти: Rule: Линия: Rulers Линийки @@ -5385,6 +5423,7 @@ lighting Light Светлина @msg missing panel layout липсващо оформление на панели @msg unsupported native docking operation неподдържана вградена операция за скачване Linux Display Server Дисплейен сървър за Linux + Low-Latency Drawing Рисуване с ниско забавяне X11 (XWayland) When a Pen Is Attached X11 (XWayland) при свързана писалка If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Ако писалката на графичния таблет не рисува, изберете опция X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -6064,6 +6103,8 @@ theme Appearance Външен вид Reset Tracking and Kerning Нулиране на разредката и кернинга Reset Horizontal Scale Нулиране на хоризонталния мащаб Highlight Font Name Маркиране на името на шрифта + Highlight Font Size Маркиране на размера на шрифта + Other… Друг… Highlight Kerning Маркиране на кернинга Highlight Tracking Маркиране на разредката @msg span must be "object" or "selection", got {v} span трябва да е "object" или "selection", а не {v} @@ -6689,6 +6730,12 @@ anchor Points: Точки: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` трябва да е "free", "keepAngles" или "symmetric" @msg `{key}` must be [x, y] `{key}` трябва да е [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Преобразувател на мерни единици + Unit Converter Panel Панел „Преобразувател на мерни единици“ + Copy with Units Копиране с мерните единици + From Selection От селекцията + # Color Effects add-on: Select by Color Kind. Select by Color Kind Избиране по вид цвят Objects with Spot Colors Обекти с плакатни цветове diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index bf2d140ae8..2ada0fcad9 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -64,6 +64,8 @@ Check Script Provjeri skriptu Some scripts were not listed Neke skripte nisu navedene The Scripts folder cannot be read Folder Scripts se ne može pročitati + Loading scripts… Učitavanje skripti… + The Scripts folder is still being read Folder Scripts se još čita Other Script… Druga skripta… Document Setup… Postavke dokumenta… Switch Units Promijeni jedinice @@ -167,6 +169,8 @@ Shear… Smicanje… Transform Each… Transformiši svaki… Reset Bounding Box Vrati granični okvir na početno + Rotate Bounding Box Rotiraj granični okvir + Rotate Bounding Box… Rotiraj granični okvir… Arrange Rasporedi Bring to Front Postavi na vrh Bring Forward Pomakni naprijed @@ -1521,6 +1525,7 @@ lighting Light Svjetlo Play Current Selection Reprodukuj trenutni odabir Save Actions… Sačuvaj akcije… Load Actions… Učitaj akcije… + Replace Actions… Zamijeni akcije… Reset Actions Vrati akcije na početno Replace the current actions with the default set? Zamijeniti trenutne akcije zadanim skupom? Append adds the default set after the current sets instead. Dugme Dodaj umjesto toga dodaje zadani skup iza trenutnih skupova. @@ -2751,6 +2756,7 @@ digits Malayalam Malajalam BLANK DOCUMENT PRESETS PREDLOŠCI PRAZNIH DOKUMENATA Bleed Napust Change to Right-to-Left Layout Prebaci na raspored s desna nalijevo + Columns Kolone Columns: Kolone: Documents you create appear here. Dokumenti koje kreirate pojavljuju se ovdje. More Settings Više postavki @@ -2885,6 +2891,9 @@ digits Malayalam Malajalam Open a document to preview its pages Otvorite dokument da pregledate njegove stranice Output › Mode Izlaz › Način Overprint and Transparency Flattener Options Opcije pretiska i spljoštavanja prozirnosti + Custom… Prilagođeno… + Custom Transparency Flattener Options Prilagođene opcije spljoštavanja prozirnosti + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS nema alfa prozirnost, a Pretisci određuju da li se pretisci zadržavaju. Place the pages with the placement again Ponovo postavi stranice s postavljanjem Placement: Postavljanje: Preserve CMYK Numbers Očuvaj CMYK brojeve @@ -2933,14 +2942,19 @@ digits Malayalam Malajalam Around Object Oko objekta Background: Pozadina: Changing these settings changes how raster effects look when exported, flattened or expanded. Promjena ovih postavki mijenja izgled rasterskih efekata pri izvozu, spljoštavanju ili proširivanju. + Add Around Dodaj oko objekta + Anti Alias Zaglađivanje ivica + Color Model Model boja Color Model: Model boja: Create Clipping Mask Kreiraj masku isijecanja Preserve Spot Colors Očuvaj spot boje + Resolution Rezolucija Resolution: Rezolucija: Transparent Prozirno Layout Order: Redoslijed rasporeda: Change to Left-to-Right Layout Prebaci na raspored s lijeva nadesno Artboards: {n} Radne ploče: {n} + Rows Redovi Rows: Redovi: Assign Dodijeli Color Group: Grupa boja: @@ -3931,6 +3945,7 @@ theme Appearance Izgled Enable Rubber Band for Omogući gumenu traku za Enable Touch Gestures Omogući pokrete dodirom Switch Selection and Drawing Modes Prebaci između načina odabira i crtanja + Select Last Selection Tool Odaberi posljednji alat za odabir Enable Touch Workspace Omogući radni prostor za dodir English: UK Engleski: UK Every (minutes) Svakih (minuta) @@ -4075,6 +4090,7 @@ theme Appearance Izgled Scroll Sideways with Cmd/Ctrl + Wheel Pomjeraj vodoravno uz Cmd/Ctrl + točkić miša Scrub Numeric Fields by Dragging Mijenjaj numerička polja prevlačenjem Linux Display Server Linux server prikaza + Low-Latency Drawing Crtanje s malim kašnjenjem Print Preview Pregled štampanja Print Setup Podešavanje štampe Bitmap Bitmapa @@ -4283,6 +4299,8 @@ axis Both Obje Reset Tracking and Kerning Vrati razmak slova i podrezivanje na početno Reset Horizontal Scale Vrati vodoravnu skalu na početno Highlight Font Name Istakni naziv fonta + Highlight Font Size Istakni veličinu fonta + Other… Druga… Highlight Kerning Istakni podrezivanje Highlight Tracking Istakni razmak slova Step Type Vrsta koraka @@ -4484,6 +4502,29 @@ font-technology Variable Varijabilni The unit for East Asian type measurements, which no field uses yet. Jedinica za mjere istočnoazijskog teksta, koju još nijedno polje ne koristi. When on, a number typed without a unit into a field in picas is read in points. Kad je uključeno, broj unesen bez jedinice u polje u picama čita se u tačkama. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Uz XML ID nazivi objekata prikazuju se kao XML ID u Slojevima, Varijablama i Opcijama sloja. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Korak za veličinu teksta i prored: Cmd/Ctrl+Shift+. i Cmd/Ctrl+Shift+, mijenjaju veličinu za jedan korak, a uz Alt za pet; u horizontalnom tekstu Alt sa strelicom gore ili dolje mijenja prored za jedan korak, a uz Cmd/Ctrl za pet. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Korak za razmak slova i kerning, u hiljaditim dijelovima em: u horizontalnom tekstu Alt sa strelicom lijevo ili desno mijenja kerning kod kursora ili razmak slova odabranog teksta za jedan korak, a uz Cmd/Ctrl za pet. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Korak za pomak osnovne linije: u horizontalnom tekstu Alt i Shift sa strelicom gore ili dolje pomjeraju osnovnu liniju za jedan korak, a uz Cmd/Ctrl za pet. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Prikazuje opcije za japanski i drugi istočnoazijski tekst u panelima Znak, Pasus, OpenType i Glifovi te naredbu Kompozitni fontovi. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Prikazuje opcije za arapski, hebrejski i indijski tekst u panelima Znak i Pasus, kao što su smjer pasusa, kašide i cifre. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Alati za odabir biraju tekst samo na njegovoj osnovnoj liniji, okviru teksta u području ili njegovoj putanji, a ne bilo gdje unutar njegovog okvira. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Meniji fontova prikazuju svaki font pod engleskim nazivom; kad je isključeno, font koji ima i naziv na svom jeziku prikazuje taj naziv. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Novi tekst u području počinje s uključenom automatskom veličinom, pa pravougaoni okvir horizontalnog teksta raste ili se smanjuje po visini prema svom tekstu. + Font lists and the Type › Font menu show a sample of each font beside its name. Liste fontova i meni Font prikazuju uzorak svakog fonta pored njegovog naziva. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Uzorci fontova crtaju se tamnim tekstom na bijelom, bez obzira na svjetlinu interfejsa; to važi samo dok su pregledi fontova u menijima uključeni. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Koliko je visok svaki red u listama polja za font, na primjer u panelu Znak, a time i koliko je velik svaki uzorak. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Koliko posljednje korištenih fontova, od 1 do 15, prikazuju Nedavni fontovi i liste fontova, najnoviji prvi. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Kad promijenite font ili stil fonta teksta, znakovi za koje novi font nema glif zadržavaju font koji su imali. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Ružičasto isticanje na platnu označava glifove koje su zamijenile OpenType funkcije, kao što su ligature; ne štampa se i ne izvozi. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. S alatom za tekst odabir jednog znaka prikazuje pored njega na platnu red njegovih alternativnih glifova za izbor. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Ružičasto isticanje na platnu označava tekst nacrtan zamjenskim fontom jer njegov font nedostaje; ne štampa se i ne izvozi. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Novi tekst napravljen alatom za tekst počinje odabranim tekstom čuvara mjesta, koji kucanje zamjenjuje. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Kucanje oznake liste, kao što je 1. ili *, a zatim razmaka na početku pasusa pretvara pasus u listu. + Fonts in this folder show in the font menus and can be used without being installed. Fontovi u ovoj mapi prikazuju se u menijima fontova i mogu se koristiti bez instaliranja. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Primjena grafičkog stila na tekst uklanja vlastitu ispunu ili potez znakova gdje ga stil ima, tako da se vidi boja stila. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Poravnaj i Rasporedi mjere tekst u tački prema tinti njegovih glifova umjesto prema njegovom em okviru. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Poravnaj i Rasporedi mjere tekst u području prema tinti njegovih glifova umjesto prema njegovom okviru. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Granični okvir i panel Transformiši mjere tekst u tački prema tinti njegovih glifova umjesto prema njegovom em okviru. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Priljepljuje crtanje, pomicanje i skaliranje uz podjele mreže, čak i dok je mreža skrivena; dok je uključeno, „Prilijepi uz piksel“ se ne primjenjuje. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Boja vodilica koje nisu odabrane; radna ploča s „Oznakom vodilica“ crta svoje vodilice u boji oznake. Draws guides as solid lines or as dots, including the guides already in the document. Crta vodilice kao pune linije ili kao tačke, uključujući vodilice koje su već u dokumentu. @@ -7070,6 +7111,11 @@ shape Open Otvoren Create Swatch Legend… Kreiraj legendu uzoraka boja… HEX HEX Help Bar Traka pomoći +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Pretvarač jedinica + Unit Converter Panel Panel Pretvarač jedinica + Copy with Units Kopiraj s jedinicama + From Selection Iz odabira # Type Tools add-on (Object › Plug-ins › Type Tools). Type Tools Alati za tekst Text Tweaker… Podešavanje teksta… diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 8e33bfee52..f1347ffbdf 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -186,6 +186,7 @@ Add Anchor Point Afegeix un punt d’ancoratge Add Anchor Point Tool Eina d’afegir un punt d’ancoratge Add Anchor Points Afegeix punts d’ancoratge + Add Around Afegeix al voltant de l’objecte Add Content Afegeix contingut Add Effect Afegeix un efecte Add Event Afegeix un esdeveniment @@ -296,6 +297,7 @@ Angles Angles Angular Angular Animated Zoom Zoom animat + Anti Alias Antialiàsing Anti-alias Antialiàsing Anti-Alias Antialiàsing Anti-alias Rasters Antialiàsing de ràsters @@ -804,6 +806,7 @@ antiAlias Sharp Nítid Color Mixer (Shift-click the chip) Mesclador de colors (Maj+clic a la mostra) Color Mode Mode de color Color Mode: Mode de color: + Color Model Model de color Color Model: Model de color: Color Models Models de color Color Panel Options Opcions del panell de color @@ -840,6 +843,7 @@ antiAlias Sharp Nítid Column Graph Tool Eina de gràfic de columnes Column Type: Tipus de columna: Column Width: Amplada de columna: + Columns Columnes Columns: Columnes: Column… Columna… Combine Slices Combina els talls @@ -1521,6 +1525,7 @@ antiAlias Sharp Nítid Enable text access for screen readers Activa l’accés al text per als lectors de pantalla Enable Touch Gestures Activa els gestos tàctils Switch Selection and Drawing Modes Canvia entre els modes de selecció i de dibuix + Select Last Selection Tool Tria l'última eina de selecció Enable Touch Workspace Activa l’espai de treball tàctil Encoding Codificació Encoding and writing the file… S’està codificant i escrivint el fitxer… @@ -1819,6 +1824,8 @@ digits Malayalam Malaiàlam Fonts added in the last 30 days Tipus de lletra afegits en els darrers 30 dies Font Preview Size Mida de previsualització del tipus de lletra Font Size Mida del tipus de lletra + Highlight Font Size Ressalta la mida del tipus de lletra + Other… Una altra… Font Style: Estil de tipus de lletra: Font Technology Tecnologia del tipus de lletra Font: Tipus de lletra: @@ -2498,6 +2505,7 @@ digits Malayalam Malaiàlam Linked Files Fitxers enllaçats Links Enllaços Linux Display Server Servidor de pantalla de Linux + Low-Latency Drawing Dibuix de baixa latència Liquify Liquifica List Data Sets Llista els conjunts de dades List Folder Llista la carpeta @@ -3150,6 +3158,9 @@ digits Malayalam Malaiàlam Overprint Sobrimpressió Overprint and Transparency Flattener Aplanador de sobremipressió i transparència Overprint and Transparency Flattener Options Opcions de l’aplanador de sobremipressió i transparència + Custom… Personalitzat… + Custom Transparency Flattener Options Opcions personalitzades de l’aplanador de transparència + EPS has no alpha transparency, and Overprints sets whether overprints are kept. L’EPS no té transparència alfa, i Sobreimpressions determina si es conserven les sobreimpressions. Overprint Black… Sobrimpressió del negre… Overprint Fill Sobrimpressió del farciment Overprint Preview Previsualització de la sobremipressió @@ -3343,6 +3354,7 @@ digits Malayalam Malaiàlam Play Current Selection Reprodueix la selecció actual Save Actions… Desa les accions… Load Actions… Carrega accions… + Replace Actions… Reemplaça les accions… Reset Actions Restableix les accions Replace the current actions with the default set? Voleu reemplaçar les accions actuals pel conjunt predeterminat? Append adds the default set after the current sets instead. Amb Afegeix, el conjunt predeterminat s’afegeix després dels conjunts actuals. @@ -3759,6 +3771,8 @@ digits Malayalam Malaiàlam Reset Automation Restableix Automation Reset Bar Position Restableix la posició de la barra Reset Bounding Box Restableix el quadre delimitador + Rotate Bounding Box Gira el quadre delimitador + Rotate Bounding Box… Gira el quadre delimitador… Reset Envelope Mesh Restableix la malla de l’embolcall Reset Envelope Shape Restableix la forma de l’embolcall Reset Essentials Restableix Essentials @@ -3819,6 +3833,7 @@ digits Malayalam Malaiàlam Resize panels Redimensiona els panells Resize Slice Redimensiona el tall Resize Type Area Redimensiona l’àrea de text + Resolution Resolució Resolution: Resolució: Responsive Adaptatiu Restore Restaura @@ -3875,6 +3890,29 @@ digits Malayalam Malaiàlam The unit for East Asian type measurements, which no field uses yet. La unitat per a les mesures del text d’Àsia oriental, que encara no fa servir cap camp. When on, a number typed without a unit into a field in picas is read in points. Quan està activat, un nombre escrit sense unitat en un camp en piques es llegeix en punts. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Amb ID XML, els noms dels objectes es mostren com a ID XML a Capes, Variables i Opcions de la capa. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. El pas de la mida del text i de l’interlineat: Cmd/Ctrl+Maj+. i Cmd/Ctrl+Maj+, canvien la mida un pas, o cinc amb Alt també; en text horitzontal, Alt amb la fletxa amunt o avall canvia l’interlineat un pas, o cinc amb Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. El pas del tracking i del kerning, en mil·lèsimes d’em: en text horitzontal, Alt amb la fletxa esquerra o dreta canvia el kerning al cursor o el tracking del text seleccionat un pas, o cinc amb Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. El pas del desplaçament de la línia de base: en text horitzontal, Alt i Maj amb la fletxa amunt o avall mouen la línia de base un pas, o cinc amb Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Mostra les opcions del text japonès i d’altres llengües d’Àsia oriental als taulers Caràcter, Paràgraf, OpenType i Glifs, i l’ordre Tipus de lletra compostos. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Mostra les opcions del text àrab, hebreu i índic als taulers Caràcter i Paràgraf, com la direcció del paràgraf, les caixides i els dígits. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Les eines de selecció seleccionen el text només a la línia de base, al marc del text d’àrea o al seu traçat, no a qualsevol punt dins de la seva caixa. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Els menús de tipus de lletra mostren cada tipus de lletra amb el nom en anglès; desactivat, un tipus de lletra que també té nom en la seva llengua mostra aquest nom. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. El text d’àrea nou comença amb Mida automàtica activada, de manera que un marc rectangular de text horitzontal creix o s’encongeix en alçada per encabir-hi el text. + Font lists and the Type › Font menu show a sample of each font beside its name. Les llistes de tipus de lletra i el menú Tipus de lletra mostren una mostra de cada tipus de lletra al costat del nom. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Les mostres de tipus de lletra es dibuixen en text fosc sobre blanc, sigui quina sigui la brillantor de la interfície; només s’aplica mentre les previsualitzacions als menús estan activades. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. L’alçada de cada fila a les llistes dels camps de tipus de lletra, com el del tauler Caràcter, i per tant la mida de cada mostra. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Quants dels últims tipus de lletra usats, de 1 a 15, mostren Tipus de lletra recents i les llistes, del més recent al més antic. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Quan canvieu el tipus de lletra o l’estil d’un text, els caràcters per als quals el nou tipus de lletra no té glif conserven el que tenien. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Un ressaltat rosa al llenç marca els glifs que les funcions OpenType han substituït, com les lligadures; no s’imprimeix ni s’exporta. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Amb l’eina de text, seleccionar un sol caràcter mostra al seu costat, al llenç, una fila dels seus glifs alternatius per triar-ne un. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Un ressaltat rosa al llenç marca el text dibuixat amb un tipus de lletra substitut perquè el seu falta; no s’imprimeix ni s’exporta. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. El text nou fet amb una eina de text comença amb text de farciment seleccionat, que el que escriviu substitueix. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Escriure un marcador de llista com 1. o * i després un espai a l’inici d’un paràgraf converteix el paràgraf en una llista. + Fonts in this folder show in the font menus and can be used without being installed. Els tipus de lletra d’aquesta carpeta apareixen als menús de tipus de lletra i es poden usar sense instal·lar-los. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Aplicar un estil gràfic a un text treu als caràcters el seu propi emplenament o traç on l’estil en té un, perquè es vegi la pintura de l’estil. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Alinea i Distribueix mesuren el text de punt per la tinta dels seus glifs en lloc de la seva caixa em. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Alinea i Distribueix mesuren el text d’àrea per la tinta dels seus glifs en lloc del seu marc. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. El quadre delimitador i el tauler Transforma mesuren el text de punt per la tinta dels seus glifs en lloc de la seva caixa em. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Ajusta el dibuix, el desplaçament i l’escalat a les subdivisions de la quadrícula, fins i tot quan la quadrícula està amagada; mentre està activat, Ajusta al píxel no s’aplica. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. El color de les guies no seleccionades; un tauler amb una Etiqueta de les guies dibuixa les seves guies amb el color de l’etiqueta. Draws guides as solid lines or as dots, including the guides already in the document. Dibuixa les guies com a línies contínues o com a punts, incloses les guies que ja són al document. @@ -3984,6 +4022,7 @@ digits Malayalam Malaiàlam Rounded Rectangle… Rectangle arrodonit… Roundness: Arrodoniment: Row Size: Mida de la fila: + Rows Files Rows: Files: Ruby Rubí Ruby… Rubí… @@ -5704,6 +5743,8 @@ digits Malayalam Malaiàlam @msg automation path rejected: outside the read root {root}: {path} camí d’automatització rebutjat: fora de l’arrel de lectura {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} camí d’automatització rebutjat: fora de les arrels de lectura {roots}: {path} @msg a linked JavaScript file is outside the read roots un fitxer JavaScript enllaçat és fora de les arrels de lectura +@msg a linked image file is outside the read roots un fitxer d’imatge enllaçat és fora de les arrels de lectura +@msg a linked file's export folder is outside the read roots la carpeta d’exportació d’un fitxer enllaçat és fora de les arrels de lectura @msg the library's file is outside the read roots el fitxer de la biblioteca és fora de les arrels de lectura @msg {file} names more than one linked JavaScript file {file} correspon a més d’un fitxer JavaScript enllaçat @msg automation path rejected: outside the write root {root}: {path} camí d’automatització rebutjat: fora de l’arrel d’escriptura {root}: {path} @@ -5790,6 +5831,8 @@ digits Malayalam Malaiàlam @msg the script is no longer in the Scripts folder l'script ja no és a la carpeta Scripts Some scripts were not listed Alguns scripts no s'han llistat The Scripts folder cannot be read No es pot llegir la carpeta Scripts + Loading scripts… S’estan carregant els scripts… + The Scripts folder is still being read Encara s’està llegint la carpeta Scripts @msg the script's run is no longer available l'execució de l'script ja no està disponible @msg a failed command changed undo steps that could not be put back, so the script was stopped una ordre fallida ha canviat passos de desfer que no s'han pogut restaurar, així que l'script s'ha aturat @msg a recovery copy could not be written, so the script was not run no s'ha pogut escriure una còpia de recuperació, per tant l'script no s'ha executat @@ -6286,6 +6329,8 @@ liquify-list-end {0}, {1} {0} i {1} @msg no target object has an opacity mask: select one or give `id` no hi ha cap objecte de destinació amb màscara d’opacitat: seleccioneu-ne un o doneu `id` @msg no threaded text selected no hi ha cap text encadenat seleccionat @msg no user library folder here aquí no hi ha cap carpeta de biblioteca d’usuari +@msg `{file}` has no swatches of its own `{file}` no té mostres pròpies +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` té mostres de motius, que un fitxer .vcswatches no pot contenir @msg no user workspace `{from}` no hi ha l’espai de treball d’usuari `{from}` @msg node {_1} is not text el node {_1} no és text @msg node {_1} is on a locked artboard el node {_1} és en un tauler bloquejat @@ -6765,6 +6810,8 @@ liquify-list-end {0}, {1} {0} i {1} @msg Trap: select two or more objects filled with solid colours Trap: selecciona dos o més objectes emplenats amb colors sòlids @msg truncated truncat @msg Unembedded to {_1} S’ha desincrustat a {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} S’ha desincrustat {n} imatge a {folder}|S’han desincrustat {n} imatges a {folder} +@msg every numbered name for {name} is taken in that folder tots els noms numerats per a {name} estan ocupats en aquesta carpeta @msg unknown command `{0}` ordre desconeguda `{0}` @msg step {step} of “{action}” runs the unknown command `{command}` el pas {step} de “{action}” executa l’ordre desconeguda `{command}` @msg unknown command `{0}`; did you mean `{1}`? ordre desconeguda `{0}`; volies dir `{1}`? @@ -7380,6 +7427,12 @@ anchor Points: Punts: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` ha de ser "free", "keepAngles" o "symmetric" @msg `{key}` must be [x, y] `{key}` ha de ser [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Convertidor d’unitats + Unit Converter Panel Tauler Convertidor d’unitats + Copy with Units Copia amb les unitats + From Selection De la selecció + # Color Effects add-on: Select by Color Kind. Select by Color Kind Selecciona per tipus de color Objects with Spot Colors Objectes amb colors directes diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index e5371164cc..af799f3669 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -173,6 +173,8 @@ Shear… Zkosit… Transform Each… Transformovat jednotlivě… Reset Bounding Box Obnovit ohraničovací rámeček + Rotate Bounding Box Otočit ohraničovací rámeček + Rotate Bounding Box… Otočit ohraničovací rámeček… Arrange Uspořádat Bring to Front Přenést do popředí Bring Forward Přenést blíž @@ -996,7 +998,7 @@ Free Transform Volná transformace Perspective Distort Perspektivní deformace -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Radial Blur… Radiální rozostření… Blur Center Střed rozostření Smart Blur… Chytré rozostření… @@ -1549,6 +1551,7 @@ lighting Light Světlo Play Current Selection Přehrát aktuální výběr Save Actions… Uložit akce… Load Actions… Načíst akce… + Replace Actions… Nahradit akce… Reset Actions Obnovit akce Replace the current actions with the default set? Nahradit aktuální akce výchozí sadou? Append adds the default set after the current sets instead. Tlačítko Připojit místo toho přidá výchozí sadu za aktuální sady. @@ -2835,6 +2838,7 @@ digits Malayalam Malajálamské BLANK DOCUMENT PRESETS PŘEDNASTAVENÍ PRÁZDNÝCH DOKUMENTŮ Bleed Spadávka Change to Right-to-Left Layout Změnit na rozvržení zprava doleva + Columns Sloupce Columns: Sloupce: Documents you create appear here. Zde se zobrazí dokumenty, které vytvoříte. More Settings Další nastavení @@ -2968,6 +2972,9 @@ digits Malayalam Malajálamské Open a document to preview its pages Otevřete dokument, abyste viděli náhled jeho stránek Output › Mode Výstup › Režim Overprint and Transparency Flattener Options Možnosti přetisku a sloučení průhlednosti + Custom… Vlastní nastavení… + Custom Transparency Flattener Options Vlastní možnosti sloučení průhlednosti + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS nemá průhlednost alfa a Přetisky určují, zda se přetisky zachovají. Place the pages with the placement again Znovu rozmístit stránky podle umístění Placement: Umístění: Preserve CMYK Numbers Zachovat hodnoty CMYK @@ -3017,14 +3024,19 @@ digits Malayalam Malajálamské Around Object Kolem objektu Background: Pozadí: Changing these settings changes how raster effects look when exported, flattened or expanded. Změna těchto nastavení mění vzhled rastrových efektů při exportu, sloučení nebo rozložení. + Add Around Přidat kolem objektu + Anti Alias Vyhlazování + Color Model Barevný model Color Model: Barevný model: Create Clipping Mask Vytvořit ořezovou masku Preserve Spot Colors Zachovat přímé barvy + Resolution Rozlišení Resolution: Rozlišení: Transparent Průhledné Layout Order: Pořadí rozvržení: Change to Left-to-Right Layout Změnit na rozvržení zleva doprava Artboards: {n} Pracovní plochy: {n} + Rows Řádky Rows: Řádky: Assign Přiřadit Color Group: Skupina barev: @@ -4033,6 +4045,7 @@ theme Appearance Motiv Enable Rubber Band for Povolit gumovou čáru pro Enable Touch Gestures Povolit dotyková gesta Switch Selection and Drawing Modes Přepnout mezi režimem výběru a kreslení + Select Last Selection Tool Vybrat poslední nástroj výběru Enable Touch Workspace Povolit dotykový pracovní prostor English: UK Angličtina: Spojené království Every (minutes) Každých (minut) @@ -4179,6 +4192,7 @@ theme Appearance Motiv Scroll Sideways with Cmd/Ctrl + Wheel Posouvat vodorovně kolečkem s Cmd/Ctrl Scrub Numeric Fields by Dragging Měnit číselné hodnoty tažením Linux Display Server Zobrazovací server Linuxu + Low-Latency Drawing Kreslení s nízkou latencí Print Preview Náhled tisku Print Setup Nastavení tisku Bitmap Bitmapa @@ -4387,6 +4401,8 @@ axis Both Obě Reset Tracking and Kerning Obnovit prostrkání a vyrovnání párů Reset Horizontal Scale Obnovit vodorovnou změnu velikosti Highlight Font Name Zvýraznit název písma + Highlight Font Size Zvýraznit velikost písma + Other… Jiná… Highlight Kerning Zvýraznit vyrovnání párů Highlight Tracking Zvýraznit prostrkání Step Type Krokovat text @@ -4588,6 +4604,29 @@ font-technology Variable Variabilní The unit for East Asian type measurements, which no field uses yet. Jednotka pro míry východoasijského písma, kterou zatím žádné pole nepoužívá. When on, a number typed without a unit into a field in picas is read in points. Když je zapnuto, číslo zadané bez jednotky do pole v pica se čte v bodech. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. S volbou XML ID se názvy objektů zobrazují jako XML ID ve Vrstvách, Proměnných a Možnostech vrstvy. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Krok velikosti textu a prokladu: Cmd/Ctrl+Shift+. a Cmd/Ctrl+Shift+, změní velikost o jeden krok, s Alt o pět; ve vodorovném textu Alt se šipkou nahoru nebo dolů změní proklad o jeden krok, s Cmd/Ctrl o pět. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Krok prostrkání a vyrovnání párů, v tisícinách em: ve vodorovném textu Alt se šipkou doleva nebo doprava změní vyrovnání páru u kurzoru nebo prostrkání vybraného textu o jeden krok, s Cmd/Ctrl o pět. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Krok posunu účaří: ve vodorovném textu Alt a Shift se šipkou nahoru nebo dolů posunou účaří o jeden krok, s Cmd/Ctrl o pět. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Zobrazí možnosti japonského a jiného východoasijského textu v panelech Znak, Odstavec, OpenType a Glyfy a příkaz Složená písma. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Zobrazí možnosti arabského, hebrejského a indického textu v panelech Znak a Odstavec, například směr odstavce, kašídy a číslice. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Nástroje výběru vybírají text jen na jeho účaří, rámečku plošného textu nebo jeho cestě, ne kdekoli uvnitř jeho ohraničení. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Nabídky písem uvádějí každé písmo pod anglickým názvem; po vypnutí písmo, které má i název ve vlastním jazyce, ukáže tento název. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Nový plošný text začíná se zapnutou automatickou velikostí, takže obdélníkový rámeček vodorovného textu roste nebo se zmenšuje na výšku podle textu. + Font lists and the Type › Font menu show a sample of each font beside its name. Seznamy písem a nabídka Písmo zobrazují vedle názvu ukázku každého písma. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Ukázky písem se kreslí tmavým textem na bílé bez ohledu na jas rozhraní; platí to jen při zapnutých náhledech písem v nabídkách. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Jak vysoký je každý řádek v seznamech polí písma, například v panelu Znak, a tedy jak velká je každá ukázka. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Kolik naposledy použitých písem, od 1 do 15, zobrazují Nedávná písma a seznamy písem, nejnovější první. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Když změníte písmo nebo řez písma textu, znaky, pro které nové písmo nemá glyf, si ponechají své dosavadní písmo. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Růžové zvýraznění na plátně označuje glyfy nahrazené funkcemi OpenType, například ligatury; netiskne se ani neexportuje. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. S nástrojem Text výběr jednoho znaku zobrazí vedle něj na plátně řadu jeho alternativních glyfů k výběru. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Růžové zvýraznění na plátně označuje text vykreslený náhradním písmem, protože jeho písmo chybí; netiskne se ani neexportuje. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Nový text vytvořený textovým nástrojem začíná vybraným zástupným textem, který psaní nahradí. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Napsání značky seznamu, například 1. nebo *, a pak mezery na začátku odstavce změní odstavec na seznam. + Fonts in this folder show in the font menus and can be used without being installed. Písma v této složce se zobrazí v nabídkách písem a lze je použít bez instalace. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Použití grafického stylu na text odebere znakům jejich vlastní výplň nebo tah tam, kde ho styl má, takže je vidět barva stylu. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Zarovnat a Rozmístit měří bodový text podle inkoustu jeho glyfů místo podle jeho čtverce em. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Zarovnat a Rozmístit měří plošný text podle inkoustu jeho glyfů místo podle jeho rámečku. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Ohraničovací rámeček a panel Transformace měří bodový text podle inkoustu jeho glyfů místo podle jeho čtverce em. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Přichytává kreslení, přesouvání a změnu velikosti k dělení mřížky, i když je mřížka skrytá; dokud je zapnuto, Přichytávat k obrazovým bodům se neuplatní. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Barva vodítek, která nejsou vybraná; pracovní plocha se Štítkem vodítek kreslí svá vodítka v barvě štítku. Draws guides as solid lines or as dots, including the guides already in the document. Kreslí vodítka jako plné čáry nebo jako tečky, včetně vodítek, která už v dokumentu jsou. @@ -4881,6 +4920,8 @@ imageTrace Outline Obrys @msg the script is no longer in the Scripts folder skript už není ve složce Scripts Some scripts were not listed Některé skripty nebyly uvedeny The Scripts folder cannot be read Složku Scripts nelze přečíst + Loading scripts… Načítání skriptů… + The Scripts folder is still being read Složka Scripts se stále načítá @msg the script's run is no longer available běh skriptu již není k dispozici @msg a failed command changed undo steps that could not be put back, so the script was stopped neúspěšný příkaz změnil kroky zpět, které nebylo možné obnovit, proto byl skript zastaven @msg a recovery copy could not be written, so the script was not run záložní kopii se nepodařilo zapsat, proto skript nebyl spuštěn @@ -5754,6 +5795,8 @@ liquify-list-end {0}, {1} {0} a {1} @msg All colors are within the CMYK gamut Všechny barvy jsou v gamutu CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} barva je mimo gamut CMYK|{n} barvy jsou mimo gamut CMYK|{n} barev je mimo gamut CMYK @msg Unembedded to {_1} Vložení zrušeno, uloženo do: {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Vložení zrušeno u {n} obrázku, uloženo do: {folder}|Vložení zrušeno u {n} obrázků, uloženo do: {folder}|Vložení zrušeno u {n} obrázků, uloženo do: {folder} +@msg every numbered name for {name} is taken in that folder v této složce jsou obsazena všechna číslovaná jména pro {name} @msg Reset {_1} Obnoveno: {_1} @msg Sent to {_1} Odesláno do {_1} @msg {_1} files Soubory {_1} @@ -5857,6 +5900,8 @@ liquify-list-end {0}, {1} {0} a {1} @msg automation path rejected: outside the read root {root}: {path} cesta automatizace odmítnuta: mimo kořen pro čtení {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} cesta automatizace odmítnuta: mimo kořeny pro čtení {roots}: {path} @msg a linked JavaScript file is outside the read roots propojený soubor JavaScript je mimo kořeny pro čtení +@msg a linked image file is outside the read roots propojený soubor obrázku je mimo kořeny pro čtení +@msg a linked file's export folder is outside the read roots exportní složka propojeného souboru je mimo kořeny pro čtení @msg automation path rejected: outside the write root {root}: {path} cesta automatizace odmítnuta: mimo kořen pro zápis {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} cesta automatizace odmítnuta: mimo kořeny pro zápis {roots}: {path} @msg automation path rejected: path is empty cesta automatizace odmítnuta: cesta je prázdná @@ -7382,6 +7427,12 @@ anchor Points: Body: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` musí být "free", "keepAngles" nebo "symmetric" @msg `{key}` must be [x, y] `{key}` musí být [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Převodník jednotek + Unit Converter Panel Panel Převodník jednotek + Copy with Units Kopírovat s jednotkami + From Selection Z výběru + # Color Effects add-on: Select by Color Kind. Select by Color Kind Vybrat podle druhu barvy Objects with Spot Colors Objekty s přímými barvami @@ -8389,6 +8440,8 @@ breakText Glyphs Glyfy @msg `{f}` is the copy of a document open now `{f}` je kopie právě otevřeného dokumentu @msg `{id}` is no writable format (see document.formats) `{id}` není formát, který lze zapisovat (viz document.formats) @msg `{id}` isn't a loaded library `{id}` není načtená knihovna +@msg `{file}` has no swatches of its own `{file}` nemá žádné vlastní vzorky +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` obsahuje vzorkové položky vzorníku, které soubor .vcswatches nepojme @msg `{key}` has no colours `{key}` neobsahuje žádné barvy @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` obsahuje více než {MAX_EDIT_WORDS} slov @msg `{key}` is a design name `{key}` je název návrhu @@ -8680,7 +8733,13 @@ breakText Glyphs Glyfy @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel musí být {own} (režim dokumentu), grayscale nebo bitmap @msg colour groups can't go into colour groups skupiny barev nelze vkládat do skupin barev @msg colour, mode and spot apply to solid-colour swatches only colour, mode a spot platí jen pro položky vzorníku s plnou barvou -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read sloupec {column}: `{cell}` je sloupec `%` pro soubory dat grafu, které se nečtou +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` je zadán relativní cestou: zadejte `base` nebo absolutní cestu +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} řádek {line}, sloupec {column}: soubor dat grafu pro `{var}` nelze přečíst: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` se nenačítá: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` je větší než {MAX_GRAPH_DATA_FILE} bajtů +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes řádek {line}, sloupec {column}: soubor dat grafu `{path}` pro `{var}` dává hodnotu grafu delší než {MAX_GRAPH_CSV} bajtů +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all řádek {line}, sloupec {column}: soubory dat grafu obsahují celkem více než {MAX_GRAPH_FILES_TOTAL} bajtů +@msg `base` is empty `base` je prázdné @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable sloupec {column}: `{cell}` uvádí `{name}`, což je proměnná typu {_1} @msg column {column}: `{cell}` names no variable sloupec {column}: `{cell}` neuvádí žádnou proměnnou @msg column {column}: the variable name is longer than {MAX_NAME} characters sloupec {column}: název proměnné je delší než {MAX_NAME} znaků diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index fb00e76e37..fa80d8524b 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -766,6 +766,8 @@ liquify-list-end {0}, {1} {0} og {1} Check Script Kontrollér script Some scripts were not listed Nogle scripter blev ikke vist The Scripts folder cannot be read Mappen Scripts kan ikke læses + Loading scripts… Indlæser scripter… + The Scripts folder is still being read Mappen Scripts læses stadig Other Script… Andet script… Document Setup… Dokumentopsætning… Switch Units Skift enheder @@ -869,6 +871,8 @@ liquify-list-end {0}, {1} {0} og {1} Shear… Skæv… Transform Each… Transformér hver for sig… Reset Bounding Box Nulstil afgrænsningsramme + Rotate Bounding Box Rotér afgrænsningsramme + Rotate Bounding Box… Rotér afgrænsningsramme… Arrange Arrangér Bring to Front Anbring forrest Bring Forward Flyt fremad @@ -1277,6 +1281,8 @@ liquify-list-end {0}, {1} {0} og {1} @msg `{f}` is the copy of a document open now `{f}` er kopien af et dokument, der er åbent nu @msg `{id}` is no writable format (see document.formats) `{id}` er ikke et skrivbart format (se document.formats) @msg `{id}` isn't a loaded library `{id}` er ikke et indlæst bibliotek +@msg `{file}` has no swatches of its own `{file}` har ingen egne farveprøver +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` har mønsterprøver, som en .vcswatches-fil ikke kan indeholde @msg `{key}` has no colours `{key}` har ingen farver @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` indeholder mere end {MAX_EDIT_WORDS} ord @msg `{key}` is a design name `{key}` er et designnavn @@ -1405,6 +1411,7 @@ liquify-list-end {0}, {1} {0} og {1} @msg a line needs at least two points en linje kræver mindst to punkter @msg a linked JavaScript file is outside the read roots en linket JavaScript-fil ligger uden for læserødderne @msg a linked image file is outside the read roots en linket billedfil ligger uden for læserødderne +@msg a linked file's export folder is outside the read roots eksportmappen for en linket fil ligger uden for læserødderne @msg a name names one asset: give multiple: false, or one object et navn angiver ét aktiv: angiv multiple: false eller ét objekt @msg a namespace declaration uses a reserved prefix or URI en navnerumserklæring bruger et reserveret præfiks eller en reserveret URI @msg a namespace qualifier is undefined en navnerumskvalifikator er udefineret @@ -4147,6 +4154,7 @@ lighting Light Lys Play Current Selection Afspil aktuel markering Save Actions… Gem handlinger… Load Actions… Indlæs handlinger… + Replace Actions… Erstat handlinger… Reset Actions Nulstil handlinger Replace the current actions with the default set? Vil du erstatte de aktuelle handlinger med standardsættet? Append adds the default set after the current sets instead. Tilføj tilføjer i stedet standardsættet efter de aktuelle sæt. @@ -5308,6 +5316,7 @@ digits Malayalam Malayalam BLANK DOCUMENT PRESETS TOMME DOKUMENTFORUDINDSTILLINGER Bleed Beskæring Change to Right-to-Left Layout Skift til højre-til-venstre-layout + Columns Kolonner Columns: Kolonner: Documents you create appear here. Dokumenter, du opretter, vises her. More Settings Flere indstillinger @@ -5441,6 +5450,9 @@ digits Malayalam Malayalam Open a document to preview its pages Åbn et dokument for at forhåndsvise dets sider Output › Mode Output › Tilstand Overprint and Transparency Flattener Options Indstillinger for overtryk og udfladning af gennemsigtighed + Custom… Brugerdefineret… + Custom Transparency Flattener Options Brugerdefinerede indstillinger for udfladning af gennemsigtighed + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS har ingen alfa-gennemsigtighed, og Overtryk bestemmer, om overtryk bevares. Place the pages with the placement again Placér siderne igen med placeringen Placement: Placering: Preserve CMYK Numbers Bevar CMYK-tal @@ -5490,14 +5502,19 @@ digits Malayalam Malayalam Around Object Omkring objektet Background: Baggrund: Changing these settings changes how raster effects look when exported, flattened or expanded. Ændring af disse indstillinger ændrer, hvordan rastereffekter ser ud, når de eksporteres, udflades eller udvides. + Add Around Tilføj omkring objektet + Anti Alias Antialiasering + Color Model Farvemodel Color Model: Farvemodel: Create Clipping Mask Opret klipemaske Preserve Spot Colors Bevar spotfarver + Resolution Opløsning Resolution: Opløsning: Transparent Gennemsigtig Layout Order: Layoutrækkefølge: Change to Left-to-Right Layout Skift til venstre-til-højre-layout Artboards: {n} Tegnebrætter: {n} + Rows Rækker Rows: Rækker: Assign Tildel Color Group: Farvegruppe: @@ -6455,6 +6472,7 @@ theme Appearance Udseende Enable Rubber Band for Aktivér gummibånd for Enable Touch Gestures Aktivér berøringsbevægelser Switch Selection and Drawing Modes Skift mellem markerings- og tegnetilstand + Select Last Selection Tool Vælg det seneste markeringsværktøj Enable Touch Workspace Aktivér touch-arbejdsområde English: UK Engelsk: UK Every (minutes) Hvert (minut) @@ -6587,6 +6605,7 @@ theme Appearance Udseende Scroll Sideways with Cmd/Ctrl + Wheel Rul vandret med Cmd/Ctrl + musehjul Scrub Numeric Fields by Dragging Juster numeriske felter ved at trække Linux Display Server Linux-visningsserver + Low-Latency Drawing Tegning med lav latens Print Preview Udskriftsvisning Print Setup Udskriftsopsætning Bitmap Bitmap @@ -6987,6 +7006,29 @@ font-technology Variable Variable The unit for East Asian type measurements, which no field uses yet. Enheden for mål i østasiatisk tekst, som intet felt bruger endnu. When on, a number typed without a unit into a field in picas is read in points. Når den er slået til, læses et tal, der skrives uden enhed i et felt i pica, i punkter. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Med XML-id vises objektnavne som XML-id'er i Lag, Variabler og Lagindstillinger. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Trinnet for tekststørrelse og linjeafstand: Cmd/Ctrl+Skift+. og Cmd/Ctrl+Skift+, ændrer størrelsen ét trin, eller fem med Alt også; i vandret tekst ændrer Alt med pil op eller ned linjeafstanden ét trin, eller fem med Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Trinnet for sporing og knibning, i tusindedele em: i vandret tekst ændrer Alt med pil venstre eller højre knibningen ved markøren eller sporingen af den markerede tekst ét trin, eller fem med Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Trinnet for forskydning af grundlinjen: i vandret tekst flytter Alt og Skift med pil op eller ned grundlinjen ét trin, eller fem med Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Viser indstillingerne for japansk og anden østasiatisk tekst i panelerne Tegn, Afsnit, OpenType og Glyffer samt kommandoen Sammensatte skrifttyper. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Viser indstillingerne for arabisk, hebraisk og indisk tekst i panelerne Tegn og Afsnit, for eksempel afsnitsretning, kashidaer og cifre. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Markeringsværktøjerne markerer kun tekst på dens grundlinje, områdetekstens ramme eller dens sti, ikke hvor som helst inden for dens boks. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Skrifttypemenuerne viser hver skrifttype med dens engelske navn; slået fra viser en skrifttype, der også har et navn på sit eget sprog, det navn. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Ny områdetekst starter med Automatisk størrelse slået til, så en rektangulær ramme med vandret tekst vokser eller skrumper i højden, så teksten passer. + Font lists and the Type › Font menu show a sample of each font beside its name. Skrifttypelister og menuen Skrifttype viser en prøve på hver skrifttype ved siden af dens navn. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Skrifttypeprøver tegnes med mørk tekst på hvidt uanset grænsefladens lysstyrke; det gælder kun, mens forhåndsvisninger af skrifttyper i menuer er slået til. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Hvor høj hver række er i listerne for skrifttypefelter, som det i panelet Tegn, og dermed hvor stor hver prøve er. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Hvor mange af de senest brugte skrifttyper, fra 1 til 15, Seneste skrifttyper og skrifttypelisterne viser, den nyeste først. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Når du skifter skrifttype eller skriftsnit for tekst, beholder tegn, som den nye skrifttype ikke har en glyf til, den skrifttype, de havde. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. En lyserød fremhævning på lærredet markerer glyffer, som OpenType-funktioner har erstattet, for eksempel ligaturer; den udskrives og eksporteres ikke. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Med tekstværktøjet viser markering af et enkelt tegn en række af dets alternative glyffer ved siden af det på lærredet at vælge imellem. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. En lyserød fremhævning på lærredet markerer tekst, der tegnes med en erstatningsskrifttype, fordi dens skrifttype mangler; den udskrives og eksporteres ikke. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Ny tekst, der laves med et tekstværktøj, starter med markeret pladsholdertekst, som det, du skriver, erstatter. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Hvis du skriver en listemarkør som 1. eller * og derefter et mellemrum i starten af et afsnit, bliver afsnittet en liste. + Fonts in this folder show in the font menus and can be used without being installed. Skrifttyper i denne mappe vises i skrifttypemenuerne og kan bruges uden at være installeret. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Når en grafisk stil anvendes på tekst, fjernes tegnenes egen udfyldning eller streg, hvor stilen har en, så stilens maling ses. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Justér og Fordel måler punkttekst efter glyffernes blæk i stedet for dens em-boks. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Justér og Fordel måler områdetekst efter glyffernes blæk i stedet for dens ramme. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Afgrænsningsboksen og panelet Transformér måler punkttekst efter glyffernes blæk i stedet for dens em-boks. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Fastgør tegning, flytning og skalering til gitterets underinddelinger, også mens gitteret er skjult; mens den er slået til, gælder Fastgør til pixel ikke. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Farven på hjælpelinjer, der ikke er markeret; en kunstplade med en hjælpelinjeetiket tegner sine egne hjælpelinjer i etikettens farve. Draws guides as solid lines or as dots, including the guides already in the document. Tegner hjælpelinjer som hele linjer eller som prikker, også de hjælpelinjer, der allerede er i dokumentet. @@ -7885,6 +7927,8 @@ imageTrace Outline Kontur @msg All colors are within the CMYK gamut Alle farver er inden for CMYK-farveomfanget @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} farve er uden for CMYK-farveomfanget|{n} farver er uden for CMYK-farveomfanget @msg Unembedded to {_1} Fjernede indlejring til {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Fjernede indlejring af {n} billede til {folder}|Fjernede indlejring af {n} billeder til {folder} +@msg every numbered name for {name} is taken in that folder alle nummererede navne til {name} er optaget i den mappe @msg Reset {_1} Nulstillede {_1} @msg Sent to {_1} Sendte til {_1} @msg {_1} files {_1}-filer @@ -8565,6 +8609,8 @@ mark-style Japanese Japansk Reset Tracking and Kerning Nulstil sporing og kerning Reset Horizontal Scale Nulstil vandret skalering Highlight Font Name Fremhæv skrifttypenavn + Highlight Font Size Fremhæv skriftstørrelse + Other… Anden… Highlight Kerning Fremhæv kerning Highlight Tracking Fremhæv sporing @msg span must be "object" or "selection", got {v} span skal være "object" eller "selection", fik {v} @@ -9465,6 +9511,12 @@ anchor Points: Punkter: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` skal være "free", "keepAngles" eller "symmetric" @msg `{key}` must be [x, y] `{key}` skal være [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Enhedsomregner + Unit Converter Panel Panelet Enhedsomregner + Copy with Units Kopiér med enheder + From Selection Fra markering + # Color Effects add-on: Select by Color Kind. Select by Color Kind Markér efter farvetype Objects with Spot Colors Objekter med spotfarver diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 2670605413..25031f9e5f 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -18,7 +18,7 @@ # `untranslated_report` lists gaps) — and the status and error messages. Left in English on purpose (`MENU_KEEP_AS_IS` in the # tests): the product name, language names, OpenType, the built-in workspace names and the bracketed # perspective grid preset names; `de-DE`, `de-AT`, `de-CH` and every other `de-*` locale resolve here. -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Glowing Edges… Leuchtende Konturen… Glowing Edges Leuchtende Konturen Edge Width Kantenbreite @@ -94,6 +94,7 @@ Add Anchor Point Ankerpunkt hinzufügen Add Anchor Point Tool Ankerpunkt-hinzufügen-Werkzeug Add Anchor Points Ankerpunkte hinzufügen + Add Around Um das Objekt hinzufügen Add Effect Effekt hinzufügen Add Freeform Line Freiformlinie hinzufügen Add Freeform Point Freiformpunkt hinzufügen @@ -171,6 +172,7 @@ Angle: Winkel: Angles Winkel Animated Zoom Animierter Zoom + Anti Alias Glättung Anti-alias Glätten Anti-Alias Glätten Anti-alias Rasters Pixelbilder glätten @@ -534,6 +536,7 @@ font-technology Variable Variabel Color Mixer (Shift-click the chip) Farbmischer (Shift-Klick auf das Farbfeld) Color Mode Farbmodus Color Mode: Farbmodus: + Color Model Farbmodell Color Model: Farbmodell: Color Models Farbmodelle Color Picker Farbwähler @@ -560,6 +563,7 @@ font-technology Variable Variabel Colors Farben Colors: Farben: Column Graph Tool Säulendiagramm-Werkzeug + Columns Spalten Columns: Spalten: Column… Säule… Combine Slices Slices kombinieren @@ -1051,6 +1055,7 @@ font-technology Variable Variabel Enable text access for screen readers Textzugriff für Bildschirmlesegeräte zulassen Enable Touch Gestures Touch-Gesten aktivieren Switch Selection and Drawing Modes Zwischen Auswahl- und Zeichenmodus wechseln + Select Last Selection Tool Zuletzt verwendetes Auswahl-Werkzeug wählen Enable Touch Workspace Touch-Arbeitsbereich aktivieren Encoding Kodierung Encoding: Kodierung: @@ -1280,6 +1285,8 @@ font-technology Variable Variabel Reset Tracking and Kerning Laufweite und Kerning zurücksetzen Reset Horizontal Scale Horizontale Skalierung zurücksetzen Highlight Font Name Schriftname hervorheben + Highlight Font Size Schriftgrad hervorheben + Other… Andere… Highlight Kerning Kerning hervorheben Highlight Tracking Laufweite hervorheben Spacing Abstand @@ -2526,6 +2533,9 @@ file-filter Templates Vorlagen Overprint Überdrucken Overprint and Transparency Flattener Überdrucken und Transparenzreduzierung Overprint and Transparency Flattener Options Optionen für Überdrucken und Transparenzreduzierung + Custom… Benutzerdefiniert… + Custom Transparency Flattener Options Benutzerdefinierte Optionen für Transparenzreduzierung + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS hat keine Alphatransparenz, und „Überdrucken“ legt fest, ob Überdrucken erhalten bleibt. Overprint Black… Schwarz überdrucken… Overprint Fill Fläche überdrucken Overprint Preview Überdruckenvorschau @@ -2634,6 +2644,7 @@ diagnostics ui Oberfläche Play Current Selection Aktuelle Auswahl abspielen Save Actions… Aktionen speichern… Load Actions… Aktionen laden… + Replace Actions… Aktionen ersetzen… Reset Actions Aktionen zurücksetzen Replace the current actions with the default set? Aktuelle Aktionen durch den Standardsatz ersetzen? Append adds the default set after the current sets instead. Mit „Anhängen“ wird der Standardsatz stattdessen nach den aktuellen Sätzen hinzugefügt. @@ -3002,6 +3013,8 @@ digits Malayalam Malayalam Reselect Erneut auswählen Reset Zurücksetzen Reset Bounding Box Begrenzungsrahmen zurücksetzen + Rotate Bounding Box Begrenzungsrahmen drehen + Rotate Bounding Box… Begrenzungsrahmen drehen… Reset Envelope Mesh Hüllengitter zurücksetzen Reset Envelope Shape Hüllenform zurücksetzen Reset Essentials Essentials zurücksetzen @@ -3043,6 +3056,7 @@ digits Malayalam Malayalam Reshape Segment Segmentform ändern Reshape Tool Form-ändern-Werkzeug Reshape Type Area Form der Textfläche ändern + Resolution Auflösung Resolution: Auflösung: Responsive Responsiv Restore Wiederherstellen @@ -3099,6 +3113,29 @@ digits Malayalam Malayalam The unit for East Asian type measurements, which no field uses yet. Die Einheit für Maße in ostasiatischem Text, die noch kein Feld verwendet. When on, a number typed without a unit into a field in picas is read in points. Wenn aktiviert, wird eine ohne Einheit eingegebene Zahl in einem Feld in Pica als Punkt gelesen. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Mit XML-ID werden Objektnamen in „Ebenen“, „Variablen“ und „Ebenenoptionen“ als XML-IDs angezeigt. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Der Schritt für Schriftgröße und Zeilenabstand: Cmd/Ctrl+Umschalt+. und Cmd/Ctrl+Umschalt+, ändern die Größe um einen Schritt, zusätzlich mit Alt um fünf; in horizontalem Text ändert Alt mit Pfeil nach oben oder unten den Zeilenabstand um einen Schritt, mit Cmd/Ctrl um fünf. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Der Schritt für Laufweite und Kerning, in Tausendstel Geviert: In horizontalem Text ändert Alt mit Pfeil nach links oder rechts das Kerning an der Einfügemarke oder die Laufweite des ausgewählten Texts um einen Schritt, mit Cmd/Ctrl um fünf. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Der Schritt für den Grundlinienversatz: In horizontalem Text verschieben Alt und Umschalt mit Pfeil nach oben oder unten die Grundlinie um einen Schritt, mit Cmd/Ctrl um fünf. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Blendet die Optionen für japanischen und anderen ostasiatischen Text in den Bedienfeldern „Zeichen“, „Absatz“, „OpenType“ und „Glyphen“ sowie den Befehl „Zusammengesetzte Schriften“ ein. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Blendet die Optionen für arabischen, hebräischen und indischen Text in den Bedienfeldern „Zeichen“ und „Absatz“ ein, etwa Absatzrichtung, Kashidas und Ziffern. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Die Auswahlwerkzeuge wählen Text nur auf seiner Grundlinie, dem Rahmen des Flächentexts oder seinem Pfad aus, nicht an jeder Stelle innerhalb seines Begrenzungsrahmens. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Schriftmenüs zeigen jede Schrift mit ihrem englischen Namen; ausgeschaltet zeigt eine Schrift, die auch einen Namen in ihrer eigenen Sprache hat, diesen Namen. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Neuer Flächentext beginnt mit eingeschalteter automatischer Größe, sodass ein rechteckiger Rahmen mit horizontalem Text in der Höhe wächst oder schrumpft, bis der Text hineinpasst. + Font lists and the Type › Font menu show a sample of each font beside its name. Schriftlisten und das Menü „Schrift“ zeigen neben jedem Namen ein Muster der Schrift. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Schriftmuster werden unabhängig von der Helligkeit der Oberfläche in dunkler Schrift auf Weiß gezeichnet; das gilt nur, solange Schriftvorschauen in Menüs eingeschaltet sind. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Wie hoch jede Zeile in den Schriftlisten der Schriftfelder ist, etwa im Bedienfeld „Zeichen“, und damit wie groß jedes Muster ist. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Wie viele der zuletzt verwendeten Schriften, von 1 bis 15, „Zuletzt verwendete Schriften“ und die Schriftlisten zeigen, die neueste zuerst. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Wenn Sie die Schrift oder den Schriftschnitt eines Texts ändern, behalten Zeichen, für die die neue Schrift keine Glyphe hat, ihre bisherige Schrift. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Eine rosa Hervorhebung auf der Zeichenfläche markiert Glyphen, die OpenType-Funktionen ersetzt haben, etwa Ligaturen; sie wird nicht gedruckt oder exportiert. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Wählen Sie mit dem Text-Werkzeug ein einzelnes Zeichen aus, erscheint daneben auf der Zeichenfläche eine Reihe seiner alternativen Glyphen zur Auswahl. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Eine rosa Hervorhebung auf der Zeichenfläche markiert Text in einer Ersatzschrift, weil seine Schrift fehlt; sie wird nicht gedruckt oder exportiert. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Neuer Text, der mit einem Text-Werkzeug erstellt wird, beginnt mit ausgewähltem Platzhaltertext, den Ihre Eingabe ersetzt. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Ein Listenzeichen wie 1. oder * und danach ein Leerzeichen, am Anfang eines Absatzes getippt, macht den Absatz zu einer Liste. + Fonts in this folder show in the font menus and can be used without being installed. Schriften in diesem Ordner erscheinen in den Schriftmenüs und lassen sich ohne Installation verwenden. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Wird ein Grafikstil auf Text angewendet, verlieren die Zeichen ihre eigene Fläche oder Kontur, wo der Stil eine hat, sodass die Farbe des Stils sichtbar wird. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Ausrichten und Verteilen messen Punkttext an den sichtbaren Formen seiner Glyphen statt an seinem Geviert. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Ausrichten und Verteilen messen Flächentext an den sichtbaren Formen seiner Glyphen statt an seinem Rahmen. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Der Begrenzungsrahmen und das Bedienfeld „Transformieren“ messen Punkttext an den sichtbaren Formen seiner Glyphen statt an seinem Geviert. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Richtet Zeichnen, Verschieben und Skalieren an den Unterteilungen des Rasters aus, auch wenn das Raster ausgeblendet ist; solange die Option an ist, wirkt „An Pixel ausrichten“ nicht. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Die Farbe nicht ausgewählter Hilfslinien; eine Zeichenfläche mit einer „Farbmarkierung der Hilfslinien“ zeichnet ihre eigenen Hilfslinien stattdessen in dieser Farbe. Draws guides as solid lines or as dots, including the guides already in the document. Zeichnet Hilfslinien als durchgezogene Linien oder als Punkte, auch die Hilfslinien, die bereits im Dokument sind. @@ -3180,6 +3217,7 @@ digits Malayalam Malayalam Rounded Rectangle Tool Abgerundetes-Rechteck-Werkzeug Rounded Rectangle… Abgerundetes Rechteck… Row Size: Zeilengröße: + Rows Zeilen Rows: Zeilen: Rule: Regel: Rulers Lineale @@ -4482,6 +4520,8 @@ theme Appearance Erscheinungsbild @msg the script is no longer in the Scripts folder das Skript befindet sich nicht mehr im Ordner „Scripts“ Some scripts were not listed Einige Skripte wurden nicht aufgeführt The Scripts folder cannot be read Der Ordner „Scripts“ kann nicht gelesen werden + Loading scripts… Skripte werden geladen… + The Scripts folder is still being read Der Ordner „Scripts“ wird noch gelesen @msg the script's run is no longer available der Lauf des Skripts ist nicht mehr verfügbar @msg a failed command changed undo steps that could not be put back, so the script was stopped ein fehlgeschlagener Befehl hat Rückgängig-Schritte geändert, die nicht wiederhergestellt werden konnten, daher wurde das Skript angehalten @msg a recovery copy could not be written, so the script was not run eine Wiederherstellungskopie konnte nicht geschrieben werden, daher wurde das Skript nicht ausgeführt @@ -5357,6 +5397,8 @@ liquify-list-end {0}, {1} {0} und {1} @msg All colors are within the CMYK gamut Alle Farben liegen im CMYK-Farbumfang @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} Farbe liegt außerhalb des CMYK-Farbumfangs|{n} Farben liegen außerhalb des CMYK-Farbumfangs @msg Unembedded to {_1} Einbettung aufgehoben, gespeichert unter {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Einbettung von {n} Bild aufgehoben, gespeichert unter {folder}|Einbettung von {n} Bildern aufgehoben, gespeichert unter {folder} +@msg every numbered name for {name} is taken in that folder alle nummerierten Namen für {name} sind in diesem Ordner bereits vergeben @msg Reset {_1} {_1} zurückgesetzt @msg Sent to {_1} An {_1} gesendet @msg {_1} files {_1}-Dateien @@ -5797,6 +5839,7 @@ lighting Light Licht @msg missing panel layout Bedienfeldanordnung fehlt @msg unsupported native docking operation Nicht unterstützte native Docking-Operation Linux Display Server Linux-Anzeigeserver + Low-Latency Drawing Zeichnen mit geringer Latenz X11 (XWayland) When a Pen Is Attached X11 (XWayland), wenn ein Stift angeschlossen ist If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Wenn der Stift eines Grafiktabletts nicht zeichnet, wählen Sie eine Option mit X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -6974,6 +7017,12 @@ anchor Points: Punkte: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` muss "free", "keepAngles" oder "symmetric" sein @msg `{key}` must be [x, y] `{key}` muss [x, y] sein +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Einheitenumrechner + Unit Converter Panel Einheitenumrechner-Bedienfeld + Copy with Units Mit Einheiten kopieren + From Selection Aus Auswahl + # Color Effects add-on: Select by Color Kind. Select by Color Kind Nach Farbart auswählen Objects with Spot Colors Objekte mit Volltonfarben @@ -8137,6 +8186,8 @@ breakText Glyphs Glyphen @msg `{f}` is the copy of a document open now `{f}` ist die Kopie eines gerade geöffneten Dokuments @msg `{id}` is no writable format (see document.formats) `{id}` ist kein beschreibbares Format (siehe document.formats) @msg `{id}` isn't a loaded library `{id}` ist keine geladene Bibliothek +@msg `{file}` has no swatches of its own `{file}` hat keine eigenen Farbfelder +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` enthält Musterfelder, die eine .vcswatches-Datei nicht aufnehmen kann @msg `{key}` has no colours `{key}` hat keine Farben @msg `{key}` is a design name `{key}` ist ein Designname @msg `{key}` is a design name or a list of them `{key}` ist ein Designname oder eine Liste davon @@ -8359,7 +8410,13 @@ breakText Glyphs Glyphen @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel muss {own} (der Modus des Dokuments), grayscale oder bitmap sein @msg colour groups can't go into colour groups Farbgruppen können nicht in Farbgruppen eingefügt werden @msg colour, mode and spot apply to solid-colour swatches only colour, mode und spot gelten nur für Vollfarbfelder -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read Spalte {column}: `{cell}` ist eine `%`-Spalte von Diagrammdatendateien, die nicht gelesen werden +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ist ein relativer Pfad: Geben Sie `base` oder einen absoluten Pfad an +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} Zeile {line}, Spalte {column}: die Diagrammdatendatei für `{var}` kann nicht gelesen werden: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} Zeile {line}, Spalte {column}: der Diagrammdatendatei `{path}` für `{var}` wird nicht gefolgt: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ist größer als {MAX_GRAPH_DATA_FILE} Byte +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes Zeile {line}, Spalte {column}: die Diagrammdatendatei `{path}` für `{var}` ergibt einen Diagrammwert, der länger als {MAX_GRAPH_CSV} Byte ist +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all Zeile {line}, Spalte {column}: die Diagrammdatendateien enthalten insgesamt mehr als {MAX_GRAPH_FILES_TOTAL} Byte +@msg `base` is empty `base` ist leer @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable Spalte {column}: `{cell}` nennt `{name}`, eine Variable vom Typ {_1} @msg column {column}: `{cell}` names no variable Spalte {column}: `{cell}` nennt keine Variable @msg column {column}: the variable name is longer than {MAX_NAME} characters Spalte {column}: Der Variablenname ist länger als {MAX_NAME} Zeichen @@ -9394,6 +9451,7 @@ breakText Glyphs Glyphen @msg a line needs at least two points eine Linie braucht mindestens zwei Punkte @msg a linked JavaScript file is outside the read roots eine verknüpfte JavaScript-Datei liegt außerhalb der Lesestammordner @msg a linked image file is outside the read roots eine verknüpfte Bilddatei liegt außerhalb der Lesestammordner +@msg a linked file's export folder is outside the read roots der Exportordner einer verknüpften Datei liegt außerhalb der Lesestammordner @msg a number cannot be read eine Zahl kann nicht gelesen werden @msg a swatch exchange block is too long ein Block der Farbfeld-Austauschdatei ist zu lang @msg a swatch exchange name is too long ein Name in der Farbfeld-Austauschdatei ist zu lang diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index b47a4ca347..f563264100 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -99,6 +99,7 @@ Add Anchor Point Προσθήκη σημείου αγκύρωσης Add Anchor Point Tool Εργαλείο προσθήκης σημείου αγκύρωσης (Add Anchor Point Tool) Add Anchor Points Προσθήκη σημείων αγκύρωσης + Add Around Προσθήκη γύρω από το αντικείμενο Add Effect Προσθήκη εφέ Add Freeform Line Προσθήκη ελεύθερης γραμμής Add Freeform Point Προσθήκη ελεύθερου σημείου @@ -176,6 +177,7 @@ Angle: Γωνία: Angles Γωνίες Animated Zoom Κινούμενη μεγέθυνση + Anti Alias Εξομάλυνση ακμών Anti-alias Εξομάλυνση ακμών Anti-Alias Εξομάλυνση ακμών Anti-alias Rasters Εξομάλυνση ακμών εικόνων ράστερ @@ -514,6 +516,7 @@ font-technology Variable Μεταβλητές Color Mixer (Shift-click the chip) Μείκτης χρωμάτων (Shift-κλικ στο δείγμα) Color Mode Λειτουργία χρώματος Color Mode: Λειτουργία χρώματος: + Color Model Μοντέλο χρώματος Color Model: Μοντέλο χρώματος: Color Models Μοντέλα χρώματος Color Picker Επιλογέας χρώματος @@ -540,6 +543,7 @@ font-technology Variable Μεταβλητές Colors Χρώματα Colors: Χρώματα: Column Graph Tool Γράφημα στηλών (Column Graph Tool) + Columns Στήλες Columns: Στήλες: Column… Στήλη… Combine Slices Συνδυασμός τομών @@ -1017,6 +1021,7 @@ font-technology Variable Μεταβλητές Enable text access for screen readers Ενεργοποίηση πρόσβασης κειμένου για αναγνώστες οθόνης Enable Touch Gestures Ενεργοποίηση χειρονομιών αφής Switch Selection and Drawing Modes Εναλλαγή λειτουργιών επιλογής και σχεδίασης + Select Last Selection Tool Επιλογή του τελευταίου εργαλείου επιλογής Enable Touch Workspace Ενεργοποίηση χώρου εργασίας αφής Encoding Κωδικοποίηση Encoding: Κωδικοποίηση: @@ -2101,6 +2106,7 @@ font-technology Variable Μεταβλητές Search Preferences Αναζήτηση στις προτιμήσεις No settings found Δεν βρέθηκαν ρυθμίσεις Reset to Default Επαναφορά προεπιλογής + Resolution Ανάλυση Resolution: Ανάλυση: Restore Επαναφορά Revert Επαναφορά αποθηκευμένης έκδοσης @@ -2121,6 +2127,7 @@ font-technology Variable Μεταβλητές Show Bounding Box While Moving and Drawing Εμφάνιση πλαισίου οριοθέτησης κατά τη μετακίνηση και τη σχεδίαση Rotate… Περιστροφή… Rotation Περιστροφή + Rows Γραμμές Rows: Γραμμές: Rulers Χάρακες Rulers & Grids Χάρακες και πλέγματα @@ -2456,6 +2463,8 @@ axis Both Και τα δύο @msg the script is no longer in the Scripts folder το σενάριο δεν βρίσκεται πλέον στον φάκελο Scripts Some scripts were not listed Ορισμένα σενάρια δεν εμφανίζονται στη λίστα The Scripts folder cannot be read Δεν είναι δυνατή η ανάγνωση του φακέλου Scripts + Loading scripts… Φόρτωση σεναρίων… + The Scripts folder is still being read Ο φάκελος Scripts διαβάζεται ακόμα @msg the script's run is no longer available η εκτέλεση του σεναρίου δεν είναι πλέον διαθέσιμη @msg a failed command changed undo steps that could not be put back, so the script was stopped μια εντολή που απέτυχε άλλαξε βήματα αναίρεσης που δεν ήταν δυνατό να επαναφερθούν, οπότε το σενάριο σταμάτησε @msg a recovery copy could not be written, so the script was not run δεν ήταν δυνατή η εγγραφή αντιγράφου ανάκτησης, οπότε το σενάριο δεν εκτελέστηκε @@ -3465,6 +3474,9 @@ theme Appearance Εμφάνιση Overprint Υπερεκτύπωση Overprint and Transparency Flattener Υπερεκτύπωση και ισοπέδωση διαφάνειας Overprint and Transparency Flattener Options Επιλογές υπερεκτύπωσης και ισοπέδωσης διαφάνειας + Custom… Προσαρμοσμένο… + Custom Transparency Flattener Options Προσαρμοσμένες επιλογές ισοπέδωσης διαφάνειας + EPS has no alpha transparency, and Overprints sets whether overprints are kept. Το EPS δεν έχει διαφάνεια άλφα και οι Υπερεκτυπώσεις ορίζουν αν διατηρούνται οι υπερεκτυπώσεις. Overprint Black… Υπερεκτύπωση μαύρου… Overprint Fill Υπερεκτύπωση γεμίσματος Overprint Preview Προεπισκόπηση υπερεκτύπωσης @@ -3545,6 +3557,7 @@ theme Appearance Εμφάνιση Play Current Selection Αναπαραγωγή τρέχουσας επιλογής Save Actions… Αποθήκευση ενεργειών… Load Actions… Φόρτωση ενεργειών… + Replace Actions… Αντικατάσταση ενεργειών… Reset Actions Επαναφορά ενεργειών Replace the current actions with the default set? Να αντικατασταθούν οι τρέχουσες ενέργειες με το προεπιλεγμένο σύνολο; Append adds the default set after the current sets instead. Η Προσάρτηση προσθέτει αντί γι’ αυτό το προεπιλεγμένο σύνολο μετά τα τρέχοντα σύνολα. @@ -3833,6 +3846,8 @@ digits Malayalam Μαλαγιάλαμ Replaces the saved preset of that name. Αντικαθιστά την αποθηκευμένη προεπιλογή με αυτό το όνομα. Require a password to open the document Απαίτηση κωδικού για το άνοιγμα εγγράφου Reset Bounding Box Επαναφορά πλαισίου οριοθέτησης + Rotate Bounding Box Περιστροφή πλαισίου οριοθέτησης + Rotate Bounding Box… Περιστροφή πλαισίου οριοθέτησης… Reset Envelope Mesh Επαναφορά πλέγματος περιβλήματος Reset Envelope Shape Επαναφορά σχήματος περιβλήματος Reset Essentials Επαναφορά χώρου εργασίας Essentials @@ -3917,6 +3932,29 @@ digits Malayalam Μαλαγιάλαμ The unit for East Asian type measurements, which no field uses yet. Η μονάδα για τις μετρήσεις κειμένου Ανατολικής Ασίας, την οποία δεν χρησιμοποιεί ακόμη κανένα πεδίο. When on, a number typed without a unit into a field in picas is read in points. Όταν είναι ενεργό, ένας αριθμός που πληκτρολογείται χωρίς μονάδα σε πεδίο σε πίκες διαβάζεται σε σημεία. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Με το Αναγνωριστικό XML, τα ονόματα αντικειμένων εμφανίζονται ως αναγνωριστικά XML στα Επίπεδα, στις Μεταβλητές και στις Επιλογές επιπέδου. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Το βήμα για το μέγεθος κειμένου και το διάστιχο: τα Cmd/Ctrl+Shift+. και Cmd/Ctrl+Shift+, αλλάζουν το μέγεθος κατά ένα βήμα, ή κατά πέντε μαζί με Alt. Σε οριζόντιο κείμενο, το Alt με το επάνω ή κάτω βέλος αλλάζει το διάστιχο κατά ένα βήμα, ή κατά πέντε με Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Το βήμα για την αραίωση και το kerning, σε χιλιοστά του em: σε οριζόντιο κείμενο, το Alt με το αριστερό ή δεξί βέλος αλλάζει το kerning στον δρομέα ή την αραίωση του επιλεγμένου κειμένου κατά ένα βήμα, ή κατά πέντε με Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Το βήμα για τη μετατόπιση γραμμής βάσης: σε οριζόντιο κείμενο, τα Alt και Shift με το επάνω ή κάτω βέλος μετακινούν τη γραμμή βάσης κατά ένα βήμα, ή κατά πέντε με Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Εμφανίζει τις επιλογές για ιαπωνικό και άλλο ανατολικοασιατικό κείμενο στα πάνελ Χαρακτήρας, Παράγραφος, OpenType και Γλύφοι, καθώς και την εντολή Σύνθετες γραμματοσειρές. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Εμφανίζει τις επιλογές για αραβικό, εβραϊκό και ινδικό κείμενο στα πάνελ Χαρακτήρας και Παράγραφος, όπως η κατεύθυνση παραγράφου, οι κασίντες και τα ψηφία. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Τα εργαλεία επιλογής επιλέγουν κείμενο μόνο στη γραμμή βάσης του, στο πλαίσιο του κειμένου περιοχής ή στη διαδρομή του, όχι οπουδήποτε μέσα στο πλαίσιό του. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Τα μενού γραμματοσειρών δείχνουν κάθε γραμματοσειρά με το αγγλικό της όνομα· όταν είναι ανενεργό, μια γραμματοσειρά που έχει και όνομα στη δική της γλώσσα δείχνει αυτό το όνομα. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Το νέο κείμενο περιοχής ξεκινά με ενεργό το Αυτόματο μέγεθος, οπότε ένα ορθογώνιο πλαίσιο οριζόντιου κειμένου μεγαλώνει ή μικραίνει σε ύψος για να χωρά το κείμενό του. + Font lists and the Type › Font menu show a sample of each font beside its name. Οι λίστες γραμματοσειρών και το μενού Γραμματοσειρά δείχνουν ένα δείγμα κάθε γραμματοσειράς δίπλα στο όνομά της. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Τα δείγματα γραμματοσειρών σχεδιάζονται με σκούρο κείμενο σε λευκό, όποια κι αν είναι η φωτεινότητα του περιβάλλοντος· ισχύει μόνο όσο είναι ενεργές οι προεπισκοπήσεις γραμματοσειρών στα μενού. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Πόσο ψηλή είναι κάθε γραμμή στις λίστες των πεδίων γραμματοσειράς, όπως αυτό του πάνελ Χαρακτήρας, και άρα πόσο μεγάλο είναι κάθε δείγμα. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Πόσες από τις τελευταίες γραμματοσειρές που χρησιμοποιήθηκαν, από 1 έως 15, δείχνουν οι Πρόσφατες γραμματοσειρές και οι λίστες γραμματοσειρών, με την πιο πρόσφατη πρώτη. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Όταν αλλάζετε τη γραμματοσειρά ή το στυλ γραμματοσειράς ενός κειμένου, οι χαρακτήρες για τους οποίους η νέα γραμματοσειρά δεν έχει γλύφο κρατούν την προηγούμενη γραμματοσειρά τους. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Μια ροζ επισήμανση στον καμβά σημειώνει τους γλύφους που αντικαταστάθηκαν από λειτουργίες OpenType, όπως τα συμπλέγματα· δεν τυπώνεται ούτε εξάγεται. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Με το εργαλείο Κείμενο, η επιλογή ενός χαρακτήρα δείχνει δίπλα του στον καμβά μια σειρά με τους εναλλακτικούς γλύφους του για να διαλέξετε. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Μια ροζ επισήμανση στον καμβά σημειώνει κείμενο που σχεδιάζεται με γραμματοσειρά αντικατάστασης επειδή λείπει η γραμματοσειρά του· δεν τυπώνεται ούτε εξάγεται. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Το νέο κείμενο που δημιουργείται με εργαλείο κειμένου ξεκινά με επιλεγμένο κείμενο κράτησης θέσης, το οποίο αντικαθίσταται από ό,τι πληκτρολογείτε. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Η πληκτρολόγηση ενός δείκτη λίστας, όπως 1. ή *, και μετά ενός κενού στην αρχή μιας παραγράφου κάνει την παράγραφο λίστα. + Fonts in this folder show in the font menus and can be used without being installed. Οι γραμματοσειρές σε αυτόν τον φάκελο εμφανίζονται στα μενού γραμματοσειρών και μπορούν να χρησιμοποιηθούν χωρίς εγκατάσταση. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Η εφαρμογή στυλ γραφικών σε κείμενο αφαιρεί το δικό τους γέμισμα ή περίγραμμα από τους χαρακτήρες όπου το στυλ έχει, ώστε να φαίνεται το χρώμα του στυλ. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Η Στοίχιση και η Κατανομή μετρούν το κείμενο σημείου με βάση το μελάνι των γλύφων του αντί για το τετράγωνο em του. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Η Στοίχιση και η Κατανομή μετρούν το κείμενο περιοχής με βάση το μελάνι των γλύφων του αντί για το πλαίσιό του. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Το πλαίσιο οριοθέτησης και το πάνελ Μετασχηματισμός μετρούν το κείμενο σημείου με βάση το μελάνι των γλύφων του αντί για το τετράγωνο em του. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Προσκολλά τη σχεδίαση, τη μετακίνηση και την κλιμάκωση στις υποδιαιρέσεις του πλέγματος, ακόμη και όταν το πλέγμα είναι κρυφό· όσο είναι ενεργό, η Προσκόλληση σε εικονοστοιχείο δεν ισχύει. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Το χρώμα των οδηγών που δεν είναι επιλεγμένοι· ένας πίνακας σχεδίασης με Ετικέτα οδηγών σχεδιάζει τους δικούς του οδηγούς στο χρώμα της ετικέτας. Draws guides as solid lines or as dots, including the guides already in the document. Σχεδιάζει τους οδηγούς ως συνεχείς γραμμές ή ως κουκκίδες, μαζί με τους οδηγούς που υπάρχουν ήδη στο έγγραφο. @@ -5084,6 +5122,8 @@ digits Malayalam Μαλαγιάλαμ @msg no target object has an opacity mask: select one or give `id` κανένα αντικείμενο-στόχος δεν έχει μάσκα αδιαφάνειας: επιλέξτε ένα ή δώστε `id` @msg no threaded text selected δεν έχει επιλεγεί συνδεδεμένο κείμενο @msg no user library folder here δεν υπάρχει φάκελος βιβλιοθήκης χρήστη εδώ +@msg `{file}` has no swatches of its own το `{file}` δεν έχει δικά του δείγματα χρωμάτων +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold το `{_1}` έχει δείγματα μοτίβου, που ένα αρχείο .vcswatches δεν μπορεί να περιέχει @msg no user workspace `{from}` δεν υπάρχει χώρος εργασίας χρήστη `{from}` @msg node {_1} is not text ο κόμβος {_1} δεν είναι κείμενο @msg node {_1} is on a locked artboard ο κόμβος {_1} βρίσκεται σε κλειδωμένο πίνακα σχεδίασης @@ -5409,6 +5449,8 @@ digits Malayalam Μαλαγιάλαμ @msg All colors are within the CMYK gamut Όλα τα χρώματα βρίσκονται εντός της χρωματικής γκάμας CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} χρώμα βρίσκεται εκτός της χρωματικής γκάμας CMYK|{n} χρώματα βρίσκονται εκτός της χρωματικής γκάμας CMYK @msg Unembedded to {_1} Καταργήθηκε η ενσωμάτωση στο {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Καταργήθηκε η ενσωμάτωση {n} εικόνας στο {folder}|Καταργήθηκε η ενσωμάτωση {n} εικόνων στο {folder} +@msg every numbered name for {name} is taken in that folder όλα τα αριθμημένα ονόματα για το {name} χρησιμοποιούνται ήδη σε αυτόν τον φάκελο @msg Reset {_1} Επαναφορά {_1} @msg Sent to {_1} Στάλθηκε στο {_1} @msg {_1} files {_1} αρχεία @@ -5554,6 +5596,8 @@ digits Malayalam Μαλαγιάλαμ @msg automation path rejected: outside the read root {root}: {path} απορρίφθηκε η διαδρομή αυτοματισμού: εκτός ρίζας ανάγνωσης {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} απορρίφθηκε η διαδρομή αυτοματισμού: εκτός των ριζών ανάγνωσης {roots}: {path} @msg a linked JavaScript file is outside the read roots ένα συνδεδεμένο αρχείο JavaScript είναι εκτός των ριζών ανάγνωσης +@msg a linked image file is outside the read roots ένα συνδεδεμένο αρχείο εικόνας είναι εκτός των ριζών ανάγνωσης +@msg a linked file's export folder is outside the read roots ο φάκελος εξαγωγής ενός συνδεδεμένου αρχείου είναι εκτός των ριζών ανάγνωσης @msg the library's file is outside the read roots το αρχείο της βιβλιοθήκης είναι εκτός των ριζών ανάγνωσης @msg {file} names more than one linked JavaScript file το {file} αντιστοιχεί σε περισσότερα από ένα συνδεδεμένα αρχεία JavaScript @msg automation path rejected: outside the write root {root}: {path} απορρίφθηκε η διαδρομή αυτοματισμού: εκτός ρίζας εγγραφής {root}: {path} @@ -5667,6 +5711,7 @@ digits Malayalam Μαλαγιάλαμ @msg missing panel layout λείπει η διάταξη πινάκων @msg unsupported native docking operation μη υποστηριζόμενη εγγενής λειτουργία σύνδεσης πινάκων Linux Display Server Διακομιστής οθόνης Linux + Low-Latency Drawing Σχεδίαση χαμηλής καθυστέρησης Ruler Origin Αρχή χαράκων Reset Ruler Origin Επαναφορά αρχής χαράκων @msg the compressed file unpacks to more than VectorCraft reads ({_1} MB of document, {_2} MB per image) το αποσυμπιεσμένο αρχείο υπερβαίνει τα όρια ανάγνωσης του VectorCraft ({_1} MB ανά έγγραφο, {_2} MB ανά εικόνα) @@ -6460,6 +6505,8 @@ effect Points Σημεία Reset Horizontal Scale Επαναφορά οριζόντιας κλίμακας Reset Tracking and Kerning Επαναφορά απόστασης χαρακτήρων και διαγραμμάτωσης Highlight Font Name Επισήμανση ονόματος γραμματοσειράς + Highlight Font Size Επισήμανση μεγέθους γραμματοσειράς + Other… Άλλο… Highlight Kerning Επισήμανση διαγραμμάτωσης Highlight Tracking Επισήμανση απόστασης χαρακτήρων Sample Color from Screen Δειγματοληψία χρώματος από την οθόνη @@ -7364,6 +7411,12 @@ anchor Points: Σημεία: @msg `mode` must be "free", "keepAngles" or "symmetric" Το `mode` πρέπει να είναι "free", "keepAngles" ή "symmetric" @msg `{key}` must be [x, y] Το `{key}` πρέπει να είναι [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Μετατροπέας μονάδων + Unit Converter Panel Πλαίσιο Μετατροπέας μονάδων + Copy with Units Αντιγραφή με μονάδες + From Selection Από την επιλογή + # Color Effects add-on: Select by Color Kind. Select by Color Kind Επιλογή κατά είδος χρώματος Objects with Spot Colors Αντικείμενα με χρώματα spot diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 6f3cc3e08c..3cdfe837b4 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -11,7 +11,7 @@ # Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`, # `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language # names, OpenType, the built-in workspace names and the bracketed perspective grid preset names. -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Glowing Edges… Bordes resplandecientes… Glowing Edges Bordes resplandecientes Edge Width Ancho del borde @@ -119,6 +119,7 @@ Add Anchor Point Agregar punto de ancla Add Anchor Point Tool Herramienta Agregar punto de ancla Add Anchor Points Agregar puntos de ancla + Add Around Agregar alrededor del objeto Add Effect Agregar efecto Add Freeform Line Agregar línea libre Add Freeform Point Agregar punto libre @@ -196,6 +197,7 @@ Angle: Ángulo: Angles Ángulos Animated Zoom Zoom animado + Anti Alias Suavizado Anti-alias Suavizado Anti-Alias Suavizado Anti-alias Rasters Suavizar imágenes ráster @@ -554,6 +556,7 @@ font-technology Variable Variables Color Mixer (Shift-click the chip) Mezclador de colores (Shift+clic en la muestra) Color Mode Modo de color Color Mode: Modo de color: + Color Model Modelo de color Color Model: Modelo de color: Color Models Modelos de color Color Picker Selector de color @@ -580,6 +583,7 @@ font-technology Variable Variables Colors Colores Colors: Colores: Column Graph Tool Herramienta Gráfico de columnas + Columns Columnas Columns: Columnas: Column… Columna… Combine Slices Combinar sectores @@ -1074,6 +1078,7 @@ font-technology Variable Variables Enable text access for screen readers Permitir el acceso al texto para lectores de pantalla Enable Touch Gestures Activar gestos táctiles Switch Selection and Drawing Modes Cambiar entre modos de selección y dibujo + Select Last Selection Tool Elegir la última herramienta de selección Enable Touch Workspace Activar espacio de trabajo táctil Encoding Codificación Encoding: Codificación: @@ -1305,6 +1310,8 @@ font-technology Variable Variables Reset Tracking and Kerning Restablecer espaciado e interletraje Reset Horizontal Scale Restablecer escala horizontal Highlight Font Name Resaltar nombre de fuente + Highlight Font Size Resaltar tamaño de fuente + Other… Otro… Highlight Kerning Resaltar interletraje Highlight Tracking Resaltar espaciado Spacing Espaciado @@ -2569,6 +2576,9 @@ font-technology Variable Variables Overprint Sobreimprimir Overprint and Transparency Flattener Sobreimpresión y acoplador de transparencia Overprint and Transparency Flattener Options Opciones de sobreimpresión y acoplador de transparencia + Custom… Personalizado… + Custom Transparency Flattener Options Opciones personalizadas de acoplador de transparencia + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS no tiene transparencia alfa, y Sobreimpresiones determina si se conservan las sobreimpresiones. Overprint Black… Sobreimprimir negro… Overprint Fill Sobreimprimir relleno Overprint Preview Vista previa de sobreimpresión @@ -2675,6 +2685,7 @@ font-technology Variable Variables Play Current Selection Reproducir la selección actual Save Actions… Guardar acciones… Load Actions… Cargar acciones… + Replace Actions… Reemplazar acciones… Reset Actions Restablecer acciones Replace the current actions with the default set? ¿Reemplazar las acciones actuales por el conjunto predeterminado? Append adds the default set after the current sets instead. Añadir agrega en su lugar el conjunto predeterminado después de los conjuntos actuales. @@ -3041,6 +3052,8 @@ digits Malayalam Malayálam Reselect Volver a seleccionar Reset Restablecer Reset Bounding Box Restablecer cuadro delimitador + Rotate Bounding Box Rotar cuadro delimitador + Rotate Bounding Box… Rotar cuadro delimitador… Reset Envelope Mesh Restablecer malla de envolvente Reset Envelope Shape Restablecer forma de envolvente Reset Essentials Restablecer Essentials @@ -3081,6 +3094,7 @@ digits Malayalam Malayálam Reshape Segment Remodelar segmento Reshape Tool Herramienta Remodelar Reshape Type Area Remodelar área de texto + Resolution Resolución Resolution: Resolución: Responsive Adaptable Restore Restaurar @@ -3137,6 +3151,29 @@ digits Malayalam Malayálam The unit for East Asian type measurements, which no field uses yet. La unidad para las medidas del texto de Asia oriental, que todavía no usa ningún campo. When on, a number typed without a unit into a field in picas is read in points. Si está activado, un número escrito sin unidad en un campo en picas se lee en puntos. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Con ID XML, los nombres de los objetos se muestran como ID XML en Capas, Variables y Opciones de capa. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. El paso del tamaño del texto y del interlineado: Cmd/Ctrl+Mayús+. y Cmd/Ctrl+Mayús+, cambian el tamaño un paso, o cinco con Alt también; en texto horizontal, Alt con la flecha arriba o abajo cambia el interlineado un paso, o cinco con Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. El paso del tracking y del kerning, en milésimas de em: en texto horizontal, Alt con la flecha izquierda o derecha cambia el kerning en el cursor o el tracking del texto seleccionado un paso, o cinco con Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. El paso del desplazamiento vertical: en texto horizontal, Alt y Mayús con la flecha arriba o abajo mueven la línea de base un paso, o cinco con Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Muestra las opciones del texto japonés y de otros idiomas de Asia oriental en los paneles Carácter, Párrafo, OpenType y Glifos, y el comando Fuentes compuestas. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Muestra las opciones del texto árabe, hebreo e índico en los paneles Carácter y Párrafo, como la dirección del párrafo, las kashidas y los dígitos. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Las herramientas de selección seleccionan el texto solo en su línea de base, el marco del texto de área o su trazado, no en cualquier punto dentro de su caja. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Los menús de fuentes muestran cada fuente con su nombre en inglés; desactivado, una fuente que también tiene un nombre en su propio idioma muestra ese nombre. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. El texto de área nuevo empieza con Tamaño automático activado, así que un marco rectangular de texto horizontal crece o se reduce en altura para ajustarse a su texto. + Font lists and the Type › Font menu show a sample of each font beside its name. Las listas de fuentes y el menú Fuente muestran una muestra de cada fuente junto a su nombre. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Las muestras de fuentes se dibujan en texto oscuro sobre blanco, sea cual sea el brillo de la interfaz; solo se aplica mientras las previsualizaciones de fuentes en los menús están activadas. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. La altura de cada fila en las listas de los campos de fuente, como el del panel Carácter, y por tanto el tamaño de cada muestra. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Cuántas de las últimas fuentes usadas, de 1 a 15, muestran Fuentes recientes y las listas de fuentes, la más reciente primero. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Al cambiar la fuente o el estilo de fuente de un texto, los caracteres para los que la nueva fuente no tiene glifo conservan la fuente que tenían. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Un resaltado rosa en el lienzo marca los glifos que las funciones OpenType han sustituido, como las ligaduras; no se imprime ni se exporta. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Con la herramienta Texto, al seleccionar un solo carácter aparece junto a él en el lienzo una fila de sus glifos alternativos para elegir. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Un resaltado rosa en el lienzo marca el texto dibujado con una fuente sustituta porque falta su fuente; no se imprime ni se exporta. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. El texto nuevo creado con una herramienta de texto empieza con texto de relleno seleccionado, que lo que escriba sustituye. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Escribir un marcador de lista como 1. o * y luego un espacio al principio de un párrafo convierte el párrafo en una lista. + Fonts in this folder show in the font menus and can be used without being installed. Las fuentes de esta carpeta aparecen en los menús de fuentes y se pueden usar sin instalarlas. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Aplicar un estilo gráfico a un texto quita a los caracteres su propio relleno o trazo donde el estilo tiene uno, para que se vea la pintura del estilo. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Alinear y Distribuir miden el texto de punto por la tinta de sus glifos en lugar de por su caja em. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Alinear y Distribuir miden el texto de área por la tinta de sus glifos en lugar de por su marco. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. El cuadro delimitador y el panel Transformar miden el texto de punto por la tinta de sus glifos en lugar de por su caja em. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Ajusta el dibujo, el desplazamiento y el escalado a las subdivisiones de la cuadrícula, aunque la cuadrícula esté oculta; mientras está activado, Ajustar a píxel no se aplica. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. El color de las guías no seleccionadas; una mesa de trabajo con una Etiqueta de las guías dibuja sus propias guías en el color de la etiqueta. Draws guides as solid lines or as dots, including the guides already in the document. Dibuja las guías como líneas continuas o como puntos, incluidas las guías que ya están en el documento. @@ -3218,6 +3255,7 @@ digits Malayalam Malayálam Rounded Rectangle Tool Herramienta Rectángulo redondeado Rounded Rectangle… Rectángulo redondeado… Row Size: Tamaño de fila: + Rows Filas Rows: Filas: Rule: Filete: Rulers Reglas @@ -4562,6 +4600,8 @@ axis Both Ambos @msg the script is no longer in the Scripts folder el script ya no está en la carpeta Scripts Some scripts were not listed Algunos scripts no se han incluido en la lista The Scripts folder cannot be read No se puede leer la carpeta Scripts + Loading scripts… Cargando scripts… + The Scripts folder is still being read Aún se está leyendo la carpeta Scripts @msg the script's run is no longer available la ejecución del script ya no está disponible @msg a failed command changed undo steps that could not be put back, so the script was stopped un comando fallido cambió pasos de deshacer que no se pudieron restaurar, así que el script se detuvo @msg a recovery copy could not be written, so the script was not run no se pudo escribir una copia de recuperación, así que el script no se ejecutó @@ -5130,6 +5170,8 @@ liquify-list-end {0}, {1} {0}, {1} @msg no target object has an opacity mask: select one or give `id` ningún objeto de destino tiene máscara de opacidad: selecciona uno o indica `id` @msg no threaded text selected no hay texto enlazado seleccionado @msg no user library folder here aquí no hay ninguna carpeta de bibliotecas de usuario +@msg `{file}` has no swatches of its own `{file}` no tiene muestras propias +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` tiene muestras de motivo, que un archivo .vcswatches no puede contener @msg no user workspace `{from}` no existe el espacio de trabajo de usuario `{from}` @msg node {_1} is not text el nodo {_1} no es texto @msg node {_1} is on a locked artboard el nodo {_1} está en una mesa de trabajo bloqueada @@ -5462,6 +5504,8 @@ liquify-list-end {0}, {1} {0}, {1} @msg All colors are within the CMYK gamut Todos los colores están dentro de la gama CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} color está fuera de la gama CMYK|{n} colores están fuera de la gama CMYK @msg Unembedded to {_1} Se desincrustó en {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Se desincrustó {n} imagen en {folder}|Se desincrustaron {n} imágenes en {folder} +@msg every numbered name for {name} is taken in that folder todos los nombres numerados para {name} ya existen en esa carpeta @msg Reset {_1} Se restableció {_1} @msg Sent to {_1} Se envió a {_1} @msg {_1} files {_1} archivos @@ -5591,6 +5635,8 @@ liquify-list-end {0}, {1} {0}, {1} @msg automation path rejected: outside the read root {root}: {path} ruta de automatización rechazada: fuera de la carpeta raíz de lectura {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} ruta de automatización rechazada: fuera de las carpetas raíz de lectura {roots}: {path} @msg a linked JavaScript file is outside the read roots un archivo JavaScript vinculado está fuera de las carpetas raíz de lectura +@msg a linked image file is outside the read roots un archivo de imagen vinculado está fuera de las carpetas raíz de lectura +@msg a linked file's export folder is outside the read roots la carpeta de exportación de un archivo vinculado está fuera de las carpetas raíz de lectura @msg automation path rejected: outside the write root {root}: {path} ruta de automatización rechazada: fuera de la carpeta raíz de escritura {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} ruta de automatización rechazada: fuera de las carpetas raíz de escritura {roots}: {path} @msg automation path rejected: path is empty ruta de automatización rechazada: la ruta está vacía @@ -5818,6 +5864,7 @@ lighting Light Luz @msg missing panel layout Falta la distribución de paneles @msg unsupported native docking operation Operación nativa de anclaje no admitida Linux Display Server Servidor de pantalla de Linux + Low-Latency Drawing Dibujo de baja latencia X11 (XWayland) When a Pen Is Attached X11 (XWayland) cuando hay un lápiz conectado If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Si el lápiz de una tableta digitalizadora no dibuja, elige una opción X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -7353,6 +7400,12 @@ anchor Points: Puntos: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` debe ser "free", "keepAngles" o "symmetric" @msg `{key}` must be [x, y] `{key}` debe ser [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Conversor de unidades + Unit Converter Panel Panel Conversor de unidades + Copy with Units Copiar con unidades + From Selection Desde la selección + # Color Effects add-on: Select by Color Kind. Select by Color Kind Seleccionar por tipo de color Objects with Spot Colors Objetos con tintas planas diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index c480e7740e..b092eb8891 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -180,6 +180,8 @@ Shear… Vinouta… Transform Each… Muunna kutakin… Reset Bounding Box Palauta rajausruutu + Rotate Bounding Box Kierrä rajausruutua + Rotate Bounding Box… Kierrä rajausruutua… Arrange Järjestä Bring to Front Tuo eteen Bring Forward Tuo eteenpäin @@ -1523,6 +1525,7 @@ lighting Light Valo Play Current Selection Toista nykyinen valinta Save Actions… Tallenna toiminnot… Load Actions… Lataa toiminnot… + Replace Actions… Korvaa toiminnot… Reset Actions Palauta toiminnot Replace the current actions with the default set? Korvataanko nykyiset toiminnot oletussarjalla? Append adds the default set after the current sets instead. Lisää-painike lisää sen sijaan oletussarjan nykyisten sarjojen perään. @@ -2779,6 +2782,7 @@ digits Malayalam Malajalam BLANK DOCUMENT PRESETS TYHJÄN ASIAKIRJAN ESIASETUKSET Bleed Leikkuuvara Change to Right-to-Left Layout Vaihda oikealta vasemmalle -asetteluun + Columns Sarakkeet Columns: Sarakkeet: Documents you create appear here. Luomasi asiakirjat näkyvät tässä. More Settings Lisää asetuksia @@ -2912,6 +2916,9 @@ digits Malayalam Malajalam Open a document to preview its pages Avaa asiakirja, niin voit esikatsella sen sivuja Output › Mode Tuloste › Tila Overprint and Transparency Flattener Options Päällepainatuksen ja läpinäkyvyyden litistyksen asetukset + Custom… Mukautettu… + Custom Transparency Flattener Options Läpinäkyvyyden litistyksen mukautetut asetukset + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS:ssä ei ole alfa-läpinäkyvyyttä, ja Päällepainatukset määrää, säilytetäänkö päällepainatukset. Place the pages with the placement again Sijoita sivut uudelleen sijoittelun mukaan Placement: Sijoittelu: Preserve CMYK Numbers Säilytä CMYK-arvot @@ -2961,14 +2968,19 @@ digits Malayalam Malajalam Around Object Objektin ympärillä Background: Tausta: Changing these settings changes how raster effects look when exported, flattened or expanded. Näiden asetusten muuttaminen vaikuttaa rasteritehosteiden ulkoasuun vietäessä, litistettäessä tai laajennettaessa. + Add Around Lisää objektin ympärille + Anti Alias Reunanpehmennys + Color Model Värijärjestelmä Color Model: Värijärjestelmä: Create Clipping Mask Luo leikkausmaski Preserve Spot Colors Säilytä spottivärit + Resolution Tarkkuus Resolution: Tarkkuus: Transparent Läpinäkyvä Layout Order: Asettelujärjestys: Change to Left-to-Right Layout Vaihda vasemmalta oikealle -asetteluun Artboards: {n} Piirtoalustat: {n} + Rows Rivit Rows: Rivit: Assign Määritä Color Group: Väriryhmä: @@ -3971,6 +3983,7 @@ theme Appearance Ulkoasu Enable Rubber Band for Ota kumilankavalinta käyttöön kohteelle Enable Touch Gestures Ota kosketuseleet käyttöön Switch Selection and Drawing Modes Vaihda valinta- ja piirtotilan välillä + Select Last Selection Tool Valitse viimeksi käytetty valintatyökalu Enable Touch Workspace Ota kosketustyötila käyttöön English: UK Englanti: UK Every (minutes) Välein (minuuttia) @@ -4103,6 +4116,7 @@ theme Appearance Ulkoasu Scroll Sideways with Cmd/Ctrl + Wheel Vieritä vaakasuunnassa Cmd/Ctrl + hiiren rullalla Scrub Numeric Fields by Dragging Muuta numerokenttiä vetämällä Linux Display Server Linuxin näyttöpalvelin + Low-Latency Drawing Pienen viiveen piirto Print Preview Tulostuksen esikatselu Print Setup Tulostusasetukset Bitmap Bittikartta @@ -4507,6 +4521,29 @@ font-technology Variable Muuttuvat The unit for East Asian type measurements, which no field uses yet. Itä-Aasian tekstin mittojen yksikkö, jota mikään kenttä ei vielä käytä. When on, a number typed without a unit into a field in picas is read in points. Kun asetus on käytössä, picoina näytettävään kenttään ilman yksikköä kirjoitettu luku luetaan pisteinä. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML-tunnus-asetuksella objektien nimet näytetään XML-tunnuksina kohteissa Tasot, Muuttujat ja Tason asetukset. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Tekstin koon ja rivivälin askel: Cmd/Ctrl+Vaihto+. ja Cmd/Ctrl+Vaihto+, muuttavat kokoa yhden askeleen, Alt-näppäimen kanssa viisi; vaakasuuntaisessa tekstissä Alt ja ylä- tai alanuoli muuttavat riviväliä yhden askeleen, Cmd/Ctrl-näppäimen kanssa viisi. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Merkkivälin ja parivälistyksen askel em-yksikön tuhannesosina: vaakasuuntaisessa tekstissä Alt ja vasen tai oikea nuoli muuttavat kohdistimen kohdan parivälistystä tai valitun tekstin merkkiväliä yhden askeleen, Cmd/Ctrl-näppäimen kanssa viisi. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Perusviivan siirron askel: vaakasuuntaisessa tekstissä Alt, vaihtonäppäin ja ylä- tai alanuoli siirtävät perusviivaa yhden askeleen, Cmd/Ctrl-näppäimen kanssa viisi. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Näyttää japanin ja muiden Itä-Aasian kielten tekstin asetukset paneeleissa Merkki, Kappale, OpenType ja Merkit sekä komennon Yhdistelmäfontit. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Näyttää arabian, heprean ja intialaisten kielten tekstin asetukset paneeleissa Merkki ja Kappale, kuten kappaleen suunnan, kashidat ja numerot. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Valintatyökalut valitsevat tekstin vain sen perusviivalta, aluetekstin kehyksestä tai sen polulta, eivät mistä tahansa sen laatikon sisältä. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Fonttivalikot näyttävät jokaisen fontin englanninkielisellä nimellä; pois päältä fontti, jolla on nimi myös omalla kielellään, näyttää sen nimen. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Uusi aluetekstin kehys alkaa automaattinen koko päällä, joten vaakasuuntaisen tekstin suorakulmainen kehys kasvaa tai pienenee korkeudeltaan tekstinsä mukaan. + Font lists and the Type › Font menu show a sample of each font beside its name. Fonttiluettelot ja Fontti-valikko näyttävät jokaisen fontin näytteen sen nimen vieressä. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Fonttinäytteet piirretään tummalla tekstillä valkoiselle käyttöliittymän kirkkaudesta riippumatta; tämä koskee vain aikaa, jolloin valikkojen fonttiesikatselut ovat päällä. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Kuinka korkea kukin rivi on fonttikenttien luetteloissa, kuten Merkki-paneelin kentässä, ja siten kuinka suuri kukin näyte on. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Kuinka monta viimeksi käytettyä fonttia, 1–15, Viimeisimmät fontit ja fonttiluettelot näyttävät, uusin ensin. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Kun vaihdat tekstin fontin tai fonttityylin, merkit, joille uudessa fontissa ei ole glyfiä, säilyttävät aiemman fonttinsa. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Vaaleanpunainen korostus piirtoalueella merkitsee glyfit, jotka OpenType-ominaisuudet ovat korvanneet, kuten ligatuurit; sitä ei tulosteta eikä viedä. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Tekstityökalulla yhden merkin valitseminen näyttää sen vieressä piirtoalueella rivin sen vaihtoehtoisia glyfejä valittavaksi. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Vaaleanpunainen korostus piirtoalueella merkitsee tekstin, joka piirretään korvaavalla fontilla, koska sen oma fontti puuttuu; sitä ei tulosteta eikä viedä. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Tekstityökalulla luotu uusi teksti alkaa valitulla paikkamerkkitekstillä, jonka kirjoittaminen korvaa. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Luettelomerkin, kuten 1. tai *, ja sen jälkeen välilyönnin kirjoittaminen kappaleen alkuun tekee kappaleesta luettelon. + Fonts in this folder show in the font menus and can be used without being installed. Tämän kansion fontit näkyvät fonttivalikoissa, ja niitä voi käyttää asentamatta. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Grafiikkatyylin käyttäminen tekstiin poistaa merkkien oman täytön tai viivan, kun tyylissä on sellainen, joten tyylin väri näkyy. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Tasaa ja Jaa mittaavat pistetekstin sen glyfien musteen mukaan eivätkä sen em-laatikon mukaan. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Tasaa ja Jaa mittaavat aluetekstin sen glyfien musteen mukaan eivätkä sen kehyksen mukaan. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Rajausruutu ja Muunna-paneeli mittaavat pistetekstin sen glyfien musteen mukaan eivätkä sen em-laatikon mukaan. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Kohdistaa piirtämisen, siirtämisen ja skaalaamisen ruudukon jakoihin myös silloin, kun ruudukko on piilossa; kun asetus on päällä, Kohdista pikseliin ei ole käytössä. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Valitsemattomien apuviivojen väri; piirtoalusta, jolla on apuviivojen tunniste, piirtää omat apuviivansa tunnisteen värillä. Draws guides as solid lines or as dots, including the guides already in the document. Piirtää apuviivat yhtenäisinä viivoina tai pisteinä, myös asiakirjassa jo olevat apuviivat. @@ -4795,6 +4832,8 @@ imageTrace Outline Ääriviiva @msg the script is no longer in the Scripts folder komentosarja ei ole enää Scripts-kansiossa Some scripts were not listed Kaikkia komentosarjoja ei ole lueteltu The Scripts folder cannot be read Scripts-kansiota ei voi lukea + Loading scripts… Ladataan komentosarjoja… + The Scripts folder is still being read Scripts-kansiota luetaan vielä @msg the script's run is no longer available komentosarjan suoritus ei ole enää käytettävissä @msg a failed command changed undo steps that could not be put back, so the script was stopped epäonnistunut komento muutti kumoamisvaiheita, joita ei voitu palauttaa, joten komentosarja pysäytettiin @msg a recovery copy could not be written, so the script was not run palautuskopiota ei voitu kirjoittaa, joten komentosarjaa ei suoritettu @@ -5354,6 +5393,8 @@ liquify-list-end {0}, {1} {0} ja {1} @msg no target object has an opacity mask: select one or give `id` millään kohdeobjektilla ei ole peittävyysmaskia: valitse sellainen tai anna `id` @msg no threaded text selected ketjutettua tekstiä ei ole valittu @msg no user library folder here täällä ei ole käyttäjäkirjastokansiota +@msg `{file}` has no swatches of its own tiedostossa `{file}` ei ole omia värimalleja +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold kirjastossa `{_1}` on kuviomalleja, joita .vcswatches-tiedosto ei voi sisältää @msg no user workspace `{from}` ei käyttäjän työtilaa `{from}` @msg node {_1} is not text solmu {_1} ei ole tekstiä @msg node {_1} is on a locked artboard solmu {_1} on lukitulla piirtoalustalla @@ -5678,6 +5719,8 @@ liquify-list-end {0}, {1} {0} ja {1} @msg All colors are within the CMYK gamut Kaikki värit ovat CMYK-väriavaruuden sisällä @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} väri on CMYK-väriavaruuden ulkopuolella|{n} väriä on CMYK-väriavaruuden ulkopuolella @msg Unembedded to {_1} Upotus purettiin kohteeseen {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Upotus purettiin {n} kuvalta kohteeseen {folder}|Upotus purettiin {n} kuvalta kohteeseen {folder} +@msg every numbered name for {name} is taken in that folder kaikki kohteen {name} numeroidut nimet ovat jo käytössä siinä kansiossa @msg Reset {_1} Palautettiin oletukseksi {_1} @msg Sent to {_1} Lähetettiin kohteeseen {_1} @msg {_1} files {_1}-tiedostot @@ -5781,6 +5824,8 @@ liquify-list-end {0}, {1} {0} ja {1} @msg automation path rejected: outside the read root {root}: {path} automaation polku hylättiin: lukujuuren {root} ulkopuolella: {path} @msg automation path rejected: outside the read roots {roots}: {path} automaation polku hylättiin: lukujuurten {roots} ulkopuolella: {path} @msg a linked JavaScript file is outside the read roots linkitetty JavaScript-tiedosto on lukujuurten ulkopuolella +@msg a linked image file is outside the read roots linkitetty kuvatiedosto on lukujuurten ulkopuolella +@msg a linked file's export folder is outside the read roots linkitetyn tiedoston vientikansio on lukujuurten ulkopuolella @msg the library's file is outside the read roots kirjaston tiedosto on lukujuurten ulkopuolella @msg {file} names more than one linked JavaScript file {file} vastaa useampaa kuin yhtä linkitettyä JavaScript-tiedostoa @msg automation path rejected: outside the write root {root}: {path} automaation polku hylättiin: kirjoitusjuuren {root} ulkopuolella: {path} @@ -6470,6 +6515,8 @@ mark-style Japanese Japanilainen Reset Horizontal Scale Palauta vaakaskaalaus Reset Tracking and Kerning Palauta merkkiväli ja parivälistys Highlight Font Name Korosta fontin nimi + Highlight Font Size Korosta fonttikoko + Other… Muu… Highlight Kerning Korosta parivälistys Highlight Tracking Korosta merkkiväli Sample Color from Screen Poimi väri näytöltä @@ -7441,6 +7488,12 @@ anchor Points: Pisteet: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` on oltava "free", "keepAngles" tai "symmetric" @msg `{key}` must be [x, y] `{key}` on oltava [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Yksikkömuunnin + Unit Converter Panel Yksikkömuunnin-paneeli + Copy with Units Kopioi yksiköineen + From Selection Valinnasta + # Color Effects add-on: Select by Color Kind. Select by Color Kind Valitse värityypin mukaan Objects with Spot Colors Objektit, joissa on spottivärejä diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3d591510b5..14410c225a 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -12,7 +12,7 @@ # Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`, # `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language # names, OpenType, the built-in workspace names and the bracketed perspective grid preset names. -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Glowing Edges… Contour lumineux… Glowing Edges Contour lumineux Edge Width Largeur du bord @@ -120,6 +120,7 @@ Add Anchor Point Ajouter un point d’ancrage Add Anchor Point Tool Outil Ajout de point d’ancrage Add Anchor Points Ajouter des points d’ancrage + Add Around Ajouter autour de l’objet Add Effect Ajouter un effet Add Freeform Line Ajouter une ligne libre Add Freeform Point Ajouter un point libre @@ -197,6 +198,7 @@ Angle: Angle : Angles Angles Animated Zoom Zoom animé + Anti Alias Lissage Anti-alias Lissage Anti-Alias Lissage Anti-alias Rasters Lisser les images pixellisées @@ -555,6 +557,7 @@ font-technology Variable Variables Color Mixer (Shift-click the chip) Mélangeur de couleurs (Maj+clic sur la vignette) Color Mode Mode colorimétrique Color Mode: Mode colorimétrique : + Color Model Modèle colorimétrique Color Model: Modèle colorimétrique : Color Models Modèles colorimétriques Color Picker Sélecteur de couleurs @@ -581,6 +584,7 @@ font-technology Variable Variables Colors Couleurs Colors: Couleurs : Column Graph Tool Outil Graphe à barres verticales + Columns Colonnes Columns: Colonnes : Column… Colonne… Combine Slices Combiner les tranches @@ -1065,6 +1069,7 @@ font-technology Variable Variables Enable text access for screen readers Autoriser l’accès au texte pour les lecteurs d’écran Enable Touch Gestures Activer les gestes tactiles Switch Selection and Drawing Modes Basculer entre les modes sélection et dessin + Select Last Selection Tool Choisir le dernier outil de sélection Enable Touch Workspace Activer l’espace de travail tactile Encoding Codage Encoding: Codage : @@ -1295,6 +1300,8 @@ font-technology Variable Variables Reset Tracking and Kerning Réinitialiser l’approche et le crénage Reset Horizontal Scale Réinitialiser la mise à l’échelle horizontale Highlight Font Name Surligner le nom de la police + Highlight Font Size Surligner la taille de police + Other… Autre… Highlight Kerning Surligner le crénage Highlight Tracking Surligner l’approche Spacing Espacement @@ -2557,6 +2564,9 @@ font-technology Variable Variables Overprint Surimpression Overprint and Transparency Flattener Surimpression et aplatissement des transparences Overprint and Transparency Flattener Options Options de surimpression et d’aplatissement des transparences + Custom… Personnalisé… + Custom Transparency Flattener Options Options personnalisées d’aplatissement des transparences + EPS has no alpha transparency, and Overprints sets whether overprints are kept. Le format EPS n’a pas de transparence alpha, et Surimpressions détermine si les surimpressions sont conservées. Overprint Black… Surimpression du noir… Overprint Fill Surimpression du fond Overprint Preview Aperçu de la surimpression @@ -2663,6 +2673,7 @@ font-technology Variable Variables Play Current Selection Exécuter la sélection actuelle Save Actions… Enregistrer les scripts… Load Actions… Charger des scripts… + Replace Actions… Remplacer les scripts… Reset Actions Réinitialiser les scripts Replace the current actions with the default set? Remplacer les scripts actuels par le jeu par défaut ? Append adds the default set after the current sets instead. Le bouton Ajouter ajoute plutôt le jeu par défaut après les jeux actuels. @@ -3029,6 +3040,8 @@ digits Malayalam Malayalam Reselect Resélectionner Reset Réinitialiser Reset Bounding Box Réinitialiser le cadre de sélection + Rotate Bounding Box Faire pivoter le cadre de sélection + Rotate Bounding Box… Faire pivoter le cadre de sélection… Reset Envelope Mesh Réinitialiser le filet de l’enveloppe Reset Envelope Shape Réinitialiser la forme de l’enveloppe Reset Essentials Réinitialiser Essentials @@ -3069,6 +3082,7 @@ digits Malayalam Malayalam Reshape Segment Modeler le segment Reshape Tool Outil Modelage Reshape Type Area Modeler la zone de texte + Resolution Résolution Resolution: Résolution : Responsive Adaptatif Restore Restaurer @@ -3125,6 +3139,29 @@ digits Malayalam Malayalam The unit for East Asian type measurements, which no field uses yet. L’unité des mesures du texte d’Asie orientale, qu’aucun champ n’utilise encore. When on, a number typed without a unit into a field in picas is read in points. Si cette option est activée, un nombre saisi sans unité dans un champ en picas est lu en points. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Avec ID XML, les noms des objets s’affichent sous forme d’ID XML dans Calques, Variables et Options de calque. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Le pas de la taille du texte et de l’interlignage. Cmd/Ctrl+Maj+. et Cmd/Ctrl+Maj+, modifient la taille d’un pas, ou de cinq avec Alt en plus. Dans le texte horizontal, Alt avec la flèche haut ou bas modifie l’interlignage d’un pas, ou de cinq avec Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Le pas de l’approche et du crénage, en millièmes de cadratin. Dans le texte horizontal, Alt avec la flèche gauche ou droite modifie le crénage au point d’insertion ou l’approche du texte sélectionné d’un pas, ou de cinq avec Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Le pas du décalage de la ligne de base. Dans le texte horizontal, Alt et Maj avec la flèche haut ou bas déplacent la ligne de base d’un pas, ou de cinq avec Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Affiche les options du texte japonais et des autres textes d’Asie orientale dans les panneaux Caractère, Paragraphe, OpenType et Glyphes, et la commande Polices composites. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Affiche les options du texte arabe, hébreu et indien dans les panneaux Caractère et Paragraphe, comme le sens du paragraphe, les kashidas et les chiffres. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Les outils de sélection ne sélectionnent le texte que sur sa ligne de base, le cadre du texte captif ou son tracé, et non n’importe où dans son cadre. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Les menus de polices affichent chaque police sous son nom anglais. Désactivé, une police qui a aussi un nom dans sa propre langue affiche ce nom. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Le nouveau texte captif démarre avec Taille automatique activée, si bien qu’un cadre rectangulaire de texte horizontal s’agrandit ou se réduit en hauteur selon son texte. + Font lists and the Type › Font menu show a sample of each font beside its name. Les listes de polices et le menu Police affichent un échantillon de chaque police à côté de son nom. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Les échantillons de polices sont dessinés en texte foncé sur blanc, quelle que soit la luminosité de l’interface. Cela ne s’applique que si les aperçus de polices dans les menus sont activés. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. La hauteur de chaque ligne dans les listes des champs de police, comme celui du panneau Caractère, et donc la taille de chaque échantillon. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Le nombre de polices utilisées en dernier, de 1 à 15, que Polices récentes et les listes de polices affichent, de la plus récente à la plus ancienne. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Quand vous changez la police ou le style de police d’un texte, les caractères pour lesquels la nouvelle police n’a pas de glyphe gardent leur ancienne police. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Une surbrillance rose sur la zone de travail marque les glyphes remplacés par des fonctions OpenType, comme les ligatures. Elle n’est ni imprimée ni exportée. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Avec l’outil Texte, la sélection d’un seul caractère affiche à côté de lui, sur la zone de travail, une rangée de ses glyphes de substitution à choisir. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Une surbrillance rose sur la zone de travail marque le texte dessiné dans une police de substitution parce que sa police manque. Elle n’est ni imprimée ni exportée. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Le nouveau texte créé avec un outil Texte commence par un texte de remplissage sélectionné, que la saisie remplace. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Taper un marqueur de liste comme 1. ou * puis une espace au début d’un paragraphe transforme ce paragraphe en liste. + Fonts in this folder show in the font menus and can be used without being installed. Les polices de ce dossier apparaissent dans les menus de polices et peuvent être utilisées sans être installées. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Appliquer un style graphique à du texte retire aux caractères leur propre fond ou contour là où le style en a un, pour que la peinture du style soit visible. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Aligner et Répartir mesurent le texte de point d’après l’encre de ses glyphes plutôt que d’après son cadratin. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Aligner et Répartir mesurent le texte captif d’après l’encre de ses glyphes plutôt que d’après son cadre. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Le cadre de sélection et le panneau Transformation mesurent le texte de point d’après l’encre de ses glyphes plutôt que d’après son cadratin. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Aligne le dessin, le déplacement et la mise à l’échelle sur les subdivisions de la grille, même quand la grille est masquée. Tant que l’option est activée, Magnétisme du pixel ne s’applique pas. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. La couleur des repères non sélectionnés. Un plan de travail doté d’une Étiquette des repères trace ses propres repères dans la couleur de l’étiquette. Draws guides as solid lines or as dots, including the guides already in the document. Trace les repères en lignes continues ou en points, y compris les repères déjà présents dans le document. @@ -3206,6 +3243,7 @@ digits Malayalam Malayalam Rounded Rectangle Tool Outil Rectangle arrondi Rounded Rectangle… Rectangle arrondi… Row Size: Taille des lignes : + Rows Lignes Rows: Lignes : Rule: Règle : Rulers Règles @@ -4547,6 +4585,8 @@ axis Both Les deux @msg the script is no longer in the Scripts folder le script ne se trouve plus dans le dossier Scripts Some scripts were not listed Certains scripts ne sont pas répertoriés The Scripts folder cannot be read Impossible de lire le dossier Scripts + Loading scripts… Chargement des scripts… + The Scripts folder is still being read Le dossier Scripts est encore en cours de lecture @msg the script's run is no longer available l’exécution du script n’est plus disponible @msg a failed command changed undo steps that could not be put back, so the script was stopped une commande en échec a modifié des étapes d’annulation qui n’ont pas pu être rétablies, le script a donc été arrêté @msg a recovery copy could not be written, so the script was not run une copie de récupération n’a pas pu être écrite, le script n’a donc pas été exécuté @@ -5420,6 +5460,8 @@ liquify-list-end {0}, {1} {0} et {1} @msg All colors are within the CMYK gamut Toutes les couleurs sont dans la gamme CMJN @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} couleur est hors de la gamme CMJN|{n} couleurs sont hors de la gamme CMJN @msg Unembedded to {_1} Incorporation annulée vers {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Incorporation annulée pour {n} image vers {folder}|Incorporation annulée pour {n} images vers {folder} +@msg every numbered name for {name} is taken in that folder tous les noms numérotés pour {name} sont déjà pris dans ce dossier @msg Reset {_1} {_1} réinitialisé @msg Sent to {_1} Envoyé à {_1} @msg {_1} files Fichiers {_1} @@ -5573,6 +5615,8 @@ liquify-list-end {0}, {1} {0} et {1} @msg automation path rejected: outside the read root {root}: {path} chemin d’automatisation refusé : hors du dossier racine de lecture {root} : {path} @msg automation path rejected: outside the read roots {roots}: {path} chemin d’automatisation refusé : hors des dossiers racines de lecture {roots} : {path} @msg a linked JavaScript file is outside the read roots un fichier JavaScript lié est hors des dossiers racines de lecture +@msg a linked image file is outside the read roots un fichier image lié est hors des dossiers racines de lecture +@msg a linked file's export folder is outside the read roots le dossier d’exportation d’un fichier lié est hors des dossiers racines de lecture @msg automation path rejected: outside the write root {root}: {path} chemin d’automatisation refusé : hors du dossier racine d’écriture {root} : {path} @msg automation path rejected: outside the write roots {roots}: {path} chemin d’automatisation refusé : hors des dossiers racines d’écriture {roots} : {path} @msg automation path rejected: path is empty chemin d’automatisation refusé : le chemin est vide @@ -5799,6 +5843,7 @@ lighting Light Lumière @msg missing panel layout Disposition des panneaux manquante @msg unsupported native docking operation Opération native d’ancrage non prise en charge Linux Display Server Serveur d’affichage Linux + Low-Latency Drawing Dessin à faible latence X11 (XWayland) When a Pen Is Attached X11 (XWayland) quand un stylet est branché If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Si le stylet d’une tablette graphique ne dessine pas, choisissez une option X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -7377,6 +7422,12 @@ anchor Points: Points : @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` doit être "free", "keepAngles" ou "symmetric" @msg `{key}` must be [x, y] `{key}` doit être [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Convertisseur d’unités + Unit Converter Panel Panneau Convertisseur d’unités + Copy with Units Copier avec les unités + From Selection Depuis la sélection + # Color Effects add-on: Select by Color Kind. Select by Color Kind Sélectionner par type de couleur Objects with Spot Colors Objets avec tons directs @@ -8249,6 +8300,8 @@ breakText Glyphs Glyphes @msg `{f}` is the copy of a document open now `{f}` est la copie d’un document actuellement ouvert @msg `{id}` is no writable format (see document.formats) `{id}` n’est pas un format inscriptible (voir document.formats) @msg `{id}` isn't a loaded library `{id}` n’est pas une bibliothèque chargée +@msg `{file}` has no swatches of its own `{file}` n’a pas de nuances propres +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` contient des nuances de motif, qu’un fichier .vcswatches ne peut pas contenir @msg `{key}` has no colours `{key}` ne contient aucune couleur @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` contient plus de {MAX_EDIT_WORDS} mots @msg `{key}` is a design name `{key}` est un nom de motif @@ -8539,7 +8592,13 @@ breakText Glyphs Glyphes @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel doit valoir {own} (le mode du document), grayscale ou bitmap @msg colour groups can't go into colour groups un groupe de couleurs ne peut pas aller dans un groupe de couleurs @msg colour, mode and spot apply to solid-colour swatches only couleur, mode et ton direct s’appliquent uniquement aux nuances de couleur unie -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read colonne {column} : `{cell}` est une colonne `%` des fichiers de données de graphe, qui ne sont pas lus +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` est un chemin relatif : indiquez `base` ou un chemin absolu +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` n’est pas suivi : {r} +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} ligne {line}, colonne {column} : impossible de lire le fichier de données de graphe pour `{var}` : {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` dépasse {MAX_GRAPH_DATA_FILE} octets +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes ligne {line}, colonne {column} : le fichier de données de graphe `{path}` pour `{var}` donne une valeur de graphe de plus de {MAX_GRAPH_CSV} octets +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all ligne {line}, colonne {column} : les fichiers de données de graphe contiennent plus de {MAX_GRAPH_FILES_TOTAL} octets au total +@msg `base` is empty `base` est vide @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable colonne {column} : `{cell}` désigne `{name}`, qui est une variable {_1} @msg column {column}: `{cell}` names no variable colonne {column} : `{cell}` ne désigne aucune variable @msg column {column}: the variable name is longer than {MAX_NAME} characters colonne {column} : le nom de variable dépasse {MAX_NAME} caractères diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 2e5c0bba75..879bb6fabe 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -123,6 +123,7 @@ Add Anchor Point Tool એન્કર બિંદુ ઉમેરો ટૂલ Add Anchor Points એન્કર બિંદુઓ ઉમેરો Add Anchors… એન્કર ઉમેરો… + Add Around ઑબ્જેક્ટની આસપાસ ઉમેરો Add Content કન્ટેન્ટ ઉમેરો Add Effect ઇફેક્ટ ઉમેરો Add Event ઇવેન્ટ ઉમેરો @@ -230,6 +231,7 @@ Angled Strokes… ત્રાંસા સ્ટ્રોક… Angles ખૂણા Animated Zoom ઍનિમેટેડ ઝૂમ + Anti Alias એન્ટિ-એલિયાસિંગ Anti-Alias એન્ટિ-એલિયાસ Anti-alias એન્ટિ-એલિયાસ Anti-alias Rasters રાસ્ટર એન્ટિ-એલિયાસ @@ -639,6 +641,7 @@ Color Library… રંગ લાઇબ્રેરી… Color Mode રંગ મોડ Color Mode: રંગ મોડ: + Color Model રંગ મોડેલ Color Model: રંગ મોડેલ: Color Models રંગ મોડેલ Color Panel Options રંગ પેનલ વિકલ્પો @@ -671,6 +674,7 @@ Column Graph Tool કૉલમ ગ્રાફ ટૂલ Column Type: કૉલમ પ્રકાર: Column Width: કૉલમ પહોળાઈ: + Columns કૉલમ Columns: કૉલમ: Column… કૉલમ… Combine Point Text પોઇન્ટ ટેક્સ્ટ જોડો @@ -770,6 +774,7 @@ Copy into the document's folder દસ્તાવેજના ફોલ્ડરમાં નકલ કરો Copy only fonts you own or are licensed to install. ફક્ત તમારી માલિકીના અથવા ઇન્સ્ટોલ કરવાના લાઇસન્સવાળા ફોન્ટ્સની નકલ કરો. Copy to User Defined વપરાશકર્તા-વ્યાખ્યાયિતમાં નકલ કરો + Copy with Units એકમો સાથે નકલ કરો Copyright કૉપીરાઇટ Copyright Info URL: કૉપીરાઇટ માહિતી URL: Templates ટેમ્પલેટ @@ -1508,6 +1513,7 @@ Frequencies and angles are the output device's to apply. ફ્રિક્વન્સી અને એંગલ આઉટપુટ ડિવાઇસ લાગુ કરશે. Frequency ફ્રિક્વન્સી Fresco… ફ્રેસ્કો… + From Selection પસંદગીમાંથી From: થી: Front આગળ Full Document સંપૂર્ણ દસ્તાવેજ @@ -1710,6 +1716,8 @@ Highlight Alternate Glyphs વૈકલ્પિક ગ્લિફ હાઇલાઇટ કરો Highlight Area વિસ્તાર હાઇલાઇટ કરો Highlight Font Name ફોન્ટનું નામ હાઇલાઇટ કરો + Highlight Font Size ફોન્ટ સાઇઝ હાઇલાઇટ કરો + Other… અન્ય… Highlight Intensity હાઇલાઇટ તીવ્રતા Highlight Kerning કર્નિંગ હાઇલાઇટ કરો Highlight Rows પંક્તિઓ હાઇલાઇટ કરો @@ -2047,6 +2055,7 @@ Linked Files લિંક કરેલી ફાઇલો Links લિંક્સ Linux Display Server Linux ડિસ્પ્લે સર્વર + Low-Latency Drawing ઓછા વિલંબવાળું ડ્રોઇંગ Liquify લિક્વિફાઇ List Data Sets ડેટા સેટની યાદી List Folder ફોલ્ડરની યાદી @@ -2071,6 +2080,7 @@ Live curve fitting લાઇવ કર્વ ફિટિંગ Live preview લાઇવ પૂર્વાવલોકન Load Actions… ઍક્શન લોડ કરો… + Replace Actions… ઍક્શન બદલો… Reset Actions ઍક્શન રીસેટ કરો Replace the current actions with the default set? વર્તમાન ઍક્શનને ડિફૉલ્ટ સેટથી બદલવા છે? Append adds the default set after the current sets instead. ઉમેરો તેના બદલે ડિફૉલ્ટ સેટને વર્તમાન સેટ પછી ઉમેરે છે. @@ -2612,6 +2622,9 @@ Overprint Stroke ઓવરપ્રિન્ટ સ્ટ્રોક Overprint and Transparency Flattener ઓવરપ્રિન્ટ અને પારદર્શિતા ફ્લેટનર Overprint and Transparency Flattener Options ઓવરપ્રિન્ટ અને પારદર્શિતા ફ્લેટનર વિકલ્પો + Custom… કસ્ટમ… + Custom Transparency Flattener Options કસ્ટમ પારદર્શિતા ફ્લેટનર વિકલ્પો + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS માં આલ્ફા પારદર્શિતા નથી, અને ઓવરપ્રિન્ટ્સ નક્કી કરે છે કે ઓવરપ્રિન્ટ્સ જાળવવામાં આવે કે નહીં. Overprint: ઓવરપ્રિન્ટ: Overprints: ઓવરપ્રિન્ટ્સ: Override Character Color અક્ષરનો રંગ ઓવરરાઇડ કરો @@ -3113,6 +3126,8 @@ Reset રીસેટ કરો Reset Bar Position બાર સ્થિતિ રીસેટ કરો Reset Bounding Box બાઉન્ડિંગ બોક્સ રીસેટ કરો + Rotate Bounding Box બાઉન્ડિંગ બોક્સ ફેરવો + Rotate Bounding Box… બાઉન્ડિંગ બોક્સ ફેરવો… Reset Envelope Mesh એન્વેલપ મેશ રીસેટ કરો Reset Envelope Shape એન્વેલપ આકાર રીસેટ કરો Reset Essentials એસેન્શિયલ્સ રીસેટ કરો @@ -3154,6 +3169,7 @@ Resize Artboard આર્ટબોર્ડનું માપ બદલો Resize Slice સ્લાઇસનું માપ બદલો Resize Type Area ટાઇપ એરિયાનું માપ બદલો + Resolution રિઝોલ્યુશન Resolution: રિઝોલ્યુશન: Responsive રિસ્પોન્સિવ Restore પુનઃસ્થાપિત કરો @@ -3211,6 +3227,29 @@ The unit for East Asian type measurements, which no field uses yet. પૂર્વ એશિયાઈ ટાઇપના માપ માટેનો એકમ, જેનો હજી કોઈ ફીલ્ડ ઉપયોગ કરતું નથી. When on, a number typed without a unit into a field in picas is read in points. ચાલુ હોય ત્યારે, પાઇકામાં હોય તેવા ફીલ્ડમાં એકમ વિના ટાઇપ કરેલી સંખ્યા પોઇન્ટ્સમાં વંચાય છે. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML ID પસંદ હોય ત્યારે ઑબ્જેક્ટનાં નામ લેયર્સ, વેરિએબલ્સ અને લેયર વિકલ્પોમાં XML ID તરીકે દેખાય છે. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. ટાઇપ કદ અને લીડિંગનું પગલું: Cmd/Ctrl+Shift+. અને Cmd/Ctrl+Shift+, કદને એક પગલું બદલે છે, અને Alt સાથે પાંચ પગલાં; આડા ટાઇપમાં Alt સાથે ઉપર કે નીચેનો એરો લીડિંગને એક પગલું બદલે છે, અને Cmd/Ctrl સાથે પાંચ પગલાં. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. ટ્રેકિંગ અને કર્નિંગનું પગલું, em ના હજારમા ભાગમાં: આડા ટાઇપમાં Alt સાથે ડાબો કે જમણો એરો કેરેટ પરનું કર્નિંગ અથવા પસંદ કરેલા ટેક્સ્ટનું ટ્રેકિંગ એક પગલું બદલે છે, અને Cmd/Ctrl સાથે પાંચ પગલાં. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. બેઝલાઇન શિફ્ટનું પગલું: આડા ટાઇપમાં Alt અને Shift સાથે ઉપર કે નીચેનો એરો બેઝલાઇનને એક પગલું ખસેડે છે, અને Cmd/Ctrl સાથે પાંચ પગલાં. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. અક્ષર, ફકરો, OpenType અને ગ્લિફ્સ પેનલમાં જાપાની અને અન્ય પૂર્વ એશિયન ટાઇપના વિકલ્પો, અને કમ્પોઝિટ ફોન્ટ્સ આદેશ બતાવે છે. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. અક્ષર અને ફકરો પેનલમાં અરબી, હિબ્રુ અને ભારતીય ટાઇપના વિકલ્પો બતાવે છે, જેમ કે ફકરાની દિશા, કશીદા અને અંકો. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. પસંદગી ટૂલ્સ ટાઇપને ફક્ત તેની બેઝલાઇન, એરિયા ટાઇપની ફ્રેમ કે તેના પાથ પર પસંદ કરે છે, તેના બૉક્સની અંદર ગમે ત્યાં નહીં. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. ફોન્ટ મેનૂ દરેક ફોન્ટને તેના અંગ્રેજી નામથી બતાવે છે; બંધ હોય ત્યારે, જે ફોન્ટનું પોતાની ભાષામાં પણ નામ હોય તે એ નામ બતાવે છે. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. નવો એરિયા ટાઇપ ઑટો સાઇઝ ચાલુ સાથે શરૂ થાય છે, તેથી આડા ટાઇપની લંબચોરસ ફ્રેમ તેના ટેક્સ્ટ મુજબ ઊંચાઈમાં વધે કે ઘટે છે. + Font lists and the Type › Font menu show a sample of each font beside its name. ફોન્ટ યાદીઓ અને ફોન્ટ મેનૂ દરેક ફોન્ટના નામની બાજુમાં તેનો નમૂનો બતાવે છે. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. ઇન્ટરફેસની તેજસ્વિતા ગમે તે હોય, ફોન્ટ નમૂના સફેદ પર ઘેરા ટાઇપમાં દોરાય છે; આ ફક્ત મેનૂમાં ફોન્ટ પૂર્વાવલોકન ચાલુ હોય ત્યારે જ લાગુ પડે છે. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. ફોન્ટ ફીલ્ડની યાદીઓમાં, જેમ કે અક્ષર પેનલની, દરેક હરોળ કેટલી ઊંચી છે, અને તેથી દરેક નમૂનો કેટલો મોટો છે. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. તાજેતરના ફોન્ટ્સ અને ફોન્ટ યાદીઓ છેલ્લે વાપરેલા કેટલા ફોન્ટ બતાવે છે, 1 થી 15, સૌથી નવો પહેલાં. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. તમે ટેક્સ્ટનો ફોન્ટ અથવા ફોન્ટ શૈલી બદલો ત્યારે, જે અક્ષરો માટે નવા ફોન્ટમાં ગ્લિફ નથી તે પોતાનો જૂનો ફોન્ટ રાખે છે. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. કૅનવાસ પર ગુલાબી હાઇલાઇટ OpenType સુવિધાઓએ બદલેલા ગ્લિફ્સ દર્શાવે છે, જેમ કે લિગેચર; તે પ્રિન્ટ કે નિકાસ થતું નથી. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. ટાઇપ ટૂલથી એક અક્ષર પસંદ કરતાં કૅનવાસ પર તેની બાજુમાં પસંદ કરવા માટે તેના વૈકલ્પિક ગ્લિફ્સની એક હરોળ દેખાય છે. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. કૅનવાસ પર ગુલાબી હાઇલાઇટ એ ટેક્સ્ટ દર્શાવે છે જે પોતાનો ફોન્ટ ખૂટતો હોવાથી બદલીના ફોન્ટમાં દોરાયું છે; તે પ્રિન્ટ કે નિકાસ થતું નથી. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. ટાઇપ ટૂલથી બનેલો નવો ટાઇપ પસંદ કરેલા પ્લેસહોલ્ડર ટેક્સ્ટથી શરૂ થાય છે, જેને તમે ટાઇપ કરો તે બદલી નાખે છે. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. ફકરાની શરૂઆતમાં 1. કે * જેવું યાદી ચિહ્ન અને પછી સ્પેસ ટાઇપ કરવાથી ફકરો યાદી બની જાય છે. + Fonts in this folder show in the font menus and can be used without being installed. આ ફોલ્ડરના ફોન્ટ ફોન્ટ મેનૂમાં દેખાય છે અને ઇન્સ્ટોલ કર્યા વિના વાપરી શકાય છે. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. ટાઇપ પર ગ્રાફિક સ્ટાઇલ લાગુ કરવાથી, જ્યાં સ્ટાઇલમાં ફિલ કે સ્ટ્રોક હોય ત્યાં અક્ષરોનું પોતાનું ફિલ કે સ્ટ્રોક દૂર થાય છે, જેથી સ્ટાઇલનો રંગ દેખાય. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. સંરેખિત કરો અને વિતરિત કરો પોઇન્ટ ટાઇપને તેના em બૉક્સને બદલે તેના ગ્લિફ્સની શાહીથી માપે છે. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. સંરેખિત કરો અને વિતરિત કરો એરિયા ટાઇપને તેની ફ્રેમને બદલે તેના ગ્લિફ્સની શાહીથી માપે છે. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. બાઉન્ડિંગ બૉક્સ અને ટ્રાન્સફોર્મ પેનલ પોઇન્ટ ટાઇપને તેના em બૉક્સને બદલે તેના ગ્લિફ્સની શાહીથી માપે છે. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. ગ્રિડ છુપાયેલી હોય ત્યારે પણ દોરવું, ખસેડવું અને સ્કેલ કરવું ગ્રિડના ઉપવિભાગો પર સ્નેપ કરે છે; આ ચાલુ હોય ત્યાં સુધી પિક્સેલ પર સ્નેપ લાગુ પડતું નથી. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. પસંદ ન કરેલી ગાઇડ્સનો રંગ; ગાઇડ લેબલવાળું આર્ટબોર્ડ પોતાની ગાઇડ્સ લેબલના રંગમાં દોરે છે. Draws guides as solid lines or as dots, including the guides already in the document. દસ્તાવેજમાં પહેલેથી રહેલી ગાઇડ્સ સહિત, ગાઇડ્સને ઘન રેખાઓ અથવા બિંદુઓ તરીકે દોરે છે. @@ -3295,6 +3334,7 @@ Rounded Rectangle… ગોળાકાર લંબચોરસ… Roundness: ગોળાઈ: Row Size: પંક્તિનું માપ: + Rows પંક્તિઓ Rows: પંક્તિઓ: Ruby રૂબી Ruby… રૂબી… @@ -3883,6 +3923,7 @@ Start Normally સામાન્ય રીતે શરૂ કરો Start Tile શરૂઆતની ટાઇલ Start arrowhead શરૂઆતનું એરોહેડ + Start at: આનાથી શરૂ કરો: Start from VectorCraft Defaults VectorCraft ડિફૉલ્ટથી શરૂ કરો Start in Safe Mode સેફ મોડમાં શરૂ કરો Start: શરૂ: @@ -4039,6 +4080,8 @@ Thai થાઈ The Print Tiling tool placed the pages. પ્રિન્ટ ટાઇલિંગ ટૂલે પૃષ્ઠો ગોઠવ્યાં. The Scripts folder cannot be read સ્ક્રિપ્ટ્સ ફોલ્ડર વાંચી શકાતું નથી + Loading scripts… સ્ક્રિપ્ટ લોડ થઈ રહી છે… + The Scripts folder is still being read સ્ક્રિપ્ટ્સ ફોલ્ડર હજી વંચાઈ રહ્યું છે The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. જ્યારે VECTORCRAFT_TITLEBAR એન્વાયર્નમેન્ટ વેરિએબલ સેટ હોય ત્યારે તે ટાઇટલ બાર પસંદ કરે છે. The active document changed while the screen color sampler was open સ્ક્રીન રંગ સેમ્પલર ખુલ્લું હતું ત્યારે સક્રિય દસ્તાવેજ બદલાયો The art keeps its own colors. આર્ટમાં પોતાના રંગો રહે છે. @@ -4219,6 +4262,8 @@ Uniform યુનિફોર્મ Uniformly Scaled સમાન રીતે સ્કેલ કરેલ Unite યુનાઇટ + Unit Converter એકમ રૂપાંતરક + Unit Converter Panel એકમ રૂપાંતરક પેનલ Units એકમો Units: એકમો: Units: {units} એકમો: {units} diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index efa90dae91..af0a0e7e26 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -213,6 +213,7 @@ Add Anchor Point एंकर पॉइंट जोड़ें Add Anchor Point Tool ऐड एंकर पॉइंट टूल Add Anchor Points एंकर पॉइंट जोड़ें + Add Around ऑब्जेक्ट के चारों ओर जोड़ें Add Anchors एंकर जोड़ें Add Anchors… एंकर जोड़ें… Add as Effect इफ़ेक्ट के रूप में जोड़ें @@ -343,6 +344,7 @@ Angular कोणीय Angular Guides कोणीय गाइड्स Animated Zoom एनिमेटेड ज़ूम + Anti Alias एंटी-एलियासिंग Anti-alias एंटी-एलियास Anti-Alias एंटी-एलियास Anti-alias Rasters रास्टर एंटी-एलियास करें @@ -936,6 +938,7 @@ antiAlias Sharp शार्प Color Mixer (Shift-click the chip) कलर मिक्सर (रंग चिप पर Shift-क्लिक करें) Color Mode रंग मोड Color Mode: रंग मोड: + Color Model रंग मॉडल Color Model: रंग मॉडल: Color Models रंग मॉडल Color Panel Options रंग पैनल ऑप्शन्स @@ -973,6 +976,7 @@ antiAlias Sharp शार्प Column Type: स्तंभ प्रकार: Column Width: कॉलम चौड़ाई: Column… स्तंभ… + Columns कॉलम Columns: कॉलम: Combine Point Text पॉइंट टेक्स्ट को मिलाएं Combine Slices संयोजन स्लाइस @@ -1086,6 +1090,7 @@ antiAlias Sharp शार्प Copy Selected Style सिलेक्टेड स्टाइल को कॉपी करें Copy to User Defined उपयोगकर्ता परिभाषित करने के लिए कॉपी करें Copy Width Point कॉपी चौड़ाई पॉइंट + Copy with Units इकाइयों के साथ कॉपी करें Copyright कॉपीराइट Copyright and Contact Info कॉपीराइट और संपर्क जानकारी Copyright Info URL: कॉपीराइट जानकारी URL: @@ -1696,6 +1701,7 @@ antiAlias Sharp शार्प Enable text access for screen readers स्क्रीन रीडर के लिए टेक्स्ट एक्सेस सक्षम करें Enable Touch Gestures टच जेस्चर ऑन करें Switch Selection and Drawing Modes चयन और ड्रॉइंग मोड के बीच बदलें + Select Last Selection Tool पिछला सिलेक्शन टूल चुनें Enable Touch Workspace टच वर्कस्पेस सक्षम करें Enclosing Lasso लासो संलग्न करना Enclosing Lasso Tool लासो टूल संलग्न करना @@ -2057,6 +2063,7 @@ antiAlias Sharp शार्प Fresco… फ़्रेस्को… from the format's public description फ़ॉर्मैट के सार्वजनिक विवरण से from your earlier imports अपने पहले आयात से + From Selection सिलेक्शन से From: से: Front सामने Frosted फ़्रॉस्टेड @@ -2340,6 +2347,8 @@ antiAlias Sharp शार्प Highlight anchors on mouse over माउस ओवर पर हाइलाइट एंकर Highlight Area हाइलाइट क्षेत्र Highlight Font Name हाइलाइट फ़ॉन्ट नाम + Highlight Font Size हाइलाइट फ़ॉन्ट साइज़ + Other… अन्य… Highlight Kerning हाइलाइट कर्निंग Highlight Rows हाइलाइट पंक्तियाँ Highlight Substituted Fonts हाईलाइट सबस्टिट्यूटेड फ़ॉन्ट @@ -2746,6 +2755,7 @@ antiAlias Sharp शार्प Linked Files लिंक्ड फ़ाइलें Links लिंक Linux Display Server Linux डिस्प्ले सर्वर + Low-Latency Drawing कम विलंब वाली ड्राइंग Liquify लिक्विफ़ाई List Data Sets सूची डेटा सेट List Folder सूची फ़ोल्डर @@ -2769,6 +2779,7 @@ antiAlias Sharp शार्प Live Shape लाइव आकार Live Shape Properties लाइव शेप प्रॉपर्टीज़ Load Actions… एक्शन्स लोड करें… + Replace Actions… एक्शन्स रिप्लेस करें… Reset Actions एक्शन्स रीसेट करें Replace the current actions with the default set? मौजूदा एक्शन्स को डिफ़ॉल्ट सेट से बदलें? Append adds the default set after the current sets instead. जोड़ें इसके बजाय डिफ़ॉल्ट सेट को मौजूदा सेट के बाद जोड़ता है। @@ -3432,6 +3443,9 @@ antiAlias Sharp शार्प Overprint ओवरप्रिंट Overprint and Transparency Flattener ओवरप्रिंट और ट्रांसपेरेंसी फ़्लैटनर Overprint and Transparency Flattener Options ओवरप्रिंट और ट्रांसपेरेंसी फ़्लैटनर ऑप्शन्स + Custom… कस्टम… + Custom Transparency Flattener Options कस्टम ट्रांसपेरेंसी फ़्लैटनर ऑप्शन्स + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS में अल्फा पारदर्शिता नहीं होती, और ओवरप्रिंट तय करता है कि ओवरप्रिंट रखे जाएँ या नहीं। Overprint Black ओवरप्रिंट ब्लैक Overprint Black… ओवरप्रिंट ब्लैक… Overprint Fill फ़िल ओवरप्रिंट करें @@ -4126,6 +4140,8 @@ antiAlias Sharp शार्प Reset Automation स्वचालन रीसेट करें Reset Bar Position बार स्थिति रीसेट करें Reset Bounding Box बाउंडिंग बॉक्स रीसेट करें + Rotate Bounding Box बाउंडिंग बॉक्स घुमाएँ + Rotate Bounding Box… बाउंडिंग बॉक्स घुमाएँ… Reset Envelope Mesh एन्वेलप मेश रीसेट करें Reset Envelope Shape एन्वेलप शेप रीसेट करें Reset Essentials एसेंशियल्स रीसेट करें @@ -4191,6 +4207,7 @@ antiAlias Sharp शार्प Resize panels पैनलों का साइज़ बदलें Resize Slice स्लाइस का आकार Resize Type Area टाइप एरिया का आकार बदलें + Resolution रिज़ॉल्यूशन Resolution: रिज़ॉल्यूशन: Responsive उत्तरदायी Restore पुनर्स्थापित करें @@ -4247,6 +4264,29 @@ antiAlias Sharp शार्प The unit for East Asian type measurements, which no field uses yet. पूर्वी एशियाई टाइप के माप की इकाई, जिसका अभी कोई फ़ील्ड उपयोग नहीं करता। When on, a number typed without a unit into a field in picas is read in points. चालू होने पर, पाइका वाले फ़ील्ड में बिना इकाई के टाइप की गई संख्या पॉइंट्स में पढ़ी जाती है। With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML ID चुनने पर ऑब्जेक्ट के नाम लेयर्स, वेरिएबल्स और लेयर ऑप्शन्स में XML ID के रूप में दिखते हैं। + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. टाइप साइज़ और लीडिंग का स्टेप: Cmd/Ctrl+Shift+. और Cmd/Ctrl+Shift+, साइज़ को एक स्टेप बदलते हैं, और Alt के साथ पाँच स्टेप; क्षैतिज टाइप में Alt के साथ ऊपर या नीचे का एरो लीडिंग को एक स्टेप बदलता है, और Cmd/Ctrl के साथ पाँच स्टेप। + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. ट्रैकिंग और कर्निंग का स्टेप, em के हज़ारवें हिस्सों में: क्षैतिज टाइप में Alt के साथ बायाँ या दायाँ एरो कैरेट पर कर्निंग या चुने हुए टेक्स्ट की ट्रैकिंग को एक स्टेप बदलता है, और Cmd/Ctrl के साथ पाँच स्टेप। + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. बेसलाइन शिफ़्ट का स्टेप: क्षैतिज टाइप में Alt और Shift के साथ ऊपर या नीचे का एरो बेसलाइन को एक स्टेप खिसकाते हैं, और Cmd/Ctrl के साथ पाँच स्टेप। + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. कैरेक्टर, पैराग्राफ़, OpenType और ग्लिफ़्स पैनल में जापानी और दूसरे पूर्वी एशियाई टाइप के ऑप्शन्स, और कंपोज़िट फ़ॉन्ट कमांड दिखाता है। + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. कैरेक्टर और पैराग्राफ़ पैनल में अरबी, हिब्रू और भारतीय टाइप के ऑप्शन्स दिखाता है, जैसे पैराग्राफ़ की दिशा, कशीदे और अंक। + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. सिलेक्शन टूल टाइप को सिर्फ़ उसकी बेसलाइन, एरिया टाइप के फ़्रेम या उसके पाथ पर चुनते हैं, उसके बॉक्स के अंदर कहीं भी नहीं। + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. फ़ॉन्ट मेनू हर फ़ॉन्ट को उसके अंग्रेज़ी नाम से दिखाते हैं; बंद होने पर, जिस फ़ॉन्ट का अपनी भाषा में भी नाम है, वह वही नाम दिखाता है। + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. नया एरिया टाइप ऑटो साइज़ चालू होकर शुरू होता है, इसलिए क्षैतिज टाइप का आयताकार फ़्रेम अपने टेक्स्ट के हिसाब से ऊँचाई में बढ़ता या घटता है। + Font lists and the Type › Font menu show a sample of each font beside its name. फ़ॉन्ट सूचियाँ और फ़ॉन्ट मेनू हर फ़ॉन्ट के नाम के पास उसका नमूना दिखाते हैं। + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. फ़ॉन्ट नमूने इंटरफ़ेस की चमक चाहे जो हो, सफ़ेद पर गहरे टाइप में बनाए जाते हैं; यह तभी लागू होता है जब मेनू में फ़ॉन्ट प्रीव्यू चालू हों। + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. फ़ॉन्ट फ़ील्ड की सूचियों में, जैसे कैरेक्टर पैनल वाली में, हर पंक्ति कितनी ऊँची है, और इसलिए हर नमूना कितना बड़ा है। + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. हाल के फ़ॉन्ट्स और फ़ॉन्ट सूचियाँ आख़िरी बार इस्तेमाल किए गए कितने फ़ॉन्ट दिखाती हैं, 1 से 15 तक, सबसे नया पहले। + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. जब आप टेक्स्ट का फ़ॉन्ट या फ़ॉन्ट स्टाइल बदलते हैं, तो जिन कैरेक्टर का ग्लिफ़ नए फ़ॉन्ट में नहीं है, वे अपना पुराना फ़ॉन्ट रखते हैं। + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. कैनवस पर गुलाबी हाइलाइट उन ग्लिफ़्स को दिखाता है जिन्हें OpenType फ़ीचर्स ने बदला है, जैसे लिगेचर; यह प्रिंट या एक्सपोर्ट नहीं होता। + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. टाइप टूल से एक कैरेक्टर चुनने पर कैनवस पर उसके पास चुनने के लिए उसके वैकल्पिक ग्लिफ़्स की एक पंक्ति दिखती है। + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. कैनवस पर गुलाबी हाइलाइट उस टेक्स्ट को दिखाता है जो अपना फ़ॉन्ट न होने के कारण किसी दूसरे फ़ॉन्ट में बना है; यह प्रिंट या एक्सपोर्ट नहीं होता। + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. टाइप टूल से बना नया टाइप चुने हुए प्लेसहोल्डर टेक्स्ट से शुरू होता है, जिसे टाइप करने पर आपका टेक्स्ट बदल देता है। + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. पैराग्राफ़ की शुरुआत में 1. या * जैसा सूची चिह्न और फिर स्पेस टाइप करने से पैराग्राफ़ सूची बन जाता है। + Fonts in this folder show in the font menus and can be used without being installed. इस फ़ोल्डर के फ़ॉन्ट फ़ॉन्ट मेनू में दिखते हैं और इंस्टॉल किए बिना इस्तेमाल किए जा सकते हैं। + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. टाइप पर ग्राफ़िक स्टाइल लगाने से, जहाँ स्टाइल में फ़िल या स्ट्रोक है वहाँ कैरेक्टर का अपना फ़िल या स्ट्रोक हट जाता है, ताकि स्टाइल का पेंट दिखे। + Align and Distribute measure point type by the ink of its glyphs instead of its em box. अलाइन और डिस्ट्रिब्यूट पॉइंट टाइप को उसके em बॉक्स के बजाय उसके ग्लिफ़्स की स्याही से मापते हैं। + Align and Distribute measure area type by the ink of its glyphs instead of its frame. अलाइन और डिस्ट्रिब्यूट एरिया टाइप को उसके फ़्रेम के बजाय उसके ग्लिफ़्स की स्याही से मापते हैं। + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. बाउंडिंग बॉक्स और ट्रांसफ़ॉर्म पैनल पॉइंट टाइप को उसके em बॉक्स के बजाय उसके ग्लिफ़्स की स्याही से मापते हैं। Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. ग्रिड छिपी होने पर भी ड्रॉ करना, खिसकाना और स्केल करना ग्रिड के उप-विभाजनों पर स्नैप करता है; इसके चालू रहने तक पिक्सेल के लिए स्नैप लागू नहीं होता। The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. उन गाइड्स का रंग जो चयनित नहीं हैं; गाइड लेबल वाला आर्टबोर्ड अपनी गाइड्स लेबल के रंग में बनाता है। Draws guides as solid lines or as dots, including the guides already in the document. दस्तावेज़ में पहले से मौजूद गाइड्स सहित, गाइड्स को ठोस रेखाओं या बिंदुओं के रूप में बनाता है। @@ -4361,6 +4401,7 @@ antiAlias Sharp शार्प Rounded Rectangle… गोल आयत… Roundness: राउंडनेस: Row Size: पंक्ति का आकार: + Rows पंक्तियाँ Rows: पंक्तियाँ: Ruby रूबी Ruby… रूबी… @@ -5601,6 +5642,8 @@ antiAlias Sharp शार्प Unique अनोखा Unite मिलाएँ Unite and Simplify एकजुट और सरलीकरण + Unit Converter इकाई कनवर्टर + Unit Converter Panel इकाई कनवर्टर पैनल Units इकाइयाँ Units & Scale इकाइयों और स्केल Units: इकाइयाँ: @@ -6215,6 +6258,8 @@ antiAlias Sharp शार्प @msg `{id}` is no writable format (see document.formats) `{id}` लिखने योग्य फ़ॉर्मैट नहीं है (document.formats देखें) @msg `{id}` is not a colour adjustment `{id}` एक रंग समायोजन नहीं है @msg `{id}` isn't a loaded library `{id}` एक लोड लाइब्रेरी नहीं है +@msg `{file}` has no swatches of its own `{file}` में अपने कोई स्वॉचेस नहीं हैं +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` में पैटर्न स्वॉचेस हैं, जिन्हें .vcswatches फ़ाइल नहीं रख सकती @msg `{k}.family` is required `{k}.family` की आवश्यकता है @msg `{k}` is a number 0..1 `{k}` एक नंबर 0..1 है। @msg `{k}` is true or false `{k}` true या false है @@ -6740,6 +6785,8 @@ antiAlias Sharp शार्प @msg automation path rejected: outside the read root {root}: {path} स्वचालन पाथ खारिज: पढ़ने की जड़ के बाहर {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} स्वचालन पाथ खारिज: पढ़ने की जड़ों के बाहर {roots}: {path} @msg a linked JavaScript file is outside the read roots एक लिंक की गई जावास्क्रिप्ट फ़ाइल पढ़ने की जड़ों के बाहर है +@msg a linked image file is outside the read roots एक लिंक की गई छवि फ़ाइल पढ़ने की जड़ों के बाहर है +@msg a linked file's export folder is outside the read roots एक लिंक की गई फ़ाइल का निर्यात फ़ोल्डर पढ़ने की जड़ों के बाहर है @msg the library's file is outside the read roots लाइब्रेरी की फ़ाइल पढ़ने की जड़ों के बाहर है @msg {file} names more than one linked JavaScript file {file} एक से अधिक लिंक की गई जावास्क्रिप्ट फ़ाइलों से मेल खाता है @msg automation path rejected: outside the write root {root}: {path} स्वचालन पाथ खारिज: लिखने की जड़ के बाहर {root}: {path} @@ -6865,7 +6912,13 @@ antiAlias Sharp शार्प @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: अधिकतम {MAX_TABLE} रंग @msg colour groups can't go into colour groups रंग समूह रंग समूहों में नहीं जा सकते हैं @msg colour, mode and spot apply to solid-colour swatches only रंग, मोड और स्पॉट केवल ठोस रंग वाले स्वॉच पर लागू होते हैं -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read कॉलम {column}: `{cell}` ग्राफ़ डेटा फ़ाइल का `%` कॉलम है, जिसे पढ़ा नहीं जाता +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` एक सापेक्ष पाथ है: `base` या एक पूर्ण पाथ दें +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल पढ़ी नहीं जा सकती: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` का पालन नहीं किया गया है: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` {MAX_GRAPH_DATA_FILE} बाइट्स से बड़ी है +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes लाइन {line}, कॉलम {column}: `{var}` के लिए ग्राफ़ डेटा फ़ाइल `{path}` से मिलने वाला ग्राफ़ मूल्य {MAX_GRAPH_CSV} बाइट्स से अधिक है +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all लाइन {line}, कॉलम {column}: ग्राफ़ डेटा फ़ाइलों में कुल मिलाकर {MAX_GRAPH_FILES_TOTAL} बाइट्स से अधिक हैं +@msg `base` is empty `base` खाली है @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable कॉलम {column}: `{cell}` में `{name}` नाम का {_1} वेरिएबल है @msg column {column}: `{cell}` names no variable कॉलम {column}: `{cell}` किसी वेरिएबल का नाम नहीं है @msg column {column}: the variable name is longer than {MAX_NAME} characters कॉलम {column}: वेरिएबल का नाम {MAX_NAME} कैरेक्टर से लंबा है @@ -6914,6 +6967,8 @@ antiAlias Sharp शार्प @msg the script is no longer in the Scripts folder स्क्रिप्ट अब Scripts फ़ोल्डर में नहीं है Some scripts were not listed कुछ स्क्रिप्ट सूचीबद्ध नहीं की गईं The Scripts folder cannot be read Scripts फ़ोल्डर पढ़ा नहीं जा सकता + Loading scripts… स्क्रिप्ट लोड हो रही हैं… + The Scripts folder is still being read Scripts फ़ोल्डर अभी भी पढ़ा जा रहा है @msg the script's run is no longer available स्क्रिप्ट का रन अब उपलब्ध नहीं है @msg a failed command changed undo steps that could not be put back, so the script was stopped एक विफल कमांड ने पूर्ववत चरण बदल दिए जिन्हें वापस नहीं रखा जा सका, इसलिए स्क्रिप्ट रोक दी गई @msg a recovery copy could not be written, so the script was not run रिकवरी प्रति नहीं लिखी जा सकी, इसलिए स्क्रिप्ट नहीं चलाई गई @@ -8834,6 +8889,8 @@ liquify-list-end {0}, {1} {0} और {1} @msg type that changes writing direction inside a text object opens in the direction of its first character टेक्स्ट ऑब्जेक्ट के भीतर लेखन दिशा बदलने वाला टेक्स्ट अपने पहले वर्ण की दिशा में खुलता है @msg type used as a mask in linked areas, wraparound text or a compound path doesn't clip लिंक्ड एरिया, रैपअराउंड टेक्स्ट या कंपाउंड पाथ में मास्क के रूप में इस्तेमाल किया गया टाइप क्लिप नहीं करता @msg Unembedded to {_1} एम्बेड हटाकर {_1} में रखा गया +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} {n} इमेज का एम्बेड हटाकर {folder} में रखा गया|{n} इमेज का एम्बेड हटाकर {folder} में रखा गया +@msg every numbered name for {name} is taken in that folder {name} के लिए हर नंबर वाला नाम उस फ़ोल्डर में पहले से लिया गया है @msg unexpected host trap होस्ट में अप्रत्याशित ट्रैप @msg unexpected resources अप्रत्याशित संसाधन @msg unknown {k} key `{key}` (size, position) अज्ञात {k} कुंजी `{key}` (size, position) diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index a9849bee2a..5584758ae5 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -183,6 +183,7 @@ Add Anchor Point Horgonypont hozzáadása Add Anchor Point Tool Horgonypont hozzáadása Add Anchor Points Horgonypontok hozzáadása + Add Around Hozzáadás az objektum körül Add Content Tartalom hozzáadása Add Effect Effektus hozzáadása Add Font Files Betűtípusfájlok hozzáadása @@ -277,6 +278,7 @@ Angled Strokes… Ferde vonások… Angles Szögek Animated Zoom Animált nagyítás + Anti Alias Élsimítás Anti-alias Élsimítás Anti-Alias Élsimítás Anti-alias Rasters Raszterek élsimítása @@ -734,6 +736,7 @@ font-technology Variable Változó Color Mixer (Shift-click the chip) Színkeverő (Shift+kattintás a színmezőre) Color Mode Színmód Color Mode: Színmód: + Color Model Színmodell Color Model: Színmodell: Color Models Színmodellek Color Picker Színválasztó @@ -762,6 +765,7 @@ font-technology Variable Változó Colors Színek Colors: Színek: Column Graph Tool Oszlopdiagram + Columns Oszlopok Columns: Oszlopok: Column… Oszlop… Combine Slices Szeletek egyesítése @@ -1357,6 +1361,7 @@ font-technology Variable Változó Enable text access for screen readers Szöveghozzáférés engedélyezése képernyőolvasóknak Enable Touch Gestures Érintési kézmozdulatok Switch Selection and Drawing Modes Váltás a kijelölési és a rajzolási mód között + Select Last Selection Tool Az utoljára használt kijelölőeszköz kiválasztása Enable Touch Workspace Érintőképernyős munkaterület Encoding Kódolás Encoding: Kódolás: @@ -2500,6 +2505,7 @@ file-filter Templates Sablonok Linked File Not Found A csatolt fájl nem található Links Csatolások Linux Display Server Linuxos megjelenítőszerver + Low-Latency Drawing Alacsony késleltetésű rajzolás Liquify Folyékony torzítás List Data Sets Adatkészletek listázása List Folder Mappa listázása @@ -3058,6 +3064,9 @@ file-filter Templates Sablonok Overprint Felülnyomás Overprint and Transparency Flattener Felülnyomás és átlátszóság-lapítás Overprint and Transparency Flattener Options Felülnyomás és átlátszóság-lapítás beállításai + Custom… Egyéni… + Custom Transparency Flattener Options Egyéni átlátszóság-lapítási beállítások + EPS has no alpha transparency, and Overprints sets whether overprints are kept. Az EPS-ben nincs alfa-átlátszóság, és a Felülnyomások beállítás dönti el, hogy megmaradnak-e a felülnyomások. Overprint Black… Fekete felülnyomása… Overprint Fill Kitöltés felülnyomása Overprint Preview Felülnyomás-előnézet @@ -3222,6 +3231,7 @@ diagnostics ui felület Play Current Selection Kijelölt művelet lejátszása Save Actions… Műveletek mentése… Load Actions… Műveletek betöltése… + Replace Actions… Műveletek cseréje… Reset Actions Műveletek visszaállítása Replace the current actions with the default set? Lecseréled az aktuális műveleteket az alapértelmezett készletre? Append adds the default set after the current sets instead. A Hozzáfűzés ehelyett az aktuális készletek után adja hozzá az alapértelmezett készletet. @@ -3603,6 +3613,8 @@ mark-style Japanese Japán Reset Automation Automation visszaállítása Reset Bar Position Sáv helyének visszaállítása Reset Bounding Box Befoglaló keret visszaállítása + Rotate Bounding Box Befoglaló keret elforgatása + Rotate Bounding Box… Befoglaló keret elforgatása… Reset Envelope Mesh Burkolóháló visszaállítása Reset Envelope Shape Burkoló alakjának visszaállítása Reset Essentials Essentials visszaállítása @@ -3643,6 +3655,8 @@ mark-style Japanese Japán Reset Tracing Tracing visszaállítása Reset Tracking and Kerning Betűköz és alávágás visszaállítása Highlight Font Name Betűtípusnév kiemelése + Highlight Font Size Betűméret kiemelése + Other… Egyéb… Highlight Kerning Alávágás kiemelése Highlight Tracking Betűköz kiemelése Reset Typography Typography visszaállítása @@ -3662,6 +3676,7 @@ mark-style Japanese Japán Resize Átméretezés Resize panel window Panelablak átméretezése Resize panels Panelek átméretezése + Resolution Felbontás Resolution: Felbontás: Responsive Reszponzív Restore Visszaállít @@ -3718,6 +3733,29 @@ mark-style Japanese Japán The unit for East Asian type measurements, which no field uses yet. A kelet-ázsiai szöveg méreteinek mértékegysége, amelyet egyelőre egyetlen mező sem használ. When on, a number typed without a unit into a field in picas is read in points. Bekapcsolva egy pica mértékegységű mezőbe mértékegység nélkül beírt számot pontként értelmez a program. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML-azonosító esetén az objektumnevek XML-azonosítóként jelennek meg a Rétegek, a Változók és a Rétegbeállítások ablakban. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. A betűméret és a sortávolság lépésköze: a Cmd/Ctrl+Shift+. és a Cmd/Ctrl+Shift+, egy lépéssel, Alt billentyűvel is öttel változtatja a méretet; vízszintes szövegben az Alt és a fel vagy le nyíl egy lépéssel, Cmd/Ctrl billentyűvel öttel változtatja a sortávolságot. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. A betűköz és az alávágás lépésköze em ezredrészében: vízszintes szövegben az Alt és a bal vagy jobb nyíl egy lépéssel, Cmd/Ctrl billentyűvel öttel változtatja a szövegkurzornál az alávágást vagy a kijelölt szöveg betűközét. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Az alapvonal-eltolás lépésköze: vízszintes szövegben az Alt, a Shift és a fel vagy le nyíl egy lépéssel, Cmd/Ctrl billentyűvel öttel tolja el az alapvonalat. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Megjeleníti a japán és más kelet-ázsiai szöveg beállításait a Karakter, a Bekezdés, az OpenType és a Glifák panelen, valamint az Összetett betűtípusok parancsot. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Megjeleníti az arab, héber és indiai szöveg beállításait a Karakter és a Bekezdés panelen, például a bekezdés irányát, a kasidákat és a számjegyeket. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. A kijelölőeszközök a szöveget csak az alapvonalán, a területi szöveg keretén vagy az útvonalán jelölik ki, nem bárhol a dobozán belül. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. A betűtípusmenük minden betűtípust angol nevén mutatnak; kikapcsolva a saját nyelvén is elnevezett betűtípus azt a nevet mutatja. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Az új területi szöveg bekapcsolt automatikus mérettel indul, így a vízszintes szöveg téglalap alakú kerete a szöveghez igazodva nő vagy csökken magasságban. + Font lists and the Type › Font menu show a sample of each font beside its name. A betűtípuslisták és a Betűtípus menü minden betűtípus neve mellett mintát mutatnak. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. A betűtípusminták sötét szöveggel fehérre rajzolódnak a felület fényerejétől függetlenül; ez csak a menükben bekapcsolt betűtípus-előnézetek mellett érvényes. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Milyen magas egy sor a betűtípusmezők listáiban, például a Karakter panelén, és így mekkora egy minta. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. A legutóbb használt betűtípusok közül hányat mutat 1 és 15 között a Legutóbbi betűtípusok és a betűtípuslisták, a legújabbal kezdve. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Ha megváltoztatja egy szöveg betűtípusát vagy betűstílusát, azok a karakterek, amelyekhez az új betűtípusban nincs glifa, megtartják korábbi betűtípusukat. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. A vásznon rózsaszín kiemelés jelöli az OpenType-funkciók által cserélt glifákat, például a ligatúrákat; nyomtatásban és exportban nem jelenik meg. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. A Szöveg eszközzel egyetlen karaktert kijelölve mellette a vásznon megjelenik alternatív glifáinak sora, amelyből választhat. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. A vásznon rózsaszín kiemelés jelöli a helyettesítő betűtípussal rajzolt szöveget, mert a saját betűtípusa hiányzik; nyomtatásban és exportban nem jelenik meg. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. A szövegeszközzel készített új szöveg kijelölt helyőrző szöveggel indul, amelyet a gépelés lecserél. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Ha egy bekezdés elejére listajelet, például 1. vagy * jelet, majd szóközt gépel, a bekezdés lista lesz. + Fonts in this folder show in the font menus and can be used without being installed. A mappában lévő betűtípusok megjelennek a betűtípusmenükben, és telepítés nélkül használhatók. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Ha grafikai stílust alkalmaz szövegre, a karakterek saját kitöltése vagy körvonala eltűnik ott, ahol a stílusnak van ilyen, így a stílus festéke látszik. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Az Igazítás és az Elosztás a pontszöveget glifáinak tintája szerint méri az em-doboza helyett. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Az Igazítás és az Elosztás a területi szöveget glifáinak tintája szerint méri a kerete helyett. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. A határolókeret és az Átalakítás panel a pontszöveget glifáinak tintája szerint méri az em-doboza helyett. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. A rajzolást, mozgatást és méretezést a rács osztásaihoz illeszti, akkor is, ha a rács rejtve van; amíg be van kapcsolva, az Illesztés pixelhez nem érvényes. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. A nem kijelölt segédvonalak színe; a Segédvonalak címkéjével rendelkező rajztábla a saját segédvonalait a címke színével rajzolja. Draws guides as solid lines or as dots, including the guides already in the document. A segédvonalakat folytonos vonalként vagy pontokként rajzolja, a dokumentumban már meglévőket is. @@ -3823,6 +3861,7 @@ mark-style Japanese Japán Rounded Rectangle… Lekerekített téglalap… Roundness: Kerekség: Row Size: Sorméret: + Rows Sorok Rows: Sorok: Rule: Szabály: Ruler Origin Vonalzók origója @@ -5303,6 +5342,8 @@ imageTrace Outline Körvonal @msg automation path rejected: outside the read root {root}: {path} az automatizálás útvonala elutasítva: kívül esik az olvasási gyökéren ({root}): {path} @msg automation path rejected: outside the read roots {roots}: {path} az automatizálás útvonala elutasítva: kívül esik az olvasási gyökereken ({roots}): {path} @msg a linked JavaScript file is outside the read roots egy csatolt JavaScript-fájl kívül esik az olvasási gyökereken +@msg a linked image file is outside the read roots egy csatolt képfájl kívül esik az olvasási gyökereken +@msg a linked file's export folder is outside the read roots egy csatolt fájl exportálási mappája kívül esik az olvasási gyökereken @msg automation path rejected: outside the write root {root}: {path} az automatizálás útvonala elutasítva: kívül esik az írási gyökéren ({root}): {path} @msg automation path rejected: outside the write roots {roots}: {path} az automatizálás útvonala elutasítva: kívül esik az írási gyökereken ({roots}): {path} @msg automation path rejected: parent traversal below a folder that doesn't exist: {path} az automatizálás útvonala elutasítva: szülőmappára lépés egy nem létező mappa alatt: {path} @@ -5383,6 +5424,8 @@ imageTrace Outline Körvonal @msg the script is no longer in the Scripts folder a parancsfájl már nincs a Scripts mappában Some scripts were not listed Néhány szkript nem szerepel a listában The Scripts folder cannot be read A Scripts mappa nem olvasható + Loading scripts… Szkriptek betöltése… + The Scripts folder is still being read A Scripts mappa olvasása még tart @msg the script's run is no longer available a parancsfájl futása már nem érhető el @msg a failed command changed undo steps that could not be put back, so the script was stopped egy sikertelen parancs olyan visszavonási lépéseket módosított, amelyeket nem lehetett visszaállítani, ezért a parancsfájl leállt @msg a recovery copy could not be written, so the script was not run a helyreállítási másolatot nem sikerült kiírni, ezért a parancsfájl nem futott le @@ -6147,6 +6190,8 @@ liquify-list-end {0}, {1} {0} és {1} @msg tool shortcuts must be a single key (optionally with Shift) eszköz billentyűparancsa egyetlen billentyű lehet (Shifttel vagy anélkül) @msg truncated csonka @msg Unembedded to {_1} Beágyazás megszüntetve, ide: {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Beágyazás megszüntetve, képek: {n}, ide: {folder} +@msg every numbered name for {name} is taken in that folder abban a mappában minden sorszámozott név foglalt: {name} @msg unknown command `{0}` ismeretlen parancs: `{0}` @msg step {step} of “{action}” runs the unknown command `{command}` „{action}”, lépés: {step}: ismeretlen parancsot futtat: `{command}` @msg unknown command `{0}`; did you mean `{1}`? ismeretlen parancs: `{0}`; erre gondolt: `{1}`? @@ -7367,6 +7412,12 @@ anchor Points: Pontok: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode`: "free", "keepAngles" vagy "symmetric" kell @msg `{key}` must be [x, y] `{key}`: [x, y] kell +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Mértékegység-átváltó + Unit Converter Panel Mértékegység-átváltó panel + Copy with Units Másolás mértékegységgel + From Selection A kijelölésből + # Color Effects add-on: Select by Color Kind. Select by Color Kind Kijelölés színtípus szerint Objects with Spot Colors Direkt színeket használó objektumok @@ -8259,6 +8310,8 @@ breakText Glyphs Glifák @msg `{f}` is the copy of a document open now egy most megnyitott dokumentum másolata: `{f}` @msg `{id}` is no writable format (see document.formats) nem írható formátum: `{id}` (lásd: document.formats) @msg `{id}` isn't a loaded library nem betöltött könyvtár: `{id}` +@msg `{file}` has no swatches of its own nincsenek saját színminták: `{file}` +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold mintázatszínmintákat tartalmaz, amelyeket egy .vcswatches fájl nem tud tárolni: `{_1}` @msg `{key}` has no colours `{key}`: nincsenek benne színek @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}`: több mint {MAX_EDIT_WORDS} szót tartalmaz @msg `{key}` is a design name `{key}`: diagramminta neve @@ -8550,7 +8603,13 @@ breakText Glyphs Glifák @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel: {own} (a dokumentum módja), grayscale vagy bitmap kell @msg colour groups can't go into colour groups színcsoport nem kerülhet színcsoportba @msg colour, mode and spot apply to solid-colour swatches only colour, mode és spot: csak egyszínű színmintákra vonatkozik -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read {column}. oszlop: `{cell}` a diagramadat-fájlok `%` oszlopa, ezek beolvasása nem történik meg +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja relatív elérési út: adja meg a `base` értéket vagy egy abszolút elérési utat +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line}. sor, {column}. oszlop: a(z) `{var}` diagramadat-fájlja nem olvasható: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} {line}. sor, {column}. oszlop: a(z) `{var}` diagramadat-fájlja nem lesz követve: `{path}`: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja nagyobb {MAX_GRAPH_DATA_FILE} bájtnál +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line}. sor, {column}. oszlop: a(z) `{var}` `{path}` diagramadat-fájlja {MAX_GRAPH_CSV} bájtnál hosszabb diagramértéket ad +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line}. sor, {column}. oszlop: a diagramadat-fájlok összesen több mint {MAX_GRAPH_FILES_TOTAL} bájtot tartalmaznak +@msg `base` is empty a `base` üres @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable {column}. oszlop: `{cell}` ezt nevezi meg: `{name}`, amely {_1} típusú változó @msg column {column}: `{cell}` names no variable {column}. oszlop: `{cell}` nem nevez meg változót @msg column {column}: the variable name is longer than {MAX_NAME} characters {column}. oszlop: a változó neve hosszabb {MAX_NAME} karakternél diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index c0a21f7312..600dc12aa7 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -57,6 +57,8 @@ Check Script Periksa skrip Some scripts were not listed Beberapa skrip tidak dicantumkan The Scripts folder cannot be read Folder Scripts tidak dapat dibaca + Loading scripts… Memuat skrip… + The Scripts folder is still being read Folder Scripts masih dibaca Other Script… Skrip lain… Document Setup… Pengaturan dokumen… Switch Units Ganti satuan @@ -160,6 +162,8 @@ Shear… Miringkan… Transform Each… Transformasi masing-masing… Reset Bounding Box Atur ulang kotak pembatas + Rotate Bounding Box Putar kotak pembatas + Rotate Bounding Box… Putar kotak pembatas… Arrange Susun Bring to Front Bawa ke depan Bring Forward Majukan @@ -1448,6 +1452,7 @@ lighting Light Cahaya Play Current Selection Putar seleksi saat ini Save Actions… Simpan tindakan… Load Actions… Muat tindakan… + Replace Actions… Ganti tindakan… Reset Actions Atur ulang tindakan Replace the current actions with the default set? Ganti tindakan saat ini dengan set default? Append adds the default set after the current sets instead. Tambahkan justru menambahkan set default setelah set saat ini. @@ -2560,6 +2565,7 @@ digits Malayalam Malayalam BLANK DOCUMENT PRESETS PRESET DOKUMEN KOSONG Bleed Bleed Change to Right-to-Left Layout Ubah ke tata letak kanan ke kiri + Columns Kolom Columns: Kolom: Documents you create appear here. Dokumen yang Anda buat muncul di sini. More Settings Pengaturan lainnya @@ -2693,6 +2699,9 @@ digits Malayalam Malayalam Open a document to preview its pages Buka dokumen untuk melihat pratinjau halamannya Output › Mode Keluaran › Mode Overprint and Transparency Flattener Options Opsi overprint dan perataan transparansi + Custom… Kustom… + Custom Transparency Flattener Options Opsi perataan transparansi kustom + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS tidak memiliki transparansi alfa, dan Overprint menentukan apakah overprint dipertahankan. Place the pages with the placement again Tempatkan halaman lagi dengan penempatan tersebut Placement: Penempatan: Preserve CMYK Numbers Pertahankan angka CMYK @@ -2742,14 +2751,19 @@ digits Malayalam Malayalam Around Object Di sekeliling objek Background: Latar belakang: Changing these settings changes how raster effects look when exported, flattened or expanded. Mengubah pengaturan ini mengubah tampilan efek raster saat diekspor, diratakan, atau diperluas. + Add Around Tambah di sekeliling objek + Anti Alias Anti-aliasing + Color Model Model warna Color Model: Model warna: Create Clipping Mask Buat clipping mask Preserve Spot Colors Pertahankan warna spot + Resolution Resolusi Resolution: Resolusi: Transparent Transparan Layout Order: Urutan tata letak: Change to Left-to-Right Layout Ubah ke tata letak kiri ke kanan Artboards: {n} Artboard: {n} + Rows Baris Rows: Baris: Assign Tetapkan Color Group: Grup warna: @@ -3707,6 +3721,7 @@ theme Appearance Tampilan Enable Rubber Band for Aktifkan rubber band untuk Enable Touch Gestures Aktifkan gestur sentuh Switch Selection and Drawing Modes Beralih antara mode seleksi dan menggambar + Select Last Selection Tool Pilih alat seleksi terakhir Enable Touch Workspace Aktifkan ruang kerja sentuh English: UK Inggris: UK Every (minutes) Setiap (menit) @@ -3839,6 +3854,7 @@ theme Appearance Tampilan Scroll Sideways with Cmd/Ctrl + Wheel Gulir horizontal dengan Cmd/Ctrl + roda mouse Scrub Numeric Fields by Dragging Atur nilai kolom numerik dengan menyeret Linux Display Server Server tampilan Linux + Low-Latency Drawing Penggambaran latensi rendah Print Preview Pratinjau cetak Print Setup Pengaturan cetak Bitmap Bitmap @@ -4239,6 +4255,29 @@ font-technology Variable Variabel The unit for East Asian type measurements, which no field uses yet. Satuan untuk ukuran teks Asia Timur, yang belum digunakan bidang mana pun. When on, a number typed without a unit into a field in picas is read in points. Jika aktif, angka yang diketik tanpa satuan di bidang dalam pica dibaca dalam titik. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Dengan ID XML, nama objek ditampilkan sebagai ID XML di Lapisan, Variabel, dan Opsi lapisan. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Langkah untuk ukuran teks dan spasi baris: Cmd/Ctrl+Shift+. dan Cmd/Ctrl+Shift+, mengubah ukuran satu langkah, atau lima dengan Alt juga; pada teks horizontal, Alt dengan panah atas atau bawah mengubah spasi baris satu langkah, atau lima dengan Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Langkah untuk tracking dan kerning, dalam perseribu em: pada teks horizontal, Alt dengan panah kiri atau kanan mengubah kerning di kursor atau tracking teks yang dipilih satu langkah, atau lima dengan Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Langkah untuk pergeseran garis dasar: pada teks horizontal, Alt dan Shift dengan panah atas atau bawah menggeser garis dasar satu langkah, atau lima dengan Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Menampilkan opsi untuk teks Jepang dan teks Asia Timur lainnya di panel Karakter, Paragraf, OpenType, dan Glif, serta perintah Font komposit. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Menampilkan opsi untuk teks Arab, Ibrani, dan India di panel Karakter dan Paragraf, seperti arah paragraf, kashida, dan digit. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Alat seleksi memilih teks hanya pada garis dasarnya, bingkai teks area, atau jalurnya, bukan di sembarang tempat di dalam kotaknya. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Menu font mencantumkan setiap font dengan nama bahasa Inggrisnya; jika nonaktif, font yang juga punya nama dalam bahasanya sendiri menampilkan nama itu. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Teks area baru dimulai dengan Ukuran otomatis aktif, sehingga bingkai persegi panjang berisi teks horizontal bertambah atau berkurang tingginya agar teksnya muat. + Font lists and the Type › Font menu show a sample of each font beside its name. Daftar font dan menu Font menampilkan contoh setiap font di samping namanya. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Contoh font digambar dengan teks gelap di atas putih, apa pun kecerahan antarmuka; ini hanya berlaku selama pratinjau font di menu aktif. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Tinggi setiap baris dalam daftar bidang font, seperti di panel Karakter, dan karenanya besar setiap contoh. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Berapa banyak font yang terakhir dipakai, dari 1 sampai 15, yang ditampilkan Font terbaru dan daftar font, yang terbaru lebih dulu. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Saat Anda mengganti font atau gaya font teks, karakter yang tidak memiliki glif di font baru tetap memakai font sebelumnya. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Sorotan merah muda di kanvas menandai glif yang diganti oleh fitur OpenType, seperti ligatur; sorotan ini tidak dicetak atau diekspor. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Dengan alat teks, memilih satu karakter menampilkan deretan glif alternatifnya di sampingnya di kanvas untuk dipilih. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Sorotan merah muda di kanvas menandai teks yang digambar dengan font pengganti karena fontnya tidak ada; sorotan ini tidak dicetak atau diekspor. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Teks baru yang dibuat dengan alat teks dimulai dengan teks pengganti yang terpilih, sehingga ketikan Anda menggantikannya. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Mengetik penanda daftar seperti 1. atau * lalu spasi di awal paragraf mengubah paragraf itu menjadi daftar. + Fonts in this folder show in the font menus and can be used without being installed. Font di folder ini muncul di menu font dan dapat dipakai tanpa diinstal. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Menerapkan gaya grafis pada teks menghapus isian atau garis milik karakter jika gaya memilikinya, sehingga cat gaya itu terlihat. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Sejajarkan dan Distribusikan mengukur teks titik menurut tinta glifnya, bukan kotak em-nya. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Sejajarkan dan Distribusikan mengukur teks area menurut tinta glifnya, bukan bingkainya. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Kotak pembatas dan panel Transformasi mengukur teks titik menurut tinta glifnya, bukan kotak em-nya. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Menempelkan penggambaran, pemindahan, dan penskalaan ke subdivisi kisi, bahkan saat kisi disembunyikan; selama opsi ini aktif, Snap ke piksel tidak berlaku. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Warna panduan yang tidak dipilih; artboard yang memiliki Label panduan menggambar panduannya sendiri dengan warna label tersebut. Draws guides as solid lines or as dots, including the guides already in the document. Menggambar panduan sebagai garis utuh atau sebagai titik, termasuk panduan yang sudah ada di dokumen. @@ -5809,6 +5848,8 @@ mark-style Japanese Jepang Reset Tracking and Kerning Atur ulang tracking dan kerning Reset Horizontal Scale Atur ulang skala horizontal Highlight Font Name Sorot nama font + Highlight Font Size Sorot ukuran font + Other… Lainnya… Highlight Kerning Sorot kerning Highlight Tracking Sorot tracking @msg span must be "object" or "selection", got {v} span harus "object" atau "selection", diterima {v} @@ -6705,6 +6746,12 @@ anchor Points: Titik: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` harus "free", "keepAngles" atau "symmetric" @msg `{key}` must be [x, y] `{key}` harus [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Pengonversi Satuan + Unit Converter Panel Panel Pengonversi Satuan + Copy with Units Salin dengan Satuan + From Selection Dari Seleksi + # Color Effects add-on: Select by Color Kind. Select by Color Kind Pilih menurut Jenis Warna Objects with Spot Colors Objek dengan Warna Spot diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 4e9e66f135..574b1dbd3c 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -11,7 +11,7 @@ # Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`, # `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language # names, OpenType, the built-in workspace names and the bracketed perspective grid preset names. -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Glowing Edges… Bordi luminosi… Glowing Edges Bordi luminosi Edge Width Larghezza bordo @@ -119,6 +119,7 @@ Add Anchor Point Aggiungi punto di ancoraggio Add Anchor Point Tool Strumento Aggiungi punto di ancoraggio Add Anchor Points Aggiungi punti di ancoraggio + Add Around Aggiungi attorno all'oggetto Add Effect Aggiungi effetto Add Freeform Line Aggiungi linea libera Add Freeform Point Aggiungi punto libero @@ -196,6 +197,7 @@ Angle: Angolo: Angles Angoli Animated Zoom Zoom animato + Anti Alias Anti-aliasing Anti-alias Anti-aliasing Anti-Alias Anti-aliasing Anti-alias Rasters Anti-aliasing per immagini raster @@ -556,6 +558,7 @@ font-technology Variable Variabili Color Mixer (Shift-click the chip) Miscelatore colori (Shift+clic sul riquadro colore) Color Mode Metodo colore Color Mode: Metodo colore: + Color Model Modello colore Color Model: Modello colore: Color Models Modelli colore Color Picker Selettore colore @@ -582,6 +585,7 @@ font-technology Variable Variabili Colors Colori Colors: Colori: Column Graph Tool Strumento Grafico a colonne + Columns Colonne Columns: Colonne: Column… Colonna… Combine Slices Combina sezioni @@ -1085,6 +1089,7 @@ font-technology Variable Variabili Enable text access for screen readers Consenti l'accesso al testo per le utilità di lettura dello schermo Enable Touch Gestures Attiva gesti touch Switch Selection and Drawing Modes Passa tra modalità selezione e disegno + Select Last Selection Tool Scegli l'ultimo strumento di selezione Enable Touch Workspace Attiva area di lavoro touch Encoding Codifica Encoding: Codifica: @@ -1314,6 +1319,8 @@ font-technology Variable Variabili Reset Tracking and Kerning Reimposta spaziatura caratteri e crenatura Reset Horizontal Scale Reimposta scala orizzontale Highlight Font Name Evidenzia nome del font + Highlight Font Size Evidenzia dimensione font + Other… Altro… Highlight Kerning Evidenzia crenatura Highlight Tracking Evidenzia spaziatura caratteri Spacing Spaziatura @@ -2607,6 +2614,9 @@ file-filter Templates Modelli Overprint Sovrastampa Overprint and Transparency Flattener Sovrastampa e appiattimento trasparenza Overprint and Transparency Flattener Options Opzioni sovrastampa e appiattimento trasparenza + Custom… Personalizzato… + Custom Transparency Flattener Options Opzioni di appiattimento trasparenza personalizzate + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS non ha trasparenza alfa, e Sovrastampe stabilisce se le sovrastampe vengono mantenute. Overprint Black… Sovrastampa nero… Overprint Fill Sovrastampa riempimento Overprint Preview Anteprima sovrastampa @@ -2715,6 +2725,7 @@ diagnostics ui interfaccia Play Current Selection Esegui selezione corrente Save Actions… Salva azioni… Load Actions… Carica azioni… + Replace Actions… Sostituisci azioni… Reset Actions Ripristina azioni Replace the current actions with the default set? Sostituire le azioni correnti con il set predefinito? Append adds the default set after the current sets instead. Aggiungi aggiunge invece il set predefinito dopo i set correnti. @@ -3083,6 +3094,8 @@ digits Malayalam Malayalam Reselect Riseleziona Reset Reimposta Reset Bounding Box Reimposta riquadro di delimitazione + Rotate Bounding Box Ruota riquadro di delimitazione + Rotate Bounding Box… Ruota riquadro di delimitazione… Reset Envelope Mesh Reimposta trama involucro Reset Envelope Shape Reimposta forma involucro Reset Essentials Reimposta Essentials @@ -3124,6 +3137,7 @@ digits Malayalam Malayalam Reshape Segment Rimodella segmento Reshape Tool Strumento Rimodella Reshape Type Area Rimodella area di testo + Resolution Risoluzione Resolution: Risoluzione: Responsive Adattivo Restore Ripristina @@ -3180,6 +3194,29 @@ digits Malayalam Malayalam The unit for East Asian type measurements, which no field uses yet. L'unità per le misure del testo dell'Asia orientale, che nessun campo usa ancora. When on, a number typed without a unit into a field in picas is read in points. Se attiva, un numero digitato senza unità in un campo in pica viene letto in punti. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Con ID XML, i nomi degli oggetti sono mostrati come ID XML in Livelli, Variabili e Opzioni livello. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Il passo per dimensione del testo e interlinea: Cmd/Ctrl+Maiusc+. e Cmd/Ctrl+Maiusc+, cambiano la dimensione di un passo, o di cinque aggiungendo Alt; nel testo orizzontale, Alt con la freccia su o giù cambia l’interlinea di un passo, o di cinque con Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Il passo per tracking e crenatura, in millesimi di em: nel testo orizzontale, Alt con la freccia sinistra o destra cambia la crenatura al cursore o il tracking del testo selezionato di un passo, o di cinque con Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Il passo per lo spostamento della linea di base: nel testo orizzontale, Alt e Maiusc con la freccia su o giù spostano la linea di base di un passo, o di cinque con Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Mostra le opzioni per il testo giapponese e di altre lingue dell’Asia orientale nei pannelli Carattere, Paragrafo, OpenType e Glifi, e il comando Font compositi. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Mostra le opzioni per il testo arabo, ebraico e indiano nei pannelli Carattere e Paragrafo, come la direzione del paragrafo, le kashida e le cifre. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Gli strumenti di selezione selezionano il testo solo sulla sua linea di base, sulla cornice del testo in area o sul suo tracciato, non in qualunque punto del suo riquadro. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. I menu dei font elencano ogni font con il suo nome inglese; se disattivato, un font che ha anche un nome nella propria lingua mostra quel nome. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Il nuovo testo in area parte con la dimensione automatica attiva, quindi una cornice rettangolare di testo orizzontale cresce o si riduce in altezza per contenere il testo. + Font lists and the Type › Font menu show a sample of each font beside its name. Gli elenchi dei font e il menu Font mostrano un campione di ogni font accanto al suo nome. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. I campioni dei font sono disegnati in testo scuro su bianco, qualunque sia la luminosità dell’interfaccia; vale solo finché le anteprime dei font nei menu sono attive. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. L’altezza di ogni riga negli elenchi dei campi font, come quello del pannello Carattere, e quindi la grandezza di ogni campione. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Quanti degli ultimi font usati, da 1 a 15, mostrano Font recenti e gli elenchi dei font, dal più recente. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Quando cambi il font o lo stile del font di un testo, i caratteri per cui il nuovo font non ha un glifo mantengono il font che avevano. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Un’evidenziazione rosa sulla tavola segna i glifi sostituiti da funzioni OpenType, come le legature; non viene stampata né esportata. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Con lo strumento Testo, selezionando un solo carattere appare accanto a esso sulla tavola una fila dei suoi glifi alternativi tra cui scegliere. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Un’evidenziazione rosa sulla tavola segna il testo disegnato con un font sostitutivo perché il suo font manca; non viene stampata né esportata. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Il nuovo testo creato con uno strumento Testo inizia con un testo segnaposto selezionato, che la digitazione sostituisce. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Digitare un indicatore di elenco come 1. o * e poi uno spazio all’inizio di un paragrafo trasforma il paragrafo in un elenco. + Fonts in this folder show in the font menus and can be used without being installed. I font in questa cartella compaiono nei menu dei font e si possono usare senza installarli. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Applicare uno stile grafico a un testo toglie ai caratteri il proprio riempimento o traccia dove lo stile ne ha uno, così si vede il colore dello stile. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Allinea e Distribuisci misurano il testo con punto in base all’inchiostro dei suoi glifi invece che al suo riquadro em. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Allinea e Distribuisci misurano il testo in area in base all’inchiostro dei suoi glifi invece che alla sua cornice. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Il riquadro di selezione e il pannello Trasforma misurano il testo con punto in base all’inchiostro dei suoi glifi invece che al suo riquadro em. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Aggancia il disegno, lo spostamento e il ridimensionamento alle suddivisioni della griglia, anche quando la griglia è nascosta; finché è attivo, Aggancia ai pixel non si applica. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Il colore delle guide non selezionate; una tavola da disegno con un'Etichetta delle guide disegna le proprie guide nel colore dell'etichetta. Draws guides as solid lines or as dots, including the guides already in the document. Disegna le guide come linee continue o come punti, comprese le guide già presenti nel documento. @@ -3261,6 +3298,7 @@ digits Malayalam Malayalam Rounded Rectangle Tool Strumento Rettangolo arrotondato Rounded Rectangle… Rettangolo arrotondato… Row Size: Dimensione riga: + Rows Righe Rows: Righe: Rule: Regola: Rulers Righelli @@ -4616,6 +4654,8 @@ axis Both Entrambi @msg the script is no longer in the Scripts folder lo script non è più nella cartella Scripts Some scripts were not listed Alcuni script non sono stati elencati The Scripts folder cannot be read Impossibile leggere la cartella Scripts + Loading scripts… Caricamento degli script… + The Scripts folder is still being read La cartella Scripts è ancora in lettura @msg the script's run is no longer available l'esecuzione dello script non è più disponibile @msg a failed command changed undo steps that could not be put back, so the script was stopped un comando non riuscito ha modificato passaggi di annullamento che non è stato possibile ripristinare, quindi lo script è stato interrotto @msg a recovery copy could not be written, so the script was not run non è stato possibile scrivere una copia di recupero, quindi lo script non è stato eseguito @@ -5490,6 +5530,8 @@ liquify-list-end {0}, {1} {0} e {1} @msg All colors are within the CMYK gamut Tutti i colori rientrano nella gamma CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} colore è fuori dalla gamma CMYK|{n} colori sono fuori dalla gamma CMYK @msg Unembedded to {_1} Incorporamento rimosso, salvato in {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Incorporamento rimosso per {n} immagine, salvata in {folder}|Incorporamento rimosso per {n} immagini, salvate in {folder} +@msg every numbered name for {name} is taken in that folder tutti i nomi numerati per {name} sono già usati in quella cartella @msg Reset {_1} Reimpostato {_1} @msg Sent to {_1} Inviato a {_1} @msg {_1} files {_1} file @@ -5619,6 +5661,8 @@ liquify-list-end {0}, {1} {0} e {1} @msg automation path rejected: outside the read root {root}: {path} percorso di automazione rifiutato: fuori dalla cartella radice di lettura {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} percorso di automazione rifiutato: fuori dalle cartelle radice di lettura {roots}: {path} @msg a linked JavaScript file is outside the read roots un file JavaScript collegato è fuori dalle cartelle radice di lettura +@msg a linked image file is outside the read roots un file immagine collegato è fuori dalle cartelle radice di lettura +@msg a linked file's export folder is outside the read roots la cartella di esportazione di un file collegato è fuori dalle cartelle radice di lettura @msg automation path rejected: outside the write root {root}: {path} percorso di automazione rifiutato: fuori dalla cartella radice di scrittura {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} percorso di automazione rifiutato: fuori dalle cartelle radice di scrittura {roots}: {path} @msg automation path rejected: path is empty percorso di automazione rifiutato: il percorso è vuoto @@ -5848,6 +5892,7 @@ lighting Light Luce @msg missing panel layout Disposizione dei pannelli mancante @msg unsupported native docking operation Operazione nativa di ancoraggio non supportata Linux Display Server Server di visualizzazione Linux + Low-Latency Drawing Disegno a bassa latenza X11 (XWayland) When a Pen Is Attached X11 (XWayland) quando è collegata una penna If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Se la penna di una tavoletta grafica non disegna, scegli un'opzione X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -7010,6 +7055,12 @@ anchor Points: Punti: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` deve essere "free", "keepAngles" o "symmetric" @msg `{key}` must be [x, y] `{key}` deve essere [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Convertitore di unità + Unit Converter Panel Pannello Convertitore di unità + Copy with Units Copia con le unità + From Selection Dalla selezione + # Color Effects add-on: Select by Color Kind. Select by Color Kind Seleziona per tipo di colore Objects with Spot Colors Oggetti con colori spot @@ -8188,6 +8239,8 @@ breakText Glyphs Glifi @msg `{f}` is the copy of a document open now `{f}` è la copia di un documento aperto in questo momento @msg `{id}` is no writable format (see document.formats) `{id}` non è un formato scrivibile (vedi document.formats) @msg `{id}` isn't a loaded library `{id}` non è una libreria caricata +@msg `{file}` has no swatches of its own `{file}` non ha campioni propri +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` ha campioni motivo, che un file .vcswatches non può contenere @msg `{key}` has no colours `{key}` non ha colori @msg `{key}` is a design name `{key}` è il nome di un design @msg `{key}` is a design name or a list of them `{key}` è il nome di un design o un elenco di nomi @@ -8410,7 +8463,13 @@ breakText Glyphs Glifi @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel deve essere {own} (il metodo del documento), grayscale o bitmap @msg colour groups can't go into colour groups i gruppi di colori non possono entrare in altri gruppi di colori @msg colour, mode and spot apply to solid-colour swatches only colore, metodo e spot si applicano solo ai campioni di colore pieno -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read colonna {column}: `{cell}` è una colonna `%` dei file di dati dei grafici, che non vengono letti +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` è un percorso relativo: indica `base` o un percorso assoluto +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} riga {line}, colonna {column}: impossibile leggere il file di dati del grafico per `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` non viene seguito: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` supera i {MAX_GRAPH_DATA_FILE} byte +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes riga {line}, colonna {column}: il file di dati del grafico `{path}` per `{var}` dà un valore di grafico che supera i {MAX_GRAPH_CSV} byte +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all riga {line}, colonna {column}: i file di dati dei grafici contengono in tutto più di {MAX_GRAPH_FILES_TOTAL} byte +@msg `base` is empty `base` è vuoto @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable colonna {column}: `{cell}` indica `{name}`, che è una variabile {_1} @msg column {column}: `{cell}` names no variable colonna {column}: `{cell}` non indica alcuna variabile @msg column {column}: the variable name is longer than {MAX_NAME} characters colonna {column}: il nome della variabile supera {MAX_NAME} caratteri diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index b87cfd3d04..de43b4fe55 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -217,6 +217,8 @@ digits Malayalam マラヤーラム数字 Shear… シアー… Transform Each… 個別に変形… Reset Bounding Box バウンディングボックスのリセット + Rotate Bounding Box バウンディングボックスの回転 + Rotate Bounding Box… バウンディングボックスの回転… Arrange 重ね順 Bring to Front 最前面へ Bring Forward 前面へ @@ -464,6 +466,8 @@ digits Malayalam マラヤーラム数字 Reset Tracking and Kerning トラッキングとカーニングをリセット Reset Horizontal Scale 水平比率をリセット Highlight Font Name フォント名をハイライト + Highlight Font Size フォントサイズをハイライト + Other… その他… Highlight Kerning カーニングをハイライト Highlight Tracking トラッキングをハイライト Step Type 文字を段階的に調整 @@ -1055,6 +1059,7 @@ digits Malayalam マラヤーラム数字 Add Anchor (Pen) アンカーポイントを追加 (ペン) Add Anchor Point アンカーポイントを追加 Add Anchor Point Tool アンカーポイントの追加ツール + Add Around オブジェクトの周囲に追加 Add Effect 効果を追加 Add Freeform Line フリーフォームラインを追加 Add Freeform Point フリーフォームポイントを追加 @@ -1116,6 +1121,7 @@ digits Malayalam マラヤーラム数字 Angle: 角度: Angles 角度 Animated Zoom アニメーションズーム + Anti Alias アンチエイリアス Anti-Alias アンチエイリアス Anti-alias アンチエイリアス Anti-alias Rasters ラスターをアンチエイリアス @@ -1340,6 +1346,7 @@ antiAlias Sharp シャープ Color Guide Options… カラーガイドオプション… Color Mode カラーモード Color Mode: カラーモード: + Color Model カラーモデル Color Model: カラーモデル: Color Models カラーモデル Color Picker カラーピッカー @@ -1358,6 +1365,7 @@ antiAlias Sharp シャープ Colors カラー Colors: カラー数: Column Graph Tool 集合縦棒グラフツール + Columns 列数 Columns: 列数: Coming soon — tracked in the parity plan 近日対応予定 Command Click to Select Objects Behind Command+クリックで背面のオブジェクトを選択 @@ -1696,6 +1704,7 @@ antiAlias Sharp シャープ Enable Rubber Band for ラバーバンドを有効にする対象 Enable Touch Gestures タッチジェスチャーを有効にする Switch Selection and Drawing Modes 選択モードと描画モードを切り替え + Select Last Selection Tool 最後に使用した選択ツールに切り替え Enable Touch Workspace タッチワークスペースを有効にする Enable copying of text, images and other content テキスト、イメージ、その他のコンテンツのコピーを許可 Enable in-menu font previews メニュー内でフォントプレビューを有効にする @@ -2728,6 +2737,9 @@ antiAlias Sharp シャープ Overprint Stroke 線をオーバープリント Overprint and Transparency Flattener オーバープリントと透明の分割・統合 Overprint and Transparency Flattener Options オーバープリントと透明の分割・統合オプション + Custom… カスタム… + Custom Transparency Flattener Options カスタムの透明の分割・統合オプション + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS にはアルファ透明がなく、オーバープリントを保持するかどうかは「オーバープリント」で決まります。 Overprint: オーバープリント: Overprints: オーバープリント: Override Character Color 文字カラーを上書き @@ -2802,6 +2814,7 @@ diagnostics ui UI Play Current Selection 選択項目を再生 Save Actions… アクションを保存… Load Actions… アクションを読み込み… + Replace Actions… アクションを置き換え… Reset Actions アクションをリセット Replace the current actions with the default set? 現在のアクションを初期設定のセットで置き換えますか? Append adds the default set after the current sets instead. 「追加」を選ぶと、初期設定のセットを現在のセットの後に追加します。 @@ -3100,6 +3113,7 @@ mark-style Japanese 日本式 Reshape Segment セグメントをシェイプ変形 Reshape Tool リシェイプツール Reshape Type Area テキストエリアの形を変更 + Resolution 解像度 Resolution: 解像度: Responsive レスポンシブ Restore 復元 @@ -3157,6 +3171,29 @@ mark-style Japanese 日本式 The unit for East Asian type measurements, which no field uses yet. 東アジア言語の文字の測定に使う単位で、まだどのフィールドも使っていません。 When on, a number typed without a unit into a field in picas is read in points. オンのとき、パイカのフィールドに単位なしで入力した数値はポイントとして読み取られます。 With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML ID を選ぶと、レイヤー、変数、レイヤーオプションでオブジェクト名が XML ID として表示されます。 + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. 文字サイズと行送りの増減値です。Cmd/Ctrl+Shift+. と Cmd/Ctrl+Shift+, で文字サイズを 1 段階、Alt も押すと 5 段階変えます。横組みの文字では Alt と上下の矢印キーで行送りを 1 段階、Cmd/Ctrl も押すと 5 段階変えます。 + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. トラッキングとカーニングの増減値で、単位は 1/1000 em です。横組みの文字では Alt と左右の矢印キーで、キャレット位置のカーニングまたは選択したテキストのトラッキングを 1 段階、Cmd/Ctrl も押すと 5 段階変えます。 + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. ベースラインシフトの増減値です。横組みの文字では Alt と Shift と上下の矢印キーでベースラインを 1 段階、Cmd/Ctrl も押すと 5 段階移動します。 + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. 文字、段落、OpenType、字形の各パネルに日本語などの東アジアの文字のオプションを表示し、合成フォントのコマンドも表示します。 + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. 文字パネルと段落パネルに、段落の方向、カシーダ、数字など、アラビア語、ヘブライ語、インド系文字のオプションを表示します。 + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. 選択ツールは文字をベースライン、エリア内文字の枠、またはパス上でのみ選択し、ボックス内の任意の場所では選択しません。 + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. フォントメニューに各フォントを英語名で表示します。オフにすると、自国語の名前も持つフォントはその名前で表示されます。 + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. 新しいエリア内文字は自動サイズ調整がオンの状態で作成され、横組みの長方形の枠は文字に合わせて高さが伸び縮みします。 + Font lists and the Type › Font menu show a sample of each font beside its name. フォントリストとフォントメニューに、各フォントの名前の横にそのフォントのサンプルを表示します。 + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. フォントのサンプルを、インターフェイスの明るさにかかわらず白地に濃い色の文字で描きます。メニュー内のフォントプレビューがオンのときだけ有効です。 + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. 文字パネルなどのフォント欄のリストで各行をどれだけ高くするか、つまり各サンプルの大きさです。 + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. 最近使用したフォントとフォントリストに、最後に使ったフォントを新しい順にいくつ表示するかです (1~15)。 + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. 文字のフォントまたはフォントスタイルを変えたとき、新しいフォントに字形がない文字は元のフォントのままになります。 + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. OpenType 機能で置き換えられた合字などの字形を、カンバス上でピンクのハイライトで示します。プリントや書き出しには含まれません。 + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. 文字ツールで 1 文字を選択すると、カンバス上のその横に、選べる異体字の列が表示されます。 + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. フォントが見つからず代替フォントで描かれた文字を、カンバス上でピンクのハイライトで示します。プリントや書き出しには含まれません。 + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. 文字ツールで作成した新しい文字は、選択されたサンプルテキストで始まり、入力するとそれが置き換わります。 + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. 段落の先頭で 1. や * などのリスト記号とスペースを入力すると、その段落がリストになります。 + Fonts in this folder show in the font menus and can be used without being installed. このフォルダーのフォントはフォントメニューに表示され、インストールせずに使えます。 + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. 文字にグラフィックスタイルを適用すると、スタイルに塗りや線があればその文字自体の塗りや線が取り除かれ、スタイルのペイントが見えるようになります。 + Align and Distribute measure point type by the ink of its glyphs instead of its em box. 整列と分布は、ポイント文字を仮想ボディではなく字形のインクで測ります。 + Align and Distribute measure area type by the ink of its glyphs instead of its frame. 整列と分布は、エリア内文字を枠ではなく字形のインクで測ります。 + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. バウンディングボックスと変形パネルは、ポイント文字を仮想ボディではなく字形のインクで測ります。 Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. グリッドが非表示でも、描画、移動、拡大・縮小をグリッドの分割位置にスナップします。オンの間は「ピクセルにスナップ」は働きません。 The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. 選択されていないガイドの色です。ガイドのラベルを設定したアートボードは、自身のガイドをラベルの色で描きます。 Draws guides as solid lines or as dots, including the guides already in the document. ドキュメントにすでにあるガイドも含め、ガイドを実線または点線で描きます。 @@ -3219,6 +3256,7 @@ mark-style Japanese 日本式 Rounded Rectangle 角丸長方形 Rounded Rectangle Tool 角丸長方形ツール Row Size: 行のサイズ: + Rows 行数 Rows: 行数: Rule: ルール: Rulers & Grids 定規とグリッド @@ -4518,7 +4556,7 @@ theme Appearance 外観 Free Transform 自由変形 Perspective Distort 遠近変形 -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Radial Blur… ぼかし (放射状)… Blur Center ぼかしの中心 Smart Blur… ぼかし (詳細)… @@ -5392,6 +5430,8 @@ swatch Bright Violet ビビッドバイオレット @msg the script is no longer in the Scripts folder スクリプトは Scripts フォルダーにもうありません Some scripts were not listed 一部のスクリプトは一覧に表示されていません The Scripts folder cannot be read Scripts フォルダーを読み込めません + Loading scripts… スクリプトを読み込み中… + The Scripts folder is still being read Scripts フォルダーをまだ読み込んでいます @msg the script's run is no longer available スクリプトの実行は利用できなくなりました @msg a failed command changed undo steps that could not be put back, so the script was stopped 失敗したコマンドが元に戻せない取り消し手順を変更したため、スクリプトを停止しました @msg a recovery copy could not be written, so the script was not run 復元用のコピーを書き込めなかったため、スクリプトは実行されませんでした @@ -5559,6 +5599,8 @@ liquify-list-end {0}, {1} {0}、{1} @msg All colors are within the CMYK gamut すべてのカラーが CMYK の色域内です @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} 個のカラーが CMYK の色域外です @msg Unembedded to {_1} 埋め込みを解除して {_1} に保存しました +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} {n} 枚の画像の埋め込みを解除して {folder} に保存しました +@msg every numbered name for {name} is taken in that folder そのフォルダーでは、{name} の番号付きの名前がすべて使われています @msg no swatch library `{l}` (see swatch.library.list) スウォッチライブラリ `{l}` が見つかりません (swatch.library.list を参照) @msg no user library folder here この環境にはユーザーライブラリフォルダーがありません @msg Couldn't place {name}: the document it was dropped on was closed {name} を配置できませんでした: ドロップ先のドキュメントは閉じられています @@ -5661,6 +5703,8 @@ liquify-list-end {0}, {1} {0}、{1} @msg automation path rejected: outside the read root {root}: {path} 自動化のパスを拒否しました: 読み込みルート {root} の外です: {path} @msg automation path rejected: outside the read roots {roots}: {path} 自動化のパスを拒否しました: 読み込みルート {roots} のいずれの中でもありません: {path} @msg a linked JavaScript file is outside the read roots リンクされた JavaScript ファイルが読み込みルートの外にあります +@msg a linked image file is outside the read roots リンクされた画像ファイルが読み込みルートの外にあります +@msg a linked file's export folder is outside the read roots リンクされたファイルの書き出しフォルダーが読み込みルートの外にあります @msg automation path rejected: outside the write root {root}: {path} 自動化のパスを拒否しました: 書き込みルート {root} の外です: {path} @msg automation path rejected: outside the write roots {roots}: {path} 自動化のパスを拒否しました: 書き込みルート {roots} のいずれの中でもありません: {path} @msg automation path rejected: path is empty 自動化のパスを拒否しました: パスが空です @@ -5891,6 +5935,7 @@ lighting Light ライト @msg missing panel layout パネル配置がありません @msg unsupported native docking operation ネイティブドッキング操作は未対応です Linux Display Server Linux ディスプレイサーバー + Low-Latency Drawing 低遅延描画 X11 (XWayland) When a Pen Is Attached ペン接続時は X11 (XWayland) If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. ペンタブレットのペンで描画できない場合は、X11 (XWayland) のいずれかを選択してください。 X11 (XWayland) X11 (XWayland) @@ -7342,6 +7387,8 @@ axis Y Axis Y 軸 @msg `{f}` is the copy of a document open now `{f}` は現在開いているドキュメントのコピーです @msg `{id}` is no writable format (see document.formats) `{id}` は書き出せる形式ではありません (document.formats を参照) @msg `{id}` isn't a loaded library `{id}` は読み込まれているライブラリではありません +@msg `{file}` has no swatches of its own `{file}` には独自のスウォッチがありません +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` にはパターンスウォッチがあり、.vcswatches ファイルには保存できません @msg `{key}` has no colours `{key}` にカラーがありません @msg `{key}` is a design name `{key}` にはデザイン名を指定してください @msg `{key}` is a design name or a list of them `{key}` にはデザイン名またはそのリストを指定してください @@ -7564,7 +7611,13 @@ axis Y Axis Y 軸 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel には {own} (ドキュメントのモード)、grayscale、bitmap のいずれかを指定してください @msg colour groups can't go into colour groups カラーグループをカラーグループに入れることはできません @msg colour, mode and spot apply to solid-colour swatches only colour、mode、spot を適用できるのは単色のスウォッチだけです -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read 列 {column}: `{cell}` はグラフデータファイルの `%` 列で、読み込まれません +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` は相対パスです: `base` か絶対パスを指定してください +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line} 行目、列 {column}: `{var}` のグラフデータファイルを読み込めません: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` は参照しません: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` が {MAX_GRAPH_DATA_FILE} バイトを超えています +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line} 行目、列 {column}: `{var}` のグラフデータファイル `{path}` から得られるグラフの値が {MAX_GRAPH_CSV} バイトを超えています +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line} 行目、列 {column}: グラフデータファイルが合計で {MAX_GRAPH_FILES_TOTAL} バイトを超えています +@msg `base` is empty `base` が空です @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable 列 {column}: `{cell}` が指定している `{name}` は {_1} 変数です @msg column {column}: `{cell}` names no variable 列 {column}: `{cell}` に該当する変数はありません @msg column {column}: the variable name is longer than {MAX_NAME} characters 列 {column}: 変数名が {MAX_NAME} 文字を超えています @@ -8885,6 +8938,12 @@ anchor Points: ポイント: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` には "free"、"keepAngles" または "symmetric" を指定してください @msg `{key}` must be [x, y] `{key}` には [x, y] を指定してください +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter 単位換算 + Unit Converter Panel 単位換算パネル + Copy with Units 単位付きでコピー + From Selection 選択範囲から + # Color Effects add-on: Select by Color Kind. Select by Color Kind カラーの種類で選択 Objects with Spot Colors 特色を使用したオブジェクト diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 81eeae3088..b62252fdd5 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -409,6 +409,8 @@ @msg `{f}` is the copy of a document open now `{f}` ახლა გახსნილი დოკუმენტის ასლია @msg `{id}` is no writable format (see document.formats) `{id}` ჩაწერადი ფორმატი არ არის (იხ. document.formats) @msg `{id}` isn't a loaded library `{id}` ჩატვირთული ბიბლიოთეკა არ არის +@msg `{file}` has no swatches of its own `{file}`-ს საკუთარი ფერის ნიმუშები არ აქვს +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}`-ს აქვს პატერნის ნიმუშები, რომლებსაც .vcswatches ფაილი ვერ შეინახავს @msg `{key}` has no colours `{key}`: ფერები არ არის @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` {MAX_EDIT_WORDS}-ზე მეტ სიტყვას შეიცავს @msg `{key}` is a design name `{key}` არის დიზაინის სახელი @@ -2062,6 +2064,7 @@ @msg {var_key} must be 0 or more {var_key} უნდა იყოს 0 ან მეტი @msg {var_key} must be at most {most} {var_key} უნდა იყოს მაქსიმუმ {most} @msg a linked image file is outside the read roots დაკავშირებული გამოსახულების ფაილი წაკითხვის ძირეული საქაღალდეების გარეთაა +@msg a linked file's export folder is outside the read roots დაკავშირებული ფაილის ექსპორტის საქაღალდე წაკითხვის ძირეული საქაღალდეების გარეთაა Neon & Glow ნეონი და ნათება Show Hidden Panels at Edge დამალული პანელების ჩვენება კიდესთან @msg `anchor` must be a [subpath, anchor] pair `anchor` უნდა იყოს წყვილი [subpath, anchor] @@ -2331,6 +2334,8 @@ Shear… დახრა… Transform Each… თითოეულის გარდაქმნა… Reset Bounding Box შემომსაზღვრელი ჩარჩოს ჩამოყრა + Rotate Bounding Box შემომსაზღვრელი ჩარჩოს შემობრუნება + Rotate Bounding Box… შემომსაზღვრელი ჩარჩოს შემობრუნება… Arrange დალაგება Bring to Front წინა პლანზე გადმოტანა Bring Forward წინ გადმოტანა @@ -3585,6 +3590,7 @@ lighting Light სინათლე Play Current Selection მიმდინარე მონიშნულის შესრულება Save Actions… მოქმედებების შენახვა… Load Actions… მოქმედებების ჩატვირთვა… + Replace Actions… მოქმედებების ჩანაცვლება… Reset Actions მოქმედებების ჩამოყრა Replace the current actions with the default set? ჩანაცვლდეს მიმდინარე მოქმედებები ნაგულისხმევი ნაკრებით? Append adds the default set after the current sets instead. „დამატება“ ამის ნაცვლად ნაგულისხმევ ნაკრებს მიმდინარე ნაკრებების შემდეგ ამატებს. @@ -4730,6 +4736,7 @@ digits Malayalam მალაიალამური BLANK DOCUMENT PRESETS ცარიელი დოკუმენტის პრესეტები Bleed ჭრისპირა არე Change to Right-to-Left Layout მარჯვნიდან მარცხნივ განლაგებაზე გადასვლა + Columns სვეტები Columns: სვეტები: Documents you create appear here. თქვენ მიერ შექმნილი დოკუმენტები აქ გამოჩნდება. More Settings მეტი პარამეტრი @@ -4862,6 +4869,9 @@ digits Malayalam მალაიალამური Open a document to preview its pages გახსენით დოკუმენტი მისი გვერდების წინასწარ სანახავად Output › Mode გამოტანა › რეჟიმი Overprint and Transparency Flattener Options ზედდაბეჭდვისა და გამჭვირვალობის გაბრტყელების პარამეტრები + Custom… მორგებული… + Custom Transparency Flattener Options გამჭვირვალობის გაბრტყელების მორგებული პარამეტრები + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS-ს არ აქვს ალფა-გამჭვირვალობა, ხოლო ზედდაბეჭდვები განსაზღვრავს, შენარჩუნდება თუ არა ზედდაბეჭდვები. Place the pages with the placement again გვერდების ხელახლა განთავსება განთავსების მიხედვით Placement: განთავსება: Preserve CMYK Numbers CMYK მნიშვნელობების შენარჩუნება @@ -4908,14 +4918,19 @@ digits Malayalam მალაიალამური Around Object ობიექტის ირგვლივ Background: ფონი: Changing these settings changes how raster effects look when exported, flattened or expanded. ამ პარამეტრების შეცვლა ცვლის, თუ როგორ გამოიყურება რასტრული ეფექტები ექსპორტის, გაბრტყელების ან გაშლის შემდეგ. + Add Around ობიექტის ირგვლივ დამატება + Anti Alias ანტიალიასინგი + Color Model ფერის მოდელი Color Model: ფერის მოდელი: Create Clipping Mask მომჭრელი ნიღბის შექმნა Preserve Spot Colors სპოტ-ფერების შენარჩუნება + Resolution გარჩევადობა Resolution: გარჩევადობა: Transparent გამჭვირვალე Layout Order: განლაგების რიგი: Change to Left-to-Right Layout მარცხნიდან მარჯვნივ განლაგებაზე გადასვლა Artboards: {n} სამუშაო დაფა: {n} + Rows სტრიქონები Rows: სტრიქონები: Assign მინიჭება Color Group: ფერთა ჯგუფი: @@ -5798,6 +5813,7 @@ theme Appearance იერსახე Enable Rubber Band for რეზინის ზოლის ჩართვა: Enable Touch Gestures შეხების ჟესტების ჩართვა Switch Selection and Drawing Modes მონიშვნისა და ხატვის რეჟიმების გადართვა + Select Last Selection Tool ბოლოს გამოყენებული მონიშვნის ხელსაწყოს არჩევა Enable Touch Workspace სენსორული სამუშაო სივრცის ჩართვა English: UK ინგლისური: ბრიტანეთი Every (minutes) ყოველ (წუთში) @@ -5931,6 +5947,7 @@ theme Appearance იერსახე Scroll Sideways with Cmd/Ctrl + Wheel ჰორიზონტალური გადაადგილება Cmd/Ctrl + ბორბლით Scrub Numeric Fields by Dragging რიცხვითი ველების შეცვლა გადათრევით Linux Display Server Linux-ის ეკრანის სერვერი + Low-Latency Drawing დაბალი დაყოვნების ხატვა Print Preview ნახვა ამობეჭდვამდე Print Setup ბეჭდვის მომართვა Bitmap ბიტმაპი @@ -6305,6 +6322,29 @@ font-technology Variable ცვლადი The unit for East Asian type measurements, which no field uses yet. აღმოსავლეთაზიური ტექსტის ზომების ერთეული, რომელსაც ჯერჯერობით არცერთი ველი არ იყენებს. When on, a number typed without a unit into a field in picas is read in points. ჩართვისას პიკებში მოცემულ ველში ერთეულის გარეშე აკრეფილი რიცხვი პუნქტებში იკითხება. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML ID-ის არჩევისას ობიექტების სახელები შრეების პანელში, ცვლადების პანელსა და შრის პარამეტრებში XML ID-ებად ჩანს. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. ტექსტის ზომისა და სტრიქონთაშორისის ბიჯი: Cmd/Ctrl+Shift+. და Cmd/Ctrl+Shift+, ზომას ერთი ბიჯით ცვლის (Alt-ით ხუთით); ჰორიზონტალურ ტექსტში Alt და ზემოთ ან ქვემოთ ისარი სტრიქონთაშორისს ერთი ბიჯით ცვლის (Cmd/Ctrl-ით ხუთით). + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. ტრეკინგისა და კერნინგის ბიჯი em-ის მეათასედებში: ჰორიზონტალურ ტექსტში Alt მარცხენა ან მარჯვენა ისართან ერთად კურსორთან კერნინგს ან მონიშნული ტექსტის ტრეკინგს ერთი ბიჯით ცვლის, Cmd/Ctrl-თან ერთად კი ხუთით. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. საბაზისო ხაზის წანაცვლების ბიჯი: ჰორიზონტალურ ტექსტში Alt და Shift ზემოთ ან ქვემოთ ისართან ერთად საბაზისო ხაზს ერთი ბიჯით ანაცვლებს, Cmd/Ctrl-თან ერთად კი ხუთით. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. აჩვენებს იაპონური და სხვა აღმოსავლეთაზიური ტექსტის პარამეტრებს პანელებში სიმბოლო, აბზაცი, OpenType და გლიფები, ასევე ბრძანებას კომპოზიტური შრიფტები. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. აჩვენებს არაბული, ებრაული და ინდური ტექსტის პარამეტრებს პანელებში სიმბოლო და აბზაცი, მაგალითად აბზაცის მიმართულებას, ქაშიდებს და ციფრებს. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. მონიშვნის ხელსაწყოები ტექსტს მხოლოდ მის საბაზისო ხაზზე, არის ტექსტის ჩარჩოზე ან მის კონტურზე მონიშნავენ და არა მისი ყუთის შიგნით ნებისმიერ ადგილას. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. შრიფტების მენიუები ყოველ შრიფტს ინგლისური სახელით აჩვენებს; გამორთვისას შრიფტი, რომელსაც საკუთარ ენაზეც აქვს სახელი, იმ სახელს აჩვენებს. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. ახალი არის ტექსტი ჩართული ავტომატური ზომით იწყება, ამიტომ ჰორიზონტალური ტექსტის მართკუთხა ჩარჩო სიმაღლეში იზრდება ან მცირდება, რომ ტექსტი დაეტიოს. + Font lists and the Type › Font menu show a sample of each font beside its name. შრიფტების სიები და მენიუ შრიფტი თითოეული შრიფტის ნიმუშს მისი სახელის გვერდით აჩვენებს. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. შრიფტის ნიმუშები მუქი ტექსტით თეთრზე იხატება ინტერფეისის სიკაშკაშის მიუხედავად; ეს მოქმედებს მხოლოდ მაშინ, როცა მენიუში შრიფტების გადახედვა ჩართულია. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. რამდენად მაღალია თითოეული სტრიქონი შრიფტის ველების სიებში, მაგალითად სიმბოლოს პანელში, და შესაბამისად რამდენად დიდია თითოეული ნიმუში. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. ბოლოს გამოყენებული რამდენი შრიფტი, 1-დან 15-მდე, ჩანს ბოლოდროინდელ შრიფტებსა და შრიფტების სიებში, უახლესი პირველი. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. ტექსტის შრიფტის ან შრიფტის სტილის შეცვლისას სიმბოლოები, რომელთათვისაც ახალ შრიფტს გლიფი არ აქვს, წინა შრიფტს ინარჩუნებენ. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. ტილოზე ვარდისფერი მონიშვნა აღნიშნავს OpenType-ის ფუნქციების მიერ ჩანაცვლებულ გლიფებს, მაგალითად ლიგატურებს; ის არ იბეჭდება და არ ექსპორტდება. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. ტექსტის ხელსაწყოთი ერთი სიმბოლოს მონიშვნისას ტილოზე მის გვერდით ჩანს მისი ალტერნატიული გლიფების რიგი ასარჩევად. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. ტილოზე ვარდისფერი მონიშვნა აღნიშნავს ტექსტს, რომელიც შემცვლელი შრიფტით იხატება, რადგან მისი შრიფტი აკლია; ის არ იბეჭდება და არ ექსპორტდება. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. ტექსტის ხელსაწყოთი შექმნილი ახალი ტექსტი მონიშნული ჩანაცვლების ტექსტით იწყება, რომელსაც აკრეფილი ტექსტი ცვლის. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. აბზაცის დასაწყისში სიის ნიშნის, მაგალითად 1. ან *, და შემდეგ ჰარის აკრეფა აბზაცს სიად აქცევს. + Fonts in this folder show in the font menus and can be used without being installed. ამ საქაღალდის შრიფტები შრიფტების მენიუებში ჩანს და მათი გამოყენება დაყენების გარეშეა შესაძლებელი. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. ტექსტზე გრაფიკული სტილის გამოყენება სიმბოლოებს საკუთარ შევსებას ან კონტურს აშორებს იქ, სადაც სტილს ისინი აქვს, რათა სტილის საღებავი გამოჩნდეს. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. სწორება და განაწილება წერტილის ტექსტს მისი გლიფების მელნით ზომავს და არა მისი em-ყუთით. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. სწორება და განაწილება არის ტექსტს მისი გლიფების მელნით ზომავს და არა მისი ჩარჩოთი. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. შემომსაზღვრელი ჩარჩო და გარდაქმნის პანელი წერტილის ტექსტს მისი გლიფების მელნით ზომავს და არა მისი em-ყუთით. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. ხატვას, გადაადგილებასა და მასშტაბირებას ბადის დაყოფებზე მიაბამს, მაშინაც კი, როცა ბადე დამალულია; სანამ ჩართულია, პიქსელზე მიბმა არ მოქმედებს. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. არჩეული არ მყოფი დამხმარე ხაზების ფერი; იარლიყიანი სამუშაო დაფა საკუთარ დამხმარე ხაზებს იარლიყის ფერით ხატავს. Draws guides as solid lines or as dots, including the guides already in the document. დამხმარე ხაზებს უწყვეტი ხაზებით ან წერტილებით ხატავს, დოკუმენტში უკვე არსებულების ჩათვლით. @@ -7236,6 +7276,8 @@ font-technology Variable ცვლადი @msg All colors are within the CMYK gamut ყველა ფერი CMYK-ის გამის ფარგლებშია @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut CMYK-ის გამის ფარგლებს გარეთაა ფერი ({n}) @msg Unembedded to {_1} ჩაშენება მოხსნილია: {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} ჩაშენება მოხსნილია, გამოსახულებები: {n}, საქაღალდე: {folder} +@msg every numbered name for {name} is taken in that folder იმ საქაღალდეში {name}-ის ყველა დანომრილი სახელი დაკავებულია @msg Reset {_1} ჩამოყრილია: {_1} @msg Sent to {_1} გაგზავნილია: {_1} @msg {_1} files ფაილები: {_1} @@ -8017,6 +8059,8 @@ imageTrace Outline კონტური @msg the script is no longer in the Scripts folder სკრიპტი აღარ არის Scripts საქაღალდეში Some scripts were not listed ზოგიერთი სკრიპტი არ არის ჩამოთვლილი The Scripts folder cannot be read Scripts საქაღალდის წაკითხვა შეუძლებელია + Loading scripts… სკრიპტების ჩატვირთვა… + The Scripts folder is still being read Scripts საქაღალდე ჯერ კიდევ იკითხება @msg the script's run is no longer available სკრიპტის გაშვება აღარ არის ხელმისაწვდომი @msg a failed command changed undo steps that could not be put back, so the script was stopped წარუმატებელმა ბრძანებამ დაბრუნების ნაბიჯები შეცვალა და მათი პირვანდელ მდგომარეობაში მოყვანა ვერ მოხერხდა, ამიტომ სკრიპტი შეჩერდა @msg a recovery copy could not be written, so the script was not run აღდგენის ასლის ჩაწერა ვერ მოხერხდა, ამიტომ სკრიპტი არ გაეშვა @@ -8246,6 +8290,8 @@ liquify-list-end {0}, {1} {0} და {1} Keep selected მონიშნულად დატოვება Reset Tracking and Kerning ტრეკინგისა და კერნინგის ჩამოყრა Highlight Font Name შრიფტის სახელის გამოკვეთა + Highlight Font Size შრიფტის ზომის გამოკვეთა + Other… სხვა… Highlight Kerning კერნინგის გამოკვეთა Highlight Tracking ტრეკინგის გამოკვეთა Legacy (version 7) ძველი (ვერსია 7) @@ -9596,6 +9642,12 @@ anchor Points: წერტილები: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` უნდა იყოს "free", "keepAngles" ან "symmetric" @msg `{key}` must be [x, y] `{key}` უნდა იყოს [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter ერთეულების გადამყვანი + Unit Converter Panel ერთეულების გადამყვანის პანელი + Copy with Units ერთეულებით კოპირება + From Selection მონიშნულიდან + # Color Effects add-on: Select by Color Kind. Select by Color Kind ფერის სახეობით არჩევა Objects with Spot Colors ობიექტები სპოტ-ფერებით diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 64ecc94d0d..cda6faa065 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -210,6 +210,8 @@ digits Malayalam 말라얄람어 Shear… 기울이기… Transform Each… 각각 변형… Reset Bounding Box 경계 상자 재설정 + Rotate Bounding Box 경계 상자 회전 + Rotate Bounding Box… 경계 상자 회전… Arrange 정렬 순서 Bring to Front 맨 앞으로 가져오기 Bring Forward 앞으로 가져오기 @@ -457,6 +459,8 @@ digits Malayalam 말라얄람어 Reset Tracking and Kerning 자간 및 커닝 재설정 Reset Horizontal Scale 가로 비율 재설정 Highlight Font Name 글꼴 이름 강조 표시 + Highlight Font Size 글꼴 크기 강조 표시 + Other… 기타… Highlight Kerning 커닝 강조 표시 Highlight Tracking 자간 강조 표시 Step Type 단계별 문자 @@ -1045,6 +1049,7 @@ digits Malayalam 말라얄람어 Add Anchor (Pen) 앵커 추가(펜) Add Anchor Point 앵커 포인트 추가 Add Anchor Point Tool 앵커 포인트 추가 도구 + Add Around 개체 주위에 추가 Add Effect 효과 추가 Add Freeform Line 자유형 선 추가 Add Freeform Point 자유형 점 추가 @@ -1106,6 +1111,7 @@ digits Malayalam 말라얄람어 Angle: 각도: Angles 각도 Animated Zoom 애니메이션 확대/축소 + Anti Alias 안티 앨리어싱 Anti-Alias 안티 앨리어싱 Anti-alias 안티 앨리어싱 Anti-alias Rasters 래스터 안티 앨리어싱 @@ -1330,6 +1336,7 @@ antiAlias Sharp 날카롭게 Color Guide Options… 색상 가이드 옵션… Color Mode 색상 모드 Color Mode: 색상 모드: + Color Model 색상 모델 Color Model: 색상 모델: Color Models 색상 모델 Color Picker 색상 피커 @@ -1348,6 +1355,7 @@ antiAlias Sharp 날카롭게 Colors 색상 Colors: 색상: Column Graph Tool 세로 막대 그래프 도구 + Columns 열 Columns: 열: Coming soon — tracked in the parity plan 곧 제공 예정 — 기능 동등성 계획에서 관리 중 Command Click to Select Objects Behind Command-클릭으로 뒤쪽 개체 선택 @@ -1686,6 +1694,7 @@ antiAlias Sharp 날카롭게 Enable Rubber Band for 러버 밴드 사용 대상 Enable Touch Gestures 터치 제스처 사용 Switch Selection and Drawing Modes 선택 모드와 그리기 모드 전환 + Select Last Selection Tool 마지막으로 사용한 선택 도구로 전환 Enable Touch Workspace 터치 작업 영역 사용 Enable copying of text, images and other content 텍스트, 이미지 및 기타 콘텐츠 복사 허용 Enable in-menu font previews 메뉴에서 글꼴 미리 보기 사용 @@ -2718,6 +2727,9 @@ antiAlias Sharp 날카롭게 Overprint Stroke 선 오버프린트 Overprint and Transparency Flattener 오버프린트 및 투명도 병합 Overprint and Transparency Flattener Options 오버프린트 및 투명도 병합 옵션 + Custom… 사용자 지정… + Custom Transparency Flattener Options 사용자 지정 투명도 병합 옵션 + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS에는 알파 투명도가 없으며, 오버프린트 설정에 따라 오버프린트 유지 여부가 결정됩니다. Overprint: 오버프린트: Overprints: 오버프린트: Override Character Color 문자 색상 덮어쓰기 @@ -2792,6 +2804,7 @@ diagnostics ui UI Play Current Selection 현재 선택 항목 재생 Save Actions… 액션 저장… Load Actions… 액션 불러오기… + Replace Actions… 액션 바꾸기… Reset Actions 액션 재설정 Replace the current actions with the default set? 현재 액션을 기본 세트로 바꾸시겠습니까? Append adds the default set after the current sets instead. 추가를 누르면 대신 기본 세트를 현재 세트 뒤에 추가합니다. @@ -3089,6 +3102,7 @@ mark-style Japanese 일본식 Reshape Segment 세그먼트 모양 다듬기 Reshape Tool 모양 다듬기 도구 Reshape Type Area 문자 영역 모양 다듬기 + Resolution 해상도 Resolution: 해상도: Responsive 반응형 Restore 복원 @@ -3146,6 +3160,29 @@ mark-style Japanese 일본식 The unit for East Asian type measurements, which no field uses yet. 동아시아 문자 측정에 쓰는 단위로, 아직 이 단위를 쓰는 필드는 없습니다. When on, a number typed without a unit into a field in picas is read in points. 켜면 파이카 필드에 단위 없이 입력한 숫자를 포인트로 읽습니다. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML ID를 고르면 레이어, 변수, 레이어 옵션에서 개체 이름이 XML ID로 표시됩니다. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. 문자 크기와 행간의 단계입니다. Cmd/Ctrl+Shift+. 와 Cmd/Ctrl+Shift+, 는 크기를 한 단계, Alt도 누르면 다섯 단계 바꿉니다. 가로 문자에서 Alt와 위쪽 또는 아래쪽 화살표는 행간을 한 단계, Cmd/Ctrl도 누르면 다섯 단계 바꿉니다. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. 자간과 커닝의 단계로, 단위는 1/1000 em입니다. 가로 문자에서 Alt와 왼쪽 또는 오른쪽 화살표는 캐럿 위치의 커닝이나 선택한 텍스트의 자간을 한 단계, Cmd/Ctrl도 누르면 다섯 단계 바꿉니다. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. 기준선 이동의 단계입니다. 가로 문자에서 Alt, Shift와 위쪽 또는 아래쪽 화살표는 기준선을 한 단계, Cmd/Ctrl도 누르면 다섯 단계 옮깁니다. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. 문자, 단락, OpenType, 글리프 패널에 일본어 등 동아시아 문자의 옵션을 표시하고 합성 글꼴 명령도 표시합니다. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. 문자 패널과 단락 패널에 단락 방향, 카시다, 숫자 등 아랍어, 히브리어, 인도계 문자의 옵션을 표시합니다. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. 선택 도구는 문자를 기준선, 영역 문자의 프레임 또는 패스에서만 선택하며 상자 안의 아무 곳에서나 선택하지 않습니다. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. 글꼴 메뉴에 각 글꼴을 영어 이름으로 표시합니다. 끄면 자국어 이름도 있는 글꼴은 그 이름으로 표시됩니다. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. 새 영역 문자는 자동 크기가 켜진 상태로 시작하므로 가로 문자의 직사각형 프레임이 텍스트에 맞게 높이가 늘거나 줄어듭니다. + Font lists and the Type › Font menu show a sample of each font beside its name. 글꼴 목록과 글꼴 메뉴에 각 글꼴 이름 옆에 그 글꼴의 견본을 표시합니다. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. 글꼴 견본을 인터페이스 밝기와 관계없이 흰 바탕에 어두운 글자로 그립니다. 메뉴의 글꼴 미리 보기가 켜져 있을 때만 적용됩니다. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. 문자 패널 같은 글꼴 필드의 목록에서 각 행의 높이이며, 따라서 각 견본의 크기입니다. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. 최근 글꼴과 글꼴 목록에 마지막으로 사용한 글꼴을 최신순으로 몇 개 표시할지입니다(1~15). + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. 텍스트의 글꼴이나 글꼴 스타일을 바꿀 때 새 글꼴에 글리프가 없는 문자는 원래 글꼴을 유지합니다. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. OpenType 기능이 대체한 합자 등의 글리프를 캔버스에서 분홍색 강조로 표시합니다. 인쇄나 내보내기에는 포함되지 않습니다. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. 문자 도구로 한 글자를 선택하면 캔버스에서 그 옆에 고를 수 있는 대체 글리프 줄이 표시됩니다. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. 글꼴이 없어 대체 글꼴로 그려진 텍스트를 캔버스에서 분홍색 강조로 표시합니다. 인쇄나 내보내기에는 포함되지 않습니다. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. 문자 도구로 만든 새 문자는 선택된 자리 표시자 텍스트로 시작하며, 입력하면 그 텍스트가 바뀝니다. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. 단락 시작에서 1. 또는 * 같은 목록 기호와 공백을 입력하면 그 단락이 목록이 됩니다. + Fonts in this folder show in the font menus and can be used without being installed. 이 폴더의 글꼴은 글꼴 메뉴에 표시되며 설치하지 않고 사용할 수 있습니다. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. 문자에 그래픽 스타일을 적용하면 스타일에 칠이나 선이 있는 곳에서 문자 자체의 칠이나 선이 제거되어 스타일의 페인트가 보입니다. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. 정렬과 분포는 포인트 문자를 em 상자 대신 글리프의 잉크로 측정합니다. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. 정렬과 분포는 영역 문자를 프레임 대신 글리프의 잉크로 측정합니다. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. 테두리 상자와 변형 패널은 포인트 문자를 em 상자 대신 글리프의 잉크로 측정합니다. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. 격자가 숨겨져 있어도 그리기, 이동, 크기 조절을 격자의 세분 위치에 스냅합니다. 켜져 있는 동안에는 픽셀에 스냅이 적용되지 않습니다. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. 선택되지 않은 안내선의 색상입니다. 안내선 레이블이 있는 아트보드는 자신의 안내선을 레이블 색상으로 그립니다. Draws guides as solid lines or as dots, including the guides already in the document. 문서에 이미 있는 안내선을 포함해 안내선을 실선 또는 점으로 그립니다. @@ -3208,6 +3245,7 @@ mark-style Japanese 일본식 Rounded Rectangle 둥근 사각형 Rounded Rectangle Tool 둥근 사각형 도구 Row Size: 행 크기: + Rows 행 Rows: 행: Rule: 규칙: Rulers & Grids 눈금자 및 격자 @@ -5319,6 +5357,8 @@ theme Appearance 외관 @msg the script is no longer in the Scripts folder 스크립트가 더 이상 Scripts 폴더에 없습니다 Some scripts were not listed 일부 스크립트가 나열되지 않았습니다 The Scripts folder cannot be read Scripts 폴더를 읽을 수 없습니다 + Loading scripts… 스크립트 불러오는 중… + The Scripts folder is still being read Scripts 폴더를 아직 읽는 중입니다 @msg the script's run is no longer available 스크립트 실행을 더 이상 사용할 수 없습니다 @msg a failed command changed undo steps that could not be put back, so the script was stopped 실패한 명령이 되돌릴 수 없는 실행 취소 단계를 변경하여 스크립트를 중지했습니다 @msg a recovery copy could not be written, so the script was not run 복구 사본을 쓸 수 없어 스크립트를 실행하지 않았습니다 @@ -5486,6 +5526,8 @@ liquify-list-end {0}, {1} {0} 및 {1} @msg All colors are within the CMYK gamut 모든 색상이 CMYK 색상 범위 안에 있습니다 @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut 색상 {n}개가 CMYK 색상 범위를 벗어났습니다 @msg Unembedded to {_1} {_1}에 포함 해제했습니다 +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} 이미지 {n}개를 {folder}에 포함 해제했습니다 +@msg every numbered name for {name} is taken in that folder 해당 폴더에서 {name}을(를) 위한 번호 이름이 모두 사용 중입니다 @msg no swatch library `{l}` (see swatch.library.list) 견본 라이브러리 `{l}`이(가) 없습니다(swatch.library.list 참조) @msg no user library folder here 여기에는 사용자 라이브러리 폴더가 없습니다 @msg Couldn't place {name}: the document it was dropped on was closed {name}을(를) 가져올 수 없습니다: 놓은 문서가 닫혔습니다 @@ -5588,6 +5630,8 @@ liquify-list-end {0}, {1} {0} 및 {1} @msg automation path rejected: outside the read root {root}: {path} 자동화 경로가 거부되었습니다: 읽기 루트 {root} 밖입니다: {path} @msg automation path rejected: outside the read roots {roots}: {path} 자동화 경로가 거부되었습니다: 읽기 루트 {roots} 밖입니다: {path} @msg a linked JavaScript file is outside the read roots 연결된 JavaScript 파일이 읽기 루트 밖에 있습니다 +@msg a linked image file is outside the read roots 연결된 이미지 파일이 읽기 루트 밖에 있습니다 +@msg a linked file's export folder is outside the read roots 연결된 파일의 내보내기 폴더가 읽기 루트 밖에 있습니다 @msg automation path rejected: outside the write root {root}: {path} 자동화 경로가 거부되었습니다: 쓰기 루트 {root} 밖입니다: {path} @msg automation path rejected: outside the write roots {roots}: {path} 자동화 경로가 거부되었습니다: 쓰기 루트 {roots} 밖입니다: {path} @msg automation path rejected: path is empty 자동화 경로가 거부되었습니다: 경로가 비어 있습니다 @@ -5812,6 +5856,7 @@ lighting Light 광원 @msg missing panel layout 패널 레이아웃이 없습니다 @msg unsupported native docking operation 지원되지 않는 기본 도킹 작업 Linux Display Server Linux 디스플레이 서버 + Low-Latency Drawing 저지연 그리기 X11 (XWayland) When a Pen Is Attached 펜 연결 시 X11 (XWayland) If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. 드로잉 태블릿의 펜으로 그려지지 않으면 X11 (XWayland) 옵션을 선택하세요. X11 (XWayland) X11 (XWayland) @@ -6974,6 +7019,12 @@ anchor Points: 포인트: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode`는 "free", "keepAngles" 또는 "symmetric"이어야 합니다 @msg `{key}` must be [x, y] `{key}`은(는) [x, y]여야 합니다 +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter 단위 변환기 + Unit Converter Panel 단위 변환기 패널 + Copy with Units 단위 포함 복사 + From Selection 선택 영역에서 + # Color Effects add-on: Select by Color Kind. Select by Color Kind 색상 종류로 선택 Objects with Spot Colors 별색을 사용한 개체 @@ -7986,6 +8037,8 @@ breakText Glyphs 글리프 @msg `{f}` is the copy of a document open now `{f}`은(는) 지금 열려 있는 문서의 복사본입니다 @msg `{id}` is no writable format (see document.formats) `{id}`은(는) 기록할 수 있는 형식이 아닙니다(document.formats 참조) @msg `{id}` isn't a loaded library `{id}`은(는) 불러온 라이브러리가 아닙니다 +@msg `{file}` has no swatches of its own `{file}`에 자체 견본이 없습니다 +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}`에 패턴 견본이 있어 .vcswatches 파일에 담을 수 없습니다 @msg `{key}` has no colours `{key}`에 색상이 없습니다 @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}`에 단어가 {MAX_EDIT_WORDS}개보다 많습니다 @msg `{key}` is a design name `{key}`은(는) 디자인 이름입니다 @@ -8278,7 +8331,13 @@ breakText Glyphs 글리프 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel은 {own}(문서의 모드), grayscale 또는 bitmap이어야 합니다 @msg colour groups can't go into colour groups 색상 그룹은 색상 그룹 안에 넣을 수 없습니다 @msg colour, mode and spot apply to solid-colour swatches only colour, mode, spot은 단색 견본에만 적용됩니다 -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read {column}열: `{cell}`은(는) 그래프 데이터 파일의 `%` 열이며, 이 열은 읽지 않습니다 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`은(는) 상대 경로입니다. `base` 또는 절대 경로를 지정하세요 +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} {line}행, {column}열: `{var}`의 그래프 데이터 파일을 읽을 수 없습니다: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`을(를) 따라가지 않습니다: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`이(가) {MAX_GRAPH_DATA_FILE}바이트보다 큽니다 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes {line}행, {column}열: `{var}`의 그래프 데이터 파일 `{path}`에서 나온 그래프 값이 {MAX_GRAPH_CSV}바이트보다 깁니다 +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all {line}행, {column}열: 그래프 데이터 파일이 모두 합쳐 {MAX_GRAPH_FILES_TOTAL}바이트를 넘습니다 +@msg `base` is empty `base`가 비어 있습니다 @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable {column}열: `{cell}`이(가) 가리키는 `{name}`은(는) {_1} 변수입니다 @msg column {column}: `{cell}` names no variable {column}열: `{cell}`이(가) 가리키는 변수가 없습니다 @msg column {column}: the variable name is longer than {MAX_NAME} characters {column}열: 변수 이름이 {MAX_NAME}자보다 깁니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 1d05c63c57..b6859243ab 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -616,6 +616,8 @@ liquify-list-end {0}, {1} {0} en {1} Check Script Script controleren Some scripts were not listed Sommige scripts zijn niet weergegeven The Scripts folder cannot be read De map Scripts kan niet worden gelezen + Loading scripts… Scripts laden… + The Scripts folder is still being read De map Scripts wordt nog gelezen Other Script… Ander script… Document Setup… Documentinstellingen… Switch Units Eenheden wisselen @@ -733,6 +735,8 @@ liquify-list-end {0}, {1} {0} en {1} Shear… Schuin zetten… Transform Each… Elk afzonderlijk transformeren… Reset Bounding Box Begrenzingskader herstellen + Rotate Bounding Box Begrenzingskader roteren + Rotate Bounding Box… Begrenzingskader roteren… Arrange Schikken Bring to Front Naar de voorgrond brengen Bring Forward Naar voren brengen @@ -2021,6 +2025,7 @@ lighting Light Licht Play Current Selection Huidige selectie afspelen Save Actions… Acties opslaan… Load Actions… Acties laden… + Replace Actions… Acties vervangen… Reset Actions Acties opnieuw instellen Replace the current actions with the default set? De huidige acties vervangen door de standaardset? Append adds the default set after the current sets instead. Toevoegen voegt in plaats daarvan de standaardset toe na de huidige sets. @@ -3182,6 +3187,7 @@ digits Malayalam Malayalam BLANK DOCUMENT PRESETS LEGE DOCUMENTVOORINSTELLINGEN Bleed Afrulling Change to Right-to-Left Layout Omschakelen naar lay-out van rechts naar links + Columns Kolommen Columns: Kolommen: Documents you create appear here. Documenten die je maakt, verschijnen hier. More Settings Meer instellingen @@ -3315,6 +3321,9 @@ digits Malayalam Malayalam Open a document to preview its pages Open een document om een voorbeeld van de pagina's te bekijken Output › Mode Uitvoer › Modus Overprint and Transparency Flattener Options Opties voor overprint en transparantiepletter + Custom… Aangepast… + Custom Transparency Flattener Options Aangepaste opties voor transparantieafvlakking + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS heeft geen alfatransparantie, en Overdrukken bepaalt of overdrukken behouden blijven. Place the pages with the placement again Plaats de pagina's opnieuw met de plaatsing Placement: Plaatsing: Preserve CMYK Numbers CMYK-waarden behouden @@ -3364,14 +3373,19 @@ digits Malayalam Malayalam Around Object Rond object Background: Achtergrond: Changing these settings changes how raster effects look when exported, flattened or expanded. Als je deze instellingen wijzigt, verandert hoe rastereffecten eruitzien bij exporteren, pletten of uitbreiden. + Add Around Toevoegen rond object + Anti Alias Anti-aliasing + Color Model Kleurmodel Color Model: Kleurmodel: Create Clipping Mask Knipmasker maken Preserve Spot Colors Spotkleuren behouden + Resolution Resolutie Resolution: Resolutie: Transparent Transparant Layout Order: Indelingsvolgorde: Change to Left-to-Right Layout Omschakelen naar lay-out van links naar rechts Artboards: {n} Tekenborden: {n} + Rows Rijen Rows: Rijen: Assign Toewijzen Color Group: Kleurgroep: @@ -4329,6 +4343,7 @@ theme Appearance Vormgeving Enable Rubber Band for Rubberband inschakelen voor Enable Touch Gestures Touchgebaren inschakelen Switch Selection and Drawing Modes Wisselen tussen selectie- en tekenmodus + Select Last Selection Tool Laatst gebruikte selectiegereedschap kiezen Enable Touch Workspace Touch-werkruimte inschakelen English: UK Engels: VK Every (minutes) Elke (minuten) @@ -4461,6 +4476,7 @@ theme Appearance Vormgeving Scroll Sideways with Cmd/Ctrl + Wheel Horizontaal scrollen met Cmd/Ctrl + muiswiel Scrub Numeric Fields by Dragging Numerieke velden aanpassen door te slepen Linux Display Server Linux-weergaveserver + Low-Latency Drawing Tekenen met lage latentie Print Preview Afdrukvoorbeeld Print Setup Afdrukinstellingen Bitmap Bitmap @@ -4861,6 +4877,29 @@ font-technology Variable Variabel The unit for East Asian type measurements, which no field uses yet. De eenheid voor maten van Oost-Aziatische tekst, die nog geen enkel veld gebruikt. When on, a number typed without a unit into a field in picas is read in points. Wanneer dit aan staat, wordt een getal dat zonder eenheid in een veld in pica's wordt getypt, in punten gelezen. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Met XML-id worden objectnamen als XML-id's getoond in Lagen, Variabelen en Laagopties. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. De stap voor tekstgrootte en regelafstand: Cmd/Ctrl+Shift+. en Cmd/Ctrl+Shift+, veranderen de grootte één stap, of vijf met Alt erbij; in horizontale tekst verandert Alt met de pijl omhoog of omlaag de regelafstand één stap, of vijf met Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. De stap voor spatiëring en tekenpaarspatiëring, in duizendsten van een em: in horizontale tekst verandert Alt met de pijl links of rechts de tekenpaarspatiëring bij de cursor of de spatiëring van de geselecteerde tekst één stap, of vijf met Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. De stap voor basislijnverschuiving: in horizontale tekst verplaatsen Alt en Shift met de pijl omhoog of omlaag de basislijn één stap, of vijf met Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Toont de opties voor Japanse en andere Oost-Aziatische tekst in de panelen Teken, Alinea, OpenType en Glyphs, en de opdracht Samengestelde lettertypen. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Toont de opties voor Arabische, Hebreeuwse en Indische tekst in de panelen Teken en Alinea, zoals alinearichting, kashida's en cijfers. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. De selectiegereedschappen selecteren tekst alleen op de basislijn, het kader van de vlaktekst of het pad, niet overal binnen het tekstvak. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Lettertypemenu's tonen elk lettertype met de Engelse naam; uitgeschakeld toont een lettertype met ook een naam in de eigen taal die naam. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Nieuwe vlaktekst begint met Automatisch formaat aan, zodat een rechthoekig kader met horizontale tekst in hoogte groeit of krimpt tot de tekst past. + Font lists and the Type › Font menu show a sample of each font beside its name. Lettertypelijsten en het menu Lettertype tonen naast elke naam een voorbeeld van het lettertype. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Lettertypevoorbeelden worden in donkere tekst op wit getekend, ongeacht de helderheid van de interface; dit geldt alleen zolang voorvertoningen in menu's aan staan. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Hoe hoog elke rij is in de lijsten van lettertypevelden, zoals dat van het paneel Teken, en dus hoe groot elk voorbeeld is. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Hoeveel van de laatst gebruikte lettertypen, van 1 tot 15, Recente lettertypen en de lettertypelijsten tonen, het nieuwste eerst. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Als u het lettertype of de letterstijl van tekst wijzigt, houden tekens waarvoor het nieuwe lettertype geen glyph heeft hun oude lettertype. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Een roze markering op het canvas toont glyphs die door OpenType-functies zijn vervangen, zoals ligaturen; ze wordt niet afgedrukt of geëxporteerd. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Met het Type-gereedschap toont het selecteren van één teken ernaast op het canvas een rij alternatieve glyphs om uit te kiezen. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Een roze markering op het canvas toont tekst in een vervangend lettertype omdat het eigen lettertype ontbreekt; ze wordt niet afgedrukt of geëxporteerd. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Nieuwe tekst die met een tekstgereedschap wordt gemaakt, begint met geselecteerde opvultekst die uw invoer vervangt. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Een lijstteken zoals 1. of * gevolgd door een spatie aan het begin van een alinea typen maakt van de alinea een lijst. + Fonts in this folder show in the font menus and can be used without being installed. Lettertypen in deze map verschijnen in de lettertypemenu's en kunnen zonder installatie worden gebruikt. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Een grafische stijl op tekst toepassen verwijdert de eigen vulling of lijn van de tekens waar de stijl er een heeft, zodat de verf van de stijl zichtbaar is. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Uitlijnen en Verdelen meten punttekst naar de inkt van de glyphs in plaats van naar het em-vak. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Uitlijnen en Verdelen meten vlaktekst naar de inkt van de glyphs in plaats van naar het kader. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Het selectiekader en het paneel Transformeren meten punttekst naar de inkt van de glyphs in plaats van naar het em-vak. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Lijnt tekenen, verplaatsen en schalen uit op de onderverdelingen van het raster, ook als het raster verborgen is; zolang dit aan staat, geldt Uitlijnen op pixel niet. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. De kleur van hulplijnen die niet geselecteerd zijn; een tekenbord met een hulplijnlabel tekent zijn eigen hulplijnen in de kleur van het label. Draws guides as solid lines or as dots, including the guides already in the document. Tekent hulplijnen als doorgetrokken lijnen of als stippen, ook de hulplijnen die al in het document staan. @@ -5759,6 +5798,8 @@ imageTrace Outline Contour @msg All colors are within the CMYK gamut Alle kleuren vallen binnen het CMYK-gamut @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} kleur valt buiten het CMYK-gamut|{n} kleuren vallen buiten het CMYK-gamut @msg Unembedded to {_1} Extern gemaakt: {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} {n} afbeelding extern gemaakt in {folder}|{n} afbeeldingen extern gemaakt in {folder} +@msg every numbered name for {name} is taken in that folder elke genummerde naam voor {name} is al vergeven in die map @msg Reset {_1} {_1} opnieuw ingesteld @msg Sent to {_1} Verzonden naar {_1} @msg {_1} files {_1}-bestanden @@ -6230,6 +6271,8 @@ imageTrace Outline Contour @msg `{f}` is the copy of a document open now `{f}` is de kopie van een document dat nu geopend is @msg `{id}` is no writable format (see document.formats) `{id}` is geen schrijfbare indeling (zie document.formats) @msg `{id}` isn't a loaded library `{id}` is geen geladen bibliotheek +@msg `{file}` has no swatches of its own `{file}` heeft geen eigen stalen +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` heeft patroonstalen, die een .vcswatches-bestand niet kan bevatten @msg `{key}` has no colours `{key}` heeft geen kleuren @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` bevat meer dan {MAX_EDIT_WORDS} woorden @msg `{key}` is a design name `{key}` is de naam van een ontwerp @@ -6342,6 +6385,7 @@ imageTrace Outline Contour @msg a legend draws at most {MAX_CHIPS} swatches een legenda tekent maximaal {MAX_CHIPS} stalen @msg a linked JavaScript file is outside the read roots een gekoppeld JavaScript-bestand staat buiten de leesroots @msg a linked image file is outside the read roots een gekoppeld afbeeldingsbestand staat buiten de leesroots +@msg a linked file's export folder is outside the read roots de exportmap van een gekoppeld bestand staat buiten de leesroots @msg a name names one asset: give multiple: false, or one object een naam noemt één asset: geef multiple: false, of één object @msg a namespace declaration uses a reserved prefix or URI een naamruimtedeclaratie gebruikt een gereserveerd voorvoegsel of een gereserveerde URI @msg a namespace qualifier is undefined een naamruimtekwalificatie is niet gedefinieerd @@ -6524,7 +6568,13 @@ imageTrace Outline Contour @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel moet {own} (de modus van het document), grayscale of bitmap zijn @msg colour groups can't go into colour groups kleurgroepen kunnen niet in kleurgroepen worden geplaatst @msg colour, mode and spot apply to solid-colour swatches only colour, mode en spot gelden alleen voor stalen met een effen kleur -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read kolom {column}: `{cell}` is een `%`-kolom van grafiekgegevensbestanden, die niet worden gelezen +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` is een relatief pad: geef `base` of een absoluut pad op +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} regel {line}, kolom {column}: het grafiekgegevensbestand voor `{var}` kan niet worden gelezen: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` wordt niet gevolgd: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` is groter dan {MAX_GRAPH_DATA_FILE} bytes +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes regel {line}, kolom {column}: het grafiekgegevensbestand `{path}` voor `{var}` geeft een grafiekwaarde langer dan {MAX_GRAPH_CSV} bytes +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all regel {line}, kolom {column}: de grafiekgegevensbestanden bevatten samen meer dan {MAX_GRAPH_FILES_TOTAL} bytes +@msg `base` is empty `base` is leeg @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable kolom {column}: `{cell}` noemt `{name}`, en dat is een variabele van het type {_1} @msg column {column}: `{cell}` names no variable kolom {column}: `{cell}` noemt geen variabele @msg column {column}: the variable name is longer than {MAX_NAME} characters kolom {column}: de naam van de variabele is langer dan {MAX_NAME} tekens @@ -8345,6 +8395,8 @@ mark-style Japanese Japans Reset Tracking and Kerning Tracking en kerning herstellen Reset Horizontal Scale Horizontale schaal herstellen Highlight Font Name Lettertypenaam markeren + Highlight Font Size Lettertypegrootte markeren + Other… Andere… Highlight Kerning Kerning markeren Highlight Tracking Tracking markeren @msg span must be "object" or "selection", got {v} span moet "object" of "selection" zijn, maar is {v} @@ -9287,6 +9339,12 @@ anchor Points: Punten: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` moet "free", "keepAngles" of "symmetric" zijn @msg `{key}` must be [x, y] `{key}` moet [x, y] zijn +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Eenhedenomrekenaar + Unit Converter Panel Deelvenster Eenhedenomrekenaar + Copy with Units Kopiëren met eenheden + From Selection Uit selectie + # Color Effects add-on: Select by Color Kind. Select by Color Kind Selecteren op kleursoort Objects with Spot Colors Objecten met steunkleuren diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 861bf0d470..1f53255fd1 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -137,6 +137,8 @@ Shear… Pochyl… Transform Each… Przekształć każdy… Reset Bounding Box Resetuj obwiednię + Rotate Bounding Box Obróć obwiednię + Rotate Bounding Box… Obróć obwiednię… Arrange Ułóż Bring to Front Przenieś na wierzch Bring Forward Przesuń do przodu @@ -1462,6 +1464,7 @@ lighting Light Światło Play Current Selection Odtwórz bieżące zaznaczenie Save Actions… Zapisz operacje… Load Actions… Wczytaj operacje… + Replace Actions… Zastąp operacje… Reset Actions Resetuj operacje Replace the current actions with the default set? Zastąpić bieżące operacje zestawem domyślnym? Append adds the default set after the current sets instead. Dołącz dodaje zamiast tego zestaw domyślny po bieżących zestawach. @@ -2749,6 +2752,7 @@ digits Malayalam Malajalam BLANK DOCUMENT PRESETS USTAWIENIA PUSTEGO DOKUMENTU Bleed Spad Change to Right-to-Left Layout Zmień na układ od prawej do lewej + Columns Kolumny Columns: Kolumny: Documents you create appear here. Tu pojawią się utworzone dokumenty. More Settings Więcej ustawień @@ -2881,6 +2885,9 @@ digits Malayalam Malajalam Open a document to preview its pages Otwórz dokument, aby podejrzeć jego strony Output › Mode Wyjście › Tryb Overprint and Transparency Flattener Options Opcje nadruku i spłaszczania przezroczystości + Custom… Niestandardowe… + Custom Transparency Flattener Options Niestandardowe opcje spłaszczania przezroczystości + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS nie ma przezroczystości alfa, a Nadruki określają, czy nadruki są zachowywane. Place the pages with the placement again Ponownie rozmieść strony według położenia Placement: Położenie: Preserve CMYK Numbers Zachowaj wartości CMYK @@ -2929,14 +2936,19 @@ digits Malayalam Malajalam Around Object Wokół obiektu Background: Tło: Changing these settings changes how raster effects look when exported, flattened or expanded. Zmiana tych ustawień zmienia wygląd efektów rastrowych po eksporcie, spłaszczeniu lub rozszerzeniu. + Add Around Dodaj wokół obiektu + Anti Alias Wygładzanie + Color Model Model kolorów Color Model: Model kolorów: Create Clipping Mask Utwórz maskę przycinającą Preserve Spot Colors Zachowaj kolory dodatkowe + Resolution Rozdzielczość Resolution: Rozdzielczość: Transparent Przezroczyste Layout Order: Kolejność układu: Change to Left-to-Right Layout Zmień na układ od lewej do prawej Artboards: {n} Obszary kompozycji: {n} + Rows Wiersze Rows: Wiersze: Assign Przypisz Color Group: Grupa kolorów: @@ -3910,6 +3922,7 @@ theme Appearance Wygląd Enable Rubber Band for Włącz gumkę podglądu dla Enable Touch Gestures Włącz gesty dotykowe Switch Selection and Drawing Modes Przełącz tryby zaznaczania i rysowania + Select Last Selection Tool Wybierz ostatnie narzędzie zaznaczania Enable Touch Workspace Włącz dotykowy obszar roboczy English: UK Angielski: Wielka Brytania Every (minutes) Co (minuty) @@ -4042,6 +4055,7 @@ theme Appearance Wygląd Scroll Sideways with Cmd/Ctrl + Wheel Przewijaj w poziomie kółkiem z Cmd/Ctrl Scrub Numeric Fields by Dragging Zmieniaj pola liczbowe przeciąganiem Linux Display Server Serwer wyświetlania Linux + Low-Latency Drawing Rysowanie z niskim opóźnieniem Print Preview Podgląd wydruku Print Setup Ustawienia wydruku Bitmap Bitmapa @@ -4229,6 +4243,8 @@ axis Both Obie Reset Tracking and Kerning Resetuj światło i kerning Reset Horizontal Scale Resetuj skalę poziomą Highlight Font Name Wyróżnij nazwę czcionki + Highlight Font Size Wyróżnij rozmiar czcionki + Other… Inny… Highlight Kerning Wyróżnij kerning Highlight Tracking Wyróżnij światło Step Type Krok tekstu @@ -4429,6 +4445,29 @@ font-technology Variable Zmienne The unit for East Asian type measurements, which no field uses yet. Jednostka miar tekstu wschodnioazjatyckiego, której żadne pole jeszcze nie używa. When on, a number typed without a unit into a field in picas is read in points. Gdy opcja jest włączona, liczba wpisana bez jednostki w polu w pica jest odczytywana w punktach. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Przy ID XML nazwy obiektów są wyświetlane jako ID XML w Warstwach, Zmiennych i Opcjach warstwy. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Krok rozmiaru tekstu i interlinii: Cmd/Ctrl+Shift+. i Cmd/Ctrl+Shift+, zmieniają rozmiar o jeden krok, a z Alt o pięć; w tekście poziomym Alt ze strzałką w górę lub w dół zmienia interlinię o jeden krok, a z Cmd/Ctrl o pięć. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Krok światła i kerningu, w tysięcznych częściach em: w tekście poziomym Alt ze strzałką w lewo lub w prawo zmienia kerning przy kursorze lub światło zaznaczonego tekstu o jeden krok, a z Cmd/Ctrl o pięć. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Krok przesunięcia linii bazowej: w tekście poziomym Alt i Shift ze strzałką w górę lub w dół przesuwają linię bazową o jeden krok, a z Cmd/Ctrl o pięć. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Pokazuje opcje tekstu japońskiego i innego wschodnioazjatyckiego w panelach Znak, Akapit, OpenType i Glify oraz polecenie Fonty złożone. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Pokazuje opcje tekstu arabskiego, hebrajskiego i indyjskiego w panelach Znak i Akapit, takie jak kierunek akapitu, kaszidy i cyfry. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Narzędzia zaznaczania zaznaczają tekst tylko na jego linii bazowej, ramce tekstu w obszarze lub jego ścieżce, a nie w dowolnym miejscu jego obwiedni. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Menu czcionek pokazują każdą czcionkę pod angielską nazwą; po wyłączeniu czcionka, która ma też nazwę we własnym języku, pokazuje tę nazwę. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Nowy tekst w obszarze zaczyna z włączonym automatycznym rozmiarem, więc prostokątna ramka tekstu poziomego rośnie lub maleje w pionie, by zmieścić tekst. + Font lists and the Type › Font menu show a sample of each font beside its name. Listy czcionek i menu Czcionka pokazują obok nazwy próbkę każdej czcionki. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Próbki czcionek są rysowane ciemnym tekstem na białym tle niezależnie od jasności interfejsu; działa to tylko przy włączonych podglądach czcionek w menu. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Wysokość każdego wiersza na listach pól czcionek, na przykład w panelu Znak, a więc i wielkość każdej próbki. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Ile ostatnio używanych czcionek, od 1 do 15, pokazują Ostatnie czcionki i listy czcionek, od najnowszej. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Gdy zmienisz czcionkę lub styl czcionki tekstu, znaki, dla których nowa czcionka nie ma glifu, zachowują dotychczasową czcionkę. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Różowe wyróżnienie na obszarze roboczym oznacza glify zastąpione przez funkcje OpenType, takie jak ligatury; nie jest drukowane ani eksportowane. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. W narzędziu Tekst zaznaczenie jednego znaku pokazuje obok niego na obszarze roboczym rząd jego alternatywnych glifów do wyboru. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Różowe wyróżnienie na obszarze roboczym oznacza tekst rysowany czcionką zastępczą, bo brakuje jego czcionki; nie jest drukowane ani eksportowane. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Nowy tekst utworzony narzędziem tekstowym zaczyna się od zaznaczonego tekstu zastępczego, którego miejsce zajmuje wpisywany tekst. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Wpisanie znacznika listy, takiego jak 1. lub *, a potem spacji na początku akapitu zmienia akapit w listę. + Fonts in this folder show in the font menus and can be used without being installed. Czcionki z tego folderu są widoczne w menu czcionek i można ich używać bez instalowania. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Zastosowanie stylu graficznego do tekstu usuwa własne wypełnienie lub obrys znaków tam, gdzie styl je ma, więc widać farbę stylu. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Wyrównaj i Rozmieść mierzą tekst punktowy według tuszu jego glifów zamiast jego kwadratu em. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Wyrównaj i Rozmieść mierzą tekst w obszarze według tuszu jego glifów zamiast jego ramki. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Obwiednia i panel Przekształć mierzą tekst punktowy według tuszu jego glifów zamiast jego kwadratu em. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Przyciąga rysowanie, przesuwanie i skalowanie do podpodziałów siatki, nawet gdy siatka jest ukryta; dopóki jest włączone, Przyciągaj do pikseli nie działa. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Kolor niezaznaczonych linii pomocniczych; obszar kompozycji z Etykietą linii pomocniczych rysuje własne linie pomocnicze w kolorze etykiety. Draws guides as solid lines or as dots, including the guides already in the document. Rysuje linie pomocnicze jako linie ciągłe lub kropki, także te, które już są w dokumencie. @@ -4705,6 +4744,8 @@ imageTrace Outline Kontur @msg the script is no longer in the Scripts folder skryptu nie ma już w folderze Scripts Some scripts were not listed Niektóre skrypty nie zostały wyświetlone The Scripts folder cannot be read Nie można odczytać folderu Scripts + Loading scripts… Wczytywanie skryptów… + The Scripts folder is still being read Folder Scripts jest nadal odczytywany @msg the script's run is no longer available uruchomienie skryptu nie jest już dostępne @msg a failed command changed undo steps that could not be put back, so the script was stopped nieudane polecenie zmieniło kroki cofania, których nie udało się przywrócić, więc skrypt został zatrzymany @msg a recovery copy could not be written, so the script was not run nie udało się zapisać kopii odzyskiwania, więc skrypt nie został uruchomiony @@ -5580,6 +5621,8 @@ liquify-list-end {0}, {1} {0} i {1} @msg All colors are within the CMYK gamut Wszystkie kolory mieszczą się w gamucie CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} kolor nie mieści się w gamucie CMYK|{n} kolory nie mieszczą się w gamucie CMYK|{n} kolorów nie mieści się w gamucie CMYK @msg Unembedded to {_1} Wyodrębniono do {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Wyodrębniono {n} obraz do {folder}|Wyodrębniono {n} obrazy do {folder}|Wyodrębniono {n} obrazów do {folder} +@msg every numbered name for {name} is taken in that folder wszystkie numerowane nazwy dla {name} są zajęte w tym folderze @msg Reset {_1} Zresetowano {_1} @msg Sent to {_1} Wysłano do {_1} @msg {_1} files Pliki {_1} @@ -5683,6 +5726,8 @@ liquify-list-end {0}, {1} {0} i {1} @msg automation path rejected: outside the read root {root}: {path} odrzucono ścieżkę automatyzacji: poza katalogiem głównym odczytu {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} odrzucono ścieżkę automatyzacji: poza katalogami głównymi odczytu {roots}: {path} @msg a linked JavaScript file is outside the read roots połączony plik JavaScript jest poza katalogami głównymi odczytu +@msg a linked image file is outside the read roots połączony plik obrazu jest poza katalogami głównymi odczytu +@msg a linked file's export folder is outside the read roots folder eksportu połączonego pliku jest poza katalogami głównymi odczytu @msg automation path rejected: outside the write root {root}: {path} odrzucono ścieżkę automatyzacji: poza katalogiem głównym zapisu {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} odrzucono ścieżkę automatyzacji: poza katalogami głównymi zapisu {roots}: {path} @msg automation path rejected: path is empty odrzucono ścieżkę automatyzacji: ścieżka jest pusta @@ -7237,6 +7282,12 @@ anchor Points: Punkty: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` musi mieć wartość "free", "keepAngles" lub "symmetric" @msg `{key}` must be [x, y] `{key}` musi mieć postać [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Konwerter jednostek + Unit Converter Panel Panel Konwerter jednostek + Copy with Units Kopiuj z jednostkami + From Selection Z zaznaczenia + # Color Effects add-on: Select by Color Kind. Select by Color Kind Zaznacz według rodzaju koloru Objects with Spot Colors Obiekty z kolorami dodatkowymi @@ -8427,6 +8478,8 @@ breakText Glyphs Glify @msg `{f}` is the copy of a document open now `{f}` to kopia otwartego teraz dokumentu @msg `{id}` is no writable format (see document.formats) `{id}` nie jest formatem z możliwością zapisu (patrz document.formats) @msg `{id}` isn't a loaded library `{id}` nie jest wczytaną biblioteką +@msg `{file}` has no swatches of its own `{file}` nie ma własnych próbek +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` zawiera próbki wzorków, których plik .vcswatches nie może przechować @msg `{key}` has no colours `{key}` nie zawiera kolorów @msg `{key}` is a design name `{key}` to nazwa wzoru @msg `{key}` is a design name or a list of them `{key}` to nazwa wzoru lub lista takich nazw @@ -8649,7 +8702,13 @@ breakText Glyphs Glify @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel musi mieć wartość {own} (tryb dokumentu), grayscale lub bitmap @msg colour groups can't go into colour groups grup kolorów nie można umieszczać w grupach kolorów @msg colour, mode and spot apply to solid-colour swatches only color, mode i spot dotyczą tylko próbek kolorów jednolitych -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read kolumna {column}: `{cell}` to kolumna `%` plików danych wykresu, które nie są odczytywane +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` ma ścieżkę względną: podaj `base` albo ścieżkę bezwzględną +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} wiersz {line}, kolumna {column}: nie można odczytać pliku danych wykresu dla `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` nie jest pobierany: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` jest większy niż {MAX_GRAPH_DATA_FILE} bajtów +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes wiersz {line}, kolumna {column}: plik danych wykresu `{path}` dla `{var}` daje wartość wykresu dłuższą niż {MAX_GRAPH_CSV} bajtów +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all wiersz {line}, kolumna {column}: pliki danych wykresu zawierają łącznie ponad {MAX_GRAPH_FILES_TOTAL} bajtów +@msg `base` is empty `base` jest puste @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable kolumna {column}: `{cell}` wskazuje `{name}`, czyli zmienną typu {_1} @msg column {column}: `{cell}` names no variable kolumna {column}: `{cell}` nie wskazuje żadnej zmiennej @msg column {column}: the variable name is longer than {MAX_NAME} characters kolumna {column}: nazwa zmiennej ma więcej niż {MAX_NAME} znaków diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 08c48c7285..e3a3c85a68 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -126,6 +126,7 @@ Add Anchor Point Adicionar Ponto de Ancoragem Add Anchor Point Tool Ferramenta Adicionar Ponto de Ancoragem Add Anchor Points Adicionar Pontos de Ancoragem + Add Around Adicionar ao Redor do Objeto Add Effect Adicionar Efeito Add Freeform Line Adicionar Linha Livre Add Freeform Point Adicionar Ponto Livre @@ -195,6 +196,7 @@ Angle: Ângulo: Angles Ângulos Animated Zoom Zoom Animado + Anti Alias Suavização Anti-Alias Suavização de Serrilhado Anti-alias Suavizar bordas Anti-alias Rasters Suavizar Rasters @@ -501,6 +503,7 @@ antiAlias Sharp Nítido Color Library… Biblioteca de Cores… Color Mode Modo de Cor Color Mode: Modo de Cor: + Color Model Modelo de Cor Color Model: Modelo de Cor: Color Models Modelos de Cor Color Picker Seletor de Cores @@ -529,6 +532,7 @@ antiAlias Sharp Nítido Colors Cores Colors: Cores: Column Graph Tool Ferramenta Gráfico de Colunas + Columns Colunas Columns: Colunas: Column… Coluna… Combine Slices Combinar Fatias @@ -962,6 +966,7 @@ antiAlias Sharp Nítido Enable Rubber Band for Habilitar Elástico para Enable Touch Gestures Habilitar Gestos de Toque Switch Selection and Drawing Modes Alternar Modos de Seleção e Desenho + Select Last Selection Tool Selecionar Última Ferramenta de Seleção Enable Touch Workspace Habilitar Espaço de Trabalho de Toque Enable copying of text, images and other content Habilitar cópia de texto, imagens e outro conteúdo Enable in-menu font previews Habilitar visualizações de fonte no menu @@ -1185,6 +1190,8 @@ antiAlias Sharp Nítido Reset Tracking and Kerning Redefinir Rastreamento e Kerning Reset Horizontal Scale Redefinir Escala Horizontal Highlight Font Name Destacar Nome da Fonte + Highlight Font Size Destacar Tamanho da Fonte + Other… Outro… Highlight Kerning Destacar Kerning Highlight Tracking Destacar Rastreamento Step Type Ajustar Texto em Incrementos @@ -2116,6 +2123,9 @@ antiAlias Sharp Nítido Overprint Stroke Sobreimpressão de Traçado Overprint and Transparency Flattener Sobreimpressão e Achatamento de Transparência Overprint and Transparency Flattener Options Opções de Sobreimpressão e Achatamento de Transparência + Custom… Personalizado… + Custom Transparency Flattener Options Opções Personalizadas de Achatamento de Transparência + EPS has no alpha transparency, and Overprints sets whether overprints are kept. O EPS não tem transparência alfa, e Sobreimpressões define se as sobreimpressões são mantidas. Overprint: Sobreimpressão: Overprints: Sobreimpressões: Override Character Color Substituir Cor do Caractere @@ -2210,6 +2220,7 @@ antiAlias Sharp Nítido Play Current Selection Reproduzir Seleção Atual Save Actions… Salvar Ações… Load Actions… Carregar Ações… + Replace Actions… Substituir Ações… Reset Actions Redefinir Ações Replace the current actions with the default set? Substituir as ações atuais pelo conjunto padrão? Append adds the default set after the current sets instead. Anexar adiciona o conjunto padrão depois dos conjuntos atuais. @@ -2534,6 +2545,8 @@ digits Malayalam Malaiala Reselect Resselecionar Reset Redefinir Reset Bounding Box Redefinir Caixa Delimitadora + Rotate Bounding Box Girar Caixa Delimitadora + Rotate Bounding Box… Girar Caixa Delimitadora… Reset Envelope Mesh Redefinir Malha do Envelope Reset Envelope Shape Redefinir Forma do Envelope Reset Essentials Redefinir Essentials @@ -2572,6 +2585,7 @@ digits Malayalam Malaiala Reshape Segment Remodelar Segmento Reshape Tool Ferramenta Remodelar Reshape Type Area Remodelar Área de Texto + Resolution Resolução Resolution: Resolução: Responsive Responsivo Restore Restaurar @@ -2629,6 +2643,29 @@ digits Malayalam Malaiala The unit for East Asian type measurements, which no field uses yet. A unidade das medidas de texto do Leste Asiático, que nenhum campo usa ainda. When on, a number typed without a unit into a field in picas is read in points. Quando ativado, um número digitado sem unidade em um campo em picas é lido em pontos. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Com ID XML, os nomes dos objetos aparecem como IDs XML em Camadas, Variáveis e Opções de Camada. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. O passo do tamanho do texto e da entrelinha: Cmd/Ctrl+Shift+. e Cmd/Ctrl+Shift+, mudam o tamanho em um passo, ou em cinco com Alt também; em texto horizontal, Alt com a seta para cima ou para baixo muda a entrelinha em um passo, ou em cinco com Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. O passo do tracking e do kerning, em milésimos de em: em texto horizontal, Alt com a seta para a esquerda ou para a direita muda o kerning no cursor ou o tracking do texto selecionado em um passo, ou em cinco com Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. O passo do deslocamento da linha de base: em texto horizontal, Alt e Shift com a seta para cima ou para baixo movem a linha de base em um passo, ou em cinco com Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Mostra as opções de texto japonês e de outros idiomas do Leste Asiático nos painéis Caractere, Parágrafo, OpenType e Glifos, e o comando Fontes compostas. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Mostra as opções de texto árabe, hebraico e índico nos painéis Caractere e Parágrafo, como a direção do parágrafo, as kashidas e os dígitos. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. As ferramentas de seleção selecionam o texto só na linha de base, no quadro do texto de área ou no seu demarcador, e não em qualquer ponto dentro da sua caixa. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Os menus de fontes listam cada fonte pelo nome em inglês; desativado, uma fonte que também tem um nome no próprio idioma mostra esse nome. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. O novo texto de área começa com Tamanho Automático ativado, então um quadro retangular de texto horizontal cresce ou encolhe em altura para caber o texto. + Font lists and the Type › Font menu show a sample of each font beside its name. As listas de fontes e o menu Fonte mostram uma amostra de cada fonte ao lado do nome. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. As amostras de fontes são desenhadas em texto escuro sobre branco, seja qual for o brilho da interface; vale só enquanto as visualizações de fontes nos menus estão ativadas. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. A altura de cada linha nas listas dos campos de fonte, como o do painel Caractere, e portanto o tamanho de cada amostra. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Quantas das últimas fontes usadas, de 1 a 15, Fontes Recentes e as listas de fontes mostram, da mais recente para a mais antiga. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Ao mudar a fonte ou o estilo da fonte de um texto, os caracteres para os quais a nova fonte não tem glifo mantêm a fonte que tinham. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Um realce rosa na tela de desenho marca os glifos substituídos por recursos OpenType, como as ligaduras; ele não é impresso nem exportado. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Com a ferramenta Texto, selecionar um único caractere mostra ao lado dele, na tela de desenho, uma fileira dos seus glifos alternativos para escolher. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Um realce rosa na tela de desenho marca o texto desenhado com uma fonte substituta porque a fonte dele está ausente; ele não é impresso nem exportado. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. O novo texto criado com uma ferramenta de texto começa com um texto de preenchimento selecionado, que a digitação substitui. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Digitar um marcador de lista como 1. ou * e depois um espaço no início de um parágrafo transforma o parágrafo em uma lista. + Fonts in this folder show in the font menus and can be used without being installed. As fontes desta pasta aparecem nos menus de fontes e podem ser usadas sem ser instaladas. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Aplicar um estilo gráfico a um texto remove o preenchimento ou o traçado próprio dos caracteres onde o estilo tem um, para que a pintura do estilo apareça. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Alinhar e Distribuir medem o texto de ponto pela tinta dos seus glifos em vez da sua caixa em. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Alinhar e Distribuir medem o texto de área pela tinta dos seus glifos em vez do seu quadro. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. A caixa delimitadora e o painel Transformar medem o texto de ponto pela tinta dos seus glifos em vez da sua caixa em. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Ajusta o desenho, o movimento e a escala às subdivisões da grade, mesmo com a grade oculta; enquanto está ativado, Ajustar ao Pixel não se aplica. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. A cor das guias não selecionadas; uma prancheta com Rótulo das Guias desenha as próprias guias na cor do rótulo. Draws guides as solid lines or as dots, including the guides already in the document. Desenha as guias como linhas contínuas ou como pontos, inclusive as guias que já estão no documento. @@ -2702,6 +2739,7 @@ digits Malayalam Malaiala Rounded Rectangle Retângulo Arredondado Rounded Rectangle Tool Ferramenta Retângulo Arredondado Rounded Rectangle… Retângulo Arredondado… + Rows Linhas Rows: Linhas: Rule: Regra: Rulers Réguas @@ -4761,6 +4799,8 @@ axis Both Ambos @msg All colors are within the CMYK gamut Todas as cores estão dentro do gamut CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} cor está fora do gamut CMYK|{n} cores estão fora do gamut CMYK @msg Unembedded to {_1} Desincorporado para {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} {n} imagem desincorporada para {folder}|{n} imagens desincorporadas para {folder} +@msg every numbered name for {name} is taken in that folder todos os nomes numerados para {name} já existem nessa pasta @msg Reset {_1} Redefinir {_1} @msg Sent to {_1} Enviado para {_1} @msg {_1} files {_1} arquivos @@ -4853,6 +4893,8 @@ axis Both Ambos @msg automation path rejected: outside the read root {root}: {path} caminho da automação rejeitado: fora da raiz de leitura {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} caminho da automação rejeitado: fora das raízes de leitura {roots}: {path} @msg a linked JavaScript file is outside the read roots um arquivo JavaScript vinculado está fora das raízes de leitura +@msg a linked image file is outside the read roots um arquivo de imagem vinculado está fora das raízes de leitura +@msg a linked file's export folder is outside the read roots a pasta de exportação de um arquivo vinculado está fora das raízes de leitura @msg automation path rejected: outside the write root {root}: {path} caminho da automação rejeitado: fora da raiz de gravação {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} caminho da automação rejeitado: fora das raízes de gravação {roots}: {path} @msg automation path rejected: path is empty caminho da automação rejeitado: o caminho está vazio @@ -5632,6 +5674,8 @@ axis Both Ambos @msg the script is no longer in the Scripts folder o script não está mais na pasta Scripts Some scripts were not listed Alguns scripts não foram listados The Scripts folder cannot be read Não é possível ler a pasta Scripts + Loading scripts… Carregando scripts… + The Scripts folder is still being read A pasta Scripts ainda está sendo lida @msg the script's run is no longer available a execução do script não está mais disponível @msg a failed command changed undo steps that could not be put back, so the script was stopped um comando que falhou alterou etapas de desfazer que não puderam ser restauradas, então o script foi interrompido @msg a recovery copy could not be written, so the script was not run não foi possível gravar uma cópia de recuperação, portanto o script não foi executado @@ -5866,6 +5910,7 @@ liquify-list-end {0}, {1} {0} e {1} Right Diagonal Diagonal Direita Left Diagonal Diagonal Esquerda Linux Display Server Servidor de Exibição do Linux + Low-Latency Drawing Desenho de Baixa Latência X11 (XWayland) When a Pen Is Attached X11 (XWayland) Quando Houver uma Caneta Conectada If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Se a caneta de uma mesa digitalizadora não desenhar, escolha uma opção X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -7295,6 +7340,12 @@ anchor Points: Pontos: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` deve ser "free", "keepAngles" ou "symmetric" @msg `{key}` must be [x, y] `{key}` deve ser [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Conversor de unidades + Unit Converter Panel Painel Conversor de unidades + Copy with Units Copiar com unidades + From Selection Da seleção + # Color Effects add-on: Select by Color Kind. Select by Color Kind Selecionar por tipo de cor Objects with Spot Colors Objetos com cores spot @@ -8451,6 +8502,8 @@ swatch Yellow Green Verde-amarelado @msg `{f}` is the copy of a document open now `{f}` é a cópia de um documento aberto agora @msg `{id}` is no writable format (see document.formats) `{id}` não é um formato gravável (veja document.formats) @msg `{id}` isn't a loaded library `{id}` não é uma biblioteca carregada +@msg `{file}` has no swatches of its own `{file}` não tem amostras próprias +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` tem amostras de padrão, que um arquivo .vcswatches não pode conter @msg `{key}` has no colours `{key}` não tem cores @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` contém mais de {MAX_EDIT_WORDS} palavras @msg `{key}` is a design name `{key}` é o nome de um projeto @@ -8742,7 +8795,13 @@ swatch Yellow Green Verde-amarelado @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel deve ser {own} (o modo do documento), grayscale ou bitmap @msg colour groups can't go into colour groups grupos de cores não podem ficar dentro de grupos de cores @msg colour, mode and spot apply to solid-colour swatches only colour, mode e spot se aplicam somente a amostras de cor sólida -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read coluna {column}: `{cell}` é uma coluna `%` de arquivos de dados de gráfico, que não são lidos +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` é um caminho relativo: informe `base` ou um caminho absoluto +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} linha {line}, coluna {column}: não é possível ler o arquivo de dados de gráfico de `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` não é seguido: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` tem mais de {MAX_GRAPH_DATA_FILE} bytes +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes linha {line}, coluna {column}: o arquivo de dados de gráfico `{path}` de `{var}` gera um valor de gráfico com mais de {MAX_GRAPH_CSV} bytes +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all linha {line}, coluna {column}: os arquivos de dados de gráfico têm mais de {MAX_GRAPH_FILES_TOTAL} bytes no total +@msg `base` is empty `base` está vazio @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable coluna {column}: `{cell}` indica `{name}`, que é uma variável de {_1} @msg column {column}: `{cell}` names no variable coluna {column}: `{cell}` não indica nenhuma variável @msg column {column}: the variable name is longer than {MAX_NAME} characters coluna {column}: o nome da variável tem mais de {MAX_NAME} caracteres diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 75325864d5..714fc4849f 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -9,7 +9,7 @@ # Coverage: the whole interface — every menu string and every `tl!` literal (`complete_menus`, # `untranslated_report` lists gaps). Left in English on purpose (`MENU_KEEP_AS_IS` in the tests): the product name, language # names, OpenType, the built-in workspace names and the bracketed perspective grid preset names. -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Glowing Edges… Светящиеся края… Glowing Edges Светящиеся края Edge Width Ширина края @@ -117,6 +117,7 @@ Add Anchor Point Добавить опорную точку Add Anchor Point Tool Инструмент «Добавить опорную точку» Add Anchor Points Добавить опорные точки + Add Around Добавить вокруг объекта Add Effect Добавить эффект Add Freeform Line Добавить произвольную линию Add Freeform Point Добавить произвольную точку @@ -194,6 +195,7 @@ Angle: Угол: Angles Углы Animated Zoom Анимированное масштабирование + Anti Alias Сглаживание Anti-alias Сглаживание Anti-Alias Сглаживание Anti-alias Rasters Сглаживать растровые изображения @@ -552,6 +554,7 @@ font-technology Variable Вариативные Color Mixer (Shift-click the chip) Смеситель цветов (Shift+щелчок по образцу) Color Mode Цветовой режим Color Mode: Цветовой режим: + Color Model Цветовая модель Color Model: Цветовая модель: Color Models Цветовые модели Color Picker Палитра цветов @@ -578,6 +581,7 @@ font-technology Variable Вариативные Colors Цвета Colors: Цвета: Column Graph Tool Инструмент «Гистограмма» + Columns Столбцы Columns: Столбцы: Column… Столбец… Combine Slices Объединить фрагменты @@ -1072,6 +1076,7 @@ font-technology Variable Вариативные Enable text access for screen readers Разрешить доступ к тексту для программ чтения с экрана Enable Touch Gestures Включить сенсорные жесты Switch Selection and Drawing Modes Переключить режимы выделения и рисования + Select Last Selection Tool Выбрать последний инструмент выделения Enable Touch Workspace Включить сенсорную рабочую среду Encoding Кодировка Encoding: Кодировка: @@ -1303,6 +1308,8 @@ font-technology Variable Вариативные Reset Tracking and Kerning Сбросить трекинг и кернинг Reset Horizontal Scale Сбросить масштаб по горизонтали Highlight Font Name Выделить имя шрифта + Highlight Font Size Выделить размер шрифта + Other… Другой… Highlight Kerning Выделить кернинг Highlight Tracking Выделить трекинг Spacing Интервал @@ -2594,6 +2601,9 @@ file-filter Templates Шаблоны Overprint Наложение Overprint and Transparency Flattener Наложение и объединение прозрачностей Overprint and Transparency Flattener Options Параметры наложения и объединения прозрачностей + Custom… Пользовательские… + Custom Transparency Flattener Options Пользовательские параметры объединения прозрачностей + EPS has no alpha transparency, and Overprints sets whether overprints are kept. В EPS нет альфа-прозрачности, а параметр «Наложения» определяет, сохраняются ли наложения. Overprint Black… Наложение чёрного… Overprint Fill Наложение заливки Overprint Preview Просмотр наложения @@ -2702,6 +2712,7 @@ diagnostics ui интерфейс Play Current Selection Воспроизвести текущее выделение Save Actions… Сохранить действия… Load Actions… Загрузить действия… + Replace Actions… Заменить действия… Reset Actions Сбросить действия Replace the current actions with the default set? Заменить текущие действия набором по умолчанию? Append adds the default set after the current sets instead. Кнопка «Добавить» вместо этого добавляет набор по умолчанию после текущих наборов. @@ -3070,6 +3081,8 @@ digits Malayalam Малаялам Reselect Выделить снова Reset Сбросить Reset Bounding Box Сбросить ограничительную рамку + Rotate Bounding Box Повернуть ограничительную рамку + Rotate Bounding Box… Повернуть ограничительную рамку… Reset Envelope Mesh Сбросить сетку оболочки Reset Envelope Shape Сбросить форму оболочки Reset Essentials Сбросить «Основные» @@ -3111,6 +3124,7 @@ digits Malayalam Малаялам Reshape Segment Изменить форму сегмента Reshape Tool Инструмент «Изменение формы» Reshape Type Area Изменить форму текстовой области + Resolution Разрешение Resolution: Разрешение: Responsive Адаптивный Restore Восстановить @@ -3167,6 +3181,29 @@ digits Malayalam Малаялам The unit for East Asian type measurements, which no field uses yet. Единица для размеров восточноазиатского текста, которую пока не использует ни одно поле. When on, a number typed without a unit into a field in picas is read in points. Если включено, число, введённое без единицы в поле в пиках, читается в пунктах. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. При XML ID имена объектов показываются как XML ID в «Слоях», «Переменных» и «Параметрах слоя». + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Шаг размера текста и интерлиньяжа: Cmd/Ctrl+Shift+. и Cmd/Ctrl+Shift+, меняют размер на один шаг, а вместе с Alt — на пять; в горизонтальном тексте Alt со стрелкой вверх или вниз меняет интерлиньяж на один шаг, а с Cmd/Ctrl — на пять. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Шаг трекинга и кернинга в тысячных долях em: в горизонтальном тексте Alt со стрелкой влево или вправо меняет кернинг у курсора или трекинг выделенного текста на один шаг, а с Cmd/Ctrl — на пять. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Шаг смещения базовой линии: в горизонтальном тексте Alt и Shift со стрелкой вверх или вниз сдвигают базовую линию на один шаг, а с Cmd/Ctrl — на пять. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Показывает параметры японского и другого восточноазиатского текста на панелях «Символ», «Абзац», «OpenType» и «Глифы», а также команду «Составные шрифты». + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Показывает параметры арабского, еврейского и индийского текста на панелях «Символ» и «Абзац», например направление абзаца, кашиды и цифры. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Инструменты выделения выделяют текст только на его базовой линии, рамке текста в области или его контуре, а не в любом месте внутри его рамки. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Меню шрифтов показывают каждый шрифт под английским названием; если выключено, шрифт, у которого есть название на собственном языке, показывает это название. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Новый текст в области создаётся с включённым авторазмером, поэтому прямоугольная рамка горизонтального текста растёт или уменьшается по высоте под свой текст. + Font lists and the Type › Font menu show a sample of each font beside its name. Списки шрифтов и меню «Шрифт» показывают образец каждого шрифта рядом с его названием. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Образцы шрифтов рисуются тёмным текстом на белом при любой яркости интерфейса; это действует, только пока включён просмотр шрифтов в меню. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Высота каждой строки в списках полей шрифта, например на панели «Символ», а значит, и размер каждого образца. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Сколько последних использованных шрифтов, от 1 до 15, показывают «Последние шрифты» и списки шрифтов, начиная с самого нового. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Когда вы меняете шрифт или начертание текста, символы, для которых в новом шрифте нет глифа, сохраняют прежний шрифт. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Розовая подсветка на холсте отмечает глифы, заменённые функциями OpenType, например лигатуры; она не печатается и не экспортируется. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. С инструментом «Текст» при выделении одного символа рядом с ним на холсте появляется ряд его альтернативных глифов для выбора. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Розовая подсветка на холсте отмечает текст, нарисованный заменяющим шрифтом из-за отсутствия его шрифта; она не печатается и не экспортируется. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Новый текст, созданный текстовым инструментом, начинается с выделенного текста-заполнителя, который заменяется вводом. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Если в начале абзаца ввести маркер списка, например 1. или *, а затем пробел, абзац становится списком. + Fonts in this folder show in the font menus and can be used without being installed. Шрифты из этой папки появляются в меню шрифтов, и их можно использовать без установки. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Применение графического стиля к тексту убирает собственную заливку или обводку символов там, где они есть у стиля, чтобы была видна краска стиля. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. «Выровнять» и «Распределить» измеряют текст из точки по краске его глифов, а не по его em-квадрату. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. «Выровнять» и «Распределить» измеряют текст в области по краске его глифов, а не по его рамке. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Ограничительная рамка и панель «Трансформирование» измеряют текст из точки по краске его глифов, а не по его em-квадрату. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Привязывает рисование, перемещение и масштабирование к делениям сетки, даже когда сетка скрыта; пока параметр включен, «Привязать к пикселю» не действует. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Цвет невыделенных направляющих; монтажная область с «Меткой направляющих» рисует свои направляющие цветом метки. Draws guides as solid lines or as dots, including the guides already in the document. Рисует направляющие сплошными линиями или точками, включая направляющие, которые уже есть в документе. @@ -3248,6 +3285,7 @@ digits Malayalam Малаялам Rounded Rectangle Tool Инструмент «Скруглённый прямоугольник» Rounded Rectangle… Скруглённый прямоугольник… Row Size: Размер строки: + Rows Строки Rows: Строки: Rule: Линейка: Rulers Линейки @@ -4599,6 +4637,8 @@ axis Both Оба @msg the script is no longer in the Scripts folder скрипт больше не находится в папке Scripts Some scripts were not listed Некоторые сценарии не показаны The Scripts folder cannot be read Не удалось прочитать папку Scripts + Loading scripts… Загрузка сценариев… + The Scripts folder is still being read Папка Scripts ещё читается @msg the script's run is no longer available выполнение скрипта больше недоступно @msg a failed command changed undo steps that could not be put back, so the script was stopped неудавшаяся команда изменила шаги отмены, которые не удалось восстановить, поэтому скрипт остановлен @msg a recovery copy could not be written, so the script was not run не удалось записать копию для восстановления, поэтому скрипт не выполнен @@ -5486,6 +5526,8 @@ liquify-list-end {0}, {1} {0} и {1} @msg All colors are within the CMYK gamut Все цвета входят в цветовой охват CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} цвет выходит за пределы цветового охвата CMYK|{n} цвета выходят за пределы цветового охвата CMYK|{n} цветов выходят за пределы цветового охвата CMYK @msg Unembedded to {_1} Извлечено в {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Извлечено {n} изображение в {folder}|Извлечено {n} изображения в {folder}|Извлечено {n} изображений в {folder} +@msg every numbered name for {name} is taken in that folder все нумерованные имена для {name} уже заняты в этой папке @msg Reset {_1} Сброшено: {_1} @msg Sent to {_1} Отправлено в {_1} @msg {_1} files {_1} файлов @@ -5617,6 +5659,8 @@ liquify-list-end {0}, {1} {0} и {1} @msg automation path rejected: outside the read root {root}: {path} путь автоматизации отклонён: вне корневой папки для чтения {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} путь автоматизации отклонён: вне корневых папок для чтения {roots}: {path} @msg a linked JavaScript file is outside the read roots связанный файл JavaScript находится вне корневых папок для чтения +@msg a linked image file is outside the read roots связанный файл изображения находится вне корневых папок для чтения +@msg a linked file's export folder is outside the read roots папка экспорта связанного файла находится вне корневых папок для чтения @msg automation path rejected: outside the write root {root}: {path} путь автоматизации отклонён: вне корневой папки для записи {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} путь автоматизации отклонён: вне корневых папок для записи {roots}: {path} @msg automation path rejected: path is empty путь автоматизации отклонён: путь пуст @@ -5844,6 +5888,7 @@ lighting Light Свет @msg missing panel layout Отсутствует расположение панелей @msg unsupported native docking operation Неподдерживаемая собственная операция прикрепления Linux Display Server Дисплейный сервер Linux + Low-Latency Drawing Рисование с низкой задержкой X11 (XWayland) When a Pen Is Attached X11 (XWayland) при подключенном пере If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Если перо графического планшета не рисует, выберите вариант X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -7372,6 +7417,12 @@ anchor Points: Точки: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` должно быть "free", "keepAngles" или "symmetric" @msg `{key}` must be [x, y] `{key}` должно быть [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Конвертер единиц + Unit Converter Panel Панель «Конвертер единиц» + Copy with Units Копировать с единицами + From Selection Из выделения + # Color Effects add-on: Select by Color Kind. Select by Color Kind Выделить по типу цвета Objects with Spot Colors Объекты с плашечными цветами @@ -8372,6 +8423,8 @@ shape Open Открытый @msg `{f}` is the copy of a document open now `{f}` — копия документа, открытого сейчас @msg `{id}` is no writable format (see document.formats) `{id}` не является форматом для записи (см. document.formats) @msg `{id}` isn't a loaded library `{id}` не является загруженной библиотекой +@msg `{file}` has no swatches of its own в `{file}` нет собственных образцов +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold в `{_1}` есть образцы узоров, которые файл .vcswatches не может хранить @msg `{key}` has no colours в `{key}` нет цветов @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` содержит больше {MAX_EDIT_WORDS} слов @msg `{key}` is a design name `{key}` — имя дизайна diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 643a07d97c..f37e787a46 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -107,6 +107,7 @@ Add Anchor Point Lägg till ankarpunkt Add Anchor Point Tool Verktyget Lägg till ankarpunkt Add Anchor Points Lägg till ankarpunkter + Add Around Lägg till runt objektet Add Effect Lägg till effekt Add Freeform Line Lägg till fri linje Add Freeform Point Lägg till fri punkt @@ -184,6 +185,7 @@ Angle: Vinkel: Angles Vinklar Animated Zoom Animerad zoom + Anti Alias Kantutjämning Anti-alias Kantutjämning Anti-Alias Kantutjämning Anti-alias Rasters Kantutjämna rasterbilder @@ -541,6 +543,7 @@ font-technology Variable Variabla Color Mixer (Shift-click the chip) Färgmixer (Shift-klicka på färgrutan) Color Mode Färgläge Color Mode: Färgläge: + Color Model Färgmodell Color Model: Färgmodell: Color Models Färgmodeller Color Picker Färgväljare @@ -567,6 +570,7 @@ font-technology Variable Variabla Colors Färger Colors: Färger: Column Graph Tool Stapeldiagramverktyg + Columns Kolumner Columns: Kolumner: Column… Kolumn… Combine Slices Kombinera skivor @@ -1049,6 +1053,7 @@ font-technology Variable Variabla Enable text access for screen readers Ge skärmläsare åtkomst till text Enable Touch Gestures Aktivera pekgester Switch Selection and Drawing Modes Växla mellan markerings- och ritläge + Select Last Selection Tool Välj det senaste markeringsverktyget Enable Touch Workspace Aktivera arbetslayout för pekskärm Encoding Kodning Encoding: Kodning: @@ -2502,6 +2507,9 @@ font-technology Variable Variabla Overprint Övertryck Overprint and Transparency Flattener Övertryck och transparensutplattning Overprint and Transparency Flattener Options Alternativ för övertryck och transparensutplattning + Custom… Anpassad… + Custom Transparency Flattener Options Anpassade alternativ för transparensutplattning + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS har ingen alfatransparens, och Övertryck avgör om övertryck behålls. Overprint Black… Övertryck svart… Overprint Fill Övertryck fyllning Overprint Preview Förhandsgranskning av övertryck @@ -2606,6 +2614,7 @@ font-technology Variable Variabla Play Current Selection Spela upp aktuell markering Save Actions… Spara åtgärder… Load Actions… Läs in åtgärder… + Replace Actions… Ersätt åtgärder… Reset Actions Återställ åtgärder Replace the current actions with the default set? Vill du ersätta de aktuella åtgärderna med standarduppsättningen? Append adds the default set after the current sets instead. Lägg till lägger i stället till standarduppsättningen efter de aktuella uppsättningarna. @@ -2971,6 +2980,8 @@ digits Malayalam Malayalam Reselect Markera igen Reset Återställ Reset Bounding Box Återställ begränsningsram + Rotate Bounding Box Rotera begränsningsram + Rotate Bounding Box… Rotera begränsningsram… Reset Envelope Mesh Återställ kuvertnät Reset Envelope Shape Återställ kuvertform Reset Essentials Återställ Grundläggande @@ -3011,6 +3022,7 @@ digits Malayalam Malayalam Reshape Segment Omforma segment Reshape Tool Omformningsverktyg Reshape Type Area Omforma textområde + Resolution Upplösning Resolution: Upplösning: Responsive Responsiv Restore Återställ @@ -3067,6 +3079,29 @@ digits Malayalam Malayalam The unit for East Asian type measurements, which no field uses yet. Enheten för mått i östasiatisk text, som inget fält använder ännu. When on, a number typed without a unit into a field in picas is read in points. När det är på läses ett tal som skrivs utan enhet i ett fält i pica i punkter. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Med XML-id visas objektnamn som XML-id:n i Lager, Variabler och Lageralternativ. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Steget för textstorlek och radavstånd: Cmd/Ctrl+Skift+. och Cmd/Ctrl+Skift+, ändrar storleken ett steg, eller fem med Alt också; i vågrät text ändrar Alt med uppåt- eller nedåtpil radavståndet ett steg, eller fem med Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Steget för spärrning och kerning, i tusendels em: i vågrät text ändrar Alt med vänster- eller högerpil kerningen vid markören eller spärrningen av den markerade texten ett steg, eller fem med Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Steget för baslinjeförskjutning: i vågrät text flyttar Alt och Skift med uppåt- eller nedåtpil baslinjen ett steg, eller fem med Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Visar alternativen för japansk och annan östasiatisk text i panelerna Tecken, Stycke, OpenType och Glyfer, och kommandot Sammansatta typsnitt. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Visar alternativen för arabisk, hebreisk och indisk text i panelerna Tecken och Stycke, till exempel styckeriktning, kashidor och siffror. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Markeringsverktygen markerar text bara på dess baslinje, ramen för områdestext eller dess bana, inte var som helst inuti dess ruta. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Typsnittsmenyerna visar varje typsnitt med dess engelska namn; avstängt visar ett typsnitt som också har ett namn på sitt eget språk det namnet. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Ny områdestext börjar med Automatisk storlek på, så att en rektangulär ram med vågrät text växer eller krymper på höjden för att rymma texten. + Font lists and the Type › Font menu show a sample of each font beside its name. Typsnittslistor och menyn Typsnitt visar ett prov på varje typsnitt bredvid dess namn. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Typsnittsprov ritas med mörk text på vitt oavsett gränssnittets ljusstyrka; det gäller bara medan förhandsvisningar av typsnitt i menyer är på. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Hur hög varje rad är i listorna för typsnittsfält, som det i panelen Tecken, och därmed hur stort varje prov är. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Hur många av de senast använda typsnitten, från 1 till 15, Senaste typsnitt och typsnittslistorna visar, det nyaste först. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. När du byter typsnitt eller typsnittsstil för text behåller tecken som det nya typsnittet saknar glyf för det typsnitt de hade. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. En rosa markering på arbetsytan visar glyfer som OpenType-funktioner har ersatt, till exempel ligaturer; den skrivs inte ut och exporteras inte. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Med textverktyget visar en markering av ett enda tecken en rad med dess alternativa glyfer bredvid det på arbetsytan att välja bland. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. En rosa markering på arbetsytan visar text som ritas med ett ersättningstypsnitt eftersom dess typsnitt saknas; den skrivs inte ut och exporteras inte. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Ny text som skapas med ett textverktyg börjar med markerad platshållartext, som det du skriver ersätter. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Att skriva en listmarkör som 1. eller * och sedan ett blanksteg i början av ett stycke gör stycket till en lista. + Fonts in this folder show in the font menus and can be used without being installed. Typsnitt i den här mappen visas i typsnittsmenyerna och kan användas utan att installeras. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. När en grafikstil tillämpas på text tas teckens egen fyllning eller linje bort där stilen har en, så att stilens färg syns. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Justera och Fördela mäter punkttext efter glyfernas bläck i stället för dess em-ruta. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Justera och Fördela mäter områdestext efter glyfernas bläck i stället för dess ram. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Begränsningsramen och panelen Transformera mäter punkttext efter glyfernas bläck i stället för dess em-ruta. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Fäster ritande, flyttning och skalning mot rutnätets underindelningar, även när rutnätet är dolt; medan det är på gäller inte Fäst mot pixel. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Färgen på stödlinjer som inte är markerade; en rityta med en stödlinjeetikett ritar sina egna stödlinjer i etikettens färg. Draws guides as solid lines or as dots, including the guides already in the document. Ritar stödlinjer som heldragna linjer eller som punkter, även stödlinjer som redan finns i dokumentet. @@ -3148,6 +3183,7 @@ digits Malayalam Malayalam Rounded Rectangle Tool Verktyg för rundad rektangel Rounded Rectangle… Rundad rektangel… Row Size: Radstorlek: + Rows Rader Rows: Rader: Rule: Regel: Rulers Linjaler @@ -4468,6 +4504,8 @@ axis Both Båda @msg the script is no longer in the Scripts folder skriptet finns inte längre i mappen Scripts Some scripts were not listed Vissa skript visas inte i listan The Scripts folder cannot be read Mappen Scripts kan inte läsas + Loading scripts… Läser in skript… + The Scripts folder is still being read Mappen Scripts läses fortfarande @msg the script's run is no longer available skriptets körning är inte längre tillgänglig @msg a failed command changed undo steps that could not be put back, so the script was stopped ett misslyckat kommando ändrade ångrasteg som inte kunde återställas, så skriptet stoppades @msg a recovery copy could not be written, so the script was not run en återställningskopia kunde inte skrivas, så skriptet kördes inte @@ -5350,6 +5388,8 @@ liquify-list-end {0}, {1} {0} och {1} @msg All colors are within the CMYK gamut Alla färger ligger inom CMYK-färgomfånget @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} färg ligger utanför CMYK-färgomfånget|{n} färger ligger utanför CMYK-färgomfånget @msg Unembedded to {_1} Extraherad till {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Extraherade {n} bild till {folder}|Extraherade {n} bilder till {folder} +@msg every numbered name for {name} is taken in that folder alla numrerade namn för {name} är upptagna i den mappen @msg Reset {_1} Återställ {_1} @msg Sent to {_1} Skickat till {_1} @msg {_1} files {_1}-filer @@ -5499,6 +5539,8 @@ liquify-list-end {0}, {1} {0} och {1} @msg automation filesystem access is not granted: write authority is absent: {path} automatiseringen har inte fått åtkomst till filsystemet: skrivbehörighet saknas: {path} @msg automation path rejected: outside the read root {root}: {path} automatiseringssökvägen avvisades: utanför läsroten {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} automatiseringssökvägen avvisades: utanför läsrötterna {roots}: {path} +@msg a linked image file is outside the read roots en länkad bildfil ligger utanför läsrötterna +@msg a linked file's export folder is outside the read roots exportmappen för en länkad fil ligger utanför läsrötterna @msg automation path rejected: outside the write root {root}: {path} automatiseringssökvägen avvisades: utanför skrivroten {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} automatiseringssökvägen avvisades: utanför skrivrötterna {roots}: {path} @msg automation path rejected: path is empty automatiseringssökvägen avvisades: sökvägen är tom @@ -5722,6 +5764,7 @@ lighting Light Ljus @msg missing panel layout panellayout saknas @msg unsupported native docking operation inbyggd dockningsåtgärd som inte stöds Linux Display Server Linux-skärmserver + Low-Latency Drawing Ritning med låg latens X11 (XWayland) When a Pen Is Attached X11 (XWayland) när en penna är ansluten If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Om ritplattans penna inte ritar väljer du ett X11 (XWayland)-alternativ. X11 (XWayland) X11 (XWayland) @@ -6452,6 +6495,8 @@ theme Appearance Utseende Reset Horizontal Scale Återställ horisontell skala Reset Tracking and Kerning Återställ spärrning och kerning Highlight Font Name Framhäv typsnittsnamn + Highlight Font Size Framhäv teckenstorlek + Other… Annan… Highlight Kerning Framhäv kerning Highlight Tracking Framhäv spärrning Sample Color from Screen Hämta färg från skärmen @@ -7411,6 +7456,12 @@ anchor Points: Punkter: @msg not an RTF file: it doesn't start with {{\\rtf inte en RTF-fil: den börjar inte med {{\\rtf shape Open Öppen +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Enhetsomvandlare + Unit Converter Panel Panelen Enhetsomvandlare + Copy with Units Kopiera med enheter + From Selection Från markering + # Color Effects add-on: Select by Color Kind. Select by Color Kind Markera efter färgtyp Objects with Spot Colors Objekt med dekorfärger @@ -7946,6 +7997,8 @@ digits Hindi Hindi @msg `{file}` is over {_1} MB `{file}` är större än {_1} MB @msg `{id}` is no writable format (see document.formats) `{id}` är inget skrivbart format (se document.formats) @msg `{id}` isn't a loaded library `{id}` är inte ett inläst bibliotek +@msg `{file}` has no swatches of its own `{file}` har inga egna färgrutor +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` har mönsterprover, som en .vcswatches-fil inte kan innehålla @msg `{k}.family` is required `{k}.family` är obligatoriskt @msg `{k}` is a number 0..1 `{k}` är ett tal 0..1 @msg `{k}` is true or false `{k}` är true eller false @@ -8321,7 +8374,13 @@ digits Hindi Hindi @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel måste vara {own} (dokumentets läge), grayscale eller bitmap @msg colour groups can't go into colour groups färggrupper kan inte läggas i färggrupper @msg colour, mode and spot apply to solid-colour swatches only färg, läge och dekor gäller endast enfärgade färgrutor -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read kolumn {column}: `{cell}` är en `%`-kolumn i diagramdatafiler, som inte läses +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` är en relativ sökväg: ange `base` eller en absolut sökväg +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} rad {line}, kolumn {column}: diagramdatafilen för `{var}` kan inte läsas: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` följs inte: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` är större än {MAX_GRAPH_DATA_FILE} byte +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes rad {line}, kolumn {column}: diagramdatafilen `{path}` för `{var}` ger ett diagramvärde som är längre än {MAX_GRAPH_CSV} byte +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all rad {line}, kolumn {column}: diagramdatafilerna innehåller sammanlagt mer än {MAX_GRAPH_FILES_TOTAL} byte +@msg `base` is empty `base` är tom @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable kolumn {column}: `{cell}` anger `{name}`, som är en {_1}-variabel @msg column {column}: `{cell}` names no variable kolumn {column}: `{cell}` anger ingen variabel @msg column {column}: the variable name is longer than {MAX_NAME} characters kolumn {column}: variabelnamnet är längre än {MAX_NAME} tecken diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 3316c038bb..e7c8fcf89a 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -104,6 +104,7 @@ Add Anchor Point Bağlantı Noktası Ekle Add Anchor Point Tool Bağlantı Noktası Ekleme Aracı Add Anchor Points Bağlantı Noktaları Ekle + Add Around Nesnenin Etrafına Ekle Add Effect Efekt Ekle Add Freeform Line Serbest Biçimli Çizgi Ekle Add Freeform Point Serbest Biçim Noktası Ekle @@ -181,6 +182,7 @@ Angle: Açı: Angles Açılar Animated Zoom Animasyonlu Yakınlaştırma + Anti Alias Kenar yumuşatma Anti-alias Kenar yumuşatma Anti-Alias Kenar Yumuşatma Anti-alias Rasters Kenar Yumuşatma Rasterleri @@ -536,6 +538,7 @@ font-technology Variable Değişken Color Mixer (Shift-click the chip) Renk Karıştırıcı (Çipe Shift tuşuna basarak tıklayın) Color Mode Renk Modu Color Mode: Renk Modu: + Color Model Renk Modeli Color Model: Renk Modeli: Color Models Renkli Modeller Color Picker Renk Seçici @@ -561,6 +564,7 @@ font-technology Variable Değişken Colors Renkler Colors: Renkler: Column Graph Tool Sütun Grafiği Aracı + Columns Sütunlar Columns: Sütunlar: Column… Sütun… Combine Slices Dilimleri Birleştir @@ -1041,6 +1045,7 @@ font-technology Variable Değişken Enable text access for screen readers Ekran okuyucular için metin erişimini etkinleştirin Enable Touch Gestures Dokunma Hareketlerini Etkinleştir Switch Selection and Drawing Modes Seçim ve Çizim Modları Arasında Geçiş Yap + Select Last Selection Tool Son Kullanılan Seçim Aracını Seç Enable Touch Workspace Dokunmatik Çalışma Alanını Etkinleştir Encoding Kodlama Encoding: Kodlama: @@ -1254,6 +1259,8 @@ font-technology Variable Değişken Reset Tracking and Kerning Takip ve Karakter Aralığını Sıfırla Reset Horizontal Scale Yatay Ölçeği Sıfırla Highlight Font Name Yazı Tipi Adını Vurgula + Highlight Font Size Yazı Tipi Boyutunu Vurgula + Other… Diğer… Highlight Kerning Karakter Aralığını Vurgula Highlight Tracking Takibi Vurgula Spacing Aralık @@ -2341,6 +2348,9 @@ shape Open Açık Overprint Üst Baskı Overprint and Transparency Flattener Üst Baskı ve Asetat Düzleştirici Overprint and Transparency Flattener Options Üst Baskı ve Asetat Düzleştirici Seçenekleri + Custom… Özel… + Custom Transparency Flattener Options Özel Şeffaflık Düzleştirici Seçenekleri + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS'de alfa şeffaflığı yoktur ve Üst baskılar, üst baskıların korunup korunmayacağını belirler. Overprint Black… Üst Baskı Siyah… Overprint Fill Üst Baskı Dolgusu Overprint Preview Üst Baskı Önizleme @@ -2447,6 +2457,7 @@ shape Open Açık Play Current Selection Geçerli Seçimi Oynat Save Actions… Eylemleri Kaydet… Load Actions… Eylemleri Yükle… + Replace Actions… Eylemleri Değiştir… Reset Actions Eylemleri Sıfırla Replace the current actions with the default set? Geçerli eylemler varsayılan setle değiştirilsin mi? Append adds the default set after the current sets instead. Ekle bunun yerine varsayılan seti geçerli setlerin sonuna ekler. @@ -2808,6 +2819,8 @@ digits Malayalam Malayalam Reselect Yeniden seç Reset Sıfırla Reset Bounding Box Sınırlayıcı Kutuyu Sıfırla + Rotate Bounding Box Sınırlayıcı Kutuyu Döndür + Rotate Bounding Box… Sınırlayıcı Kutuyu Döndür… Reset Envelope Mesh Zarf Ağını Sıfırla Reset Envelope Shape Zarf Şeklini Sıfırla Reset Essentials Essentials'ı sıfırla @@ -2848,6 +2861,7 @@ digits Malayalam Malayalam Reshape Segment Segmenti Yeniden Şekillendir Reshape Tool Yeniden Şekillendir Aracı Reshape Type Area Yazı Alanını Yeniden Şekillendir + Resolution Çözünürlük Resolution: Çözünürlük: Responsive duyarlı Restore Geri yükle @@ -2904,6 +2918,29 @@ digits Malayalam Malayalam The unit for East Asian type measurements, which no field uses yet. Doğu Asya metni ölçüleri için henüz hiçbir alanın kullanmadığı birim. When on, a number typed without a unit into a field in picas is read in points. Açıkken, pika cinsinden bir alana birimsiz yazılan sayı punto olarak okunur. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. XML kimliği seçiliyken nesne adları Katmanlar, Değişkenler ve Katman Seçenekleri'nde XML kimliği olarak gösterilir. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Yazı boyutu ve satır aralığı adımı: Cmd/Ctrl+Shift+. ve Cmd/Ctrl+Shift+, boyutu bir adım, Alt ile birlikte beş adım değiştirir; yatay yazıda Alt ile yukarı veya aşağı ok satır aralığını bir adım, Cmd/Ctrl ile beş adım değiştirir. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. İzleme ve karakter çifti aralığı adımı, em'in binde biri olarak: yatay yazıda Alt ile sol veya sağ ok imleçteki karakter çifti aralığını ya da seçili metnin izlemesini bir adım, Cmd/Ctrl ile beş adım değiştirir. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Taban çizgisi kaydırma adımı: yatay yazıda Alt ve Shift ile yukarı veya aşağı ok taban çizgisini bir adım, Cmd/Ctrl ile beş adım taşır. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Karakter, Paragraf, OpenType ve Glifler panellerinde Japonca ve diğer Doğu Asya dillerindeki yazı seçeneklerini ve Bileşik Fontlar komutunu gösterir. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Karakter ve Paragraf panellerinde Arapça, İbranice ve Hint dillerindeki yazı seçeneklerini gösterir; örneğin paragraf yönü, keşideler ve rakamlar. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Seçim araçları yazıyı yalnızca taban çizgisinde, alan yazısının çerçevesinde veya yolunda seçer, kutusunun içinde herhangi bir yerde değil. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Yazı tipi menüleri her yazı tipini İngilizce adıyla listeler; kapalıyken kendi dilinde de adı olan bir yazı tipi o adı gösterir. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Yeni alan yazısı Otomatik Boyut açık başlar; böylece yatay yazının dikdörtgen çerçevesi metnine sığacak şekilde yükseklikte büyür veya küçülür. + Font lists and the Type › Font menu show a sample of each font beside its name. Yazı tipi listeleri ve Yazı tipi menüsü her yazı tipinin adının yanında bir örneğini gösterir. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Yazı tipi örnekleri, arayüzün parlaklığı ne olursa olsun beyaz üzerine koyu yazıyla çizilir; bu yalnızca menülerdeki yazı tipi önizlemeleri açıkken geçerlidir. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Karakter panelindeki gibi yazı tipi alanlarının listelerinde her satırın ne kadar yüksek olduğu ve dolayısıyla her örneğin ne kadar büyük olduğu. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Son Yazı Tipleri ve yazı tipi listelerinin en yeniden başlayarak gösterdiği, son kullanılan yazı tiplerinin sayısı, 1 ile 15 arası. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Bir metnin yazı tipini veya yazı tipi stilini değiştirdiğinizde, yeni yazı tipinde glifi olmayan karakterler önceki yazı tiplerini korur. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Tuvaldeki pembe vurgu, OpenType özelliklerinin değiştirdiği glifleri, örneğin bitişik harfleri işaretler; yazdırılmaz ve dışa aktarılmaz. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Yazım Aracı ile tek bir karakter seçildiğinde tuvalde yanında seçmeniz için alternatif gliflerinden oluşan bir sıra görünür. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Tuvaldeki pembe vurgu, kendi yazı tipi eksik olduğu için yedek bir yazı tipiyle çizilen metni işaretler; yazdırılmaz ve dışa aktarılmaz. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Bir yazı aracıyla oluşturulan yeni yazı, seçili yer tutucu metinle başlar; yazdığınız metin onun yerini alır. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Paragrafın başına 1. veya * gibi bir liste işareti ve ardından boşluk yazmak paragrafı bir listeye dönüştürür. + Fonts in this folder show in the font menus and can be used without being installed. Bu klasördeki yazı tipleri yazı tipi menülerinde görünür ve yüklenmeden kullanılabilir. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Yazıya grafik stili uygulamak, stilin dolgusu veya konturu olan yerlerde karakterlerin kendi dolgusunu veya konturunu kaldırır, böylece stilin boyası görünür. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Hizala ve Dağıt nokta yazısını em kutusu yerine gliflerinin mürekkebine göre ölçer. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Hizala ve Dağıt alan yazısını çerçevesi yerine gliflerinin mürekkebine göre ölçer. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Sınırlayıcı kutu ve Dönüştür paneli nokta yazısını em kutusu yerine gliflerinin mürekkebine göre ölçer. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Izgara gizliyken bile çizmeyi, taşımayı ve ölçeklemeyi ızgaranın alt bölümlerine yaslar; açık olduğu sürece Piksel'e Yapış uygulanmaz. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Seçili olmayan kılavuzların rengi; Kılavuz Etiketi olan bir çalışma yüzeyi kendi kılavuzlarını etiketin renginde çizer. Draws guides as solid lines or as dots, including the guides already in the document. Belgede zaten bulunan kılavuzlar da dahil olmak üzere kılavuzları düz çizgi ya da nokta olarak çizer. @@ -2980,6 +3017,7 @@ digits Malayalam Malayalam Rounded Rectangle Tool Yuvarlak Köşeli Dikdörtgen Aracı Rounded Rectangle… Yuvarlatılmış Dikdörtgen… Row Size: Satır Boyutu: + Rows Satırlar Rows: Satırlar: Rule: Kural: Rulers Cetveller @@ -4324,6 +4362,8 @@ axis Both Her İkisi @msg the script is no longer in the Scripts folder betik artık Scripts klasöründe değil Some scripts were not listed Bazı komut dosyaları listelenmedi The Scripts folder cannot be read Scripts klasörü okunamıyor + Loading scripts… Betikler yükleniyor… + The Scripts folder is still being read Scripts klasörü hâlâ okunuyor @msg the script's run is no longer available betiğin çalıştırması artık kullanılamıyor @msg a failed command changed undo steps that could not be put back, so the script was stopped başarısız bir komut geri yüklenemeyen geri alma adımlarını değiştirdi, bu yüzden betik durduruldu @msg a recovery copy could not be written, so the script was not run kurtarma kopyası yazılamadı, bu nedenle betik çalıştırılmadı @@ -5179,6 +5219,8 @@ liquify-list-end {0}, {1} {0} ve {1} @msg All colors are within the CMYK gamut Tüm renkler CMYK gamındadır @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} renk CMYK gamının dışında @msg Unembedded to {_1} {_1}'ye gömülü değil +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} {n} görselin gömülmesi kaldırıldı: {folder} +@msg every numbered name for {name} is taken in that folder {name} için numaralandırılmış her ad o klasörde zaten kullanılıyor @msg Reset {_1} {_1}'yi sıfırla @msg Sent to {_1} {_1}'ye gönderildi @msg {_1} files {_1} dosyaları @@ -5582,6 +5624,7 @@ lighting Light Işık @msg missing panel layout eksik panel düzeni @msg unsupported native docking operation desteklenmeyen yerel yerleştirme işlemi Linux Display Server Linux Görüntü Sunucusu + Low-Latency Drawing Düşük Gecikmeli Çizim X11 (XWayland) X11 (XWayland) Ruler Origin Cetvelin Kökeni Reset Ruler Origin Cetvel Başlangıç Noktasını Sıfırla @@ -7437,6 +7480,8 @@ axis Y Axis Y ekseni @msg the guide is hidden or locked kılavuz gizli veya kilitli @msg the library's file is outside the read roots kütüphanenin dosyası okuma köklerinin dışında @msg a linked JavaScript file is outside the read roots bağlantılı bir JavaScript dosyası okuma köklerinin dışında +@msg a linked image file is outside the read roots bağlantılı bir görüntü dosyası okuma köklerinin dışında +@msg a linked file's export folder is outside the read roots bağlantılı bir dosyanın dışa aktarma klasörü okuma köklerinin dışında @msg the line is too long, or the paths it passes too many, to check çizgi denetlenemeyecek kadar uzun veya geçtiği yollar çok fazla @msg the method needs an XML value yöntem için bir XML değeri gerekir @msg the paint is not a freeform gradient (apply one with paint.editGradient {kind}) boya bir serbest biçimli degrade değil (paint.editGradient {kind} ile bir tane uygulayın) @@ -7726,6 +7771,8 @@ axis Y Axis Y ekseni @msg `{f}` is the copy of a document open now `{f}` şu anda açık olan bir belgenin kopyası @msg `{id}` is no writable format (see document.formats) `{id}` yazılabilir bir biçim değil (bkz. document.formats) @msg `{id}` isn't a loaded library `{id}` yüklenmiş bir kütüphane değil +@msg `{file}` has no swatches of its own `{file}` dosyasının kendi renk örnekleri yok +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` desen örnekleri içeriyor ve bir .vcswatches dosyası bunları tutamaz @msg `{key}` has no colours `{key}` renk içermiyor @msg `{key}` is a design name `{key}` bir tasarım adıdır @msg `{key}` is a design name or a list of them `{key}` bir tasarım adı veya tasarım adları listesidir @@ -7949,7 +7996,13 @@ axis Y Axis Y ekseni @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel {own} (belgenin modu), grayscale veya bitmap olmalıdır @msg colour groups can't go into colour groups renk grupları renk gruplarının içine konulamaz @msg colour, mode and spot apply to solid-colour swatches only colour, mode ve spot yalnızca düz renkli renk örnekleri için geçerlidir -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read sütun {column}: `{cell}`, grafik veri dosyalarının bir `%` sütunudur ve bu dosyalar okunmaz +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası göreli bir yoldur: `base` ya da mutlak bir yol verin +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} satır {line}, sütun {column}: `{var}` için grafik veri dosyası okunamıyor: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası izlenmiyor: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası {MAX_GRAPH_DATA_FILE} bayttan büyük +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes satır {line}, sütun {column}: `{var}` için `{path}` grafik veri dosyası {MAX_GRAPH_CSV} bayttan uzun bir grafik değeri veriyor +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all satır {line}, sütun {column}: grafik veri dosyaları toplamda {MAX_GRAPH_FILES_TOTAL} bayttan fazla +@msg `base` is empty `base` boş @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable sütun {column}: `{cell}`, {_1} türünde bir değişken olan `{name}` değişkenini belirtiyor @msg column {column}: `{cell}` names no variable sütun {column}: `{cell}` hiçbir değişkeni belirtmiyor @msg column {column}: the variable name is longer than {MAX_NAME} characters sütun {column}: değişken adı {MAX_NAME} karakterden uzun @@ -9263,6 +9316,12 @@ anchor Points: Noktalar: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` "free", "keepAngles" veya "symmetric" olmalıdır @msg `{key}` must be [x, y] `{key}` [x, y] olmalıdır +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Birim Dönüştürücü + Unit Converter Panel Birim Dönüştürücü Paneli + Copy with Units Birimlerle Kopyala + From Selection Seçimden + # Color Effects add-on: Select by Color Kind. Select by Color Kind Renk Türüne Göre Seç Objects with Spot Colors Spot Renkli Nesneler diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 32033f9436..b1dc4a0b63 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -113,6 +113,7 @@ Add Anchor Point Додати опорну точку Add Anchor Point Tool Інструмент «Додати опорну точку» Add Anchor Points Додати опорні точки + Add Around Додати навколо об’єкта Add Effect Додати ефект Add Freeform Line Додати довільну лінію Add Freeform Point Додати довільну точку @@ -190,6 +191,7 @@ Angle: Кут: Angles Кути Animated Zoom Анімоване масштабування + Anti Alias Згладжування Anti-alias Згладжування Anti-Alias Згладжування Anti-alias Rasters Згладжувати растрові зображення @@ -550,6 +552,7 @@ font-technology Variable Варіативні Color Mixer (Shift-click the chip) Змішувач кольорів (Shift+клацання на зразку) Color Mode Колірний режим Color Mode: Колірний режим: + Color Model Колірна модель Color Model: Колірна модель: Color Models Колірні моделі Color Picker Палітра кольорів @@ -576,6 +579,7 @@ font-technology Variable Варіативні Colors Кольори Colors: Кольори: Column Graph Tool Інструмент «Гістограма» + Columns Стовпці Columns: Стовпці: Column… Стовпець… Combine Slices Об’єднати фрагменти @@ -1079,6 +1083,7 @@ font-technology Variable Варіативні Enable text access for screen readers Дозволити доступ до тексту для програм читання з екрану Enable Touch Gestures Увімкнути сенсорні жести Switch Selection and Drawing Modes Перемкнути режими виділення та малювання + Select Last Selection Tool Вибрати останній інструмент виділення Enable Touch Workspace Включити сенсорне робоче середовище Encoding Кодування Encoding: Кодування: @@ -1308,6 +1313,8 @@ font-technology Variable Варіативні Reset Tracking and Kerning Скинути трекінг і кернінг Reset Horizontal Scale Скинути масштаб по горизонталі Highlight Font Name Виділити назву шрифту + Highlight Font Size Виділити розмір шрифту + Other… Інший… Highlight Kerning Виділити кернінг Highlight Tracking Виділити трекінг Spacing Інтервал @@ -2599,6 +2606,9 @@ file-filter Templates Шаблони Overprint Накладення Overprint and Transparency Flattener Накладання та зведення прозорості Overprint and Transparency Flattener Options Параметри накладання та зведення прозорості + Custom… Користувацькі… + Custom Transparency Flattener Options Користувацькі параметри зведення прозорості + EPS has no alpha transparency, and Overprints sets whether overprints are kept. У EPS немає альфа-прозорості, а параметр «Накладення» визначає, чи зберігаються накладення. Overprint Black… Накладення чорного… Overprint Fill Накладання заливки Overprint Preview Перегляд накладання @@ -2707,6 +2717,7 @@ diagnostics ui інтерфейс Play Current Selection Відтворити поточне виділення Save Actions… Зберегти дії… Load Actions… Завантажити дії… + Replace Actions… Замінити дії… Reset Actions Скинути дії Replace the current actions with the default set? Замінити поточні дії набором за умовчанням? Append adds the default set after the current sets instead. Кнопка «Додати» натомість додає набір за умовчанням після поточних наборів. @@ -3075,6 +3086,8 @@ digits Malayalam Малаялам Reselect Виділити знову Reset Скинути Reset Bounding Box Скинути обмежувальну рамку + Rotate Bounding Box Повернути обмежувальну рамку + Rotate Bounding Box… Повернути обмежувальну рамку… Reset Envelope Mesh Скинути сітку оболонки Reset Envelope Shape Скинути форму оболонки Reset Essentials Скинути «Основні» @@ -3116,6 +3129,7 @@ digits Malayalam Малаялам Reshape Segment Змінити форму сегмента Reshape Tool Інструмент «Зміна форми» Reshape Type Area Змінити форму текстової області + Resolution Роздільна здатність Resolution: Роздільна здатність: Responsive Адаптивний Restore Відновити @@ -3172,6 +3186,29 @@ digits Malayalam Малаялам The unit for East Asian type measurements, which no field uses yet. Одиниця для розмірів східноазіатського тексту, якої поки не використовує жодне поле. When on, a number typed without a unit into a field in picas is read in points. Якщо ввімкнено, число, введене без одиниці в поле в піках, читається в пунктах. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. З XML ID назви об’єктів показуються як XML ID у «Шарах», «Змінних» і «Параметрах шару». + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Крок розміру тексту й інтерліньяжу: Cmd/Ctrl+Shift+. і Cmd/Ctrl+Shift+, змінюють розмір на один крок, а разом з Alt — на п’ять; у горизонтальному тексті Alt зі стрілкою вгору або вниз змінює інтерліньяж на один крок, а з Cmd/Ctrl — на п’ять. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Крок трекінгу й кернінгу в тисячних частках em: у горизонтальному тексті Alt зі стрілкою вліво або вправо змінює кернінг біля курсора або трекінг виділеного тексту на один крок, а з Cmd/Ctrl — на п’ять. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Крок зсуву базової лінії: у горизонтальному тексті Alt і Shift зі стрілкою вгору або вниз зсувають базову лінію на один крок, а з Cmd/Ctrl — на п’ять. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Показує параметри японського та іншого східноазійського тексту на панелях «Символ», «Абзац», «OpenType» і «Гліфи», а також команду «Складені шрифти». + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Показує параметри арабського, івритського та індійського тексту на панелях «Символ» і «Абзац», наприклад напрямок абзацу, кашиди й цифри. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Інструменти виділення виділяють текст лише на його базовій лінії, рамці тексту в області або його контурі, а не будь-де всередині його рамки. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Меню шрифтів показують кожен шрифт під англійською назвою; якщо вимкнено, шрифт, що має назву власною мовою, показує цю назву. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Новий текст в області починається з увімкненим авторозміром, тож прямокутна рамка горизонтального тексту збільшується або зменшується у висоту під свій текст. + Font lists and the Type › Font menu show a sample of each font beside its name. Списки шрифтів і меню «Шрифт» показують зразок кожного шрифту поруч із його назвою. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Зразки шрифтів малюються темним текстом на білому за будь-якої яскравості інтерфейсу; це діє, лише поки ввімкнено попередній перегляд шрифтів у меню. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Висота кожного рядка в списках полів шрифту, як-от на панелі «Символ», а отже, і розмір кожного зразка. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Скільки останніх використаних шрифтів, від 1 до 15, показують «Останні шрифти» та списки шрифтів, починаючи з найновішого. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Коли ви змінюєте шрифт або накреслення тексту, символи, для яких новий шрифт не має гліфа, зберігають попередній шрифт. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Рожеве підсвічування на полотні позначає гліфи, замінені функціями OpenType, як-от лігатури; воно не друкується й не експортується. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. З інструментом «Текст» виділення одного символу показує поруч із ним на полотні ряд його альтернативних гліфів для вибору. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Рожеве підсвічування на полотні позначає текст, намальований замінним шрифтом, бо його шрифту бракує; воно не друкується й не експортується. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Новий текст, створений текстовим інструментом, починається з виділеного тексту-заповнювача, який замінюється введеним текстом. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Якщо на початку абзацу ввести маркер списку, як-от 1. або *, а потім пробіл, абзац стає списком. + Fonts in this folder show in the font menus and can be used without being installed. Шрифти з цієї теки з’являються в меню шрифтів, і їх можна використовувати без встановлення. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Застосування графічного стилю до тексту прибирає власну заливку чи обведення символів там, де вони є в стилю, щоб було видно фарбу стилю. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. «Вирівняти» й «Розподілити» вимірюють текст із точки за фарбою його гліфів, а не за його em-квадратом. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. «Вирівняти» й «Розподілити» вимірюють текст в області за фарбою його гліфів, а не за його рамкою. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Обмежувальна рамка й панель «Трансформування» вимірюють текст із точки за фарбою його гліфів, а не за його em-квадратом. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Прив’язує малювання, переміщення й масштабування до поділок сітки, навіть коли сітку приховано; поки параметр увімкнено, «Прив’язати до пікселя» не діє. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Колір невиділених напрямних; монтажна область із «Міткою напрямних» малює свої напрямні кольором мітки. Draws guides as solid lines or as dots, including the guides already in the document. Малює напрямні суцільними лініями або крапками, включно з напрямними, які вже є в документі. @@ -3253,6 +3290,7 @@ digits Malayalam Малаялам Rounded Rectangle Tool Інструмент «Округлений прямокутник» Rounded Rectangle… Округлений прямокутник… Row Size: Розмір рядка: + Rows Рядки Rows: Рядки: Rule: Лінійка: Rulers Лінійки @@ -4600,6 +4638,8 @@ axis Both Обидві @msg the script is no longer in the Scripts folder скрипт більше не міститься в папці Scripts Some scripts were not listed Деякі сценарії не показано The Scripts folder cannot be read Не вдалося прочитати папку Scripts + Loading scripts… Завантаження сценаріїв… + The Scripts folder is still being read Папка Scripts ще читається @msg the script's run is no longer available виконання скрипта більше не доступне @msg a failed command changed undo steps that could not be put back, so the script was stopped невдала команда змінила кроки скасування, які не вдалося відновити, тому скрипт зупинено @msg a recovery copy could not be written, so the script was not run не вдалося записати копію для відновлення, тому скрипт не виконано @@ -5474,6 +5514,8 @@ liquify-list-end {0}, {1} {0} і {1} @msg All colors are within the CMYK gamut Усі кольори входять у колірне охоплення CMYK @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} колір виходить за межі колірного охоплення CMYK|{n} кольори виходять за межі колірного охоплення CMYK|{n} кольорів виходять за межі колірного охоплення CMYK @msg Unembedded to {_1} Вилучено у {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Вилучено {n} зображення у {folder}|Вилучено {n} зображення у {folder}|Вилучено {n} зображень у {folder} +@msg every numbered name for {name} is taken in that folder усі нумеровані імена для {name} уже зайняті в цій папці @msg Reset {_1} Скинуто: {_1} @msg Sent to {_1} Відправлено до {_1} @msg {_1} files {_1} файлів @@ -5603,6 +5645,8 @@ liquify-list-end {0}, {1} {0} і {1} @msg automation path rejected: outside the read root {root}: {path} шлях автоматизації відхилено: поза кореневою папкою для читання {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} шлях автоматизації відхилено: поза кореневими папками для читання {roots}: {path} @msg a linked JavaScript file is outside the read roots зв’язаний файл JavaScript перебуває поза кореневими папками для читання +@msg a linked image file is outside the read roots зв’язаний файл зображення перебуває поза кореневими папками для читання +@msg a linked file's export folder is outside the read roots папка експорту зв’язаного файлу перебуває поза кореневими папками для читання @msg automation path rejected: outside the write root {root}: {path} шлях автоматизації відхилено: поза кореневою папкою для запису {root}: {path} @msg automation path rejected: outside the write roots {roots}: {path} шлях автоматизації відхилено: поза кореневими папками для запису {roots}: {path} @msg automation path rejected: path is empty шлях автоматизації відхилено: шлях порожній @@ -5828,6 +5872,7 @@ lighting Light Світло @msg missing panel layout Відсутнє розташування панелей @msg unsupported native docking operation Непідтримувана власна операція прикріплення Linux Display Server Дисплейний сервер Linux + Low-Latency Drawing Малювання з низькою затримкою X11 (XWayland) When a Pen Is Attached X11 (XWayland), коли підключено перо If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Якщо перо графічного планшета не малює, виберіть варіант X11 (XWayland). X11 (XWayland) X11 (XWayland) @@ -6992,6 +7037,12 @@ anchor Points: Точки: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` має бути "free", "keepAngles" або "symmetric" @msg `{key}` must be [x, y] `{key}` має бути [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Конвертер одиниць + Unit Converter Panel Панель «Конвертер одиниць» + Copy with Units Копіювати з одиницями + From Selection З виділення + # Color Effects add-on: Select by Color Kind. Select by Color Kind Виділити за типом кольору Objects with Spot Colors Об’єкти з плашковими кольорами @@ -7990,6 +8041,8 @@ breakText Glyphs Гліфи @msg `{f}` is the copy of a document open now `{f}` — це копія документа, відкритого зараз @msg `{id}` is no writable format (see document.formats) `{id}` не є форматом, доступним для запису (див. document.formats) @msg `{id}` isn't a loaded library `{id}` не є завантаженою бібліотекою +@msg `{file}` has no swatches of its own у `{file}` немає власних зразків +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold у `{_1}` є зразки візерунків, яких файл .vcswatches не може містити @msg `{key}` has no colours `{key}` не містить кольорів @msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` містить понад {MAX_EDIT_WORDS} слів @msg `{key}` is a design name `{key}` — це назва дизайну @@ -8280,7 +8333,13 @@ breakText Glyphs Гліфи @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel має бути {own} (режим документа), grayscale або bitmap @msg colour groups can't go into colour groups групи кольорів не можна поміщати в групи кольорів @msg colour, mode and spot apply to solid-colour swatches only colour, mode і spot застосовуються лише до зразків суцільного кольору -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read стовпець {column}: `{cell}` — це стовпець `%` файлів даних діаграм, які не читаються +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` задано відносним шляхом: укажіть `base` або абсолютний шлях +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} рядок {line}, стовпець {column}: не вдається прочитати файл даних діаграми для `{var}`: {e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} рядок {line}, стовпець {column}: перехід до файлу даних діаграми `{path}` для `{var}` не виконується: {r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` більший за {MAX_GRAPH_DATA_FILE} байтів +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes рядок {line}, стовпець {column}: файл даних діаграми `{path}` для `{var}` дає значення діаграми довше за {MAX_GRAPH_CSV} байтів +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all рядок {line}, стовпець {column}: файли даних діаграм разом містять понад {MAX_GRAPH_FILES_TOTAL} байтів +@msg `base` is empty `base` порожнє @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable стовпець {column}: `{cell}` указує `{name}`, а це змінна типу {_1} @msg column {column}: `{cell}` names no variable стовпець {column}: `{cell}` не вказує жодної змінної @msg column {column}: the variable name is longer than {MAX_NAME} characters стовпець {column}: ім’я змінної довше за {MAX_NAME} символів diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 5f43435a45..7c4f95eb9b 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -128,6 +128,7 @@ Add Anchor Point Thêm điểm neo Add Anchor Point Tool Công cụ Thêm điểm neo Add Anchor Points Thêm các điểm neo + Add Around Thêm xung quanh đối tượng Add Content Thêm nội dung Add Effect Thêm hiệu ứng Add Font Files Thêm tệp phông chữ @@ -213,6 +214,7 @@ Angled Strokes… Nét xiên góc… Angles Các góc Animated Zoom Thu phóng có hiệu ứng + Anti Alias Khử răng cưa Anti-alias Khử răng cưa Anti-Alias Khử răng cưa Anti-alias Rasters Khử răng cưa ảnh raster @@ -648,6 +650,7 @@ font-technology Variable Biến thiên Color Mixer (Shift-click the chip) Trộn màu (Shift-bấm chip màu) Color Mode Chế độ màu Color Mode: Chế độ màu: + Color Model Mô hình màu Color Model: Mô hình màu: Color Models Các mô hình màu Color Picker Bộ chọn màu @@ -676,6 +679,7 @@ font-technology Variable Biến thiên Colors: Màu sắc: Column Graph Tool Công cụ Biểu đồ cột Column Width: Chiều rộng cột: + Columns Cột Columns: Cột: Column… Cột… Combine Slices Kết hợp lát cắt @@ -1249,6 +1253,7 @@ font-technology Variable Biến thiên Enable text access for screen readers Bật truy cập văn bản cho trình đọc màn hình Enable Touch Gestures Bật cử chỉ cảm ứng Switch Selection and Drawing Modes Chuyển giữa chế độ chọn và vẽ + Select Last Selection Tool Chọn công cụ chọn dùng gần nhất Enable Touch Workspace Bật không gian làm việc cảm ứng Encoding Mã hóa Encoding: Mã hóa: @@ -2336,6 +2341,7 @@ digits Hindi Hindi Linked File Not Found Không tìm thấy tệp liên kết Links Liên kết Linux Display Server Máy chủ hiển thị Linux + Low-Latency Drawing Vẽ độ trễ thấp Liquify Lỏng hóa List Data Sets Liệt kê tập dữ liệu List Folder Liệt kê thư mục @@ -2878,6 +2884,9 @@ digits Hindi Hindi Overprint In chồng Overprint and Transparency Flattener In chồng và làm phẳng trong suốt Overprint and Transparency Flattener Options Tùy chọn in chồng và làm phẳng trong suốt + Custom… Tùy chỉnh… + Custom Transparency Flattener Options Tùy chọn làm phẳng trong suốt tùy chỉnh + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS không có trong suốt kênh Alpha, và In chồng quyết định có giữ in chồng hay không. Overprint Black… In chồng đen… Overprint Fill Tô in chồng Overprint Preview Xem trước in chồng @@ -3024,6 +3033,7 @@ diagnostics ui giao diện Play Current Selection Phát vùng chọn hiện tại Save Actions… Lưu hành động… Load Actions… Tải hành động… + Replace Actions… Thay thế hành động… Reset Actions Đặt lại hành động Replace the current actions with the default set? Thay thế các hành động hiện tại bằng bộ mặc định? Append adds the default set after the current sets instead. Nối thêm sẽ thêm bộ mặc định vào sau các bộ hiện tại. @@ -3378,6 +3388,8 @@ mark-style Japanese Kiểu Nhật Reset all Revolve settings to their defaults. Đặt lại tất cả cài đặt Revolve về mặc định. Reset Bar Position Đặt lại vị trí thanh Reset Bounding Box Đặt lại hộp bao + Rotate Bounding Box Xoay hộp bao + Rotate Bounding Box… Xoay hộp bao… Reset Envelope Mesh Đặt lại lưới Envelope Reset Envelope Shape Đặt lại hình dạng Envelope Reset Essentials Đặt lại Essentials @@ -3414,6 +3426,8 @@ mark-style Japanese Kiểu Nhật Reset to White, Black Đặt lại về Trắng, Đen Reset Tracking and Kerning Đặt lại giãn chữ và kerning Highlight Font Name Đánh dấu tên phông + Highlight Font Size Đánh dấu cỡ chữ + Other… Khác… Highlight Kerning Đánh dấu kerning Highlight Tracking Đánh dấu giãn chữ Reset with Mesh Đặt lại với lưới @@ -3431,6 +3445,7 @@ mark-style Japanese Kiểu Nhật Resize Thay đổi kích thước Resize panel window Thay đổi kích thước cửa sổ bảng Resize panels Thay đổi kích thước bảng + Resolution Độ phân giải Resolution: Độ phân giải: Responsive Đáp ứng Restore Khôi phục @@ -3487,6 +3502,29 @@ mark-style Japanese Kiểu Nhật The unit for East Asian type measurements, which no field uses yet. Đơn vị cho số đo chữ Đông Á, hiện chưa có trường nào dùng. When on, a number typed without a unit into a field in picas is read in points. Khi bật, số nhập không có đơn vị vào trường tính bằng pica được đọc theo điểm. With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. Với XML ID, tên đối tượng hiển thị dưới dạng XML ID trong Các lớp, Biến số và Tùy chọn lớp. + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. Bước cho cỡ chữ và khoảng cách dòng: Cmd/Ctrl+Shift+. và Cmd/Ctrl+Shift+, đổi cỡ chữ một bước, hoặc năm bước khi có thêm Alt; trong chữ ngang, Alt cùng mũi tên lên hoặc xuống đổi khoảng cách dòng một bước, hoặc năm bước khi có Cmd/Ctrl. + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. Bước cho giãn chữ và kerning, tính bằng phần nghìn em: trong chữ ngang, Alt cùng mũi tên trái hoặc phải đổi kerning tại con trỏ hoặc giãn chữ của văn bản đã chọn một bước, hoặc năm bước khi có Cmd/Ctrl. + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. Bước cho dịch đường cơ sở: trong chữ ngang, Alt và Shift cùng mũi tên lên hoặc xuống dời đường cơ sở một bước, hoặc năm bước khi có Cmd/Ctrl. + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. Hiện các tùy chọn cho chữ Nhật và chữ Đông Á khác trong các bảng Ký tự, Đoạn văn, OpenType và Glyph, cùng lệnh Phông chữ tổ hợp. + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. Hiện các tùy chọn cho chữ Ả Rập, Do Thái và Ấn Độ trong các bảng Ký tự và Đoạn văn, như hướng đoạn văn, kashida và chữ số. + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. Các công cụ chọn chỉ chọn chữ trên đường cơ sở, khung của chữ vùng hoặc đường dẫn của nó, không phải bất kỳ đâu bên trong hộp của nó. + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. Menu phông chữ liệt kê mỗi phông bằng tên tiếng Anh; khi tắt, phông có cả tên bằng ngôn ngữ của nó sẽ hiện tên đó. + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. Chữ vùng mới bắt đầu với Tự động định cỡ bật, nên khung chữ nhật chứa chữ ngang cao lên hoặc thấp xuống cho vừa chữ của nó. + Font lists and the Type › Font menu show a sample of each font beside its name. Các danh sách phông chữ và menu Phông chữ hiện mẫu của mỗi phông bên cạnh tên của nó. + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. Mẫu phông chữ được vẽ bằng chữ tối trên nền trắng, bất kể độ sáng của giao diện; điều này chỉ áp dụng khi xem trước phông chữ trong menu đang bật. + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. Độ cao của mỗi hàng trong danh sách của các ô phông chữ, như ô trong bảng Ký tự, và do đó độ lớn của mỗi mẫu. + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. Số phông chữ dùng gần nhất, từ 1 đến 15, mà Phông chữ gần đây và các danh sách phông chữ hiện, mới nhất trước. + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. Khi bạn đổi phông chữ hoặc kiểu phông của văn bản, các ký tự mà phông mới không có glyph sẽ giữ phông cũ. + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. Vùng tô hồng trên canvas đánh dấu các glyph mà tính năng OpenType đã thay thế, như chữ ghép; vùng này không được in hay xuất. + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. Với công cụ Chữ, chọn một ký tự sẽ hiện bên cạnh nó trên canvas một hàng glyph thay thế để chọn. + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. Vùng tô hồng trên canvas đánh dấu chữ được vẽ bằng phông thay thế vì thiếu phông của nó; vùng này không được in hay xuất. + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. Chữ mới tạo bằng công cụ chữ bắt đầu với văn bản giữ chỗ đã được chọn, nên những gì bạn gõ sẽ thay thế nó. + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. Gõ một dấu danh sách như 1. hoặc * rồi một dấu cách ở đầu đoạn văn sẽ biến đoạn đó thành danh sách. + Fonts in this folder show in the font menus and can be used without being installed. Phông chữ trong thư mục này hiện trong các menu phông chữ và có thể dùng mà không cần cài đặt. + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. Áp dụng kiểu đồ họa cho chữ sẽ bỏ phần tô hoặc nét riêng của ký tự ở nơi kiểu có phần đó, để màu của kiểu hiện ra. + Align and Distribute measure point type by the ink of its glyphs instead of its em box. Căn chỉnh và Phân bố đo chữ điểm theo phần mực của các glyph thay vì hộp em của nó. + Align and Distribute measure area type by the ink of its glyphs instead of its frame. Căn chỉnh và Phân bố đo chữ vùng theo phần mực của các glyph thay vì khung của nó. + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. Hộp giới hạn và bảng Biến đổi đo chữ điểm theo phần mực của các glyph thay vì hộp em của nó. Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. Hút thao tác vẽ, di chuyển và co giãn vào các phân chia của lưới, kể cả khi lưới đang ẩn; khi tùy chọn này bật, Hút vào pixel không có tác dụng. The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. Màu của các đường căn không được chọn; bảng vẽ có Nhãn đường căn vẽ các đường căn của riêng nó bằng màu của nhãn. Draws guides as solid lines or as dots, including the guides already in the document. Vẽ đường căn dưới dạng đường liền hoặc chấm, kể cả các đường căn đã có trong tài liệu. @@ -3586,6 +3624,7 @@ mark-style Japanese Kiểu Nhật Rounded Rectangle… Hình chữ nhật bo góc… Roundness: Độ tròn: Row Size: Kích thước hàng: + Rows Hàng Rows: Hàng: Rule: Quy tắc: Ruler Origin Gốc thước @@ -4959,6 +4998,8 @@ theme Appearance Giao diện @msg automation path rejected: outside the read root {root}: {path} đường dẫn tự động bị từ chối: ngoài thư mục gốc đọc {root}: {path} @msg automation path rejected: outside the read roots {roots}: {path} đường dẫn tự động bị từ chối: ngoài các thư mục gốc đọc {roots}: {path} @msg a linked JavaScript file is outside the read roots một tệp JavaScript được liên kết nằm ngoài các thư mục gốc đọc +@msg a linked image file is outside the read roots một tệp hình ảnh được liên kết nằm ngoài các thư mục gốc đọc +@msg a linked file's export folder is outside the read roots thư mục xuất của một tệp được liên kết nằm ngoài các thư mục gốc đọc @msg the library's file is outside the read roots tệp của thư viện nằm ngoài các thư mục gốc đọc @msg {file} names more than one linked JavaScript file {file} khớp với nhiều hơn một tệp JavaScript được liên kết @msg automation path rejected: outside the write root {root}: {path} đường dẫn tự động bị từ chối: ngoài thư mục gốc ghi {root}: {path} @@ -5041,6 +5082,8 @@ theme Appearance Giao diện @msg the script is no longer in the Scripts folder tập lệnh không còn trong thư mục Scripts Some scripts were not listed Một số tập lệnh không được liệt kê The Scripts folder cannot be read Không thể đọc thư mục Scripts + Loading scripts… Đang tải tập lệnh… + The Scripts folder is still being read Thư mục Scripts vẫn đang được đọc @msg the script's run is no longer available lần chạy tập lệnh không còn khả dụng @msg a failed command changed undo steps that could not be put back, so the script was stopped một lệnh thất bại đã thay đổi các bước hoàn tác không thể khôi phục, nên tập lệnh đã bị dừng @msg a recovery copy could not be written, so the script was not run không thể ghi bản sao khôi phục nên tập lệnh không được chạy @@ -5488,6 +5531,8 @@ liquify-list-end {0}, {1} {0} và {1} @msg no target object has an opacity mask: select one or give `id` không có đối tượng đích có mặt nạ độ mờ: hãy chọn hoặc cung cấp `id` @msg no threaded text selected chưa chọn văn bản liên kết @msg no user library folder here không có thư mục thư viện người dùng ở đây +@msg `{file}` has no swatches of its own `{file}` không có mẫu màu riêng +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` có mẫu họa tiết, mà tệp .vcswatches không thể chứa @msg no user workspace `{from}` không có không gian làm việc người dùng `{from}` @msg node {_1} is not text nút {_1} không phải là văn bản @msg node {_1} is on a locked artboard nút {_1} nằm trên bảng vẽ bị khóa @@ -5923,6 +5968,8 @@ liquify-list-end {0}, {1} {0} và {1} @msg tool shortcuts must be a single key (optionally with Shift) phím tắt công cụ phải là một phím đơn (tùy chọn với Shift) @msg truncated bị cắt ngắn @msg Unembedded to {_1} Đã bỏ nhúng vào {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} Đã bỏ nhúng {n} ảnh vào {folder} +@msg every numbered name for {name} is taken in that folder mọi tên đánh số cho {name} đã được dùng trong thư mục đó @msg unknown command `{0}` lệnh không xác định `{0}` @msg step {step} of “{action}” runs the unknown command `{command}` bước {step} của “{action}” chạy lệnh không xác định `{command}` @msg unknown command `{0}`; did you mean `{1}`? lệnh không xác định `{0}`; ý bạn là `{1}`? @@ -7023,6 +7070,12 @@ anchor Points: Điểm: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` phải là "free", "keepAngles" hoặc "symmetric" @msg `{key}` must be [x, y] `{key}` phải là [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter Bộ chuyển đổi đơn vị + Unit Converter Panel Bảng Bộ chuyển đổi đơn vị + Copy with Units Sao chép kèm đơn vị + From Selection Từ vùng chọn + # Color Effects add-on: Select by Color Kind. Select by Color Kind Chọn theo loại màu Objects with Spot Colors Đối tượng có màu pha diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index f05b374a0b..9cf2eb31bd 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -68,6 +68,7 @@ Add Anchor Point 添加锚点 Add Anchor Point Tool 添加锚点工具 Add Anchor Points 添加锚点 + Add Around 围绕对象添加 Add Effect 添加效果 Add Freeform Line 添加自由曲线 Add Freeform Point 添加自由点 @@ -144,6 +145,7 @@ Angle: 角度: Angles 角度 Animated Zoom 动画缩放 + Anti Alias 消除锯齿 Anti-alias 消除锯齿 Anti-Alias 消除锯齿 Anti-alias Rasters 栅格消除锯齿 @@ -501,6 +503,7 @@ antiAlias Sharp 锐利 Color Mixer (Shift-click the chip) 颜色混合器 (Shift+单击色块) Color Mode 颜色模式 Color Mode: 颜色模式: + Color Model 颜色模型 Color Model: 颜色模型: Color Models 颜色模型 Color Picker 拾色器 @@ -527,6 +530,7 @@ antiAlias Sharp 锐利 Colors 颜色数 Colors: 颜色: Column Graph Tool 柱形图工具 + Columns 列数 Columns: 列数: Column… 列… Combine Slices 组合切片 @@ -1016,6 +1020,7 @@ antiAlias Sharp 锐利 Enable text access for screen readers 启用屏幕阅读器的文字访问 Enable Touch Gestures 启用触控手势 Switch Selection and Drawing Modes 切换选择与绘图模式 + Select Last Selection Tool 切换到上次使用的选择工具 Enable Touch Workspace 启用触控工作区 Encoding 编码 Encoding: 编码: @@ -1245,6 +1250,8 @@ antiAlias Sharp 锐利 Reset Tracking and Kerning 重置字距和字偶距 Reset Horizontal Scale 重置水平缩放 Highlight Font Name 突出显示字体名称 + Highlight Font Size 突出显示字号 + Other… 其他… Highlight Kerning 突出显示字偶距 Highlight Tracking 突出显示字距 Spacing 间距 @@ -2459,6 +2466,9 @@ file-filter Templates 模板 Overprint 叠印 Overprint and Transparency Flattener 叠印和透明度拼合器 Overprint and Transparency Flattener Options 叠印和透明度拼合器选项 + Custom… 自定义… + Custom Transparency Flattener Options 自定义透明度拼合器选项 + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS 没有 Alpha 透明度,“叠印”决定是否保留叠印。 Overprint Black… 黑色叠印… Overprint Fill 叠印填色 Overprint Preview 叠印预览 @@ -2568,6 +2578,7 @@ diagnostics ui 界面 Play Current Selection 播放当前选择项目 Save Actions… 存储动作… Load Actions… 载入动作… + Replace Actions… 替换动作… Reset Actions 重置动作 Replace the current actions with the default set? 要用默认动作组替换当前动作吗? Append adds the default set after the current sets instead. “追加”会改为将默认动作组添加到当前动作组之后。 @@ -2935,6 +2946,8 @@ digits Malayalam 马拉雅拉姆数字 Reselect 重新选择 Reset 重置 Reset Bounding Box 重置定界框 + Rotate Bounding Box 旋转定界框 + Rotate Bounding Box… 旋转定界框… Reset Envelope Mesh 重置封套网格 Reset Envelope Shape 重置封套形状 Reset Essentials 重置基本功能 @@ -2975,6 +2988,7 @@ digits Malayalam 马拉雅拉姆数字 Reshape Segment 整形线段 Reshape Tool 整形工具 Reshape Type Area 调整区域文字轮廓 + Resolution 分辨率 Resolution: 分辨率: Responsive 响应式 Restore 恢复 @@ -3031,6 +3045,29 @@ digits Malayalam 马拉雅拉姆数字 The unit for East Asian type measurements, which no field uses yet. 用于东亚文字度量的单位,目前还没有字段使用。 When on, a number typed without a unit into a field in picas is read in points. 开启后,在以派卡为单位的字段中输入的不带单位的数字按点读取。 With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. 选择 XML ID 时,图层、变量和图层选项中的对象名称显示为 XML ID。 + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. 文字大小和行距的步长:Cmd/Ctrl+Shift+. 和 Cmd/Ctrl+Shift+, 将字号改变一步,同时按 Alt 则改变五步;在横排文字中,Alt 加上下箭头将行距改变一步,同时按 Cmd/Ctrl 则改变五步。 + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. 字距调整和字偶间距的步长,单位为千分之一 em:在横排文字中,Alt 加左右箭头将插入点处的字偶间距或所选文字的字距调整改变一步,同时按 Cmd/Ctrl 则改变五步。 + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. 基线偏移的步长:在横排文字中,Alt、Shift 加上下箭头将基线移动一步,同时按 Cmd/Ctrl 则移动五步。 + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. 在字符、段落、OpenType 和字形面板中显示日文及其他东亚文字的选项,并显示复合字体命令。 + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. 在字符和段落面板中显示阿拉伯文、希伯来文和印度系文字的选项,例如段落方向、卡希达和数字。 + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. 选择工具只在文字的基线、区域文字的框架或其路径上选择文字,而不是在其框内任意位置。 + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. 字体菜单以英文名称列出每种字体;关闭时,也有本国语言名称的字体会显示该名称。 + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. 新的区域文字开启自动调整大小,因此横排文字的矩形框架会随文字增高或缩短。 + Font lists and the Type › Font menu show a sample of each font beside its name. 字体列表和字体菜单在每种字体的名称旁显示该字体的样本。 + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. 无论界面亮度如何,字体样本都以深色文字绘制在白色上;仅在菜单内字体预览开启时生效。 + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. 字体字段(例如字符面板中的字段)列表中每行的高度,也就是每个样本的大小。 + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. 最近字体和字体列表显示多少个最近使用的字体(1 到 15),最新的在前。 + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. 更改文字的字体或字体样式时,新字体中没有字形的字符会保留原来的字体。 + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. 画布上的粉色高亮标出被 OpenType 功能替换的字形,例如连字;高亮不会打印或导出。 + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. 使用文字工具选中一个字符时,画布上会在其旁边显示一排可供选择的替代字形。 + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. 画布上的粉色高亮标出因缺少字体而用替代字体绘制的文字;高亮不会打印或导出。 + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. 用文字工具新建的文字以选中的占位符文字开始,输入的内容会替换它。 + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. 在段落开头输入 1. 或 * 等列表标记再输入空格,该段落会变成列表。 + Fonts in this folder show in the font menus and can be used without being installed. 此文件夹中的字体会显示在字体菜单中,无需安装即可使用。 + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. 对文字应用图形样式时,样式有填色或描边的地方会移除字符自身的填色或描边,从而显示样式的颜色。 + Align and Distribute measure point type by the ink of its glyphs instead of its em box. 对齐和分布按字形的墨迹而不是全角框测量点文字。 + Align and Distribute measure area type by the ink of its glyphs instead of its frame. 对齐和分布按字形的墨迹而不是框架测量区域文字。 + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. 定界框和变换面板按字形的墨迹而不是全角框测量点文字。 Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. 即使网格已隐藏,绘制、移动和缩放也会对齐到网格的细分;开启期间,“对齐像素”不起作用。 The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. 未选中参考线的颜色;设置了参考线标签的画板会用标签颜色绘制自己的参考线。 Draws guides as solid lines or as dots, including the guides already in the document. 将参考线绘制为实线或点,包括文档中已有的参考线。 @@ -3109,6 +3146,7 @@ digits Malayalam 马拉雅拉姆数字 Rounded Rectangle 圆角矩形 Rounded Rectangle Tool 圆角矩形工具 Rounded Rectangle… 圆角矩形… + Rows 行数 Rows: 行数: Rule: 规则: Rulers 标尺 @@ -5070,6 +5108,8 @@ imageTrace Outline 轮廓 @msg the script is no longer in the Scripts folder 脚本已不在 Scripts 文件夹中 Some scripts were not listed 部分脚本未列出 The Scripts folder cannot be read 无法读取 Scripts 文件夹 + Loading scripts… 正在载入脚本… + The Scripts folder is still being read 仍在读取 Scripts 文件夹 @msg the script's run is no longer available 脚本运行已不可用 @msg a failed command changed undo steps that could not be put back, so the script was stopped 失败的命令更改了无法恢复的撤销步骤,因此脚本已停止 @msg a recovery copy could not be written, so the script was not run 无法写入恢复副本,因此未运行脚本 @@ -5236,6 +5276,8 @@ liquify-list-end {0}, {1} {0}和{1} @msg All colors are within the CMYK gamut 所有颜色皆在 CMYK 色域内 @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} 个颜色超出 CMYK 色域 @msg Unembedded to {_1} 已取消嵌入到 {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} 已将 {n} 张图像取消嵌入到 {folder} +@msg every numbered name for {name} is taken in that folder 该文件夹中 {name} 的所有带编号的名称均已被占用 @msg no swatch library `{l}` (see swatch.library.list) 没有色板库 `{l}` (请参阅 swatch.library.list) @msg no user library folder here 此处没有用户库文件夹 @msg Couldn't place {name}: the document it was dropped on was closed 无法置入 {name}:将它拖放到的文档已关闭 @@ -5335,6 +5377,8 @@ liquify-list-end {0}, {1} {0}和{1} @msg automation path rejected: outside the read root {root}: {path} 已拒绝自动化路径:位于读取根目录 {root} 之外:{path} @msg automation path rejected: outside the read roots {roots}: {path} 已拒绝自动化路径:位于所有读取根目录 {roots} 之外:{path} @msg a linked JavaScript file is outside the read roots 链接的 JavaScript 文件位于所有读取根目录之外 +@msg a linked image file is outside the read roots 链接的图像文件位于所有读取根目录之外 +@msg a linked file's export folder is outside the read roots 链接文件的导出文件夹位于所有读取根目录之外 @msg automation path rejected: outside the write root {root}: {path} 已拒绝自动化路径:位于写入根目录 {root} 之外:{path} @msg automation path rejected: outside the write roots {roots}: {path} 已拒绝自动化路径:位于所有写入根目录 {roots} 之外:{path} @msg automation path rejected: path is empty 已拒绝自动化路径:路径为空 @@ -5893,7 +5937,7 @@ axis Both 两者 Constrain 约束 Perspective Distort 透视扭曲 -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Radial Blur… 径向模糊… Blur Center 模糊中心 Smart Blur… 智能模糊… @@ -6105,6 +6149,7 @@ lighting Light 光源 Horizontal Guide 水平参考线 Move Guide to Layer 将参考线移至图层 Linux Display Server Linux 显示服务器 + Low-Latency Drawing 低延迟绘图 X11 (XWayland) When a Pen Is Attached 连接手写笔时使用 X11 (XWayland) If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. 如果数位板的笔无法绘画,请选择一个 X11 (XWayland) 选项。 X11 (XWayland) X11 (XWayland) @@ -7225,6 +7270,12 @@ anchor Points: 点: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` 必须是 "free"、"keepAngles" 或 "symmetric" @msg `{key}` must be [x, y] `{key}` 必须是 [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter 单位换算器 + Unit Converter Panel 单位换算器面板 + Copy with Units 复制时包含单位 + From Selection 从所选对象 + # Color Effects add-on: Select by Color Kind. Select by Color Kind 按颜色类型选择 Objects with Spot Colors 使用专色的对象 @@ -8415,6 +8466,8 @@ breakText Glyphs 字形 @msg `{f}` is the copy of a document open now `{f}` 是当前已打开文档的副本 @msg `{id}` is no writable format (see document.formats) `{id}` 不是可写入的格式 (参见 document.formats) @msg `{id}` isn't a loaded library `{id}` 不是已载入的库 +@msg `{file}` has no swatches of its own `{file}` 没有自己的色板 +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` 含有图案色板,.vcswatches 文件无法保存 @msg `{key}` has no colours `{key}` 中没有颜色 @msg `{key}` is a design name `{key}` 是设计名称 @msg `{key}` is a design name or a list of them `{key}` 是一个设计名称或设计名称的列表 @@ -8637,7 +8690,13 @@ breakText Glyphs 字形 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel 必须是 {own} (文档的模式)、grayscale 或 bitmap @msg colour groups can't go into colour groups 颜色组不能放入颜色组 @msg colour, mode and spot apply to solid-colour swatches only colour、mode 和 spot 只适用于纯色色板 -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read 第 {column} 列:`{cell}` 是图表数据文件的 `%` 列,不会读取 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 是相对路径:请提供 `base` 或绝对路径 +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} 第 {line} 行,第 {column} 列:无法读取 `{var}` 的图表数据文件:{e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} 第 {line} 行,第 {column} 列:未跟随 `{var}` 的图表数据文件 `{path}`:{r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 超过 {MAX_GRAPH_DATA_FILE} 字节 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes 第 {line} 行,第 {column} 列:`{var}` 的图表数据文件 `{path}` 得到的图表值超过 {MAX_GRAPH_CSV} 字节 +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all 第 {line} 行,第 {column} 列:图表数据文件总计超过 {MAX_GRAPH_FILES_TOTAL} 字节 +@msg `base` is empty `base` 为空 @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable 第 {column} 列:`{cell}` 指定了 `{name}`,而它是 {_1} 变量 @msg column {column}: `{cell}` names no variable 第 {column} 列:`{cell}` 没有对应的变量 @msg column {column}: the variable name is longer than {MAX_NAME} characters 第 {column} 列:变量名称超过 {MAX_NAME} 个字符 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 5bbf96eb35..52bf3f3531 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -77,6 +77,7 @@ Add Anchor Point 增加錨點 Add Anchor Point Tool 增加錨點工具 Add Anchor Points 增加錨點 + Add Around 繞物件新增 Add Effect 新增效果 Add Freeform Line 新增任意線條 Add Freeform Point 新增任意形狀錨點 @@ -154,6 +155,7 @@ Angle: 角度: Angles 角度 Animated Zoom 動畫縮放 + Anti Alias 消除鋸齒 Anti-alias 消除鋸齒 Anti-Alias 消除鋸齒 Anti-alias Rasters 點陣影像消除鋸齒 @@ -518,6 +520,7 @@ font-technology Variable 可變 Color Mixer (Shift-click the chip) 混色器 (Shift-按一下色塊) Color Mode 色彩模式 Color Mode: 色彩模式: + Color Model 色彩模型 Color Model: 色彩模型: Color Models 色彩模型 Color Picker 顏色選擇器 @@ -544,6 +547,7 @@ font-technology Variable 可變 Colors 顏色 Colors: 顏色: Column Graph Tool 長條圖工具 + Columns 欄數 Columns: 欄數: Column… 欄… Combine Slices 合併切片 @@ -1047,6 +1051,7 @@ font-technology Variable 可變 Enable text access for screen readers 啟用螢幕閱讀器的文字存取 Enable Touch Gestures 啟用觸控手勢 Switch Selection and Drawing Modes 切換選取與繪圖模式 + Select Last Selection Tool 切換到上次使用的選取工具 Enable Touch Workspace 啟用觸控工作區 Encoding 編碼 Encoding: 編碼: @@ -1279,6 +1284,8 @@ font-technology Variable 可變 Reset Tracking and Kerning 重設字距與字距微調 Reset Horizontal Scale 重設水平縮放 Highlight Font Name 反白顯示字體名稱 + Highlight Font Size 反白顯示字體大小 + Other… 其他… Highlight Kerning 反白顯示字距微調 Highlight Tracking 反白顯示字距 Spacing 間距 @@ -2606,6 +2613,8 @@ file-filter Templates 範本 @msg the script is no longer in the Scripts folder 指令碼已不在 Scripts 資料夾中 Some scripts were not listed 部分指令碼未列出 The Scripts folder cannot be read 無法讀取 Scripts 資料夾 + Loading scripts… 正在載入指令碼… + The Scripts folder is still being read 仍在讀取 Scripts 資料夾 @msg the script's run is no longer available 指令碼執行已無法使用 @msg a failed command changed undo steps that could not be put back, so the script was stopped 失敗的命令變更了無法還原的復原步驟,因此指令碼已停止 @msg a recovery copy could not be written, so the script was not run 無法寫入復原副本,因此未執行指令碼 @@ -2773,6 +2782,8 @@ liquify-list-end {0}, {1} {0}和{1} @msg All colors are within the CMYK gamut 所有顏色皆在 CMYK 色域內 @msgplural {n} color is out of the CMYK gamut|{n} colors are out of the CMYK gamut {n} 個顏色超出 CMYK 色域 @msg Unembedded to {_1} 已取消內嵌至 {_1} +@msgplural Unembedded {n} image to {folder}|Unembedded {n} images to {folder} 已將 {n} 個影像取消內嵌至 {folder} +@msg every numbered name for {name} is taken in that folder 該資料夾中 {name} 的所有編號名稱都已被使用 @msg no swatch library `{l}` (see swatch.library.list) 沒有色票資料庫 `{l}` (請參閱 swatch.library.list) @msg no user library folder here 此處沒有使用者資料庫資料夾 @msg Couldn't place {name}: the document it was dropped on was closed 無法置入 {name}:放置它的文件已關閉 @@ -2864,6 +2875,8 @@ liquify-list-end {0}, {1} {0}和{1} @msg automation path rejected: outside the read root {root}: {path} 已拒絕自動化路徑:位於讀取根目錄 {root} 之外:{path} @msg automation path rejected: outside the read roots {roots}: {path} 已拒絕自動化路徑:位於所有讀取根目錄 {roots} 之外:{path} @msg a linked JavaScript file is outside the read roots 連結的 JavaScript 檔案位於所有讀取根目錄之外 +@msg a linked image file is outside the read roots 連結的影像檔案位於所有讀取根目錄之外 +@msg a linked file's export folder is outside the read roots 連結檔案的匯出資料夾位於所有讀取根目錄之外 @msg automation path rejected: outside the write root {root}: {path} 已拒絕自動化路徑:位於寫入根目錄 {root} 之外:{path} @msg automation path rejected: outside the write roots {roots}: {path} 已拒絕自動化路徑:位於所有寫入根目錄 {roots} 之外:{path} @msg automation path rejected: path is empty 已拒絕自動化路徑:路徑是空的 @@ -3738,6 +3751,9 @@ liquify-list-end {0}, {1} {0}和{1} Overprint 疊印 Overprint and Transparency Flattener 疊印與透明度平面化 Overprint and Transparency Flattener Options 疊印與透明度平面化選項 + Custom… 自訂… + Custom Transparency Flattener Options 自訂透明度平面化選項 + EPS has no alpha transparency, and Overprints sets whether overprints are kept. EPS 沒有 Alpha 透明度,「疊印」決定是否保留疊印。 Overprint Black… 疊印黑色… Overprint Fill 疊印填色 Overprint Preview 疊印預視 @@ -3847,6 +3863,7 @@ diagnostics ui 介面 Play Current Selection 播放目前選取項目 Save Actions… 儲存動作… Load Actions… 載入動作… + Replace Actions… 取代動作… Reset Actions 重設動作 Replace the current actions with the default set? 要用預設動作組取代目前的動作嗎? Append adds the default set after the current sets instead. 「附加」會改為將預設動作組加到目前動作組之後。 @@ -4218,6 +4235,8 @@ digits Malayalam 馬來亞拉姆數字 Reselect 重新選取 Reset 重設 Reset Bounding Box 重設邊框 + Rotate Bounding Box 旋轉邊框 + Rotate Bounding Box… 旋轉邊框… Reset Envelope Mesh 重設封套網格 Reset Envelope Shape 重設封套形狀 Reset Essentials 重設基本功能 @@ -4259,6 +4278,7 @@ digits Malayalam 馬來亞拉姆數字 Reshape Segment 改變線段外框 Reshape Tool 改變外框工具 Reshape Type Area 改變區域文字外框 + Resolution 解析度 Resolution: 解析度: Responsive 回應式 Restore 還原 @@ -4315,6 +4335,29 @@ digits Malayalam 馬來亞拉姆數字 The unit for East Asian type measurements, which no field uses yet. 用於東亞文字度量的單位,目前還沒有欄位使用。 When on, a number typed without a unit into a field in picas is read in points. 開啟後,在以派卡為單位的欄位中輸入的不含單位數字以點讀取。 With XML ID, object names show as XML IDs in the Layers panel, the Variables panel and Layer Options. 選擇 XML ID 時,圖層、變數和圖層選項中的物件名稱會顯示為 XML ID。 + The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl. 文字大小和行距的增量:Cmd/Ctrl+Shift+. 和 Cmd/Ctrl+Shift+, 會將字級改變一步,同時按 Alt 則改變五步;在橫排文字中,Alt 加上下方向鍵會將行距改變一步,同時按 Cmd/Ctrl 則改變五步。 + The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl. 字距調整和字距微調的增量,單位為千分之一 em:在橫排文字中,Alt 加左右方向鍵會將插入點的字距微調或所選文字的字距調整改變一步,同時按 Cmd/Ctrl 則改變五步。 + The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl. 基線位移的增量:在橫排文字中,Alt、Shift 加上下方向鍵會將基線移動一步,同時按 Cmd/Ctrl 則移動五步。 + Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts. 在字元、段落、OpenType 和字符面板中顯示日文及其他東亞文字的選項,並顯示複合字體指令。 + Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits. 在字元和段落面板中顯示阿拉伯文、希伯來文和印度系文字的選項,例如段落方向、卡希達和數字。 + The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box. 選取工具只在文字的基線、區域文字的外框或其路徑上選取文字,而不是在其框內任何位置。 + Font menus list each font by its English name; off, a font that also has a name in its own language shows that name. 字體選單以英文名稱列出每種字體;關閉時,也有本國語言名稱的字體會顯示該名稱。 + New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text. 新的區域文字會開啟自動調整大小,因此橫排文字的矩形外框會隨文字增高或縮短。 + Font lists and the Type › Font menu show a sample of each font beside its name. 字體清單和字體選單會在每種字體的名稱旁顯示該字體的樣本。 + Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on. 無論介面亮度如何,字體樣本都以深色文字繪製在白色上;僅在選單內字體預覽開啟時生效。 + How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is. 字體欄位(例如字元面板中的欄位)清單中每列的高度,也就是每個樣本的大小。 + How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first. 最近使用的字體和字體清單顯示多少個最近使用的字體(1 到 15),最新的在前。 + When you change the font or font style of text, characters the new font has no glyph for keep the font they had. 變更文字的字體或字體樣式時,新字體中沒有字符的字元會保留原來的字體。 + A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export. 畫布上的粉紅色醒目提示標出被 OpenType 功能取代的字符,例如連字;它不會列印或轉存。 + With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from. 使用文字工具選取一個字元時,畫布上會在其旁邊顯示一排可供選擇的替代字符。 + A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export. 畫布上的粉紅色醒目提示標出因找不到原字體而以替代字體繪製的文字;它不會列印或轉存。 + New type made with a Type tool starts with placeholder text, selected, so typing replaces it. 以文字工具新建的文字會以選取的預留位置文字開始,輸入的內容會取代它。 + Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list. 在段落開頭輸入 1. 或 * 等清單標記再輸入空格,該段落會變成清單。 + Fonts in this folder show in the font menus and can be used without being installed. 此資料夾中的字體會顯示在字體選單中,不需安裝即可使用。 + Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows. 對文字套用繪圖樣式時,樣式有填色或筆畫的地方會移除字元本身的填色或筆畫,以顯示樣式的顏色。 + Align and Distribute measure point type by the ink of its glyphs instead of its em box. 對齊和均分會依字符的墨跡而非全形框測量點狀文字。 + Align and Distribute measure area type by the ink of its glyphs instead of its frame. 對齊和均分會依字符的墨跡而非外框測量區域文字。 + The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box. 邊框和變形面板會依字符的墨跡而非全形框測量點狀文字。 Snaps drawing, moving and scaling to the grid's subdivisions, even while the grid is hidden; while it is on, Snap to Pixel does not apply. 即使格點已隱藏,繪製、移動和縮放仍會靠齊格點的細分;開啟期間,「靠齊像素」不會作用。 The color of guides that are not selected; an artboard with a Guide Label draws its own guides in the label's color instead. 未選取參考線的顏色;設定了參考線標籤的工作區域會以標籤顏色繪製自己的參考線。 Draws guides as solid lines or as dots, including the guides already in the document. 將參考線繪製為實線或點,包括文件中已有的參考線。 @@ -4396,6 +4439,7 @@ digits Malayalam 馬來亞拉姆數字 Rounded Rectangle Tool 圓角矩形工具 Rounded Rectangle… 圓角矩形… Row Size: 列尺寸: + Rows 列數 Rows: 列數: Rule: 規則線: Rulers 尺標 @@ -5724,7 +5768,7 @@ axis Both 兩者 Free Transform 任意變形 Perspective Distort 透視扭曲 -# Photoshop-style raster effects (Effect menu, their dialogs). +# Raster effects (Effect menu, their dialogs). Radial Blur… 放射狀模糊… Blur Center 模糊中心 Smart Blur… 智慧型模糊… @@ -5941,6 +5985,7 @@ lighting Light 光源 Horizontal Guide 水平參考線 Move Guide to Layer 將參考線移至圖層 Linux Display Server Linux 顯示伺服器 + Low-Latency Drawing 低延遲繪圖 X11 (XWayland) When a Pen Is Attached 連接觸控筆時使用 X11 (XWayland) If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. 如果繪圖板的筆無法繪圖,請選擇一個 X11 (XWayland) 選項。 X11 (XWayland) X11 (XWayland) @@ -7033,6 +7078,12 @@ anchor Points: 點: @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` 必須是 "free"、"keepAngles" 或 "symmetric" @msg `{key}` must be [x, y] `{key}` 必須是 [x, y] +# Unit Converter add-on (Object › Plug-ins › Unit Converter): its panel. + Unit Converter 單位換算器 + Unit Converter Panel 單位換算器面板 + Copy with Units 複製時包含單位 + From Selection 從選取範圍 + # Color Effects add-on: Select by Color Kind. Select by Color Kind 依顏色類型選取 Objects with Spot Colors 使用特別色的物件 @@ -8344,6 +8395,8 @@ breakText Glyphs 字符 @msg `{f}` is the copy of a document open now `{f}` 是目前開啟文件的副本 @msg `{id}` is no writable format (see document.formats) `{id}` 不是可寫入的格式 (請參閱 document.formats) @msg `{id}` isn't a loaded library `{id}` 不是已載入的資料庫 +@msg `{file}` has no swatches of its own `{file}` 沒有自己的色票 +@msg `{_1}` has pattern swatches, which a .vcswatches file can't hold `{_1}` 含有圖樣色票,.vcswatches 檔案無法儲存 @msg `{key}` has no colours `{key}` 沒有顏色 @msg `{key}` is a design name `{key}` 是設計名稱 @msg `{key}` is a design name or a list of them `{key}` 是設計名稱或設計名稱的清單 @@ -8566,7 +8619,13 @@ breakText Glyphs 字符 @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel 必須是 {own} (文件的模式)、grayscale 或 bitmap @msg colour groups can't go into colour groups 顏色群組不能放入顏色群組 @msg colour, mode and spot apply to solid-colour swatches only colour、mode 和 spot 只適用於純色色票 -@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read 第 {column} 欄:`{cell}` 是圖表資料檔案的 `%` 欄,不會讀取 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is a relative path: give `base`, or an absolute path 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 是相對路徑:請提供 `base` 或絕對路徑 +@msg line {line}, column {column}: the graph data file for `{var}` can't be read: {e} 第 {line} 行,第 {column} 欄:無法讀取 `{var}` 的圖表資料檔案:{e} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` isn't followed: {r} 第 {line} 行,第 {column} 欄:未跟隨 `{var}` 的圖表資料檔案 `{path}` 的連結:{r} +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` is larger than {MAX_GRAPH_DATA_FILE} bytes 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 超過 {MAX_GRAPH_DATA_FILE} 位元組 +@msg line {line}, column {column}: the graph data file `{path}` for `{var}` gives a graph value longer than {MAX_GRAPH_CSV} bytes 第 {line} 行,第 {column} 欄:`{var}` 的圖表資料檔案 `{path}` 得到的圖表值超過 {MAX_GRAPH_CSV} 位元組 +@msg line {line}, column {column}: the graph data files hold more than {MAX_GRAPH_FILES_TOTAL} bytes in all 第 {line} 行,第 {column} 欄:圖表資料檔案合計超過 {MAX_GRAPH_FILES_TOTAL} 位元組 +@msg `base` is empty `base` 為空 @msg column {column}: `{cell}` names `{name}`, which is a {_1} variable 第 {column} 欄:`{cell}` 指定了 `{name}`,而它是 {_1} 變數 @msg column {column}: `{cell}` names no variable 第 {column} 欄:`{cell}` 未指定任何變數 @msg column {column}: the variable name is longer than {MAX_NAME} characters 第 {column} 欄:變數名稱超過 {MAX_NAME} 個字元 diff --git a/crates/ui-egui/src/io/export.rs b/crates/ui-egui/src/io/export.rs index 32733d855c..d7e37dd998 100644 --- a/crates/ui-egui/src/io/export.rs +++ b/crates/ui-egui/src/io/export.rs @@ -84,7 +84,7 @@ pub fn export(app: &mut VectorcraftApp, format: Option<&str>, path: Option std::sync::Arc::new(d), } }; - fileio::check_linked_images("file.exportAs", f.id, st, &doc, params).map_err(|e| e.to_string())?; + fileio::check_linked_images("file.exportAs", f.id, st, &doc, &checked).map_err(|e| e.to_string())?; // A PDF shows its title in the viewer's title bar only when it is the document's own, not the // file name it was titled after, as `document.export` writes it. let own_title = fileio::has_own_title(&doc); diff --git a/crates/ui-egui/src/keymap.rs b/crates/ui-egui/src/keymap.rs index 6a146826fc..54a551ad1c 100644 --- a/crates/ui-egui/src/keymap.rs +++ b/crates/ui-egui/src/keymap.rs @@ -217,7 +217,7 @@ fn catalogue(snapshot: &Snapshot, p: Platform) -> Vec { if TOGGLES.contains(&e.key.as_str()) { b = b.toggle(); } - if let Some(d) = shortcut_editor::default_of(&e.key).and_then(vc_binding) { + if let Some(d) = shortcut_editor::default_on(&e.key, p).and_then(vc_binding) { b = b.with_default(d); } for alias in default_aliases(&e.key, p) { @@ -640,6 +640,26 @@ mod tests { } } + /// Select Last Selection Tool is Ctrl+` on Windows and Linux. macOS takes Cmd+` to switch + /// between an app's windows, so there the command has no default and takes a chord the user + /// assigns. + #[test] + fn last_selection_tool_default_follows_the_platform() { + let snapshot = shortcut_editor::snapshot(); + let command = command_of("tool.selectLastSelection"); + let chord = vc_chord("Cmd+~").unwrap(); + for p in [Platform::Windows, Platform::Linux] { + let km = keymap_for(p, &snapshot); + assert_eq!(lookup(&km, &chord), Some(command.clone()), "{p:?}"); + assert_eq!(shortcut_editor::default_on("tool.selectLastSelection", p), Some("Cmd+~"), "{p:?}"); + } + let mut mac = keymap_for(Platform::Mac, &snapshot); + assert_eq!(mac.bindings(&command), vec![], "no default on macOS"); + assert_eq!(shortcut_editor::default_on("tool.selectLastSelection", Platform::Mac), None); + shortcut_editor::assign_in(&mut mac, "tool.selectLastSelection", Some("Alt+~"), true).unwrap(); + assert_eq!(lookup(&mac, &vc_chord("Alt+~").unwrap()), Some(command)); + } + #[test] fn panel_entries_bridge_to_window_panel() { let c = command_of("panel:layers"); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 0b8ee67183..b1598cdb12 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -1,4 +1,4 @@ -//! VectorCraft's egui frontend: an Illustrator-style UI over `vectorcraft-engine`. +//! VectorCraft's egui frontend: menus, tools, panels and dialogs over `vectorcraft-engine`. //! //! The UI is thin: every action goes through [`VectorcraftApp::run`], which dispatches UI commands //! (view/window) here and everything else to the engine. The same entry point serves menus, diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 4e2d80bb45..b58505590a 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -1,4 +1,4 @@ -//! The menu bar (Illustrator's menu tree) and UI-level commands. +//! The menu bar (the full menu tree) and UI-level commands. //! //! Items bound to a command id run through [`VectorcraftApp::run`]. Items not implemented yet are //! listed (disabled, with their shortcut) so the full surface is visible and discoverable; the diff --git a/crates/ui-egui/src/menus/bar.rs b/crates/ui-egui/src/menus/bar.rs index 72cbc4535b..7694791af9 100644 --- a/crates/ui-egui/src/menus/bar.rs +++ b/crates/ui-egui/src/menus/bar.rs @@ -25,7 +25,7 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 { let mut clicked: Option<(String, Value)> = None; let mut file_open = false; let tree = menu_tree_named(app.session.prefs.font_names_in_english); - // No application menu in the window (as in Illustrator): the bar starts at File on every + // No application menu in the window: the bar starts at File on every // platform. The VectorCraft menu stays in the tree: the native Mac bar takes it from there. let tree: Vec<(&str, Vec)> = tree.into_iter().filter(|(title, _)| *title != "VectorCraft").collect(); // A menu bar for its layout and menu-button style, but the titles use `Popup::menu` directly: diff --git a/crates/ui-egui/src/menus/invoke.rs b/crates/ui-egui/src/menus/invoke.rs index 845ea7102a..996622040a 100644 --- a/crates/ui-egui/src/menus/invoke.rs +++ b/crates/ui-egui/src/menus/invoke.rs @@ -17,10 +17,12 @@ pub fn click_target(label: &str, id: &str, p: &Value) -> (String, Value) { /// What an in-window menu click on `target` (a [`click_target`]) runs with `held` held: Object › /// Unlock All and Object › Show All chosen with Shift+Alt (Shift+Option) act only inside the groups /// that hold the selected objects (`scope: "group"`); Select Linked, Embedded, Missing and Modified -/// chosen with Shift add to the selection (`add: true`). +/// chosen with Shift add to the selection (`add: true`); Object › Expand… chosen with Alt (Option) +/// expands at once with the choices its dialog last expanded with (`immediate: true`). pub(crate) fn with_held_keys(target: (String, Value), held: egui::Modifiers) -> (String, Value) { match target.0.as_str() { "object.unlockAll" | "object.showAll" if held.shift && held.alt => (target.0, json!({"scope": "group"})), + "ui.expandDialog" if held.alt => (target.0, json!({"immediate": true})), // Select Linked, Embedded, Missing and Modified with Shift add to the selection. crate::addons::select::link_status::COMMAND if held.shift => (target.0, crate::addons::select::link_status::with_shift(target.1)), _ => target, diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 89f842c137..59f394f18f 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -328,6 +328,7 @@ fn run_ui_part3(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::panels::character::toggle_face(app, Face::Bold), "type.italic" => crate::panels::character::toggle_face(app, Face::Italic), "type.highlightFontName" => crate::panels::character::highlight(app, crate::panels::character::Field::FontName), + "type.highlightFontSize" => crate::panels::character::highlight(app, crate::panels::character::Field::FontSize), "type.highlightKerning" => crate::panels::character::highlight(app, crate::panels::character::Field::Kerning), "type.highlightTracking" => crate::panels::character::highlight(app, crate::panels::character::Field::Tracking), "type.underline" => crate::panels::character::toggle_underline(app), @@ -690,6 +691,11 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option Err(format!("unknown tool `{t}`")), None => Err("missing `tool`".into()), }, + "tool.selectLastSelection" => { + let id = app.session.last_selection_tool(); + let switched = if app.session.tool_id() == id { Ok(()) } else { app.try_select_tool(id) }; + switched.map(|()| json!({"tool": app.session.tool_id()})) + } crate::touch::TOGGLE_MODE => crate::touch::toggle_mode(app), crate::addons::pathtools::corner::COMMAND => crate::addons::pathtools::corner::open(app), crate::addons::pathtools::shared_edge::COMMAND => crate::addons::pathtools::shared_edge::open(app), @@ -911,7 +917,11 @@ fn run_ui_part9(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option Option> { let s = |k: &str| p.get(k).and_then(Value::as_str).map(str::to_string); let r = match id { - "ui.expandDialog" => crate::dialogs::expand::open(app), + "ui.expandDialog" => match opt_bool(p, "immediate") { + Ok(Some(true)) => crate::dialogs::expand::expand_now(app), + Ok(_) => crate::dialogs::expand::open(app), + Err(e) => Err(e), + }, "ui.simplifyAuto" => crate::dialogs::simplify_slider::auto(app), "ui.simplifyMoreOptions" => crate::dialogs::simplify_slider::more_options(app), "ui.smoothAuto" => crate::dialogs::smooth_slider::auto(app), @@ -1008,6 +1018,7 @@ fn run_ui_part11(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::panels::actions::save_set(app, p), crate::panels::actions::LOAD_SET => crate::panels::actions::load_set(app, p), + crate::panels::actions::REPLACE_SET => crate::panels::actions::replace_set(app, p), crate::panels::actions::DELETE_SETS => crate::panels::actions::delete_sets(app, p), crate::panels::actions::DUPLICATE => crate::panels::actions::duplicate(app, p), crate::panels::actions::RESET => crate::panels::actions::reset(app, p), diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index d4dda4698b..7a4b195ae1 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -219,7 +219,7 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool { match id { // Save is off for a clean document that already has its own file. "file.save" => app.session.active().is_some_and(|d| d.path.is_none() || d.converted || d.is_dirty()), - "type.bold" | "type.italic" | "type.underline" | "type.lineComposer" | "type.hyphenate" => { + "type.bold" | "type.italic" | "type.underline" | "type.lineComposer" | "type.hyphenate" | "type.highlightFontSize" => { crate::panels::character::text_style(app).is_some() } id if crate::panels::paragraph::ALIGN_COMMANDS.iter().any(|c| c.0 == id) => crate::panels::character::text_style(app).is_some(), diff --git a/crates/ui-egui/src/menus/submenus.rs b/crates/ui-egui/src/menus/submenus.rs index 469c40e7c7..1f8facea4c 100644 --- a/crates/ui-egui/src/menus/submenus.rs +++ b/crates/ui-egui/src/menus/submenus.rs @@ -111,7 +111,7 @@ pub(super) fn font_items(english_names: bool) -> Vec { /// The catalogue's menu path of the effects in 3D and Materials › 3D (Classic). const CLASSIC_3D: &[&str] = &["Effect", "3D and Materials", "3D (Classic)"]; -/// The raster effects' submenus of the Effect menu (the Photoshop-style effects, below the +/// The raster effects' submenus of the Effect menu (the pixel effects, below the /// vector effects): (submenu, the catalogue's menu path of its effects). /// The raster Stylize submenu shares its path with the vector one and lists only the effects at /// that path that [`vectorcraft_effects::PIXEL_EFFECTS`] names. @@ -157,13 +157,13 @@ pub(super) fn effect_menu() -> Vec { "Warp", ]; let top_level = |e: &vectorcraft_effects::EffectInfo| e.menu == ["Effect"] && order.contains(&e.label); - // An effect goes in the vector submenu its path names unless it is a Photoshop-style effect, + // An effect goes in the vector submenu its path names unless it is a pixel effect, // which goes in the raster submenu of the same name when `RASTER_MENUS` has one (Stylize › // Glowing Edges). let in_vector_menu = |e: &vectorcraft_effects::EffectInfo| order.iter().any(|s| e.menu == ["Effect", *s]) && !vectorcraft_effects::PIXEL_EFFECTS.contains(&e.id); let item = |e: &vectorcraft_effects::EffectInfo| match e.defaults.as_object().is_some_and(|o| o.is_empty()) { - // No options (Effect → Pathfinder, Crop Marks): apply directly, like Illustrator. + // No options (Effect → Pathfinder, Crop Marks): apply directly. true => Item::Cmd(e.label, "effect.apply", json!({ "effect": e.id })), false => Item::Cmd(e.label, "effect.dialog", json!({ "effect": e.id })), }; diff --git a/crates/ui-egui/src/menus/tests.rs b/crates/ui-egui/src/menus/tests.rs index 81de00172f..ca60adba4a 100644 --- a/crates/ui-egui/src/menus/tests.rs +++ b/crates/ui-egui/src/menus/tests.rs @@ -442,6 +442,39 @@ fn center_on_top_and_bottom_are_type_on_a_path_items() { assert!((start - 0.625).abs() < 1e-6, "{start}"); } +/// Type › Size ends with a separator and Other…, which runs `type.highlightFontSize`: dimmed +/// without selected type, enabled with it, and never checked. +#[test] +fn type_size_ends_with_other() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + let id = "type.highlightFontSize"; + assert!(!enabled(&app, id), "no document"); + app.run("file.new", json!({})).unwrap(); + let items: Vec = menu_tree() + .into_iter() + .filter(|(menu, _)| *menu == "Type") + .flat_map(|(_, items)| items) + .filter_map(|item| match item { + Item::Sub("Size", children) => Some(children), + _ => None, + }) + .flatten() + .collect(); + let n = items.len(); + assert!(n > 2, "{n} items"); + assert!(matches!(items[n - 2], Item::Sep), "a separator comes before Other…"); + assert!(matches!(&items[n - 1], Item::Cmd("Other…", c, p) if *c == id && p.is_null()), "Other… comes last"); + assert!(items[..n - 2].iter().all(|i| matches!(i, Item::Cmd(_, "text.setStyle", _))), "the sizes come first"); + assert!(!enabled(&app, id), "nothing selected"); + let path = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [path]})).unwrap(); + assert!(!enabled(&app, id), "a path selected"); + let text = app.run("text.create", json!({"x": 10, "y": 100, "text": "Size"})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [text]})).unwrap(); + assert!(enabled(&app, id), "type selected"); + assert_eq!(checked(&app, id, &Value::Null), None); +} + /// Type › Dynamic Text Presets › Circle, Arch and Bow run `type.dynamicTextPreset` with their /// preset, enabled for point type and type on a path but not for area type alone. #[test] diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index 617d0d403e..19a68f140d 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -15,7 +15,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { vec![ ( // The application menu: About and Discord only. The in-window bar never shows it (File - // is first there, as in Illustrator); on macOS `native_menu::mac_layout` composes the + // is first there); on macOS `native_menu::mac_layout` composes the // App menu from this entry and the other menus (About from Help, Settings from Edit, // Quit from File, Language and Appearance synthesized). It stays first: `from_tree` // gives the first menu the App role. @@ -397,7 +397,14 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { vec![ sub("Font", font_items(english_names)), sub("Recent Fonts", RECENT_FONT_IDS.iter().map(|id| c("Recent Font", id)).collect()), - sub("Size", TYPE_SIZES.iter().map(|(l, n)| cp(l, "text.setStyle", json!({ "size": n }))).collect()), + sub( + "Size", + TYPE_SIZES + .iter() + .map(|(l, n)| cp(l, "text.setStyle", json!({ "size": n }))) + .chain([Sep, c("Other…", "type.highlightFontSize")]) + .collect(), + ), c("Bold", "type.bold"), c("Italic", "type.italic"), Sep, @@ -770,6 +777,7 @@ pub(super) fn transform_items() -> Vec { c("Transform Each…", "object.transformEach"), Sep, c("Reset Bounding Box", "object.resetBoundingBox"), + cp("Rotate Bounding Box…", "object.rotateBoundingBox", json!({"angle": 0})), ] } diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 851047a0c5..7fe01bd8f6 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -240,7 +240,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} toggle drawing the gaps of the selected Live Paint groups (those livePaint.info lists) in each group's Gap Preview Color while edges show → true when on", ), - ("type.hiddenCharacters", "Show Hidden Characters", "Cmd+Alt+I", "{} toggle markers for spaces, paragraph ends and story ends"), + ( + "type.hiddenCharacters", + "Show Hidden Characters", + "Cmd+Alt+I", + "{} toggle markers for spaces, tabs, nonbreaking and fixed-width spaces, discretionary hyphens, forced line breaks, paragraph ends and story ends", + ), ("type.alignLeft", "Align left", "Cmd+Shift+L", "{} align the selected type's paragraphs (or those the Type tool's selection touches) left"), ( "type.alignCenter", @@ -267,7 +272,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.bulletsAndNumbering", "Bullets and Numbering…", "", - "{tab?: \"bullets\"|\"numbers\"} open Bullets and Numbering (More Options in the Paragraph panel's Bullets and Numbered List presets) on the paragraphs the Paragraph panel acts on, filled in with the values it shows, on that tab (without it, Numbers when the paragraphs are a numbered list, else Bullets) (dialog `bulletsAndNumbering`: tab (bullets|numbers), list (none|bullet|number: the kind of the preset picked), bullet (dot|dash|circle|square), number (arabic|upperLetters|lowerLetters|upperRoman|lowerRoman|twoDigits|threeDigits), listAlign (left|right), listLevel (1..9; 1 for paragraphs in no list), leftIndent, firstLineIndent (pt)): the type shows the dialog's values while it is open, OK runs text.setFormat with the values that changed (and the indents it shows when a preset puts the paragraphs in a list), as one undo step, and Cancel puts the type back; a preset picked for paragraphs in no list whose indents are 0 fills in 18 and -18 pt; an error with no type selected or an unknown tab", + "{tab?: \"bullets\"|\"numbers\"} open Bullets and Numbering (More Options in the Paragraph panel's Bullets and Numbered List presets) on the paragraphs the Paragraph panel acts on, filled in with the values it shows, on that tab (without it, Numbers when the paragraphs are a numbered list, else Bullets) (dialog `bulletsAndNumbering`: tab (bullets|numbers), list (none|bullet|number: the kind of the preset picked), bullet (dot|dash|circle|square), number (arabic|upperLetters|lowerLetters|upperRoman|lowerRoman|twoDigits|threeDigits), listAlign (left|right), listLevel (1..9; 1 for paragraphs in no list), leftIndent, firstLineIndent (pt), startAt (bool: the Numbers tab's Start at box, on when the paragraphs have the same number of their own, blank when those differ; on sends startNumber, off sends restartNumbering false), startNumber (1..999999999: its number, 1 until one is typed)): the type shows the dialog's values while it is open, OK runs text.setFormat with the values that changed (and the indents it shows when a preset puts the paragraphs in a list), as one undo step, and Cancel puts the type back; a preset picked for paragraphs in no list whose indents are 0 fills in 18 and -18 pt; an error with no type selected or an unknown tab", ), ( "type.convertListToText", @@ -383,6 +388,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "Cmd+Alt+Shift+F", "{} show the Character panel if it is hidden and open its font family menu, whose search field takes the keyboard focus: type to search, Enter applies the highlighted font → {field: \"fontName\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first", ), + ( + "type.highlightFontSize", + "Highlight Font Size", + "", + "{} (Type › Size › Other…) show the Character panel if it is hidden and give its Font Size field the keyboard focus with its value selected (blank where the selected sizes differ): type a size and press Enter → {field: \"fontSize\"}. Without selected type (or text the Type tool edits) the panel shows, and the error says to select type first", + ), ( "type.highlightKerning", "Highlight Kerning", @@ -513,7 +524,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "window.toolsBesideCanvas", "Keep Tools Beside the Canvas", "", - "{on?: bool} dock the Tools panel between the left-side panels and the canvas (true) or at the window's left edge (false, the default), or toggle (omitted or null; any other value is an error); a floating Tools panel stays floating and docks at the chosen place when it is docked again. Kept with the workspace; a workspace saved without it docks Tools at the window's edge. Returns the new state", + "{on?: bool} dock the Tools panel between the left-side panels and the canvas (true) or at the window's left edge (false, the default), or toggle (omitted or null; any other value is an error); a floating Tools panel stays floating and docks at the chosen place when it is docked again. Dropping a floating Tools panel on the canvas's left edge, right of panels docked on the left, turns it on, and on the window's left edge turns it off; with no panels docked on the left, or in the column both edges share beside panels collapsed to icons, a drop leaves it as it is. Kept with the workspace; a workspace saved without it docks Tools at the window's edge. Returns the new state", ), ( "window.floatTools", @@ -832,6 +843,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "{} make the open document before the current one in tab order the current one, as a click on its tab does (before the first document it goes to the last, and from the Home screen to the last); each view window.newWindow opened is a step of its own; returns {index}, with `view` for a document with more than one view", ), ("tool.select", "Select Tool", "", "{tool: id} (see tools) → {tool}; a tool that cannot be chosen returns the error"), + ( + "tool.selectLastSelection", + "Select Last Selection Tool", + "Cmd+~", + "{} choose the selection tool chosen last (Selection, Direct Selection or Group Selection; none yet: the Selection tool), keeping the active tool when it is that tool; choosing Magic Wand, Lasso or any other tool does not change which one it chooses → {tool}. Default shortcut Ctrl+` on Windows and Linux, none on macOS, where Cmd+` switches windows", + ), ( "tool.setOption", "Tool Option", @@ -1271,7 +1288,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.expandDialog", "Expand…", "", - "{} open Expand for the selection (dialog `expand`, fields object, fill, stroke (all on; one the selection has nothing for is disabled, see object.expand.info), gradient: objects|mesh, steps 1..1000 (255)): OK runs object.expand with them as one undo step; dimmed, and an error, while the selection has an appearance effect.expandAppearance expands (object.expand.info's appearance)", + "{immediate?: bool (false)} open Expand for the selection (dialog `expand`, fields object, fill, stroke (all on; one the selection has nothing for is disabled, see object.expand.info), gradient: objects|mesh, steps 1..1000 (255), or the choices OK last expanded with since the app started): OK runs object.expand with them as one undo step and keeps them until the app quits; immediate: true (the menu item chosen with Alt/Option) runs object.expand at once with those choices (the defaults before any OK), and opens the dialog instead when none of them has something to expand in the selection; dimmed, and an error, while the selection has an appearance effect.expandAppearance expands (object.expand.info's appearance)", ), ( "attributes.openUrl", @@ -1642,6 +1659,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{path? | data?: the file's text} read an action set file (.vcactions) at path, else a picked one, and add its set after the Actions panel's sets; a set named like one in the panel gets the next free number (Print 2), and the other sets stay. Files of another version, over 8 MiB, with more than 1,000 actions or with an action of more than 10,000 steps are refused, and so is any set, .aia ones too, that Save Actions… would write larger than 8 MiB (a file with less white space, or a name that gets a number); the panel menu's Load Actions… (disabled where there is no open dialog, the web) → {set: index, name, actions: n}. An action set another app saved as text (.aia, starting /version; read with actionSet.read) comes in with its actions. A step with a label and no recorded values comes in when exactly one menu command has that label (in English or the interface language, any case, no final …), and that command is directly in a top menu, can be recorded in actions, is what its menu bar item runs with no values and opens no dialog (never a submenu's item, a file or document command, Paste, Undo, Redo or an add-on's command), with no params and excluded from playback when it is off in the file. A Set Selection step (found by its internal name, whatever its label) comes in as select.byNote {note, caseSensitive, wholeWord} when it has exactly three recorded values: text (ustring, UTF-8; 1 to 1,024 bytes once trimmed), word and case (boolean, 0 or 1); with any other values it is left out. The other steps, every other step with no label and every other step recorded with values (a recorded menu item too) among them, are left out → {set, name, actions, skipped: [{action, step: its label, else its name}] (the first 1,000), leftOut: n}, and the status bar says how many were left out; a set with no name takes the file's name, else Actions; a file actionSet.read marks truncated is refused, and text that starts /version and isn't an action set gives \"not an action set file\"", ), + ( + crate::panels::actions::REPLACE_SET, + "Replace Actions…", + "", + "{path? | data?: the file's text} read an action set file at path, else a picked one, as ui.actionSet.load reads it (.vcactions and .aia, with the same limits, errors and reports of left-out steps and unknown commands), and replace every set in the Actions panel, the built-in Default Actions set included, with the file's set, which keeps its name. The set becomes current and selected, the panel's selected action and step and its expanded actions are cleared, and an open Set Options, New Action, Batch or step dialog that names a set closes; when the panel already holds only a set that saves alike, in that state, nothing changes, the set keeps its ids and changed is false. Omitted params count as {}. Params of another type, another key, a path or data that is not a string, a file that can't be read or is refused, a canceled pick, or a replace while an action records or plays (also while it waits at a stop) is an error and changes nothing. No undo step is recorded. The panel menu's Replace Actions… (disabled where there is no open dialog, the web, and while an action records or plays) → {changed, set: 0, name, actions: n, unknownCommands?, unknownCount?, skipped?, leftOut?}", + ), ( crate::panels::actions::DELETE_SETS, "Delete Action Sets", @@ -1671,7 +1694,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.epsOptionsDialog", "EPS Options Dialog", "", - "{path?, useArtboards?, range?, …document.exportEps options} open EPS Options (dialog `epsOptions`: fields = these options over the ones used last); OK checks them, remembers them and writes path (else asks). Export As… → EPS opens it too", + "{path?, useArtboards?, range?, …document.exportEps options} open EPS Options (dialog `epsOptions`: fields = these options over the ones used last; Custom… sets `flattener`, which a flattenerPreset given without it drops); OK checks them, remembers them and writes path (else asks). Export As… → EPS opens it too", ), ( "file.saveForWeb", diff --git a/crates/ui-egui/src/native_menu.rs b/crates/ui-egui/src/native_menu.rs index 510131be0e..5f133a6686 100644 --- a/crates/ui-egui/src/native_menu.rs +++ b/crates/ui-egui/src/native_menu.rs @@ -3,12 +3,12 @@ //! [`Backend`] (the desktop app's, through muda). //! //! Pure and platform-free, so it is tested everywhere and builds for the web; only the backend -//! touches AppKit. What the layout does ([`mac_layout`], Illustrator on the Mac as the reference): +//! touches AppKit. What the layout does ([`mac_layout`]): //! - an **app menu** named VectorCraft: About; Settings, a submenu with one item per Preferences //! page (General… ⌘K first); Language; Appearance (the UI brightness); Services; Hide VectorCraft //! ⌃⌘H (⌘H stays View › Hide Edges), Hide Others ⌥⌘H, Show All; and Quit ⌘Q, still the app's own //! `app.quit`, so documents with unsaved changes are asked about. Language and Appearance have -//! no in-window menu (as in PhotoCraft) and are synthesized here; Quit is File › Exit in the +//! no in-window menu and are synthesized here; Quit is File › Exit in the //! window and reads as Quit in the App menu. These leave the other menus (Edit › Preferences…, //! Help › About), and Join Our Discord stays under Help only; //! - **Window** gets Minimize ⌃⌘M, Zoom and Bring All to Front, and **Help** the system's search @@ -299,7 +299,7 @@ pub struct Layout { } /// The Mac menu bar of `bar` (the in-window menus, [`from_tree`]): see the module docs. -/// Language and Appearance have no in-window menu (as in PhotoCraft); when the tree doesn't +/// Language and Appearance have no in-window menu; when the tree doesn't /// carry them they are synthesized below, so the App menu keeps them. pub fn mac_layout(app: &VectorcraftApp, bar: &MenuBar, lang: Lang) -> Layout { let mut bar = bar.clone(); @@ -400,7 +400,7 @@ fn native_item(app: &VectorcraftApp, label: &'static str, command: &'static str, } /// Settings ▸: one item per page of the Preferences dialog (its own list), each opening it there; -/// the first (General…) has Preferences' shortcut (⌘K), as in Illustrator. +/// the first (General…) has Preferences' shortcut (⌘K). fn settings_pages(preferences: &Item, lang: Lang) -> Vec { vectorcraft_engine::cmd::prefscmds::PREF_CATEGORIES .iter() diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 5c531019ce..da8636c139 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -1764,10 +1764,12 @@ mod tests { assert_eq!(panels.len(), crate::state::all_panels().count()); // Many results hold "layers" in their menu path; the panel, named Layers, is shown first, and "color guide" shows the Color Guide panel first too. for (query, want) in [("layers", "panel:layers"), ("color guide", "panel:colorGuide"), ("Layers ", "panel:layers")] { - let all = entries.iter().filter(|e| query.to_lowercase().split_whitespace().all(|w| e.haystack.contains(w))).count(); + let all: Vec<&str> = + entries.iter().filter(|e| query.to_lowercase().split_whitespace().all(|w| e.haystack.contains(w))).map(|e| e.id.as_str()).collect(); let shown: Vec<&str> = matching(&entries, &query.to_lowercase()).into_iter().map(|e| e.id.as_str()).collect(); assert_eq!(shown.first(), Some(&want), "{query}: {shown:?}"); - assert_eq!(shown.len(), all, "{query}"); + // English plural and verb forms can find more results than the text alone. + assert!(all.iter().all(|id| shown.contains(id)), "{query}"); } let layers = entries.iter().find(|e| e.id == "panel:layers").unwrap(); assert_eq!(layers.shown, "Window › Show Panel › Layers"); @@ -1804,8 +1806,16 @@ mod tests { /// does, and changes nothing until the dialog is confirmed. #[test] fn an_effect_is_a_result_whose_pick_runs_its_menu_item() { - let entries = build(Lang::EN); - let effects = crate::shortcut_editor::effect_items(); + // Both reads see the same plug-in revision: another test may install or remove a live + // effect plug-in between them. + let (entries, effects) = loop { + let revision = menus::plugin_revision(); + let entries = build(Lang::EN); + let effects = crate::shortcut_editor::effect_items(); + if menus::plugin_revision() == revision { + break (entries, effects); + } + }; for e in effects.iter() { let key = format!("effect:{}", e.effect); assert_eq!(entries.iter().filter(|r| r.id == key).count(), 1, "{key}"); diff --git a/crates/ui-egui/src/palette/search.rs b/crates/ui-egui/src/palette/search.rs index a2bc113d4a..e20d75e610 100644 --- a/crates/ui-egui/src/palette/search.rs +++ b/crates/ui-egui/src/palette/search.rs @@ -10,19 +10,26 @@ use crate::menus; /// and the exact tiers read the whole query. const INDEX_CHARS: usize = 200; -/// The field of a result a word comes from, best first. +/// The field of a result a word comes from, best first, and the fields of the English stem forms +/// ([`stems`]) of the words of the label and the menu path. const LABEL: u8 = 0; const PATH: u8 = 1; const ID: u8 = 2; +const LABEL_STEMMED: u8 = 3; +const PATH_STEMMED: u8 = 4; /// A word's grade in a result, best first: a whole word of the label, a word of the label it -/// starts, a word of the menu path it is or starts, a word of the id it is or starts, or text -/// inside a word of any field ([`super::matching`]'s substring rule). -const LABEL_WORD: u8 = 1; -const LABEL_PREFIX: u8 = 2; -const PATH_WORD: u8 = 3; -const ID_WORD: u8 = 4; -const SUBSTRING: u8 = 5; +/// shares an English stem form with ("outlines" and Outline), a word of the label it starts, a +/// word of the menu path it is, shares a stem form with or starts, a word of the id it is or +/// starts, or text inside a word of any field ([`super::matching`]'s substring rule). The grades +/// without a stem are twice the values they had before stems were added, so results matched +/// without a stem keep their order by the sum of the grades. +const LABEL_WORD: u8 = 2; +const LABEL_STEM: u8 = 3; +const LABEL_PREFIX: u8 = 4; +const PATH_WORD: u8 = 6; +const ID_WORD: u8 = 8; +const SUBSTRING: u8 = 10; const NONE: u8 = u8::MAX; /// How a whole query matches a result, best first: it is the result's id, it is a label, a label @@ -34,7 +41,7 @@ const INITIALS: u8 = 3; const NO_PHRASE: u8 = 4; /// One result in the list of a term: the result's place in the catalog and the field the term is -/// a word of. +/// a word or a word's stem form of. #[derive(Clone, Copy)] struct Posting { entry: u16, @@ -73,6 +80,70 @@ fn initials_of(label: &str) -> String { .collect() } +/// The English stem forms of the lowercased `word`, at most two, and none for a word that is not +/// plain English letters. `'s` is dropped; `sses` becomes `ss`; `es` after `s`, `x`, `z`, `ch` or +/// `sh` is dropped, and with only its `s` dropped the word is a second form (`boxes`, `box` and +/// `boxe`; `rasterizes`, `rasteriz` and `rasterize`); in a word of more than 5 letters, `ies` +/// becomes `y` or `ie` (`copies`, `copy` and `copie`; `movies`, `movy` and `movie`); `ing` (more +/// than 5 letters) and `ed` (more than 4) are dropped, and when a doubled `b`, `d`, `g`, `m`, `n`, +/// `p`, `r` or `t` is left before them, the rest with that letter made single and the rest as it +/// is are the forms (`cutting`, `cut` and `cutt`), the single one only when it keeps at least 3 +/// letters (`added`, `add` alone); otherwise the rest and the rest followed by `e` are the forms +/// (`scaling`, `scal` and `scale`); a final `s` is dropped from a word of more than 3 letters that +/// does not end in `ss`, `us` or `is`. `series` and `species` have none. +fn stems(word: &str) -> Vec { + let one = |rest: &str| if rest.is_empty() { vec![] } else { vec![rest.to_string()] }; + if !word.bytes().all(|b| b.is_ascii_lowercase() || b == b'\'') || matches!(word, "series" | "species") { + return vec![]; + } + let n = word.len(); + if let Some(rest) = word.strip_suffix("'s") { + return one(rest); + } + if let Some(rest) = word.strip_suffix("sses") { + return vec![format!("{rest}ss")]; + } + if let Some(rest) = word.strip_suffix("es") + && ["s", "x", "z", "ch", "sh"].iter().any(|end| rest.ends_with(end)) + { + return vec![rest.to_string(), format!("{rest}e")]; + } + if n > 5 + && let Some(rest) = word.strip_suffix("ies") + { + return vec![format!("{rest}y"), format!("{rest}ie")]; + } + let verb = if n > 5 { word.strip_suffix("ing") } else { None }.or_else(|| if n > 4 { word.strip_suffix("ed") } else { None }); + if let Some(rest) = verb { + if let [.., a, b] = rest.as_bytes() + && a == b + && b"bdgmnprt".contains(a) + { + let single = rest.get(..rest.len() - 1).unwrap_or_default(); + if single.len() < 3 { + return vec![rest.to_string()]; + } + return vec![single.to_string(), rest.to_string()]; + } + return vec![rest.to_string(), format!("{rest}e")]; + } + if n > 3 && word.ends_with('s') && !["ss", "us", "is"].iter().any(|end| word.ends_with(end)) { + return one(word.get(..n - 1).unwrap_or_default()); + } + vec![] +} + +/// Adds each word of `text` to `found` for result `entry` in `field`, and with `stemmed`, each +/// word's English stem forms in that field. +fn add_words(found: &mut Vec<(String, u16, u8)>, text: &str, entry: u16, field: u8, stemmed: Option) { + for w in words(text) { + found.push((w.to_string(), entry, field)); + if let Some(stemmed) = stemmed { + found.extend(stems(w).into_iter().map(|s| (s, entry, stemmed))); + } + } +} + /// A name's last `›`-separated part (the label) and the parts before it (the menu path). fn split_name(name: &str) -> (&str, &str) { match name.rsplit_once(" › ") { @@ -99,9 +170,10 @@ fn ids(e: &Entry) -> impl Iterator { impl Index { /// The index of `entries`, whose menu homes and menu items read `homes` in the UI language. The - /// words of a result's menu home and of its menu item's label count as menu path words. A - /// catalog with more results than a posting can name gets an empty index, and queries match by - /// the substring rule alone. + /// words of a result's menu home and of its menu item's label count as menu path words. The + /// words of the English names, menu home and menu item label also add their English stem forms + /// ([`stems`]); words in the UI language do not. A catalog with more results than a posting can + /// name gets an empty index, and queries match by the substring rule alone. pub(crate) fn build(entries: &[Entry], homes: &[Option]) -> Index { if entries.len() > usize::from(u16::MAX) { return Index::default(); @@ -114,10 +186,13 @@ impl Index { let id = ids(e).next().unwrap_or_default(); let start = initials_text.len(); let mut seen_initials: Vec = vec![]; - for name in names(e) { + // The first two names are English, so their words also give stem forms; the shown name + // may be in another language, and its words are indexed as they are. + for (n, name) in names(e).enumerate() { + let english = n < 2; let (label, path) = split_name(without_id(name, id)); - found.extend(words(label).map(|w| (w.to_string(), entry, LABEL))); - found.extend(words(path).map(|w| (w.to_string(), entry, PATH))); + add_words(&mut found, label, entry, LABEL, english.then_some(LABEL_STEMMED)); + add_words(&mut found, path, entry, PATH, english.then_some(PATH_STEMMED)); let ini = initials_of(label); if ini.chars().count() >= 2 && !seen_initials.contains(&ini) { if !seen_initials.is_empty() { @@ -127,8 +202,11 @@ impl Index { seen_initials.push(ini); } } - for home in [e.home.as_deref(), Some(e.menu_item), homes.get(i).and_then(Option::as_deref)].into_iter().flatten() { - found.extend(words(&home.to_lowercase()).map(|w| (w.to_string(), entry, PATH))); + for home in [e.home.as_deref(), Some(e.menu_item)].into_iter().flatten() { + add_words(&mut found, &home.to_lowercase(), entry, PATH, Some(PATH_STEMMED)); + } + if let Some(home) = homes.get(i).and_then(Option::as_deref) { + add_words(&mut found, &home.to_lowercase(), entry, PATH, None); } for id in ids(e) { found.extend(words(id).map(|w| (w.to_string(), entry, ID))); @@ -183,10 +261,33 @@ impl Index { self.term_text.get(offset..offset + len as usize).unwrap_or_default() } - /// The best grade (1 to 4) `word` gets in each result, [`NONE`] where it is no word and starts - /// no word of the result. The words it starts are found by a binary search of the sorted words. + /// The postings of the word at place `t` in `terms`. + fn postings_of(&self, t: usize) -> &[Posting] { + let Some(&(begin, len)) = self.spans.get(t) else { return &[] }; + let (begin, len) = (begin as usize, len as usize); + self.postings.get(begin..begin + len).unwrap_or_default() + } + + /// The place of the word `text` in `terms`, found by a binary search. + fn find(&self, text: &str) -> Option { + self.terms.binary_search_by(|t| self.text(t).cmp(text)).ok() + } + + /// The best grade ([`LABEL_WORD`] to [`ID_WORD`]) `word` gets in each result, [`NONE`] where it + /// is no word, shares no English stem form with a word of the label or menu path, and starts no + /// word of the result. The words it starts are found by a binary search of the sorted words; a + /// stem form matches only a word or stem form equal to it. fn grades(&self, word: &str, n: usize) -> Vec { let mut out = vec![NONE; n]; + let mut mark = |postings: &[Posting], grade: &dyn Fn(u8) -> Option| { + for p in postings { + if let Some(grade) = grade(p.field) + && let Some(g) = out.get_mut(usize::from(p.entry)) + { + *g = (*g).min(grade); + } + } + }; let start = self.terms.partition_point(|t| self.text(t) < word); for (t, at) in self.terms.iter().enumerate().skip(start) { let term = self.text(at); @@ -194,19 +295,37 @@ impl Index { break; } let whole = term == word; - let Some(&(begin, len)) = self.spans.get(t) else { continue }; - let (begin, len) = (begin as usize, len as usize); - for p in self.postings.get(begin..begin + len).unwrap_or_default() { - let grade = match p.field { - LABEL if whole => LABEL_WORD, - LABEL => LABEL_PREFIX, - PATH => PATH_WORD, - _ => ID_WORD, - }; - if let Some(g) = out.get_mut(usize::from(p.entry)) { - *g = (*g).min(grade); - } - } + // A stem form is not a word of the result, so a query word that only starts it does + // not match. + mark(self.postings_of(t), &|field| match field { + LABEL if whole => Some(LABEL_WORD), + LABEL => Some(LABEL_PREFIX), + PATH => Some(PATH_WORD), + ID => Some(ID_WORD), + _ => None, + }); + } + // The word meets a stem form of a word of the result ("scale" and Scaling) when it is itself + // a word of some result, so a partly typed word ("scal") that only equals a stem form does + // not lift Scaling above Scale. + if let Some(t) = self.find(word) + && self.postings_of(t).iter().any(|p| matches!(p.field, LABEL | PATH | ID)) + { + mark(self.postings_of(t), &|field| match field { + LABEL_STEMMED => Some(LABEL_STEM), + PATH_STEMMED => Some(PATH_WORD), + _ => None, + }); + } + // A stem form of the word meets a word of the result or a stem form of one ("outlines" + // and Outline, "rotated" and Rotating). Ids are not stemmed. + for form in stems(word) { + let Some(t) = self.find(&form) else { continue }; + mark(self.postings_of(t), &|field| match field { + LABEL | LABEL_STEMMED => Some(LABEL_STEM), + PATH | PATH_STEMMED => Some(PATH_WORD), + _ => None, + }); } out } @@ -267,10 +386,11 @@ type RankKey = (u8, u8, u32, u8, usize); /// The results of `entries` that the lowercased `query` matches, best first, as places in /// `entries`. A result matches when every word of the query is text in one of its names or ids /// (the rule the palette always had, so nothing it found is lost), when every word of the query is -/// or starts a word of its label, menu path or id, or when the query is the initials of a label -/// ("ea" for Export As…). Results are ordered by how the whole query matches ([`phrase`]), then by -/// the worst grade a word gets, the sum of the grades, the kind of result ([`kind`]), the label's -/// length and the catalog order. An empty query lists every result in catalog order. +/// or starts a word of its label, menu path or id or shares an English stem form with a word of its +/// label or menu path ("rounded corners" for Round Corners…), or when the query is the initials of +/// a label ("ea" for Export As…). Results are ordered by how the whole query matches ([`phrase`]), +/// then by the worst grade a word gets, the sum of the grades, the kind of result ([`kind`]), the +/// label's length and the catalog order. An empty query lists every result in catalog order. pub(crate) fn rank(entries: &[Entry], index: &Index, query: &str) -> Vec { let query = normalize(query); if query.is_empty() { @@ -412,8 +532,13 @@ mod tests { for (query, better, worse) in [ // A whole word of the label, then a word of the label it starts. ("cut zz", entry("Zz Cut", "a.one"), entry("Zz Cutter", "b.two")), + // A whole word of the label, then a word of the label it shares a stem form with. + ("scale zz", entry("Zz Scale", "a.one"), entry("Zz Scaling", "b.two")), + // A word of the label it shares a stem form with, then a word of the label it starts. + // The id makes "scale" a word of the catalog. + ("scale zz", entry("Zz Scaling", "a.one"), entry("Zz Scalers", "scale.two")), // A word of the label it starts, then a word of the menu path. - ("fill zz", entry("Zz Filling", "a.one"), entry("Fill › Zz Other", "b.two")), + ("fill zz", entry("Zz Fillet", "a.one"), entry("Fill › Zz Other", "b.two")), // A word of the menu path, then a word of the id. ("zap zz", entry("Zap › Zz One", "a.one"), entry("Zz Two", "zap.two")), // A word of the id, then text inside a word. @@ -426,6 +551,38 @@ mod tests { } } + /// A partly typed word that equals only a stem form ("scal" of Scaling, "spac" of Spacing) is a + /// word the query starts in both results, so the shorter label stays first. + #[test] + fn a_partly_typed_word_does_not_lift_a_verb_form() { + for (query, base, form) in [("scal zz", "Zz Scale", "Zz Scaling"), ("spac zz", "Zz Space", "Zz Spacing"), ("ad zz", "Zz Add", "Zz Added")] { + let c = synthetic(vec![entry(form, "a.one"), entry(base, "b.two")]); + assert_eq!(ranked(&c, query), ["b.two", "a.one"], "{query}"); + } + } + + /// How the whole query matches comes before the word grades, so a stem form ranks above a word + /// the query starts only among results in the same whole-query tier: "scale" lists Scale, then + /// Scalers, which starts with the query, then Scaling, and "scale zz" lists Zz Scaling above Zz + /// Scalers. + #[test] + fn a_whole_query_tier_comes_before_a_stem_form() { + let c = synthetic(vec![entry("Scaling", "c.three"), entry("Scalers", "b.two"), entry("Scale", "a.one")]); + assert_eq!(ranked(&c, "scale"), ["a.one", "b.two", "c.three"]); + let c = synthetic(vec![entry("Zz Scalers", "b.two"), entry("Zz Scaling", "a.one"), entry("Zz Scale", "c.three")]); + assert_eq!(ranked(&c, "scale zz"), ["c.three", "a.one", "b.two"]); + } + + /// Results that no stem form matches keep the order they had before stems were added: two + /// results whose grades summed the same still tie on the sum, and the shorter label comes + /// first. + #[test] + fn results_matched_without_a_stem_keep_their_order() { + // Two label prefixes and a menu path word, against a label word and two menu path words. + let c = synthetic(vec![entry("Bet › Gam › Alp Zzzzzzzzzz", "b.two"), entry("Gam › Alpx Betx", "a.one")]); + assert_eq!(ranked(&c, "alp bet gam"), ["a.one", "b.two"]); + } + /// For each pair of adjacent whole-query tiers, a result in the better tier ranks above one in /// the worse. #[test] @@ -476,6 +633,77 @@ mod tests { } } + /// Do `a` and `b` share a form, each taken as it is or as one of its stem forms? + fn meet(a: &str, b: &str) -> bool { + let forms = |w: &str| std::iter::once(w.to_string()).chain(stems(w)).collect::>(); + let b = forms(b); + forms(a).iter().any(|f| b.contains(f)) + } + + /// English plurals and verb forms meet their base word, and words that only look alike do not. + #[test] + fn plurals_and_verb_forms_meet_their_base_word() { + for (a, b) in [ + ("outlines", "outline"), + ("rounded", "round"), + ("paths", "path"), + ("cutting", "cut"), + ("scaling", "scale"), + ("rotated", "rotate"), + ("spacing", "space"), + ("tracing", "trace"), + ("curved", "curve"), + ("filled", "fill"), + ("missing", "missing"), + ("boxes", "box"), + ("brushes", "brush"), + ("glasses", "glass"), + ("copies", "copy"), + ("movies", "movie"), + ("artist's", "artist"), + ("rotated", "rotating"), + ("added", "add"), + ("rasterizes", "rasterize"), + ("sizes", "size"), + ] { + assert!(meet(a, b), "{a} meets {b}"); + } + for (a, b) in [("series", "sery"), ("missing", "mis"), ("press", "pres"), ("bus", "bu"), ("axis", "axi"), ("cutting", "cu"), ("added", "ad")] + { + assert!(!meet(a, b), "{a} does not meet {b}"); + } + for w in ["outlines", "scaling", "cutting", "copies", "s", "'s", "ed", "ing", "übers", "群組", "series"] { + assert!(stems(w).len() <= 2, "{w}"); + assert!(stems(w).iter().all(|s| !s.is_empty() && s != w), "{w}: {:?}", stems(w)); + } + assert!(stems("übers").is_empty() && stems("series").is_empty() && stems("species").is_empty()); + } + + /// A query word in a plural or verb form finds a result whose label or menu path holds the base + /// word, below one that holds the word itself, and the words of a name shown in another language + /// are not stemmed. + #[test] + fn a_plural_or_verb_form_finds_the_result() { + let c = synthetic(vec![entry("Zz Rotate", "a.one"), entry("Spacing › Zz Other", "b.two"), entry("Zz Rotated", "c.three")]); + assert_eq!(ranked(&c, "rotating"), ["a.one", "c.three"]); + assert_eq!(ranked(&c, "rotated"), ["c.three", "a.one"]); + assert_eq!(ranked(&c, "spaces other"), ["b.two"], "through the menu path"); + let shown = Entry { shown: "Zz Trees".into(), haystack: "zz one\nzz one\nzz trees\na.one".into(), ..entry("Zz One", "a.one") }; + let c = synthetic(vec![shown, entry("Zz Trees", "b.two")]); + assert_eq!(ranked(&c, "treed zz"), ["b.two"], "only the English name is stemmed"); + let en = catalog(Lang::EN, false); + assert!(place(&en, "outlines", "type.createOutlines").is_some_and(|p| p < 3)); + assert_eq!(ranked(&en, "rounded corners").first().map(String::as_str), Some("effect:stylize.roundCorners")); + for (q, id) in [ + ("scaling", "object.scale"), + ("rotated", "object.rotate"), + ("rasterizes", "object.rasterize"), + ("added anchor points", "object.path.addAnchorPoints"), + ] { + assert!(place(&en, q, id).is_some(), "{q} finds {id}"); + } + } + /// The application menu of the native Mac menu bar holds the items [`menu_homes`] puts there, /// under the same submenus. #[test] diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rs index 0a4f01879d..8f98ee50c0 100644 --- a/crates/ui-egui/src/panel_docking.rs +++ b/crates/ui-egui/src/panel_docking.rs @@ -1128,6 +1128,7 @@ fn known(action: &Action) -> bool { pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui) { let area = area_id(); let ctx = ui.ctx().clone(); + crate::tools_float::set_dock_area_left(&ctx, ui.available_rect_before_wrap().left()); let changed_workspace = ctx.data_mut(|data| { let previous = data.get_temp::(area.with("generation")); data.insert_temp(area.with("generation"), app.ui.docking_generation); diff --git a/crates/ui-egui/src/panel_docking/tests.rs b/crates/ui-egui/src/panel_docking/tests.rs index e01dbc6caf..6c861c0db9 100644 --- a/crates/ui-egui/src/panel_docking/tests.rs +++ b/crates/ui-egui/src/panel_docking/tests.rs @@ -408,7 +408,7 @@ fn a_character_field_shortcut_brings_the_floating_character_panel_forward() { h.frame(vec![]); assert!(showing(&h.app.ui, "character")); assert_eq!(h.app.dock_rt.raise, None); - for command in ["type.highlightKerning", "type.highlightTracking", "type.highlightFontName"] { + for command in ["type.highlightKerning", "type.highlightTracking", "type.highlightFontName", "type.highlightFontSize"] { h.app.run(command, json!({})).unwrap(); assert_eq!(h.app.dock_rt.raise.as_deref(), Some("character"), "{command}"); h.frame(vec![]); @@ -833,57 +833,185 @@ fn keep_tools_beside_the_canvas_toggles_and_rejects_a_value_that_is_not_true_or_ assert!(!h.app.ui.tools_beside_canvas, "a bad value changes nothing"); } -/// Off, only the window's edge docks a floating Tools panel; on, the canvas's edge does too, and -/// both dock it beside the canvas. +/// Whichever way the setting is, the canvas's left edge, right of a left-side dock, docks a +/// floating Tools panel beside the canvas and turns the setting on, and the window's left edge +/// docks it outside the dock and turns the setting off; the menu item's check mark follows. #[test] -fn tools_redock_at_the_targets_of_the_chosen_placement() { +fn tools_dropped_on_a_left_edge_dock_there_and_the_setting_follows() { for beside in [false, true] { let mut h = Harness::new(); keep_tools_beside_canvas(&mut h, beside); h.app.run("window.panel.dock", json!({"panel": "layers", "side": "Start"})).unwrap(); - for at_window_edge in [false, true] { + for at_window_edge in [false, true, false] { h.app.run("window.panel.float", json!({"panel": "tools", "x": 600, "y": 300})).unwrap(); settle(&mut h); let canvas = h.app.canvas_rect.unwrap(); let canvas_edge = h.ctx.data(|d| d.get_temp::(crate::tools_float::tools_zone_id())); - assert_eq!(canvas_edge.is_some(), beside, "a canvas-edge target only while kept beside the canvas"); - let canvas_edge = canvas_edge.map_or(pos2(canvas.left() + 12.0, canvas.center().y), |r| r.center()); - let target = if at_window_edge { pos2(12.0, canvas.center().y) } else { canvas_edge }; + let canvas_edge = canvas_edge.expect("the canvas's left edge is a target whichever way the setting is"); + assert!(canvas_edge.left() > 60.0, "right of the left-side dock: {canvas_edge:?}"); + let target = if at_window_edge { pos2(12.0, canvas.center().y) } else { canvas_edge.center() }; h.drag(pos2(620.0, 307.0), target); - if !beside && !at_window_edge { - assert!(h.app.ui.toolbar_pos.is_some(), "the canvas's edge does not dock Tools while the setting is off"); - continue; - } - assert_eq!(h.app.ui.toolbar_pos, None, "beside: {beside}, at the window edge: {at_window_edge}"); + let case = format!("set before: {beside}, at the window edge: {at_window_edge}"); + assert_eq!(h.app.ui.toolbar_pos, None, "{case}"); + assert_eq!(h.app.ui.tools_beside_canvas, !at_window_edge, "{case}"); + assert_eq!(crate::menus::checked(&h.app, "window.toolsBesideCanvas", &json!({})), Some(!at_window_edge), "{case}"); settle(&mut h); - assert_eq!(tools_place(&h), Some(beside), "beside: {beside}, at the window edge: {at_window_edge}"); + assert_eq!(tools_place(&h), Some(!at_window_edge), "{case}"); } } } -/// Turning the setting off while Tools floats forgets the canvas-edge target, and turning it on -/// leaves a floating Tools panel floating. +/// With no panels docked on the left, the canvas's left edge and the window's left edge overlap, +/// and a drop there docks Tools where the setting puts it, leaving the setting as it is. #[test] -fn toggling_while_tools_floats_keeps_it_floating_and_drops_the_canvas_target() { +fn tools_dropped_where_the_left_edges_overlap_keep_the_setting() { + for beside in [false, true] { + let mut h = Harness::new(); + keep_tools_beside_canvas(&mut h, beside); + h.app.run("window.panel.float", json!({"panel": "tools", "x": 600, "y": 300})).unwrap(); + settle(&mut h); + let canvas_edge = h.ctx.data(|d| d.get_temp::(crate::tools_float::tools_zone_id())).expect("the canvas-edge target"); + assert!(canvas_edge.left() < 30.0, "no panels on the left: {canvas_edge:?}"); + h.drag(pos2(620.0, 307.0), pos2(canvas_edge.left() + 4.0, canvas_edge.center().y)); + assert_eq!(h.app.ui.toolbar_pos, None, "set before: {beside}"); + assert_eq!(h.app.ui.tools_beside_canvas, beside, "the setting is unchanged"); + settle(&mut h); + let tools = docked_tools(&h); + assert!(tools.left() < 10.0, "docked at the left edge, set before: {beside}: {tools:?}"); + assert!(tools.right() <= h.app.canvas_rect.unwrap().left() + 1.0, "left of the canvas: {tools:?}"); + } +} + +/// A toolbar made with New Toolbar docked on the left, and no panels there: Tools docks left of the +/// toolbar's lane either way, so a drop on the canvas's edge, right of the lane, keeps the setting. +#[test] +fn tools_dropped_beside_a_left_toolbar_lane_keep_the_setting() { + for beside in [false, true] { + let mut h = Harness::new(); + keep_tools_beside_canvas(&mut h, beside); + h.app.run("window.toolbar.new", json!({"name": "Mine"})).unwrap(); + h.app.run("window.toolbar.dock", json!({"name": "Mine", "side": "left"})).unwrap(); + h.app.run("window.panel.float", json!({"panel": "tools", "x": 600, "y": 300})).unwrap(); + settle(&mut h); + let canvas_edge = h.ctx.data(|d| d.get_temp::(crate::tools_float::tools_zone_id())).expect("the canvas-edge target"); + assert!(canvas_edge.left() > 30.0, "right of the toolbar lane: {canvas_edge:?}"); + let at = pos2(canvas_edge.right() - 4.0, canvas_edge.center().y); + let lit = crate::tools_float::drop_highlight(&h.ctx, at, beside).expect("a strip lights up"); + assert!(lit.left() < 10.0, "the window's edge, where Tools docks, lights up: {lit:?}"); + h.drag(pos2(620.0, 307.0), at); + assert_eq!(h.app.ui.toolbar_pos, None, "set before: {beside}"); + assert_eq!(h.app.ui.tools_beside_canvas, beside, "the setting is unchanged"); + settle(&mut h); + assert!(docked_tools(&h).left() < 10.0, "left of the lane, set before: {beside}"); + } +} + +/// Dragged out of the panel docked at the window's edge and released in the next frame, right of +/// where the panel was, Tools stays floating and the setting stays off. +#[test] +fn tools_released_as_they_float_from_the_window_edge_keep_floating() { + let mut h = Harness::new(); + let docked = docked_tools(&h); + let title = docked.min + vec2(20.0, 12.0); + h.frame(vec![Event::PointerMoved(title), button(title, true)]); + h.frame(vec![Event::PointerMoved(title + vec2(0.0, 10.0))]); + let out = pos2(docked.right().max(crate::toolbar::WIDTH) + 8.0, title.y + 10.0); + h.frame(vec![Event::PointerMoved(out)]); + assert!(h.app.ui.toolbar_pos.is_some(), "dragged out of the docked panel, Tools floats"); + h.frame(vec![button(out, false)]); + settle(&mut h); + assert!(h.app.ui.toolbar_pos.is_some(), "the strip laid out right of the docked panel docks nothing"); + assert!(!h.app.ui.tools_beside_canvas); +} + +/// A drop on the right edge leaves the setting as it is, and so does a move of Tools floating over +/// the canvas's left edge that ends within a few points of where it started. +#[test] +fn tools_docked_on_the_right_or_clicked_leave_the_setting() { + for beside in [false, true] { + let mut h = Harness::new(); + keep_tools_beside_canvas(&mut h, beside); + h.app.run("window.panel.dock", json!({"panel": "layers", "side": "Start"})).unwrap(); + h.app.run("window.panel.float", json!({"panel": "tools", "x": 600, "y": 300})).unwrap(); + settle(&mut h); + h.drag(pos2(620.0, 307.0), pos2(SCREEN.right() - 10.0, 500.0)); + assert_eq!((h.app.ui.toolbar_pos, h.app.ui.toolbar_right), (None, true), "set before: {beside}"); + assert_eq!(h.app.ui.tools_beside_canvas, beside, "docked on the right, the setting is unchanged"); + let canvas_edge = h.ctx.data(|d| d.get_temp::(crate::tools_float::tools_zone_id())).expect("the canvas-edge target"); + h.app.run("window.panel.float", json!({"panel": "tools", "x": canvas_edge.left(), "y": 300})).unwrap(); + settle(&mut h); + let [x, y] = h.app.ui.toolbar_pos.unwrap(); + let title = pos2(x + 12.0, y + 7.0); + assert!(canvas_edge.contains(title), "the title bar is over the canvas's edge: {title:?} {canvas_edge:?}"); + h.press_and_move(title, title + vec2(30.0, 0.0)); + let moved = h.app.ui.toolbar_pos.map(|[px, _]| px - x); + assert!(moved.is_some_and(|dx| dx > 10.0), "the move started, set before: {beside}: {moved:?}"); + let back = title + vec2(2.0, 0.0); + h.frame(vec![Event::PointerMoved(back)]); + h.frame(vec![button(back, false)]); + settle(&mut h); + assert!(h.app.ui.toolbar_pos.is_some(), "released where it started, Tools docks nowhere, set before: {beside}"); + assert_eq!(h.app.ui.tools_beside_canvas, beside, "the setting is unchanged"); + } +} + +/// A left-side dock collapsed to icons is narrower than the window's strip: only the column the +/// two strips share keeps the setting, and each strip's own part docks at its place. +#[test] +fn tools_dropped_beside_a_collapsed_left_dock_follow_the_strip_dropped_on() { + let mut h = Harness::new(); + h.app.run("window.panel.dock", json!({"panel": "layers", "side": "Start"})).unwrap(); + h.app.run("window.collapseDock", json!({"collapsed": true})).unwrap(); + let float = |h: &mut Harness| { + h.app.run("window.panel.float", json!({"panel": "tools", "x": 600, "y": 300})).unwrap(); + settle(h); + h.ctx.data(|d| d.get_temp::(crate::tools_float::tools_zone_id())).expect("the canvas-edge target") + }; + let zone = float(&mut h); + let window_strip = crate::toolbar::WIDTH; + assert!(zone.left() > 10.0 && zone.left() < window_strip - 4.0, "an icon column narrower than the window's strip: {zone:?}"); + let y = zone.center().y; + // Beside the canvas: right of the icon column; at the window's edge: left of it. + let placed_beside = |h: &mut Harness, icons: Rect| { + settle(h); + let tools = docked_tools(h); + if tools.left() >= icons.left() - 1.0 { + Some(true) + } else if tools.left() < 10.0 { + Some(false) + } else { + None + } + }; + // Right of the window's strip: beside the canvas. + h.drag(pos2(620.0, 307.0), pos2(window_strip + 4.0, y)); + assert_eq!((h.app.ui.toolbar_pos, h.app.ui.tools_beside_canvas), (None, true)); + assert_eq!(placed_beside(&mut h, zone), Some(true)); + // In the shared column: where the setting puts it, the setting unchanged. + let zone = float(&mut h); + h.drag(pos2(620.0, 307.0), pos2(zone.left() + 2.0, y)); + assert_eq!((h.app.ui.toolbar_pos, h.app.ui.tools_beside_canvas), (None, true)); + assert_eq!(placed_beside(&mut h, zone), Some(true)); + // Left of the icon column: at the window's edge. + let zone = float(&mut h); + h.drag(pos2(620.0, 307.0), pos2(zone.left() / 2.0, y)); + assert_eq!((h.app.ui.toolbar_pos, h.app.ui.tools_beside_canvas), (None, false)); + assert_eq!(placed_beside(&mut h, zone), Some(false)); +} + +/// Turning the setting on or off while Tools floats leaves it floating. +#[test] +fn toggling_while_tools_floats_keeps_it_floating() { let mut h = Harness::new(); h.app.run("window.panel.dock", json!({"panel": "layers", "side": "Start"})).unwrap(); keep_tools_beside_canvas(&mut h, true); h.app.run("window.panel.float", json!({"panel": "tools", "x": 600, "y": 300})).unwrap(); settle(&mut h); - let zone = h.ctx.data(|d| d.get_temp::(crate::tools_float::tools_zone_id())).expect("the canvas-edge target"); - keep_tools_beside_canvas(&mut h, false); - assert!(h.app.ui.toolbar_pos.is_some(), "turning it off leaves Tools floating"); - assert!(h.ctx.data(|d| d.get_temp::(crate::tools_float::tools_zone_id())).is_none(), "the canvas-edge target is gone"); - h.drag(pos2(620.0, 307.0), zone.center()); - assert!(h.app.ui.toolbar_pos.is_some(), "the old canvas-edge strip docks nothing"); let [x, y] = h.app.ui.toolbar_pos.unwrap(); + keep_tools_beside_canvas(&mut h, false); + assert_eq!(h.app.ui.toolbar_pos, Some([x, y]), "turning it off leaves Tools floating where it was"); keep_tools_beside_canvas(&mut h, true); assert_eq!(h.app.ui.toolbar_pos, Some([x, y]), "turning it on leaves Tools floating where it was"); - keep_tools_beside_canvas(&mut h, false); - h.drag(pos2(x + 20.0, y + 7.0), pos2(12.0, zone.center().y)); - assert_eq!(h.app.ui.toolbar_pos, None); - settle(&mut h); - assert_eq!(tools_place(&h), Some(false)); } /// The setting is kept with a workspace; state and workspaces saved without it keep Tools at the @@ -980,6 +1108,7 @@ fn tools_redock_at_window_edge_above_and_below_canvas() { assert!(panel.center().y < canvas.top() || panel.center().y > canvas.bottom()); h.drag(pos2(620.0, 307.0), pos2(12.0, panel.center().y)); assert_eq!(h.app.ui.toolbar_pos, None, "window-edge drop, beside: {beside}, above the canvas: {above}"); + assert_eq!(h.app.ui.tools_beside_canvas, beside, "no panels on the left: the setting is unchanged"); settle(&mut h); let tools = docked_tools(&h); let panel = h.tab(if above { "layers" } else { "properties" }).unwrap(); diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index aa07b13a90..3420072605 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -51,6 +51,8 @@ pub mod transform; pub mod transparency; pub mod variables; +use std::sync::Arc; + use egui::{Rect, Sense, Ui, vec2}; use serde_json::{Value, json}; use vectorcraft_color::{BlendMode, Color, Paint}; @@ -62,9 +64,11 @@ use crate::theme::Tokens; use crate::widgets::{Live, dim_label}; use crate::{VectorcraftApp, icons}; -/// The first selected node (cloned), if any. -pub fn first_selected(app: &VectorcraftApp) -> Option { - first_node(app).cloned() +/// The first selected node, as the `Arc` the document holds, if any. It does not change with later +/// edits: read it again after one. +pub fn first_selected(app: &VectorcraftApp) -> Option> { + let st = app.session.active()?; + st.selection.objects.first().and_then(|id| layers::node_arc(&st.doc, *id)) } /// The radius the Live Corners of path `n` show in the panels: that of the corners the panels set @@ -194,6 +198,7 @@ pub fn show_icon_panel(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { crate::addons::pathtools::ID => crate::addons::pathtools::show(app, ui), crate::addons::pathtools::shape::ID => crate::addons::pathtools::shape::show(app, ui), crate::addons::pen::ID => crate::addons::pen::show(app, ui), + crate::addons::units::ID => crate::addons::units::show(app, ui), id if library_panel::parse(id).is_some() => library_panel::show(app, ui, id), _ => { dim_label(ui, tl!("This panel is on the roadmap (see the parity plan).")); @@ -492,12 +497,14 @@ pub(crate) fn live_run(app: &mut VectorcraftApp, label: &str, cmd: &str, params: match phase { Live::Idle => {} Live::Dragging | Live::Released => { - if app.session.begin_interaction(label).is_ok() { + if app.begin_interaction(label).is_ok() { if let Err(e) = app.session.preview(cmd, ¶ms) { app.ui.status = e.to_string(); } - if phase == Live::Released { - app.session.commit_interaction().ok(); + if phase == Live::Released + && let Err(e) = app.session.commit_interaction() + { + app.ui.status = e.to_string(); } app.sync_views(); } else if phase == Live::Released { diff --git a/crates/ui-egui/src/panels/actions.rs b/crates/ui-egui/src/panels/actions.rs index 8f4e00893f..ccf7665359 100644 --- a/crates/ui-egui/src/panels/actions.rs +++ b/crates/ui-egui/src/panels/actions.rs @@ -13,7 +13,7 @@ use crate::{VectorcraftApp, icons}; mod files; pub(crate) use files::can_load; -pub use files::{ACTIONS_EXT, LOAD_SET, SAVE_SET, load_set, save_set}; +pub use files::{ACTIONS_EXT, LOAD_SET, REPLACE_SET, SAVE_SET, load_set, replace_set, save_set}; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Action { @@ -2160,8 +2160,6 @@ pub const RESET: &str = "ui.actionSet.reset"; /// plays (also while it waits at a stop); then nothing changes. No undo step is recorded. /// → {changed, mode, set: the index of the first built-in set} pub fn reset(app: &mut VectorcraftApp, p: &Value) -> Result { - const SELECTED: &str = "actions-selected"; - const EXPANDED: &str = "actions-expanded"; let append = match p { Value::Null => false, Value::Object(m) => { @@ -2192,6 +2190,18 @@ pub fn reset(app: &mut VectorcraftApp, p: &Value) -> Result { } return Ok(json!({ "changed": true, "mode": "append", "set": first })); } + let changed = replace_sets(app, sets); + Ok(json!({ "changed": changed, "mode": "replace", "set": 0 })) +} + +/// Replaces every set in the panel with `sets`, as Reset Actions and Replace Actions… do: the first +/// becomes current and selected, the panel's selected action and step, its expanded actions and a +/// step being dragged are cleared, and an open Set Options, New Action, Batch or step dialog that +/// names a set closes. When the panel already holds sets that save alike, shown that way, nothing +/// changes and the sets keep their ids → whether anything changed. +fn replace_sets(app: &mut VectorcraftApp, sets: Vec) -> bool { + const SELECTED: &str = "actions-selected"; + const EXPANDED: &str = "actions-expanded"; let ctx = app.ui_ctx.clone(); let panel_clear = ctx.as_ref().is_none_or(|ctx| { pstate::>(ctx, SELECTED).is_none() @@ -2200,10 +2210,10 @@ pub fn reset(app: &mut VectorcraftApp, p: &Value) -> Result { && pstate::>(ctx, EXPANDED).is_empty() }); // The ids are not saved, so two lists that save alike hold the same sets. - let built_in = serde_json::to_value(&app.ui.action_sets).is_ok_and(|now| serde_json::to_value(&sets).is_ok_and(|new| new == now)); - let shown_as_reset = app.ui.action_set == Some(0) && app.ui.action_sets_selected == [0] && !app.ui.dialog.as_ref().is_some_and(holds_set); - if built_in && shown_as_reset && panel_clear { - return Ok(json!({ "changed": false, "mode": "replace", "set": 0 })); + let same = serde_json::to_value(&app.ui.action_sets).is_ok_and(|now| serde_json::to_value(&sets).is_ok_and(|new| new == now)); + let shown_as_replaced = app.ui.action_set == Some(0) && app.ui.action_sets_selected == [0] && !app.ui.dialog.as_ref().is_some_and(holds_set); + if same && shown_as_replaced && panel_clear { + return false; } app.ui.action_sets = sets; app.ui.action_set = Some(0); @@ -2217,7 +2227,7 @@ pub fn reset(app: &mut VectorcraftApp, p: &Value) -> Result { set_pstate::>(&ctx, DRAGGED_STEP, None); set_pstate(&ctx, EXPANDED, BTreeSet::::new()); } - Ok(json!({ "changed": true, "mode": "replace", "set": 0 })) + true } /// The panel's (≡) menu. @@ -2301,12 +2311,16 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut egui::Ui) { crate::dialogs::action_playback::open(app); } ui.separator(); - // As commands, so a file dialog shown off the UI thread saves or loads when it answers. + // As commands, so a file dialog shown off the UI thread saves, loads or replaces when it answers. // Save Actions… names the current set by its id, so a file dialog that answers later saves that set. let save = json!({ "id": current.and_then(|s| app.ui.action_sets.get(s)).map(|s| s.id) }); - for (label, id, on, params) in - [(tl!("Save Actions…"), SAVE_SET, current.is_some(), save), (tl!("Load Actions…"), LOAD_SET, can_load(app), json!({}))] - { + // Replace Actions… is off while an action records or plays, as Reset Actions is. + let idle = !recording && app.ui.action_playing.is_none(); + for (label, id, on, params) in [ + (tl!("Save Actions…"), SAVE_SET, current.is_some(), save), + (tl!("Load Actions…"), LOAD_SET, can_load(app), json!({})), + (tl!("Replace Actions…"), REPLACE_SET, can_load(app) && idle, json!({})), + ] { if widgets::menu_item(ui, label, on, false) && let Err(e) = app.run(id, params) && e != "cancelled" @@ -2315,7 +2329,7 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut egui::Ui) { } } // Asks first: OK replaces the sets with the built-in set, Append adds it after them. - if widgets::menu_item(ui, tl!("Reset Actions"), !recording && app.ui.action_playing.is_none(), false) { + if widgets::menu_item(ui, tl!("Reset Actions"), idle, false) { crate::dialogs::confirm::ask_reset_actions(app); } } @@ -3987,6 +4001,172 @@ mod tests { assert_eq!(saved_sets(&app.ui.action_sets), before, "the playing set stays"); } + /// A click on the panel menu's item `label`; an item that is off takes no click. + fn menu_click(ctx: &egui::Context, app: &mut VectorcraftApp, label: &str) { + use super::super::tests_appearance::{click, frame_events}; + let texts = frame_events(ctx, app, vec![], menu); + let item = texts.iter().find(|(s, _)| s.trim() == label).map(|(_, r)| *r).unwrap_or_else(|| panic!("{label} in the menu")); + click(ctx, app, item.center(), menu); + } + + /// The panel menu's Replace Actions… asks no question, reads the picked file and puts its set, + /// with its name, in place of every set, the built-in set included. A canceled pick changes + /// nothing and says nothing, and the item does nothing where there is no open dialog and while + /// an action records or plays, waiting at a stop included. + #[test] + fn the_panel_menus_replace_actions_puts_the_files_set_in_place_of_every_set() { + let ctx = egui::Context::default(); + let mut app = app_with_sets(); + let before = saved_sets(&app.ui.action_sets); + menu_click(&ctx, &mut app, "Replace Actions…"); + assert_eq!(saved_sets(&app.ui.action_sets), before, "off where there is no open dialog"); + + let files = with_files(&mut app, "/sets/Mine.vcactions"); + let mine = files::write_set(&app.ui.action_sets[1]); + files.borrow_mut().insert("/sets/Mine.vcactions".into(), mine.clone().into_bytes()); + menu_click(&ctx, &mut app, "Replace Actions…"); + assert!(app.ui.dialog.is_none(), "no question first"); + assert_eq!(set_names(&app), ["Mine"], "the built-in set and Other go, and Mine keeps its name"); + assert_eq!(files::write_set(&app.ui.action_sets[0]), mine, "the file's actions and steps"); + assert_eq!((app.ui.action_set, app.ui.action_sets_selected.clone()), (Some(0), vec![0]), "it is current and selected"); + + app.ui.action_sets.push(ActionSet::new("Extra", vec![])); + let before = saved_sets(&app.ui.action_sets); + app.services.pick_open = Some(Box::new(|_: &crate::FilePick| None)); + app.ui.status.clear(); + menu_click(&ctx, &mut app, "Replace Actions…"); + assert_eq!(saved_sets(&app.ui.action_sets), before, "a canceled pick changes nothing"); + assert_eq!(app.ui.status, "", "and says nothing"); + + app.services.pick_open = Some(Box::new(|_: &crate::FilePick| Some("/sets/Mine.vcactions".to_string()))); + app.run("file.new", json!({"width": 200, "height": 100})).unwrap(); + app.run(START_RECORDING, json!({})).unwrap(); + menu_click(&ctx, &mut app, "Replace Actions…"); + assert_eq!(set_names(&app), ["Mine", "Extra"], "off while an action records"); + app.run(STOP_RECORDING, json!({})).unwrap(); + + let (mut app, _) = app_with_a_stop(true); + let files = with_files(&mut app, "/sets/Mine.vcactions"); + files.borrow_mut().insert("/sets/Mine.vcactions".into(), mine.into_bytes()); + let before = saved_sets(&app.ui.action_sets); + play(&mut app, 0, 0).unwrap(); + assert!(waiting_at_stop(&app)); + app.ui.dialog = None; + menu_click(&ctx, &mut app, "Replace Actions…"); + assert_eq!(saved_sets(&app.ui.action_sets), before, "off while playback waits at a stop"); + } + + /// `ui.actionSet.replace` makes the file's set current and selected, clears the panel's selected + /// action and step, expanded actions and a dragged step, closes a dialog that holds a set index + /// and records no undo step. The same file again changes nothing and keeps the ids. A set with + /// no actions replaces the sets too, an `.aia` file reports its left-out steps, and a file with + /// an unknown command reports it, as Load Actions… does; a set with no name takes the file's. + #[test] + fn replace_actions_clears_what_named_the_old_sets_and_reads_aia_files() { + let mut app = app_with_sets(); + app.run("file.new", json!({"width": 200, "height": 100})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap(); + let undo = undo_steps(&app); + app.ui.action_set = Some(2); + app.ui.action_sets_selected = vec![1, 2]; + let ctx = egui::Context::default(); + app.ui_ctx = Some(ctx.clone()); + let nudge = app.ui.action_sets[1].actions[1].id; + set_pstate::>(&ctx, "actions-selected", Some((1, 1))); + set_pstate::>(&ctx, SELECTED_STEP, Some((nudge, 0))); + set_pstate(&ctx, "actions-expanded", BTreeSet::from([nudge])); + let dragged: DraggedStep = (nudge, 0, std::sync::Arc::new((vec![], BTreeSet::new()))); + set_pstate::>(&ctx, DRAGGED_STEP, Some(dragged)); + crate::dialogs::action_batch::open(&mut app, 1, 1).unwrap(); + + let text = files::write_set(&app.ui.action_sets[1]); + let r = app.run(REPLACE_SET, json!({ "data": text })).unwrap(); + assert_eq!(r, json!({"changed": true, "set": 0, "name": "Mine", "actions": 2})); + assert_eq!(set_names(&app), ["Mine"]); + assert_eq!((app.ui.action_set, app.ui.action_sets_selected.clone()), (Some(0), vec![0])); + assert_eq!(pstate::>(&ctx, "actions-selected"), None); + assert_eq!(pstate::>(&ctx, SELECTED_STEP), None); + assert!(pstate::>(&ctx, "actions-expanded").is_empty()); + assert!(pstate::>(&ctx, DRAGGED_STEP).is_none()); + assert!(app.ui.dialog.is_none(), "the Batch dialog of a replaced set closes"); + assert_eq!(undo_steps(&app), undo, "no undo step"); + + let ids = (app.ui.action_sets[0].id, app.ui.action_sets[0].actions.iter().map(|a| a.id).collect::>()); + assert_eq!(app.run(REPLACE_SET, json!({ "data": text })).unwrap()["changed"], false, "the same set, shown that way"); + assert_eq!((app.ui.action_sets[0].id, app.ui.action_sets[0].actions.iter().map(|a| a.id).collect()), ids, "the ids stay"); + + let empty = json!({"format": "vcactions", "version": 1, "name": "Empty", "actions": []}).to_string(); + assert_eq!(app.run(REPLACE_SET, json!({ "data": empty })).unwrap(), json!({"changed": true, "set": 0, "name": "Empty", "actions": 0})); + assert_eq!(set_names(&app), ["Empty"]); + + let aia = aia_text("Tidy Up", &[("Group Them", &[("group", true), ("Move", true)])]); + let r = app.run(REPLACE_SET, json!({ "data": aia })).unwrap(); + let skipped = json!([{"action": "Group Them", "step": "Move"}]); + assert_eq!(r, json!({"changed": true, "set": 0, "name": "Tidy Up", "actions": 1, "skipped": skipped, "leftOut": 1})); + assert_eq!(set_names(&app), ["Tidy Up"]); + assert_eq!(app.ui.action_sets[0].actions[0].steps, [("object.group".to_string(), json!({}))]); + assert_eq!(app.ui.status, "Loaded “Tidy Up”: 1 step was left out"); + + let files = with_files(&mut app, "/sets/unused.vcactions"); + let odd = json!({"format": "vcactions", "version": 1, "name": "", "actions": [{"name": "A", "steps": [{"command": "example.unknown"}]}]}); + files.borrow_mut().insert("/sets/Print Jobs.vcactions".into(), odd.to_string().into_bytes()); + let r = app.run(REPLACE_SET, json!({"path": "/sets/Print Jobs.vcactions"})).unwrap(); + assert_eq!((r["name"].clone(), r["unknownCount"].clone(), r["changed"].clone()), (json!("Print Jobs"), json!(1), json!(true))); + assert_eq!(set_names(&app), ["Print Jobs"]); + } + + /// `ui.actionSet.replace` refuses params that are not an object, another key, a `path` or `data` + /// that is not text, a file that can't be read or that Load Actions… refuses (an empty one too), + /// a canceled pick, and a replace while an action records or plays, waiting at a stop included, + /// and then changes no set and keeps the current set. + #[test] + fn replace_actions_refuses_bad_params_bad_files_and_a_running_action() { + let mut app = app_with_sets(); + let files = with_files(&mut app, "/sets/missing.vcactions"); + files.borrow_mut().insert("/sets/empty.vcactions".into(), vec![]); + app.ui.action_set = Some(1); + let before = saved_sets(&app.ui.action_sets); + let many = json!({"format": "vcactions", "version": 1, "name": "Many", "actions": vec![json!({"name": "A", "steps": []}); 1001]}); + let eof = "not an action set file (EOF while parsing a value at line 1 column 0)"; + for (p, error) in [ + (json!(1), "the params must be an object, not 1"), + (json!([]), "the params must be an object, not []"), + (json!({"set": 0}), "unknown parameter `set`; the command takes: path, data"), + (json!({"path": 5}), "`path` must be a string"), + (json!({"path": null}), "`path` must be a string"), + (json!({"data": 42}), "`data` must be a string"), + (json!({"data": ""}), eof), + (json!({"data": "GIMP Palette"}), "not an action set file (expected value at line 1 column 1)"), + (json!({"data": many.to_string()}), "the action set file holds more than 1,000 actions"), + (json!({"data": " ".repeat(files::MAX_SET_FILE + 1)}), "the action set file is larger than 8 MiB"), + (json!({"data": "/version\n"}), "not an action set file"), + (json!({"path": "/sets/empty.vcactions"}), eof), + (json!({"path": "/sets/nowhere.vcactions"}), "no such file"), + (json!({}), "no such file"), + ] { + assert_eq!(app.run(REPLACE_SET, p.clone()).unwrap_err(), error, "{p}"); + assert_eq!(saved_sets(&app.ui.action_sets), before, "{p} changes nothing"); + assert_eq!(app.ui.action_set, Some(1)); + } + app.services.pick_open = Some(Box::new(|_: &crate::FilePick| None)); + assert_eq!(app.run(REPLACE_SET, Value::Null).unwrap_err(), "cancelled"); + assert_eq!(saved_sets(&app.ui.action_sets), before, "a canceled pick changes nothing"); + + let text = files::write_set(&app.ui.action_sets[1]); + app.run("file.new", json!({"width": 200, "height": 100})).unwrap(); + app.run(START_RECORDING, json!({})).unwrap(); + assert_eq!(app.run(REPLACE_SET, json!({ "data": text })).unwrap_err(), "an action is already recording"); + assert_eq!(saved_sets(&app.ui.action_sets), before, "a recording keeps its set"); + app.run(STOP_RECORDING, json!({})).unwrap(); + + let (mut app, _) = app_with_a_stop(true); + let before = saved_sets(&app.ui.action_sets); + play(&mut app, 0, 0).unwrap(); + assert!(waiting_at_stop(&app)); + assert_eq!(app.run(REPLACE_SET, json!({ "data": text })).unwrap_err(), "an action is already playing"); + assert_eq!(saved_sets(&app.ui.action_sets), before, "the playing set stays"); + } + /// A recording keeps its steps when a canceled undo group drops journal entries made before the /// recording began. #[test] diff --git a/crates/ui-egui/src/panels/actions/files.rs b/crates/ui-egui/src/panels/actions/files.rs index d6ca465275..c8f8520ebd 100644 --- a/crates/ui-egui/src/panels/actions/files.rs +++ b/crates/ui-egui/src/panels/actions/files.rs @@ -1,4 +1,4 @@ -//! Action set files: the Actions panel menu's Save Actions… and Load Actions…. +//! Action set files: the Actions panel menu's Save Actions…, Load Actions… and Replace Actions…. //! //! An action set file (`.vcactions`) is JSON: `{"format": "vcactions", "version": 1 to 6, "name", //! "actions": [{"name", "steps": [{"command", "params", "excluded"?}], "key"?, "color"?}]}`. Each step is a @@ -29,6 +29,9 @@ pub const SAVE_SET: &str = "ui.actionSet.save"; /// The command that loads an action set from a file ([`load_set`]). pub const LOAD_SET: &str = "ui.actionSet.load"; +/// The command that replaces every action set with the one from a file ([`replace_set`]). +pub const REPLACE_SET: &str = "ui.actionSet.replace"; + /// The extension of an action set file ([`write_set`]). pub const ACTIONS_EXT: &str = "vcactions"; @@ -496,33 +499,101 @@ fn aia_set(read: &Value, name: &str) -> AiaLoad { AiaLoad { set: ActionSet::new(if set.trim().is_empty() { name.to_string() } else { set }, actions), skipped, left_out } } -/// [`load_set`] of an action set another app saved as text, which `actionSet.read` reads with -/// `params`. -fn load_aia(app: &mut VectorcraftApp, params: Value) -> Result { +/// The steps left out of an action set another app saved as text: the first [`MAX_SKIPPED`] as +/// `[{action, step}]`, and how many there are. None for an action set file. +type LeftOut = Option<(Vec, usize)>; + +/// The set of an action set another app saved as text, which `actionSet.read` reads with `params`, +/// with its left-out steps. +fn read_aia(app: &mut VectorcraftApp, params: Value) -> Result<(ActionSet, LeftOut), String> { // Text that starts `/version` and no number is not an action set either. let read = app.run("actionSet.read", params).map_err(|_| "not an action set file")?; // A set read only in part would play actions that differ from the file's. if read.get("truncated").and_then(Value::as_bool).unwrap_or(false) { return Err("the action set file can't be read in full".into()); } - let AiaLoad { mut set, skipped, left_out } = aia_set(&read, "Actions"); - set.name = free_set_name(&app.ui.action_sets, &set.name); - // The set must save as a file that Load Actions… reads, which can be larger than the file read. - super::edit_keeps_set_loadable(app, None, &set)?; + let AiaLoad { set, skipped, left_out } = aia_set(&read, "Actions"); + Ok((set, Some((skipped, left_out)))) +} + +/// The set of the action set file at `p`'s `path` (else a picked one), or of the file's text +/// `data`, as [`load_set`] reads it. The second value is the left-out steps of an action set +/// another app saved as text (`.aia`), and None for an action set file. Nothing in `app` changes +/// but its status, and an error leaves the sets as they are. +fn read_file(app: &mut VectorcraftApp, p: &Value) -> Result<(ActionSet, LeftOut), String> { + let (text, stem) = match p.get("data") { + Some(Value::String(data)) => { + // Checked before the copy: `read_set` checks it again. + if data.len() > MAX_SET_FILE { + return Err("the action set file is larger than 8 MiB".into()); + } + if is_aia(data.as_bytes()) { + return read_aia(app, json!({ "data": data })); + } + (data.clone(), String::new()) + } + Some(_) => return Err("not an action set file".into()), + None => { + let path = match p.get("path").and_then(Value::as_str) { + Some(path) => path.to_string(), + None => { + let exts = [&[ACTIONS_EXT], vectorcraft_engine::cmd::actionset::EXTS].concat(); + let pick = crate::FilePick { filters: vec![crate::FilePick::filter("Action sets", &exts)], ..Default::default() }; + crate::picks::open(app, &pick).ok_or("cancelled")? + } + }; + // One byte past the limit tells a larger file apart without reading all of it. + let bytes = match (&app.services.read_head, &app.services.read) { + (Some(read_head), _) => read_head(&path, MAX_SET_FILE + 1)?, + (None, Some(read)) => read(&path)?, + (None, None) => return Err("no file reader".into()), + }; + if bytes.len() > MAX_SET_FILE { + return Err("the action set file is larger than 8 MiB".into()); + } + if is_aia(&bytes) { + return read_aia(app, json!({ "name": path, "dataBase64": vectorcraft_format::base64_encode(&bytes) })); + } + let stem = std::path::Path::new(&path).file_stem().map(|s| s.to_string_lossy().into_owned()).unwrap_or_default(); + (String::from_utf8(bytes).map_err(|_| "not an action set file")?, stem) + } + }; + Ok((read_set(&text, if stem.is_empty() { "Actions" } else { &stem })?, None)) +} + +/// The answer of [`load_set`] and [`replace_set`] for `set`, which goes at index `at`, with its +/// left-out steps `aia` ([`read_file`]); the status bar names what was left out or kept. +fn loaded(app: &mut VectorcraftApp, set: &ActionSet, at: usize, aia: LeftOut) -> Value { let (name, actions) = (set.name.clone(), set.actions.len()); - app.ui.action_sets.push(set); - if left_out > 0 { - app.status(crate::i18n::msg_n( - left_out as u64, - "Loaded “{name}”: {n} step was left out", - "Loaded “{name}”: {n} steps were left out", - &[("name", &name)], - )); + if let Some((skipped, left_out)) = aia { + if left_out > 0 { + app.status(crate::i18n::msg_n( + left_out as u64, + "Loaded “{name}”: {n} step was left out", + "Loaded “{name}”: {n} steps were left out", + &[("name", &name)], + )); + } + return json!({ "set": at, "name": name, "actions": actions, "skipped": skipped, "leftOut": left_out }); } - Ok(json!({ - "set": app.ui.action_sets.len() - 1, "name": name, "actions": actions, - "skipped": skipped, "leftOut": left_out, - })) + let (unknown, unknown_count, first) = unknown_commands(set); + let mut answer = json!({ "set": at, "name": name, "actions": actions }); + if let Some((action, step, command)) = first { + app.status(crate::i18n::msg_n( + unknown_count as u64, + "Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`", + "Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}`", + &[ + ("name", &super::shown_text(&name)), + ("action", &super::shown_text(&action)), + ("step", &step), + ("command", &super::shown_text(&command)), + ], + )); + answer["unknownCommands"] = json!(unknown); + answer["unknownCount"] = json!(unknown_count); + } + answer } /// `ui.actionSet.load {path? | data?}`: reads the action set file at `path` (else a picked one), or @@ -548,66 +619,50 @@ fn load_aia(app: &mut VectorcraftApp, params: Value) -> Result { /// Such a file that `actionSet.read` marks `truncated` is refused, and so is one whose set Save /// Actions… would write larger than 8 MiB; then no set is added. pub fn load_set(app: &mut VectorcraftApp, p: &Value) -> Result { - let (text, stem) = match p.get("data") { - Some(Value::String(data)) => { - // Checked before the copy: `read_set` checks it again. - if data.len() > MAX_SET_FILE { - return Err("the action set file is larger than 8 MiB".into()); - } - if is_aia(data.as_bytes()) { - return load_aia(app, json!({ "data": data })); - } - (data.clone(), String::new()) - } - Some(_) => return Err("not an action set file".into()), - None => { - let path = match p.get("path").and_then(Value::as_str) { - Some(path) => path.to_string(), - None => { - let exts = [&[ACTIONS_EXT], vectorcraft_engine::cmd::actionset::EXTS].concat(); - let pick = crate::FilePick { filters: vec![crate::FilePick::filter("Action sets", &exts)], ..Default::default() }; - crate::picks::open(app, &pick).ok_or("cancelled")? - } - }; - // One byte past the limit tells a larger file apart without reading all of it. - let bytes = match (&app.services.read_head, &app.services.read) { - (Some(read_head), _) => read_head(&path, MAX_SET_FILE + 1)?, - (None, Some(read)) => read(&path)?, - (None, None) => return Err("no file reader".into()), - }; - if bytes.len() > MAX_SET_FILE { - return Err("the action set file is larger than 8 MiB".into()); - } - if is_aia(&bytes) { - return load_aia(app, json!({ "name": path, "dataBase64": vectorcraft_format::base64_encode(&bytes) })); - } - let stem = std::path::Path::new(&path).file_stem().map(|s| s.to_string_lossy().into_owned()).unwrap_or_default(); - (String::from_utf8(bytes).map_err(|_| "not an action set file")?, stem) - } - }; - let mut set = read_set(&text, if stem.is_empty() { "Actions" } else { &stem })?; + let (mut set, aia) = read_file(app, p)?; set.name = free_set_name(&app.ui.action_sets, &set.name); - // A number added to the name can make a file at the limit larger than it. + // A number added to the name can make a file at the limit larger than it, and the set of an + // `.aia` file can save larger than the file read. super::edit_keeps_set_loadable(app, None, &set)?; - let (unknown, unknown_count, first) = unknown_commands(&set); - let (name, actions) = (set.name.clone(), set.actions.len()); + let answer = loaded(app, &set, app.ui.action_sets.len(), aia); app.ui.action_sets.push(set); - let mut answer = json!({ "set": app.ui.action_sets.len() - 1, "name": name, "actions": actions }); - if let Some((action, step, command)) = first { - app.status(crate::i18n::msg_n( - unknown_count as u64, - "Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`", - "Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}`", - &[ - ("name", &super::shown_text(&name)), - ("action", &super::shown_text(&action)), - ("step", &step), - ("command", &super::shown_text(&command)), - ], - )); - answer["unknownCommands"] = json!(unknown); - answer["unknownCount"] = json!(unknown_count); + Ok(answer) +} + +/// `ui.actionSet.replace {path? | data?}`: Replace Actions…. Reads an action set file as +/// [`load_set`] does, from `path`, a picked file or the file's text `data`, with the same formats, +/// limits and errors, and replaces every set in the panel with the file's set, which keeps its +/// name. The set becomes current and selected, and the panel clears what named the old sets as +/// [`super::reset`] does. When the panel already holds only a set that saves alike, shown that +/// way, nothing changes and the set keeps its ids. Omitted params (`null`) count as `{}`. Params +/// of another type, another key or a `path` or `data` that is not a string is an error, and so is a replace +/// while an action records or plays (also while it waits at a stop). On any error, a canceled +/// pick included, nothing changes. No undo step is recorded → `{changed, set: 0, name, actions}`, +/// with what [`load_set`] reports of left-out steps and unknown commands. +pub fn replace_set(app: &mut VectorcraftApp, p: &Value) -> Result { + match p { + Value::Null => {} + Value::Object(m) => { + if let Some(key) = m.keys().find(|k| !matches!(k.as_str(), "path" | "data")) { + let keys = "path, data"; + return Err(format!("unknown parameter `{key}`; the command takes: {keys}")); + } + if let Some(key) = ["path", "data"].into_iter().find(|k| m.get(*k).is_some_and(|v| !v.is_string())) { + return Err(format!("`{key}` must be a string")); + } + } + got => return Err(format!("the params must be an object, not {got}")), } + if app.ui.recording.is_some() { + return Err("an action is already recording".into()); + } + if app.ui.action_playing.is_some() { + return Err("an action is already playing".into()); + } + let (set, aia) = read_file(app, p)?; + super::edit_keeps_set_loadable(app, None, &set)?; + let mut answer = loaded(app, &set, 0, aia); + answer["changed"] = json!(super::replace_sets(app, vec![set])); Ok(answer) } diff --git a/crates/ui-egui/src/panels/appearance.rs b/crates/ui-egui/src/panels/appearance.rs index 308b8f3602..db11c16915 100644 --- a/crates/ui-egui/src/panels/appearance.rs +++ b/crates/ui-egui/src/panels/appearance.rs @@ -466,7 +466,7 @@ fn edit_tip(resp: egui::Response, name: &egui::Response) -> egui::Response { pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); let node = first_subject(app); - let sel = current_sel(app, ui.ctx(), node.as_ref()); + let sel = current_sel(app, ui.ctx(), node.as_deref()); let hide_thumb: bool = pstate(ui.ctx(), "ap-hide-thumb"); widgets::list_box(ui, |ui| { ui.spacing_mut().item_spacing.y = 0.0; @@ -519,10 +519,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { Some(n) => stack(app, ui, n, sel, r, None), None => default_stack(app, ui), } - // Spacer row like Illustrator's empty tail. + // An empty spacer row at the end of the list. ui.allocate_exact_size(vec2(ui.available_width(), 10.0), Sense::hover()); }); - bottom(app, ui, node.as_ref(), sel); + bottom(app, ui, node.as_deref(), sel); delete_key(app, ui); // A row's popup, beside the panel (in the same window when the panel floats). let panel = ui.max_rect(); @@ -543,13 +543,13 @@ fn delete_key(app: &mut VectorcraftApp, ui: &mut Ui) { let keys = super::has_row_keys(&ctx, ROW_KEYS) && !pressed_outside; super::set_row_keys(&ctx, ROW_KEYS, keys); let node = first_subject(app); - let sel = current_sel(app, &ctx, node.as_ref()); + let sel = current_sel(app, &ctx, node.as_deref()); if keys && sel.deletable() && ctx.memory(|m| m.focused().is_none()) && ui.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Delete) || i.consume_key(egui::Modifiers::NONE, egui::Key::Backspace)) { - delete_selected(app, ui, node.as_ref(), sel); + delete_selected(app, ui, node.as_deref(), sel); } } @@ -564,10 +564,10 @@ fn thumbnail_drag(ui: &mut Ui, th: Rect, id: NodeId) { } /// The object the panel lists: the targeted layer, group or object (`layer.target`), else the -/// first selected one. -fn first_subject(app: &VectorcraftApp) -> Option { +/// first selected one, as the `Arc` the document holds. +fn first_subject(app: &VectorcraftApp) -> Option> { let st = app.session.active()?; - st.selection.subjects().first().and_then(|id| st.doc.node(*id)).cloned() + st.selection.subjects().first().and_then(|id| super::layers::node_arc(&st.doc, *id)) } /// The selection as the Control bar and the object row name it: "No Selection", the kind ("Path", @@ -1680,7 +1680,7 @@ pub(crate) fn fx_menu(app: &mut VectorcraftApp, ui: &mut Ui) { pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { let node = first_subject(app); let has = node.is_some(); - let sel = current_sel(app, ui.ctx(), node.as_ref()); + let sel = current_sel(app, ui.ctx(), node.as_deref()); if menu_item(ui, tl!("Add New Fill"), has, false) { app.run("appearance.addFill", json!({})).ok(); } @@ -1689,10 +1689,10 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { } ui.separator(); if menu_item(ui, tl!("Duplicate Item"), has && sel.editable(), false) { - duplicate_selected(app, ui, node.as_ref(), sel); + duplicate_selected(app, ui, node.as_deref(), sel); } if menu_item(ui, tl!("Remove Item"), has && sel.deletable(), false) { - delete_selected(app, ui, node.as_ref(), sel); + delete_selected(app, ui, node.as_deref(), sel); } if menu_item(ui, tl!("Clear Appearance"), has, false) { app.run("appearance.clear", json!({})).ok(); diff --git a/crates/ui-egui/src/panels/appearance/tests.rs b/crates/ui-egui/src/panels/appearance/tests.rs index 1b26bd3436..2d3350443b 100644 --- a/crates/ui-egui/src/panels/appearance/tests.rs +++ b/crates/ui-egui/src/panels/appearance/tests.rs @@ -87,7 +87,7 @@ fn fx_button(window: &PopupWindow) -> egui::Pos2 { fn draw_bottom_bar(app: &mut VectorcraftApp, ui: &mut Ui) { let node = first_subject(app); - bottom(app, ui, node.as_ref(), Sel::None); + bottom(app, ui, node.as_deref(), Sel::None); } /// The Add New Effect popup has one row per effect group, plug-in groups included. @@ -144,8 +144,8 @@ fn a_duplicate_highlights_the_copies_above_the_originals() { let duplicate = |app: &mut VectorcraftApp| { let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { let node = first_subject(app); - let sel = current_sel(app, ui.ctx(), node.as_ref()); - duplicate_selected(app, ui, node.as_ref(), sel); + let sel = current_sel(app, ui.ctx(), node.as_deref()); + duplicate_selected(app, ui, node.as_deref(), sel); }); out.textures_delta.clear(); }; @@ -173,7 +173,7 @@ fn a_duplicate_highlights_the_copies_above_the_originals() { set_pstate(&ctx, "ap-multi", Highlight { owner, rows: Rows::Effects(None), order: vec![0], anchor: Some(0), active: Some(0) }); let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { let n = first_subject(&app).unwrap(); - let sel = current_sel(&app, ui.ctx(), Some(&n)); + let sel = current_sel(&app, ui.ctx(), Some(&*n)); app.run("effect.duplicate", json!({"item": null, "indices": [4]})).unwrap(); highlight_copies(&mut app, ui.ctx(), &n, sel, Rows::Effects(None), &[4]); }); @@ -197,7 +197,7 @@ fn removing_items_keeps_a_surviving_item_opacity_row_selected() { let remove = |app: &mut VectorcraftApp, k: usize| { let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { let n = first_subject(app).unwrap(); - let sel = current_sel(app, ui.ctx(), Some(&n)); + let sel = current_sel(app, ui.ctx(), Some(&*n)); app.run("appearance.removeItem", json!({ "indices": [k] })).unwrap(); highlight_after_removal(app, ui.ctx(), &n, sel, Rows::Items, &[k]); }); @@ -228,9 +228,9 @@ fn deleting_an_opacity_row_sets_it_back_to_default() { let delete = |app: &mut VectorcraftApp| { let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { let node = first_subject(app); - let sel = current_sel(app, ui.ctx(), node.as_ref()); + let sel = current_sel(app, ui.ctx(), node.as_deref()); assert!(sel.deletable() && !sel.editable(), "{sel:?}"); - delete_selected(app, ui, node.as_ref(), sel); + delete_selected(app, ui, node.as_deref(), sel); }); out.textures_delta.clear(); }; @@ -1016,3 +1016,27 @@ fn a_mixed_selection_lists_what_its_objects_share() { run(&mut app, "select.set", json!({"ids": [ids[0].clone(), t]})); assert_eq!(frame(&mut app).iter().find(|t| *t != "?").map(String::as_str), Some("Mixed Objects")); } + +/// The panel's subject is the `Arc` the document holds for the selected object, a targeted group +/// or a targeted layer, not a copy of it; nothing with nothing selected. +#[test] +fn first_subject_is_the_node_the_document_holds() { + let mut app = app_with_a_selected_rectangle(); + let held = |app: &VectorcraftApp| { + let st = app.session.active().unwrap(); + super::super::layers::node_arc(&st.doc, st.selection.subjects()[0]).unwrap() + }; + assert!(std::sync::Arc::ptr_eq(&first_subject(&app).expect("the rectangle"), &held(&app)), "the selected object"); + let group = app.run("object.group", json!({})).unwrap()["id"].clone(); + app.run("layer.target", json!({ "id": group })).unwrap(); + let n = first_subject(&app).expect("the group"); + assert_eq!(n.id.0, group.as_u64().unwrap()); + assert!(std::sync::Arc::ptr_eq(&n, &held(&app)), "the targeted group"); + let layer = app.session.active().unwrap().doc.layers[0].id; + app.run("layer.target", json!({ "id": layer.0 })).unwrap(); + let n = first_subject(&app).expect("the layer"); + assert_eq!(n.id, layer); + assert!(std::sync::Arc::ptr_eq(&n, &held(&app)), "the targeted layer"); + app.run("select.none", json!({})).unwrap(); + assert!(first_subject(&app).is_none(), "nothing selected"); +} diff --git a/crates/ui-egui/src/panels/brushes.rs b/crates/ui-egui/src/panels/brushes.rs index 0b540a4ba5..48f063e4d6 100644 --- a/crates/ui-egui/src/panels/brushes.rs +++ b/crates/ui-egui/src/panels/brushes.rs @@ -23,7 +23,7 @@ use vectorcraft_engine::cmd::swatchlib::LibraryInfo; use super::library_panel::{self, LibraryKind, LibraryRef, Row}; use super::memo::Memo; -use super::{first_selected, pstate, set_pstate}; +use super::{first_node, pstate, set_pstate}; use crate::VectorcraftApp; use crate::dialogs::brush_options; use crate::menus::Item; @@ -168,7 +168,7 @@ pub(crate) fn definition_chip(ui: &Ui, r: egui::Rect, st: Option<&DocState>, def } fn selected_brush(app: &VectorcraftApp) -> Option { - first_selected(app).and_then(|n| n.appearance.stroke().and_then(|s| s.brush.clone())) + first_node(app).and_then(|n| n.appearance.stroke().and_then(|s| s.brush.clone())) } /// What the panel's last click was made with: the document, its selected objects and the current diff --git a/crates/ui-egui/src/panels/character.rs b/crates/ui-egui/src/panels/character.rs index e9c497a4ad..f329273e7e 100644 --- a/crates/ui-egui/src/panels/character.rs +++ b/crates/ui-egui/src/panels/character.rs @@ -282,14 +282,13 @@ pub(crate) fn format(app: &mut VectorcraftApp, p: Value) { /// has selected (the whole text when nothing is selected) while it edits text, else /// `text.setFormat` on the selected stories ([`selected_stories`]). pub(crate) fn run_format(app: &mut VectorcraftApp, mut p: Value) -> Result { - let Some((id, a, b)) = text_editing(app) else { + let Some((id, a, b)) = text_editing_kept(app)? else { target_selected_stories(app, &mut p); return app.run("text.setFormat", p); }; if let Some(first) = text_story(app).and_then(|story| story.first().copied()) { return story_style(app, first, p); } - end_typing(app); p["id"] = json!(id.0); if b > a { p["start"] = json!(a); @@ -340,7 +339,8 @@ fn char_cmd(app: &mut VectorcraftApp, cmd: &str, mut p: Value) { /// and Optical set no space (#5111); nowhere to set at an empty line's start. Else it is a /// character attribute like the others: the selected range, or all the text. fn set_kerning(app: &mut VectorcraftApp, value: Value) { - let Some((id, a, b)) = text_editing(app) else { + let Ok(editing) = text_editing_kept(app) else { return }; + let Some((id, a, b)) = editing else { format(app, json!({"kerning": value})); return; }; @@ -350,7 +350,6 @@ fn set_kerning(app: &mut VectorcraftApp, value: Value) { } let Some(NodeKind::Text(t)) = app.session.active().and_then(|st| st.doc.node(id)).map(|n| &n.kind) else { return }; let Some((target, before)) = vectorcraft_text::edit::caret_kerning_target(&t.plain_text(), a) else { return }; - end_typing(app); let params = if before { json!({"id": id.0, "start": target.start, "end": target.end, "kerningBefore": value.as_f64().unwrap_or(0.0)}) } else { @@ -484,12 +483,14 @@ pub(crate) fn toggle_face(app: &mut VectorcraftApp, face: Face) -> Result &'static str { match self { Field::FontName => "ch-font", + Field::FontSize => "ch-size", Field::Kerning => "ch-kern", Field::Tracking => "ch-track", } @@ -507,17 +509,19 @@ impl Field { fn name(self) -> &'static str { match self { Field::FontName => "fontName", + Field::FontSize => "fontSize", Field::Kerning => "kerning", Field::Tracking => "tracking", } } } -/// `type.highlightFontName`, `type.highlightKerning` and `type.highlightTracking`: show the -/// Character panel if it is hidden (a shown one is activated, so its floating window comes -/// forward), and give `field` the keyboard focus when the panel next draws it, a number field with -/// its value selected (typing replaces it, Enter applies it). Without selected type or text the -/// Type tool edits, the panel shows, nothing takes the focus and the command fails. → `{field}`. +/// `type.highlightFontName`, `type.highlightFontSize`, `type.highlightKerning` and +/// `type.highlightTracking`: show the Character panel if it is hidden (a shown one is activated, +/// so its floating window comes forward), and give `field` the keyboard focus when the panel next +/// draws it, a number field with its value selected (typing replaces it, Enter applies it). +/// Without selected type or text the Type tool edits, the panel shows, nothing takes the focus and +/// the command fails. → `{field}`. pub(crate) fn highlight(app: &mut VectorcraftApp, field: Field) -> Result { // `window.panel` would hide a floating panel in front of its window, or an open flyout. if crate::panel_docking::visible(&app.ui, "character") { @@ -538,19 +542,18 @@ pub(crate) fn highlight(app: &mut VectorcraftApp, field: Field) -> Result Result { text_style(app).ok_or("select some type first")?; let on = shared(app, |s| s.underline) != Some(true); - format(app, json!({"underline": on})); + run_format(app, json!({"underline": on}))?; Ok(json!(on)) } /// `text.setRangeStyle` with `p` on the range the Type tool has selected (the whole text when /// nothing is selected). Does nothing unless the Type tool edits text. pub(crate) fn range_style(app: &mut VectorcraftApp, p: Value) { - let Some((id, a, b)) = text_editing(app) else { return }; + let Ok(Some((id, a, b))) = text_editing_kept(app) else { return }; if let Some(first) = text_story(app).and_then(|story| story.first().copied()) { story_style(app, first, p).ok(); return; } - end_typing(app); let mut q = p; q["id"] = json!(id.0); if b > a { @@ -574,6 +577,15 @@ pub(crate) fn text_editing(app: &VectorcraftApp) -> Option<(NodeId, usize, usize Some((id, g("start"), g("end"))) } +/// [`text_editing`] after [`end_typing`], for an edit of the text: the selection is read in the +/// text with the typing applied, which Real-time Drawing off leaves unapplied until then. When the +/// typing can't be kept, the error (also shown in the status bar), so the edit stops instead of +/// acting on a selection in the text without the typing. +pub(crate) fn text_editing_kept(app: &mut VectorcraftApp) -> Result, String> { + try_end_typing(app)?; + Ok(text_editing(app)) +} + /// The frames of the threaded story whose whole text the Type tool has selected after Select All, /// in the order of the edited frame's thread as the document holds it now; `None` when its /// selection is in one type object. @@ -701,13 +713,25 @@ fn story_style(app: &mut VectorcraftApp, first: NodeId, mut p: Value) -> Result< app.run("text.setRangeStyle", p) } -/// Close the Type tool's typing session (one undo step) before another command edits the text. +/// Close the Type tool's typing session (one undo step) before another command edits the text. The +/// typing Real-time Drawing off left unapplied is applied first; when it can't be kept, the error +/// shows and the session goes on. pub(crate) fn end_typing(app: &mut VectorcraftApp) { + try_end_typing(app).ok(); +} + +/// [`end_typing`] that also returns the error when the typing can't be kept. +fn try_end_typing(app: &mut VectorcraftApp) -> Result<(), String> { if app.session.tool_options().get("typing").and_then(Value::as_bool) == Some(true) { + if let Err(e) = app.keep_typing() { + app.status(e.clone()); + return Err(e); + } app.session.set_tool_option("commitTyping", &json!(true)); app.session.commit_interaction().ok(); app.sync_views(); } + Ok(()) } static CTX: OnceLock = OnceLock::new(); @@ -1318,9 +1342,10 @@ pub(crate) fn axis_sliders(app: &mut VectorcraftApp, ui: &mut Ui, face: &vectorc /// Set Variable Font settings `axes` on the text the panel acts on, live while a slider drags. fn axes_cmd(app: &mut VectorcraftApp, axes: Value, phase: widgets::Live) { - match text_editing(app) { - Some((id, a, b)) => { - end_typing(app); + match text_editing_kept(app) { + // The typing can't be kept (the error shows): nothing is set. + Err(_) => {} + Ok(Some((id, a, b))) => { let mut q = json!({"id": id.0, "fontAxes": axes}); // After Select All in threaded text: every frame of the story. if let Some(first) = text_story(app).and_then(|story| story.first().copied()) { @@ -1332,7 +1357,7 @@ fn axes_cmd(app: &mut VectorcraftApp, axes: Value, phase: widgets::Live) { } super::live_run(app, "Character", "text.setRangeStyle", q, phase); } - None => { + Ok(None) => { let mut p = json!({ "fontAxes": axes }); target_selected_stories(app, &mut p); super::live_run(app, "Character", "text.setFormat", p, phase); diff --git a/crates/ui-egui/src/panels/character/tests.rs b/crates/ui-egui/src/panels/character/tests.rs index 4b0e96679f..5280db5e8a 100644 --- a/crates/ui-egui/src/panels/character/tests.rs +++ b/crates/ui-egui/src/panels/character/tests.rs @@ -343,6 +343,57 @@ fn highlight_commands_focus_the_font_kerning_and_tracking_fields() { assert_eq!(app.character_focus, None); } +/// Type › Size › Other… (Highlight Font Size) shows the Character panel and gives its Font Size +/// field the keyboard focus with the value selected: what is typed replaces it, Enter applies it +/// as one undo step, and a selection of different sizes takes the one size typed into the blank +/// field. Without selected type the panel shows, the command fails and nothing takes the focus. +#[test] +fn highlight_font_size_focuses_the_font_size_field() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + let a = app.run("text.create", json!({"x": 20, "y": 50, "text": "AVAX", "size": 12})).unwrap()["id"].clone(); + let b = app.run("text.create", json!({"x": 20, "y": 120, "text": "Wave", "size": 20})).unwrap()["id"].clone(); + let ctx = egui::Context::default(); + let frame = |app: &mut VectorcraftApp, events: Vec| { + let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui)); + out.textures_delta.clear(); + }; + let typed = |text: &str| { + let enter = egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }; + vec![egui::Event::Text(text.into()), enter] + }; + let size = |app: &VectorcraftApp| shared(app, |s| s.size); + app.run("select.set", json!({"ids": [a.clone()]})).unwrap(); + assert_eq!(app.run("type.highlightFontSize", json!({})).unwrap(), json!({"field": "fontSize"})); + assert!(crate::panel_docking::showing(&app.ui, "character"), "the panel shows"); + frame(&mut app, vec![]); + assert_eq!(app.character_focus, None, "the Font Size field took the focus"); + frame(&mut app, typed("33")); + assert_eq!(size(&app), Some(33.0), "typing replaced the size"); + app.run("edit.undo", json!({})).unwrap(); + assert_eq!(size(&app), Some(12.0), "one undo step restores the size"); + // Choosing Other again while the field holds typed text that is not applied selects all of it. + app.run("type.highlightFontSize", json!({})).unwrap(); + frame(&mut app, vec![]); + frame(&mut app, vec![egui::Event::Text("999".into())]); + app.run("type.highlightFontSize", json!({})).unwrap(); + frame(&mut app, vec![]); + frame(&mut app, typed("18")); + assert_eq!(size(&app), Some(18.0), "typing replaced the text typed before"); + ctx.memory_mut(|m| m.stop_text_input()); + // Different sizes: the field is blank, and the size typed applies to every selected object. + app.run("select.set", json!({"ids": [a, b]})).unwrap(); + assert_eq!(size(&app), None); + app.run("type.highlightFontSize", json!({})).unwrap(); + frame(&mut app, vec![]); + frame(&mut app, typed("16")); + assert_eq!(size(&app), Some(16.0), "both objects take the size typed"); + // No type selected: the panel shows, the command fails and nothing is armed. + app.run("select.none", json!({})).unwrap(); + assert!(app.run("type.highlightFontSize", json!({})).is_err()); + assert_eq!(app.character_focus, None); +} + /// A variable font gets the Variable Font button, which opens one slider per axis named as the /// font names it; a drag along one sets that axis of the selected type in one undo step. #[test] diff --git a/crates/ui-egui/src/panels/image_trace.rs b/crates/ui-egui/src/panels/image_trace.rs index bca4192b61..bae86b0c83 100644 --- a/crates/ui-egui/src/panels/image_trace.rs +++ b/crates/ui-egui/src/panels/image_trace.rs @@ -17,7 +17,7 @@ use vectorcraft_doc::{Node, NodeId, NodeKind, TraceView}; use vectorcraft_engine::cmd::TracePresetChange; use vectorcraft_engine::cmd::swatchlib::DOCUMENT_SWATCHES; -use super::{first_selected, pstate, set_pstate, swatches}; +use super::{first_node, pstate, set_pstate, swatches}; use crate::VectorcraftApp; use crate::widgets::{self, menu_item}; @@ -152,10 +152,10 @@ pub(crate) fn is_trace(n: &Node) -> bool { /// The object Trace acts on: the first selected image or Image Trace object in paint order, as /// `imageTrace.make` takes it, else the first selected object. -fn target_node(app: &VectorcraftApp) -> Option { +fn target_node(app: &VectorcraftApp) -> Option<&Node> { let st = app.session.active()?; let traceable = |n: &&Node| is_trace(n) || matches!(n.kind, NodeKind::Image(_)); - st.selection.in_paint_order(&st.doc).into_iter().find_map(|id| st.doc.node(id).filter(traceable).cloned()).or_else(|| first_selected(app)) + st.selection.in_paint_order(&st.doc).into_iter().find_map(|id| st.doc.node(id).filter(traceable)).or_else(|| first_node(app)) } /// The active document and the object Trace acts on. @@ -166,7 +166,7 @@ fn target_key(app: &VectorcraftApp) -> Option<(u64, NodeId)> { /// What Trace acts on: an Image Trace object (with its stored settings), a plain image, or neither. fn target(app: &VectorcraftApp) -> (bool, bool, Option) { let Some(n) = target_node(app) else { return (false, false, None) }; - (is_trace(&n), matches!(n.kind, NodeKind::Image(_)), n.extras().trace.as_deref().cloned()) + (is_trace(n), matches!(n.kind, NodeKind::Image(_)), n.extras().trace.as_deref().cloned()) } /// Whether any selected object is an Image Trace object, wherever it is in the selection. diff --git a/crates/ui-egui/src/panels/image_trace/tests.rs b/crates/ui-egui/src/panels/image_trace/tests.rs index 7f686db45a..db1a66242b 100644 --- a/crates/ui-egui/src/panels/image_trace/tests.rs +++ b/crates/ui-egui/src/panels/image_trace/tests.rs @@ -2,7 +2,7 @@ use super::super::tests_long_popups::{ PopupWindow, assert_last_row_scrolls_into_view, assert_rows_stay_on_one_line, assert_short_list_does_not_scroll, }; use super::*; -use crate::panels::library_panel; +use crate::panels::{first_selected, library_panel}; use egui::{Event, PointerButton, Pos2, Rect, vec2}; /// One headless frame of the panel (and its menu) with `events`: the texts drawn, with where. diff --git a/crates/ui-egui/src/panels/info.rs b/crates/ui-egui/src/panels/info.rs index 2e81441654..19fe505c0c 100644 --- a/crates/ui-egui/src/panels/info.rs +++ b/crates/ui-egui/src/panels/info.rs @@ -14,7 +14,7 @@ use crate::VectorcraftApp; use crate::theme::Tokens; use crate::widgets::{self, menu_item}; -/// Colour values in the colour's own model, like Illustrator's Info panel. +/// Color values in the color's own model, for the Info panel. pub fn color_values(c: &Color) -> Vec<(&'static str, String)> { match *c { Color::Rgb { r, g, b } => vec![("R", format!("{:.0}", r * 255.0)), ("G", format!("{:.0}", g * 255.0)), ("B", format!("{:.0}", b * 255.0))], diff --git a/crates/ui-egui/src/panels/layers/controls.rs b/crates/ui-egui/src/panels/layers/controls.rs index 4cea41db75..c030cd85c8 100644 --- a/crates/ui-egui/src/panels/layers/controls.rs +++ b/crates/ui-egui/src/panels/layers/controls.rs @@ -83,7 +83,7 @@ pub(super) fn bottom_bar(app: &mut VectorcraftApp, ui: &mut Ui, view: &View, doc actions.push(("layer.new".into(), json!({"top": m.command}))); } } - // Rows dropped on the trash are deleted, on New Layer duplicated, as in Illustrator. Both are + // Rows dropped on the trash are deleted, on New Layer duplicated. Both are // outlined while rows (or, on the trash, a target circle) hang over them. Guide rows dropped on // the trash delete their guides (`guide.remove`); New Layer does not take them. for (button, cmd) in [(&trash, "ui.layerDelete"), (&new_layer, "layer.duplicate")] { diff --git a/crates/ui-egui/src/panels/library_panel.rs b/crates/ui-egui/src/panels/library_panel.rs index fdfb2f7c3b..01c3af49a2 100644 --- a/crates/ui-egui/src/panels/library_panel.rs +++ b/crates/ui-egui/src/panels/library_panel.rs @@ -576,7 +576,7 @@ fn set(app: &mut VectorcraftApp, panel: &str, mut params: Value) { /// (symbol and brush libraries: any document). pub(crate) fn library_pick_filters(kind: &str) -> Vec<(&'static str, &'static [&'static str])> { match kind { - super::swatches::SwatchLibraries::KIND => fileio::library_open_filters("Swatch libraries", swatchlib::LIBRARY_EXTS).collect(), + super::swatches::SwatchLibraries::KIND => fileio::library_open_filters("Swatch libraries", swatchlib::LIBRARY_PICK_EXTS).collect(), super::graphic_styles::GraphicStyleLibraries::KIND => fileio::library_open_filters("Graphic Style Libraries", &[STYLES_EXT]).collect(), _ => fileio::builtin_open_filters().collect(), } diff --git a/crates/ui-egui/src/panels/links.rs b/crates/ui-egui/src/panels/links.rs index 611c9e472a..3b45e450d4 100644 --- a/crates/ui-egui/src/panels/links.rs +++ b/crates/ui-egui/src/panels/links.rs @@ -335,6 +335,37 @@ pub(crate) fn unembed(app: &mut VectorcraftApp, id: u64, name: &str) { }); } +/// Whether Unembed… can act on `embedded` selected embedded images: one goes to a picked file, +/// several to a picked folder (the web downloads each one). +pub(crate) fn can_unembed(app: &VectorcraftApp, embedded: usize) -> bool { + match embedded { + 0 => false, + 1 => true, + _ => app.services.download.is_some() || app.services.pick_folder.is_some(), + } +} + +/// Write embedded images `ids` to new files in a picked folder and link each one to its file, in +/// one undo step (the web downloads each one and links none). +pub(crate) fn unembed_several(app: &mut VectorcraftApp, ids: Vec) { + if app.services.download.is_some() { + for id in ids { + unembed(app, id, ""); + } + return; + } + crate::picks::button(app, move |app| unembed_to_picked_folder(app, ids.clone())); +} + +fn unembed_to_picked_folder(app: &mut VectorcraftApp, ids: Vec) { + let Some(folder) = crate::picks::folder(app) else { return }; + let r = app.run("links.unembed", json!({ "ids": ids, "folder": folder })); + report(app, r, |v| { + let n = v["unembedded"].as_array().map_or(0, Vec::len); + crate::i18n::msg_n(n as u64, "Unembedded {n} image to {folder}", "Unembedded {n} images to {folder}", &[("folder", &folder)]) + }); +} + /// The UI commands `links.editOriginal` (open the linked file in its app) and `links.reveal` /// (show it in its folder) for image `id` (default: the selected linked image) → `{path}`. pub(crate) fn open_file(app: &mut VectorcraftApp, p: &Value, reveal: bool) -> Result { @@ -834,12 +865,16 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { } }); } - if menu_item(ui, tl!("Unembed…"), embedded.len() == 1, false) - && let Some(r) = embedded.first() - && let Some(id) = r["id"].as_u64() - { - let name = r["name"].as_str().unwrap_or("Image").to_string(); - unembed(app, id, &name); + if menu_item(ui, tl!("Unembed…"), can_unembed(app, embedded.len()), false) { + match &embedded[..] { + [r] => { + if let Some(id) = r["id"].as_u64() { + let name = r["name"].as_str().unwrap_or("Image").to_string(); + unembed(app, id, &name); + } + } + rows => unembed_several(app, rows.iter().filter_map(|r| r["id"].as_u64()).collect()), + } } if menu_item(ui, tl!("Placement Options…"), any, false) { crate::menus::invoke(app, "ui.placementOptionsDialog", json!({ "ids": ids(&sel, |_| true) })); diff --git a/crates/ui-egui/src/panels/navigator.rs b/crates/ui-egui/src/panels/navigator.rs index 60eb4c18d0..d6a9763b20 100644 --- a/crates/ui-egui/src/panels/navigator.rs +++ b/crates/ui-egui/src/panels/navigator.rs @@ -282,7 +282,7 @@ fn view_box(region: DRect, thumb: Rect, canvas: Rect, v: &crate::state::View, ui pts } -/// Slider position (0..1) ↔ zoom percent on Illustrator's log range 3.13 %–64 000 %. +/// Slider position (0..1) ↔ zoom percent on a log range, 3.13 %–64 000 %. pub fn zoom_to_slider(z: f64) -> f64 { ((z.clamp(3.13, 64000.0)).ln() - 3.13f64.ln()) / (64000f64.ln() - 3.13f64.ln()) } diff --git a/crates/ui-egui/src/panels/paragraph.rs b/crates/ui-egui/src/panels/paragraph.rs index 52b3135cc2..de5864565a 100644 --- a/crates/ui-egui/src/panels/paragraph.rs +++ b/crates/ui-egui/src/panels/paragraph.rs @@ -94,8 +94,7 @@ fn para_cmd(app: &mut VectorcraftApp, cmd: &str, p: Value) { /// the Selection tool these are the paragraphs of every frame of the selected stories /// ([`super::character::selected_stories`]). pub(crate) fn run_on_paragraphs(app: &mut VectorcraftApp, cmd: &str, mut p: Value) -> Result { - if let Some((id, a, b)) = super::character::text_editing(app) { - super::character::end_typing(app); + if let Some((id, a, b)) = super::character::text_editing_kept(app)? { match super::character::text_story(app) { // After Select All in threaded text: every paragraph of every frame. Some(story) => p["ids"] = json!(story.iter().map(|f| f.0).collect::>()), diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 5dede1697b..a98ad34aa7 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -1,4 +1,4 @@ -//! The Properties panel: context-sensitive sections like Illustrator's. +//! The Properties panel: sections that change with the selection. use egui::Ui; use serde_json::json; @@ -26,7 +26,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let editing_artboards = app.session.tool_id() == "artboard"; // Ruler guides selected on their own (a click on one): their position. let guides = super::transform::selected_guides(app); - let label = heading(first.as_ref(), n_sel, editing_artboards, guides.is_some()); + let label = heading(first.as_deref(), n_sel, editing_artboards, guides.is_some()); ui.label(egui::RichText::new(label).size(11.5).color(t.text_dim)); ui.add_space(4.0); if editing_artboards { diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rs index c667f01200..3b48f45e91 100644 --- a/crates/ui-egui/src/panels/stroke.rs +++ b/crates/ui-egui/src/panels/stroke.rs @@ -76,7 +76,7 @@ fn dash_state(dash: Option<&Dash>, last: Option<(Vec, bool)>) -> (Vec, } /// Six dash/gap fields → a dash pattern: stops at the first empty dash; a dash without a gap -/// repeats its length as the gap (Illustrator's behaviour). +/// repeats its length as the gap. pub fn dash_pattern(fields: &[Option; 6]) -> Vec { edited_dash_pattern(fields, &[]) } diff --git a/crates/ui-egui/src/panels/swatches.rs b/crates/ui-egui/src/panels/swatches.rs index 7b70844dcc..da789a9944 100644 --- a/crates/ui-egui/src/panels/swatches.rs +++ b/crates/ui-egui/src/panels/swatches.rs @@ -14,7 +14,7 @@ use vectorcraft_color::libraries::{BuiltinLibrary, GRADIENT_LIBRARIES, SWATCH_LI use vectorcraft_color::swatch::REGISTRATION; use vectorcraft_color::{Color, GradientKind, Paint, Swatch, SwatchLibrary}; use vectorcraft_doc::Document; -use vectorcraft_engine::cmd::patternlib::{self, PATTERN_LIBRARIES}; +use vectorcraft_engine::cmd::patternlib::PATTERN_LIBRARIES; use vectorcraft_engine::cmd::swatchlib; use super::library_panel::{self, LibraryKind, LibraryRef, Row}; diff --git a/crates/ui-egui/src/panels/swatches/libraries.rs b/crates/ui-egui/src/panels/swatches/libraries.rs index 864f6ae7e0..d5722e6354 100644 --- a/crates/ui-egui/src/panels/swatches/libraries.rs +++ b/crates/ui-egui/src/panels/swatches/libraries.rs @@ -3,7 +3,7 @@ use super::dnd::selection; use super::tiles::{describe, global_mark, list_icons, pattern_thumb_in}; use super::{ Arc, BuiltinLibrary, GRADIENT_LIBRARIES, Item, LibraryKind, LibraryRef, PATTERN_LIBRARIES, Rect, Row, SWATCH_LIBRARIES, Swatch, SwatchLibrary, - Ui, Value, VectorcraftApp, json, library_panel, menu_item, patternlib, swatch_tile, swatchlib, + Ui, Value, VectorcraftApp, json, library_panel, menu_item, swatch_tile, swatchlib, }; fn library_refs(libs: Vec) -> Vec { @@ -97,10 +97,10 @@ impl LibraryKind for SwatchLibraries { } out } - fn draw(_: &VectorcraftApp, ui: &Ui, r: Rect, w: &Swatch, selected: bool, hovered: bool) { + fn draw(app: &VectorcraftApp, ui: &Ui, r: Rect, w: &Swatch, selected: bool, hovered: bool) { swatch_tile(ui, r, &w.paint, selected, hovered); - // A built-in pattern library's pattern, drawn from the library. - if let Some(src) = patternlib::swatch_source(w) { + // A pattern library's pattern, or a loaded library's, drawn from the library. + if let Some(src) = swatchlib::pattern_source(&app.session, w) { pattern_thumb_in(&src, ui, r.shrink(1.0), &w.paint); } if w.global { diff --git a/crates/ui-egui/src/panels/tabs.rs b/crates/ui-egui/src/panels/tabs.rs index 2f45f62f75..a09c634967 100644 --- a/crates/ui-egui/src/panels/tabs.rs +++ b/crates/ui-egui/src/panels/tabs.rs @@ -431,8 +431,8 @@ fn stops_json(stops: &[TabStop]) -> Value { /// frame of the selected stories ([`super::character::selected_stories`]). Returns false when it /// fails. fn apply(app: &mut VectorcraftApp, stops: &[TabStop]) -> bool { - if let Some((id, a, b)) = super::character::text_editing(app) { - super::character::end_typing(app); + let Ok(editing) = super::character::text_editing_kept(app) else { return false }; + if let Some((id, a, b)) = editing { let p = match super::character::text_story(app) { // After Select All in threaded text: every paragraph of every frame. Some(story) => json!({"stops": stops_json(stops), "ids": story.iter().map(|f| f.0).collect::>()}), diff --git a/crates/ui-egui/src/panels/tests_appearance.rs b/crates/ui-egui/src/panels/tests_appearance.rs index 1db803b636..5ef1d8ce4a 100644 --- a/crates/ui-egui/src/panels/tests_appearance.rs +++ b/crates/ui-egui/src/panels/tests_appearance.rs @@ -2064,3 +2064,49 @@ fn a_dash_typed_in_a_stroke_popup_sticks_when_a_click_outside_closes_it() { assert!(!texts.iter().any(|(t, _)| t == "Dashed Line"), "{link}: the popup closed"); } } + +/// `first_selected` gives the `Arc` the document holds for the first selected object, nested in a +/// group too, not a copy of it; nothing with nothing selected or no document open. +#[test] +fn first_selected_is_the_node_the_document_holds() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + assert!(first_selected(&app).is_none(), "no document"); + run(&mut app, "file.new", json!({"width": 200, "height": 200})); + let a = run(&mut app, "shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50}))["id"].clone(); + let b = run(&mut app, "shape.ellipse", json!({"x": 70, "y": 10, "width": 50, "height": 50}))["id"].clone(); + let held = |app: &VectorcraftApp, id: &Value| layers::node_arc(&app.session.active().unwrap().doc, NodeId(id.as_u64().unwrap())).unwrap(); + run(&mut app, "select.set", json!({ "ids": [a, b] })); + let id = app.session.active().unwrap().selection.objects[0]; + let first = first_selected(&app).expect("a selected object"); + assert_eq!(first.id, id, "the first of the selection"); + assert!(Arc::ptr_eq(&first, &held(&app, &json!(id.0))), "the first selected object, as the document holds it"); + run(&mut app, "object.group", json!({})); + run(&mut app, "select.set", json!({ "ids": [a] })); + assert!(Arc::ptr_eq(&first_selected(&app).expect("the rectangle"), &held(&app, &a)), "a node inside a group"); + run(&mut app, "select.none", json!({})); + assert!(first_selected(&app).is_none(), "nothing selected"); +} + +/// Properties, Appearance and Transparency show the selected object's current opacity after an +/// edit and after Undo, never an earlier one. +#[test] +fn panels_show_the_selected_object_after_an_edit_and_after_undo() { + type Panel = fn(&mut VectorcraftApp, &mut egui::Ui); + let panels: [(&str, Panel); 3] = [("Properties", properties::show), ("Appearance", appearance::show), ("Transparency", transparency::show)]; + let mut app = app_with_rect(); + // One context per panel, kept across the edits, as the app keeps its own. + let ctxs: Vec = panels.iter().map(|_| egui::Context::default()).collect(); + let shows = |app: &mut VectorcraftApp, want: &str, not: &str| { + for ((name, panel), ctx) in panels.iter().zip(&ctxs) { + let texts = frame_in(ctx, app, *panel); + assert!(texts.iter().any(|t| t.contains(want)), "{name} shows {want}: {texts:?}"); + assert!(!texts.iter().any(|t| t.contains(not)), "{name} no longer shows {not}: {texts:?}"); + } + }; + run(&mut app, "transparency.set", json!({"opacity": 60})); + shows(&mut app, "60%", "35%"); + run(&mut app, "transparency.set", json!({"opacity": 35})); + shows(&mut app, "35%", "60%"); + run(&mut app, "edit.undo", json!({})); + shows(&mut app, "60%", "35%"); +} diff --git a/crates/ui-egui/src/panels/tests_links.rs b/crates/ui-egui/src/panels/tests_links.rs index 781c4f5840..aaf0ed0be7 100644 --- a/crates/ui-egui/src/panels/tests_links.rs +++ b/crates/ui-egui/src/panels/tests_links.rs @@ -500,6 +500,36 @@ fn properties_shows_the_selected_image_and_its_link_actions() { assert!(text.contains("Linked File") && text.contains("Edit Original") && text.contains("Embed"), "{text}"); } +/// Unembed… acts on several selected embedded images: it asks for one folder, writes a file for +/// each image there and links each one to its file; with no folder picked, nothing changes. +#[test] +fn unembed_writes_several_images_to_one_picked_folder() { + let dir = Folder::new("unembed-several"); + let (mut app, _, embedded) = app(&dir); + let c = dir.file("other.png", &png(30, 10)); + let other = app.run("file.place", json!({"path": c, "at": [50, 50], "link": false})).unwrap()["ids"][0].as_u64().unwrap(); + assert!(super::links::can_unembed(&app, 1)); + assert!(!super::links::can_unembed(&app, 0)); + assert!(!super::links::can_unembed(&app, 2), "no folder to pick"); + let out = dir.0.join("out"); + std::fs::create_dir_all(&out).unwrap(); + // No folder picked: nothing written or linked. + app.services.pick_folder = Some(Box::new(|| None)); + assert!(super::links::can_unembed(&app, 2)); + super::links::unembed_several(&mut app, vec![embedded, other]); + assert_eq!(std::fs::read_dir(&out).unwrap().count(), 0); + assert_eq!(app.run("links.info", json!({"id": embedded})).unwrap()["status"], "embedded"); + let picked = out.to_string_lossy().into_owned(); + let answer = picked.clone(); + app.services.pick_folder = Some(Box::new(move || Some(answer.clone()))); + super::links::unembed_several(&mut app, vec![embedded, other]); + for (id, name) in [(embedded, "embedded.png"), (other, "other.png")] { + let info = app.run("links.info", json!({"id": id})).unwrap(); + assert_eq!(info["path"], out.join(name).to_string_lossy().as_ref(), "{info}"); + } + assert_eq!(app.ui.status, format!("Unembedded 2 images to {picked}")); +} + #[test] fn the_links_menu_items_run_commands() { let tree = crate::menus::menu_tree(); diff --git a/crates/ui-egui/src/panels/transform.rs b/crates/ui-egui/src/panels/transform.rs index 1bce03c53d..95edf87f8c 100644 --- a/crates/ui-egui/src/panels/transform.rs +++ b/crates/ui-egui/src/panels/transform.rs @@ -126,7 +126,13 @@ const PATTERN_MODES: [(&str, &str); 3] = [("object", "Transform Object Only"), ( /// Only (the pattern tiles alone) or Transform Both. Until one is chosen (`default`, or any other /// value) neither is passed: patterns follow General › Transform Pattern Tiles. Errors are /// dropped, as the panels' fields have always done. -pub fn run_transform(app: &mut VectorcraftApp, cmd: &str, mut params: serde_json::Value) { +pub fn run_transform(app: &mut VectorcraftApp, cmd: &str, params: serde_json::Value) { + let params = with_pattern_switches(app, params); + app.run(cmd, params).ok(); +} + +/// `params` with the `objects` and `patterns` switches [`run_transform`] adds. +pub fn with_pattern_switches(app: &VectorcraftApp, mut params: serde_json::Value) -> serde_json::Value { let switches = match app.session.prefs.transform_panel_patterns.as_str() { "object" => Some((true, false)), "pattern" => Some((false, true)), @@ -137,7 +143,7 @@ pub fn run_transform(app: &mut VectorcraftApp, cmd: &str, mut params: serde_json params["objects"] = json!(objects); params["patterns"] = json!(patterns); } - app.run(cmd, params).ok(); + params } /// The panel menu's checked choice of [`PATTERN_MODES`]: the one chosen, else (`default`) what diff --git a/crates/ui-egui/src/panels/transform/tests.rs b/crates/ui-egui/src/panels/transform/tests.rs index 3dff8e6a4b..a798fc75ce 100644 --- a/crates/ui-egui/src/panels/transform/tests.rs +++ b/crates/ui-egui/src/panels/transform/tests.rs @@ -82,6 +82,35 @@ fn rotation_field_shows_the_angle_the_box_keeps() { assert!(shown.iter().any(|t| t == "0°") && !shown.iter().any(|t| t == "100 pt"), "{shown:?}"); } +/// Object › Transform › Rotate Bounding Box… asks for an angle and turns the box, not the art, in +/// one undo step: the panel then shows the box's angle. +#[test] +fn rotate_bounding_box_menu_item_turns_the_box_by_the_dialog_angle() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 100, "height": 50})).unwrap(); + let entry = crate::menus::menu_entries(&app) + .into_iter() + .find(|e| e.path == ["Object", "Transform"] && e.label == "Rotate Bounding Box…") + .expect("menu item"); + let (id, p) = crate::menus::click_target(&entry.label, entry.command.as_deref().unwrap(), &entry.params); + crate::menus::invoke(&mut app, &id, p); + let d = app.ui.dialog.as_mut().expect("a dialog opens"); + assert_eq!(d.str("__command"), "object.rotateBoundingBox"); + d.fields.insert("angle".into(), json!(90)); + let bounds = |app: &VectorcraftApp| { + let st = app.session.doc().unwrap(); + st.doc.bounds_of(&st.selection.objects, false) + }; + let art = bounds(&app); + let undo = app.session.doc().unwrap().history.undo.len(); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1); + assert_eq!(bounds(&app), art, "the art stays where it is"); + let shown = texts(&mut app, show); + assert!(shown.iter().any(|t| t == "90°"), "{shown:?}"); +} + /// #812: a selected live polygon shows its Polygon Properties in the Transform panel and the /// Properties panel's Transform section, and Make Sides Equal evens it out after a stretch. #[test] diff --git a/crates/ui-egui/src/panels/transparency.rs b/crates/ui-egui/src/panels/transparency.rs index 4279ac11e4..e0cd492a2e 100644 --- a/crates/ui-egui/src/panels/transparency.rs +++ b/crates/ui-egui/src/panels/transparency.rs @@ -4,6 +4,8 @@ //! neutral → off) and Opacity & Mask Define Knockout Shape; the menu's Page Isolated Blending and //! Page Knockout Group. +use std::sync::Arc; + use egui::{Sense, Stroke, StrokeKind, Ui, vec2}; use serde_json::json; use vectorcraft_color::{BlendMode, Paint}; @@ -20,20 +22,21 @@ pub(super) const MASK_THUMB: &str = "tr-mask-thumb"; /// The panel's values ([`vectorcraft_engine::Session::transparency_info`]) and its first target /// (the selection, or the object whose mask is being edited), recomputed only when the document -/// or the selection changes, or other gradient mesh points are picked. -fn state(app: &VectorcraftApp, ctx: &egui::Context) -> (TransparencyInfo, Option) { +/// or the selection changes, or other gradient mesh points are picked. The target is the `Arc` the +/// document holds. +fn state(app: &VectorcraftApp, ctx: &egui::Context) -> (TransparencyInfo, Option>) { type Key = (u64, u64, usize, Option, Option, Option)>>); let Some(st) = app.session.active() else { return Default::default() }; let sel = &st.selection.objects; let key: Key = (st.uid, st.revision, sel.len(), sel.first().copied(), sel.last().copied(), app.session.mesh_points_picked()); let id = egui::Id::unique("tr-state"); - if let Some((k, v)) = ctx.data(|d| d.get_temp::<(Key, (TransparencyInfo, Option))>(id)) + if let Some((k, v)) = ctx.data(|d| d.get_temp::<(Key, (TransparencyInfo, Option>))>(id)) && k == key { return v; } let info = app.session.transparency_info(); - let first = info.ids.first().and_then(|id| st.doc.node(*id)).cloned(); + let first = info.ids.first().and_then(|id| super::layers::node_arc(&st.doc, *id)); let v = (info, first); ctx.data_mut(|d| d.insert_temp(id, (key, v.clone()))); v @@ -82,18 +85,16 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if editing.is_some() && oresp.on_hover_text(tl!("Stop editing the opacity mask")).clicked() { app.run("transparency.stopEditingOpacityMask", json!({})).ok(); } - if let Some(n) = &n { - let mut bare = n.clone(); - bare.extras_mut().mask = None; - if !node_thumb(app, ui, "tr-obj", &bare, r.shrink(3.0), None) { - let (f, s) = current_paints(app); - let inner = r.shrink2(vec2(6.0, 10.0)); - widgets::paint_chip(ui, inner, &f); - if let Some(c) = s.color() - && !matches!(s, Paint::None) - { - ui.painter().rect_stroke(inner, 0.0, Stroke::new(1.0, super::c32(&c)), StrokeKind::Middle); - } + if let Some(n) = &n + && !node_thumb(app, ui, "tr-obj", n, r.shrink(3.0), None, false) + { + let (f, s) = current_paints(app); + let inner = r.shrink2(vec2(6.0, 10.0)); + widgets::paint_chip(ui, inner, &f); + if let Some(c) = s.color() + && !matches!(s, Paint::None) + { + ui.painter().rect_stroke(inner, 0.0, Stroke::new(1.0, super::c32(&c)), StrokeKind::Middle); } } match (mask, n.as_ref().map(|n| n.id)) { @@ -113,7 +114,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let mresp = ui.interact(mr, egui::Id::unique(MASK_THUMB), Sense::click()); let bg = if m.clip != m.invert { [0, 0, 0, 255] } else { [255, 255, 255, 255] }; ui.painter().rect_filled(mr, 0.0, egui::Color32::from_rgb(bg[0], bg[1], bg[2])); - node_thumb(app, ui, "tr-mask", &m.art, mr.shrink(2.0), Some(bg)); + node_thumb(app, ui, "tr-mask", &m.art, mr.shrink(2.0), Some(bg), true); // Viewing the mask alone (Alt-click) highlights its thumbnail. let viewing = app.session.active().is_some_and(|d| d.shown_mask().is_some()); let border = match (viewing, editing.is_some()) { @@ -262,8 +263,9 @@ fn mask_items(mask: Option<&OpacityMask>, can_make: bool) -> [(&'static str, &'s /// A rendered thumbnail of `n` (which may live outside the tree, like mask art). One texture per /// slot, re-rendered only when the document revision, object or size changes, and not during a -/// drag (every pointer move is a new revision): the last one stays until it ends. -fn node_thumb(app: &VectorcraftApp, ui: &Ui, slot: &str, n: &vectorcraft_doc::Node, r: egui::Rect, bg: Option<[u8; 4]>) -> bool { +/// drag (every pointer move is a new revision): the last one stays until it ends. With `own_mask` +/// false, `n` is drawn without its opacity mask. +fn node_thumb(app: &VectorcraftApp, ui: &Ui, slot: &str, n: &vectorcraft_doc::Node, r: egui::Rect, bg: Option<[u8; 4]>, own_mask: bool) -> bool { use std::cell::RefCell; thread_local! { static RENDERER: RefCell = RefCell::new(vectorcraft_render::Renderer::new()); @@ -275,12 +277,20 @@ fn node_thumb(app: &VectorcraftApp, ui: &Ui, slot: &str, n: &vectorcraft_doc::No let cached: Option<(egui::Id, u64, egui::TextureHandle)> = ui.ctx().data(|d| d.get_temp(slot_id)); let tex = match cached { Some((k, rev, tex)) if k == key && (rev == st.revision || busy) => Some(tex), - _ => RENDERER.with(|rr| rr.borrow_mut().render_node_thumbnail_with(&st.doc, n, px, bg, &super::layers::thumb_options())).map(|img| { - let color = crate::canvas::color_image(&img); - let tex = ui.ctx().load_texture(slot, color, egui::TextureOptions::LINEAR); - ui.ctx().data_mut(|d| d.insert_temp(slot_id, (key, st.revision, tex.clone()))); - tex - }), + _ => { + let bare = (!own_mask && n.extras().mask.is_some()).then(|| { + let mut bare = n.clone(); + bare.extras_mut().mask = None; + bare + }); + let n = bare.as_ref().unwrap_or(n); + RENDERER.with(|rr| rr.borrow_mut().render_node_thumbnail_with(&st.doc, n, px, bg, &super::layers::thumb_options())).map(|img| { + let color = crate::canvas::color_image(&img); + let tex = ui.ctx().load_texture(slot, color, egui::TextureOptions::LINEAR); + ui.ctx().data_mut(|d| d.insert_temp(slot_id, (key, st.revision, tex.clone()))); + tex + }) + } }; let Some(tex) = tex else { return false }; let side = r.width().min(r.height()); @@ -448,4 +458,57 @@ mod tests { let texts = frame(&mut app); assert!(texts.iter().any(|t| t == "✓ Page Knockout Group") && texts.iter().any(|t| t == "✓ Page Isolated Blending"), "{texts:?}"); } + + /// The pixels of the thumbnail [`node_thumb`] draws of `n`, in a context of its own (so no + /// earlier texture is reused). + fn thumb_pixels(app: &VectorcraftApp, n: &Node, own_mask: bool) -> Vec { + let ctx = egui::Context::default(); + let r = egui::Rect::from_min_size(egui::Pos2::ZERO, vec2(44.0, 44.0)); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| { + assert!(node_thumb(app, ui, "tr-test", n, r, None, own_mask), "the thumbnail draws"); + }); + let cached: Option<(egui::Id, u64, egui::TextureHandle)> = ctx.data(|d| d.get_temp(egui::Id::unique("tr-test"))); + let id = cached.expect("the thumbnail's texture").2.id(); + let pixels = out.textures_delta.set.iter().find(|e| e.0.eq(&id)).and_then(|e| e.1.last()).map(|d| { + let egui::ImageData::Color(img) = &d.image; + img.pixels.clone() + }); + out.textures_delta.clear(); + pixels.expect("the thumbnail uploads") + } + + /// The panel's state holds the target as the document holds it, a new one after an edit and + /// after Undo; the object thumbnail of a masked object draws as the object without its mask. + #[test] + fn state_holds_the_documents_node_and_the_object_thumbnail_leaves_out_the_mask() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + run(&mut app, "file.new", json!({"width": 100, "height": 100})); + let a = run(&mut app, "shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50}))["id"].clone(); + let b = run(&mut app, "shape.ellipse", json!({"x": 10, "y": 10, "width": 20, "height": 20}))["id"].clone(); + run(&mut app, "select.set", json!({"ids": [a, b]})); + run(&mut app, "transparency.makeOpacityMask", json!({})); + let held = |app: &VectorcraftApp, id: NodeId| super::super::layers::node_arc(&app.session.active().unwrap().doc, id).expect("held"); + let ctx = egui::Context::default(); + let n = state(&app, &ctx).1.expect("the masked object"); + assert!(n.extras().mask.is_some(), "the object has its mask"); + assert!(Arc::ptr_eq(&n, &held(&app, n.id)), "the node the document holds"); + assert!(Arc::ptr_eq(&state(&app, &ctx).1.expect("cached"), &n), "the cached state gives the same node"); + // The object thumbnail: as a copy with the mask removed draws, not as the masked object. + let mut bare = (*n).clone(); + bare.extras_mut().mask = None; + let without = thumb_pixels(&app, &n, false); + assert!(without == thumb_pixels(&app, &bare, true), "the object without its mask"); + assert!(without != thumb_pixels(&app, &n, true), "the mask changes the drawing"); + // An edit and its Undo: the state follows the document. + run(&mut app, "transparency.set", json!({"opacity": 40})); + let (info, edited) = state(&app, &ctx); + let edited = edited.expect("the edited object"); + assert_eq!((info.opacity, edited.opacity), (Some(40.0), 0.4)); + assert!(Arc::ptr_eq(&edited, &held(&app, n.id)) && !Arc::ptr_eq(&edited, &n), "the edited node"); + run(&mut app, "edit.undo", json!({})); + let (info, undone) = state(&app, &ctx); + let undone = undone.expect("the object after Undo"); + assert_eq!((info.opacity, undone.opacity), (Some(100.0), 1.0)); + assert!(Arc::ptr_eq(&undone, &held(&app, n.id)), "the node Undo put back"); + } } diff --git a/crates/ui-egui/src/panels/variables.rs b/crates/ui-egui/src/panels/variables.rs index 03183c6652..34a0a83e80 100644 --- a/crates/ui-egui/src/panels/variables.rs +++ b/crates/ui-egui/src/panels/variables.rs @@ -992,6 +992,8 @@ mod tests { assert_eq!(app.ui.status, "a new document won't read these variables back with their kind: `#Tag`"); let warning = app.ui.status.clone(); app.run("variable.define", json!({"name": "%Rate", "kind": "text"})).unwrap(); + // A new document reads a `%` header's values as paths of graph data files. + app.run("dataset.new", json!({"name": "Rates", "values": {"%Rate": "5"}})).unwrap(); app.run("dataset.export", json!({"path": path})).unwrap(); assert_eq!(app.ui.status, "a new document refuses this file because of these variables: `%Rate`"); let refuses = app.ui.status.clone(); diff --git a/crates/ui-egui/src/picks.rs b/crates/ui-egui/src/picks.rs index ea1b51e049..a5f7053567 100644 --- a/crates/ui-egui/src/picks.rs +++ b/crates/ui-egui/src/picks.rs @@ -82,6 +82,7 @@ const DOCUMENT_FREE: &[&str] = &[ "ui.shortcutImportDialog", crate::panels::actions::SAVE_SET, crate::panels::actions::LOAD_SET, + crate::panels::actions::REPLACE_SET, ]; impl Entry { diff --git a/crates/ui-egui/src/place.rs b/crates/ui-egui/src/place.rs index 9cce282ee6..3ff8159407 100644 --- a/crates/ui-egui/src/place.rs +++ b/crates/ui-egui/src/place.rs @@ -433,7 +433,8 @@ fn line(i: Result, units: vectorcraft_doc::Unit) -> String { match (i["pixelWidth"].as_u64(), i["pixelHeight"].as_u64()) { (Some(w), Some(h)) => { let ppi = i["ppi"][0].as_f64().unwrap_or(72.0); - format!("{w} × {h} px, {} ppi, {} ({size})", fmt_ppi(ppi), i["colorMode"].as_str().unwrap_or("RGB")) + let ppi = crate::i18n::fill_once(tl!("{n} ppi"), &[("n", &fmt_ppi(ppi))]); + format!("{w} × {h} px, {ppi}, {} ({size})", i["colorMode"].as_str().unwrap_or("RGB")) } _ => format!("{} ({size})", i["format"].as_str().unwrap_or_default().to_uppercase()), } @@ -690,7 +691,7 @@ pub fn paint_cursor(app: &mut VectorcraftApp, ctx: &egui::Context, painter: &egu // ---------- drops ---------- impl VectorcraftApp { - /// Where file `name` dropped with the pointer at `pos` (screen points) goes: as in Illustrator, + /// Where file `name` dropped with the pointer at `pos` (screen points) goes: /// onto the canvas of the open document (Shift embeds it), else opened. Where the platform /// doesn't say (`None`: desktop drags carry no position), a document opens as a tab of its /// own and a picture or text is placed in the middle of the view. A library, a presets file, a @@ -929,3 +930,20 @@ pub(crate) fn link_buttons(app: &mut VectorcraftApp, ui: &mut egui::Ui, id: u64, crate::panels::links::unembed(app, id, name); } } + +#[cfg(test)] +mod tests { + use super::*; + + /// The Place dialog's line about an image writes its resolution with the `{n} ppi` row. + #[test] + fn the_file_line_writes_the_ppi_unit_in_the_interface_language() { + let info = json!({ "pixelWidth": 300, "pixelHeight": 150, "ppi": [300.0, 300.0], "colorMode": "RGB", "width": 72.0, "height": 36.0 }); + let en = line(Ok(info.clone()), vectorcraft_doc::Unit::Points); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").unwrap()); + let fr = line(Ok(info), vectorcraft_doc::Unit::Points); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert!(en.starts_with("300 × 150 px, 300 ppi, RGB ("), "{en}"); + assert!(fr.starts_with("300 × 150 px, 300 ppp, RGB ("), "{fr}"); + } +} diff --git a/crates/ui-egui/src/prefs_dialog.rs b/crates/ui-egui/src/prefs_dialog.rs index e8a6368cbb..acd994d1a0 100644 --- a/crates/ui-egui/src/prefs_dialog.rs +++ b/crates/ui-egui/src/prefs_dialog.rs @@ -1,4 +1,4 @@ -//! Edit → Preferences (⌘K): Illustrator-style category list + fields, rendered from the engine's +//! Edit → Preferences (⌘K): a category list + its fields, rendered from the engine's //! preference table ([`PREF_SPECS`]). The dialog edits a working copy in `Dialog::fields` //! (one field per preference key, so agents can `ui.dialog.set` any of them) and OK applies it //! through `prefs.set`. Also: persistence of engine prefs inside `UiState` and the per-frame @@ -72,6 +72,7 @@ fn settings() -> impl Iterator { "appTitleBar" => APP_TITLE_BAR_SHOWN, "linuxDisplayServer" => DISPLAY_SERVER_CHOICE, "monitorProfileDisplay" => !cfg!(target_arch = "wasm32"), + "lowLatencyDrawing" => !cfg!(target_arch = "wasm32"), _ => true, }; let prefs = @@ -660,6 +661,9 @@ fn category_fields(ui: &mut egui::Ui, app: &mut VectorcraftApp, d: &mut Dialog, ui.label(egui::RichText::new(note).color(t.text_dim).size(11.0)); } } + // The desktop app only: it sets the window's present mode when it starts, so a note + // says the change applies at the next start. + PrefKind::Bool if sp.key == "lowLatencyDrawing" => desktop_startup_bool_row(ui, d, sp.key, sp.label, &t), PrefKind::Bool => bool_row(ui, d, sp.key, sp.label), PrefKind::Num { min, max, unit } => { labeled(ui, sp.label, |ui, label_id| { @@ -883,6 +887,16 @@ fn bool_row(ui: &mut egui::Ui, d: &mut Dialog, key: &str, label: &str) { } } +/// A checkbox the desktop app reads once, when it starts (Performance › Low-Latency Drawing, which +/// sets the window's present mode), with its restart note. The web build doesn't show it. +fn desktop_startup_bool_row(ui: &mut egui::Ui, d: &mut Dialog, key: &str, label: &str, t: &Tokens) { + if cfg!(target_arch = "wasm32") { + return; + } + bool_row(ui, d, key, label); + ui.label(egui::RichText::new(tl!("Applies the next time VectorCraft starts.")).color(t.text_dim).size(11.0)); +} + fn labeled(ui: &mut egui::Ui, label: &str, add: impl FnOnce(&mut egui::Ui, egui::Id)) { let t = Tokens::get(ui.ctx()); ui.horizontal(|ui| { diff --git a/crates/ui-egui/src/prefs_dialog/descriptions.rs b/crates/ui-egui/src/prefs_dialog/descriptions.rs index eb8156f8dd..f514d37bda 100644 --- a/crates/ui-egui/src/prefs_dialog/descriptions.rs +++ b/crates/ui-egui/src/prefs_dialog/descriptions.rs @@ -61,6 +61,63 @@ pub(crate) const DESCRIPTIONS: &[(&str, &str)] = &[ "artboardUpdateWhileDragging", "With Fade Region Outside Artboard on, the area outside the artboards stays dark while you drag with the Artboard tool.", ), + // Type + ( + "typeSizeIncrement", + "The step for type size and leading: Cmd/Ctrl+Shift+. and Cmd/Ctrl+Shift+, change the size by one step, or five with Alt too; in horizontal type, Alt with the Up or Down Arrow changes the leading by one step, or five with Cmd/Ctrl.", + ), + ( + "trackingIncrement", + "The step for tracking and kerning, in thousandths of an em: in horizontal type, Alt with the Left or Right Arrow changes the kerning at the caret or the tracking of the selected text by one step, or five with Cmd/Ctrl.", + ), + ( + "baselineShiftIncrement", + "The step for baseline shift: in horizontal type, Alt and Shift with the Up or Down Arrow move the baseline by one step, or five with Cmd/Ctrl.", + ), + ( + "showEastAsianOptions", + "Shows the options for Japanese and other East Asian type in the Character, Paragraph, OpenType and Glyphs panels, and Type › Composite Fonts.", + ), + ( + "showIndicOptions", + "Shows the options for Arabic, Hebrew and Indic type in the Character and Paragraph panels, such as paragraph direction, kashidas and digits.", + ), + ("typeSelectionByPathOnly", "The selection tools select type only on its baseline, its area's frame or its path, not anywhere inside its box."), + ("fontNamesInEnglish", "Font menus list each font by its English name; off, a font that also has a name in its own language shows that name."), + ( + "autoSizeAreaType", + "New area type starts with Auto Size on, so a rectangular frame of horizontal type grows or shrinks in height to fit its text.", + ), + ("fontPreview", "Font lists and the Type › Font menu show a sample of each font beside its name."), + ( + "fontSamplesOnWhite", + "Font samples are drawn in dark type on white, whatever the interface's brightness; it applies only while in-menu font previews are on.", + ), + ("fontPreviewSize", "How tall each row is in the font lists of font fields, such as the Character panel's, and so how large each sample is."), + ("recentFontsCount", "How many of the fonts used last, from 1 to 15, Type › Recent Fonts and the font lists show, newest first."), + ("missingGlyphProtection", "When you change the font or font style of text, characters the new font has no glyph for keep the font they had."), + ( + "highlightAlternateGlyphs", + "A pink highlight on the canvas marks glyphs that OpenType features replaced, such as ligatures; it does not print or export.", + ), + ( + "showCharacterAlternates", + "With the Type tool, selecting one character shows a row of its alternate glyphs beside it on the canvas to choose from.", + ), + ( + "highlightSubstitutedFonts", + "A pink highlight on the canvas marks text drawn in a substitute font because its font is missing; it does not print or export.", + ), + ("placeholderText", "New type made with a Type tool starts with placeholder text, selected, so typing replaces it."), + ("typedLists", "Typing a list marker such as 1. or * and then a space at the start of a paragraph makes the paragraph a list."), + ("fontsFolder", "Fonts in this folder show in the font menus and can be used without being installed."), + ( + "overrideCharColor", + "Applying a graphic style to type removes the characters' own fill or stroke where the style has one, so the style's paint shows.", + ), + ("alignGlyphBoundsPoint", "Align and Distribute measure point type by the ink of its glyphs instead of its em box."), + ("alignGlyphBoundsArea", "Align and Distribute measure area type by the ink of its glyphs instead of its frame."), + ("typeGlyphBounds", "The bounding box and the Transform panel measure point type by the ink of its glyphs instead of its em box."), // Selection & Anchor Display ("selectionTolerance", "How near, in pixels, the pointer must be to an object, anchor or handle for a click to select it."), ( diff --git a/crates/ui-egui/src/prefs_dialog/tests.rs b/crates/ui-egui/src/prefs_dialog/tests.rs index f7c676d441..be0450feac 100644 --- a/crates/ui-egui/src/prefs_dialog/tests.rs +++ b/crates/ui-egui/src/prefs_dialog/tests.rs @@ -512,6 +512,44 @@ fn graphics_processor_preference_shows_and_persists() { assert_eq!(saved["engine_prefs"]["gpuPreference"], json!("highPerformance")); } +/// Performance › Low-Latency Drawing (#6013): shown off with its restart note, applied by OK, +/// saved with the UI state under the key the desktop app reads before the window opens, and every +/// bundled language translates its label. +#[test] +fn low_latency_drawing_preference_shows_and_persists() { + fn texts(s: &egui::Shape, out: &mut Vec) { + match s { + egui::Shape::Text(t) => out.push(t.galley.text().to_string()), + egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)), + _ => {} + } + } + let mut a = app(); + open(&mut a, Some("Performance")); + assert_eq!(a.ui.dialog.as_ref().unwrap().fields.get("lowLatencyDrawing"), Some(&json!(false))); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| show(&mut a, ui.ctx())); + out.textures_delta.clear(); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| show(&mut a, ui.ctx())); + out.textures_delta.clear(); + let mut shown = vec![]; + out.shapes.iter().for_each(|c| texts(&c.shape, &mut shown)); + let at = shown.iter().position(|t| t == "Low-Latency Drawing").unwrap_or_else(|| panic!("{shown:?}")); + // The note is the row's own: it comes before the next row's label. + let next = shown[at..].iter().position(|t| t.starts_with("History States")).map(|n| at + n).unwrap_or_else(|| panic!("{shown:?}")); + assert!(shown[at..next].iter().any(|t| t == "Applies the next time VectorCraft starts."), "{shown:?}"); + a.ui.dialog.as_mut().unwrap().fields.insert("lowLatencyDrawing".into(), json!(true)); + confirm(&mut a).unwrap(); + assert!(a.take_prefs_changed(), "OK asks the host to write the preferences file"); + assert!(a.session.prefs.low_latency_drawing); + let saved: Value = serde_json::from_slice(&serde_json::to_vec(&a.ui).unwrap()).unwrap(); + assert_eq!(saved["engine_prefs"]["lowLatencyDrawing"], json!(true)); + for lang in crate::i18n::Lang::all().filter(|l| l.code() != crate::i18n::Lang::EN.code()) { + assert!(crate::i18n::has(lang, "Low-Latency Drawing"), "{}", lang.code()); + } +} + /// User Interface › System Title Bar: shown with its next-launch note, applied by OK and /// saved with the UI state under the key the desktop app reads before the window opens. #[test] @@ -1632,8 +1670,8 @@ fn ok_refuses_a_typed_folder_outside_the_automation_roots_before_looking_at_it() /// One frame of the open Preferences dialog with `events`, a quarter second after the last. → The /// texts it painted where they show (a text its clip rectangle hides is left out), with their -/// rectangles, and the description of each accessibility node that has one. -fn description_frame(a: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) -> (Vec<(String, egui::Rect)>, Vec) { +/// rectangles, and the description of the accessibility node with the keyboard focus, if it has one. +fn description_frame(a: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) -> (Vec<(String, egui::Rect)>, Option) { let time = ctx.input(|i| i.time) + 0.25; let screen_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1200.0, 900.0))); let raw = egui::RawInput { screen_rect, events, time: Some(time), ..Default::default() }; @@ -1653,9 +1691,11 @@ fn description_frame(a: &mut VectorcraftApp, ctx: &egui::Context, events: Vec {} + n => bad.push(format!("`{}` ({}) has {n} sentences", s.key, s.label)), + } + if descriptions::description(s.key).is_some_and(|d| d.trim().is_empty()) { + bad.push(format!("`{}` has an empty sentence", s.key)); + } + } + assert!(count > 0, "the Type category shows settings"); + assert!(bad.is_empty(), "{}", bad.join("\n")); +} + +/// The pointer over Type's Size/Leading row and over its Show East Asian Options box shows each +/// row's sentence. +#[test] +fn hovering_a_type_row_shows_its_description() { + let mut a = app(); + open(&mut a, Some("Type")); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + description_frame(&mut a, &ctx, vec![]); + let (texts, _) = description_frame(&mut a, &ctx, vec![]); + let row = |texts: &[(String, egui::Rect)], label: &str| { + texts.iter().find(|(t, _)| t == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("no `{label}` in {texts:?}")) + }; + let size = descriptions::description("typeSizeIncrement").expect("Size/Leading has a sentence"); + let east_asian = descriptions::description("showEastAsianOptions").expect("Show East Asian Options has a sentence"); + description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(row(&texts, "Size/Leading:"))]); + let (after, _) = description_frame(&mut a, &ctx, vec![]); + assert!(painted(&after, size) && !painted(&after, east_asian), "the Size/Leading row's sentence shows: {after:?}"); + description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(row(&texts, "Show East Asian Options"))]); + let (after, _) = description_frame(&mut a, &ctx, vec![]); + assert!(painted(&after, east_asian) && !painted(&after, size), "the East Asian row's sentence shows: {after:?}"); +} + +/// Tab from the search field reaches Type's first control, the Size/Leading field: the line shows +/// its sentence and a screen reader gets it as the control's description. +#[test] +fn keyboard_focus_on_a_type_row_shows_its_description() { + let mut a = app(); + open(&mut a, Some("Type")); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + description_frame(&mut a, &ctx, vec![]); + description_frame(&mut a, &ctx, vec![]); + let size = descriptions::description("typeSizeIncrement").expect("Size/Leading has a sentence"); + let mut shown = None; + for _ in 0..40 { + let (texts, described) = description_frame(&mut a, &ctx, key_press(egui::Key::Tab, egui::Modifiers::NONE)); + if painted(&texts, size) { + shown = Some(described); + break; + } + } + let described = shown.expect("Tab reaches the Size/Leading row and its sentence shows"); + assert_eq!(described.as_deref(), Some(size), "the focused control carries the sentence"); } /// The pointer over Selection & Anchor Display's Tolerance row and over its Highlight anchors on diff --git a/crates/ui-egui/src/scripts_menu.rs b/crates/ui-egui/src/scripts_menu.rs index c951aac8cb..1afaf11d34 100644 --- a/crates/ui-egui/src/scripts_menu.rs +++ b/crates/ui-egui/src/scripts_menu.rs @@ -7,6 +7,10 @@ //! active one, and each time the File menu of the window's menu bar opens ([`refresh`]). The menus show the last finished //! listing ([`items`]), so a script added to the folder is listed without a restart. //! +//! Until the first read ends the menu shows [`LOADING`], and [`SLOW`] once that read has taken +//! [`SLOW_SECS`]; a first read that cannot start or ends without a listing shows [`UNREADABLE`], +//! and the next read tries again. +//! //! `ui.runInstalledScript {path}` runs a listed script (`script.run`) without the warning Other //! Script… shows: the file was put in the folder to be run from the menu. The path is one a //! listing gave; a file that is no longer a plain script under the folder is not run. @@ -28,8 +32,14 @@ pub const COMMAND: &str = "ui.runInstalledScript"; pub const TRUNCATED: &str = "Some scripts were not listed"; /// The menu's note when the folder is there and cannot be read. pub const UNREADABLE: &str = "The Scripts folder cannot be read"; +/// The menu's note while the first read is under way. +pub const LOADING: &str = "Loading scripts…"; +/// The menu's note once the first read has taken [`SLOW_SECS`]. +pub const SLOW: &str = "The Scripts folder is still being read"; /// The notes, for the catalogs ([`crate::menus::menu_strings`]). -pub const LABELS: &[&str] = &[TRUNCATED, UNREADABLE]; +pub const LABELS: &[&str] = &[TRUNCATED, UNREADABLE, LOADING, SLOW]; +/// How long the first read runs before the menu shows [`SLOW`]. +pub const SLOW_SECS: f64 = 2.0; #[derive(Default)] struct State { @@ -45,6 +55,43 @@ struct State { started: bool, /// The window was the active one at the last [`poll`]. focused: bool, + /// A listing has been taken in. + loaded: bool, + /// When the first read started ([`crate::clock::now_secs`]), while it is under way. + first_read: Option, + /// The first read has taken [`SLOW_SECS`]. + slow: bool, + /// No listing yet, and the last read could not start or ended without one. + failed: bool, +} + +impl State { + /// The note in place of a listing before the first one. + fn first_read_note(&self) -> Option<&'static str> { + if self.loaded { + return None; + } + if self.reading.is_some() { + return Some(if self.slow { SLOW } else { LOADING }); + } + self.failed.then_some(UNREADABLE) + } + + /// No listing yet, and the read under way ended without one or could not start. + fn first_read_failed(&mut self) { + if !self.loaded { + (self.first_read, self.slow, self.failed) = (None, false, true); + self.revision += 1; + } + } + + /// Show [`SLOW`] once the first read has run [`SLOW_SECS`] by `now`. + fn mark_slow(&mut self, now: f64) { + if !self.loaded && !self.slow && self.reading.is_some() && self.first_read.is_some_and(|t| now - t >= SLOW_SECS) { + self.slow = true; + self.revision += 1; + } + } } /// The listing the menus show. One per process in the app; one per thread in unit tests, which run @@ -92,7 +139,8 @@ pub(crate) fn intern(s: &str) -> Option<&'static str> { Some(v) } -/// Changes whenever the menus' listing changes (the macOS menu bar follows it). +/// Changes whenever the menus' listing or the note before the first listing changes (the macOS +/// menu bar follows it). pub fn revision() -> u64 { state().revision } @@ -108,18 +156,28 @@ pub fn refresh(app: &VectorcraftApp, ctx: Option<&egui::Context>) { return; } let (tx, rx) = std::sync::mpsc::channel(); - let ctx = ctx.cloned(); + let worker_ctx = ctx.cloned(); let spawned = std::thread::Builder::new().name("vectorcraft-scripts".into()).spawn(move || { // The app's own folder, read for the person at the keyboard. let listing = vectorcraft_engine::file_access::unconfined(|| vectorcraft_engine::script::folder::list(&root)); if tx.send(listing).is_ok() - && let Some(ctx) = ctx + && let Some(ctx) = worker_ctx { ctx.request_repaint(); } }); - if spawned.is_ok() { - state.reading = Some(rx); + if spawned.is_err() { + state.first_read_failed(); + return; + } + state.reading = Some(rx); + if !state.loaded && state.first_read.is_none() { + // The menus show the loading note, and a frame comes when it is due to change to SLOW. + state.first_read = Some(crate::clock::now_secs()); + state.revision += 1; + if let Some(ctx) = ctx { + ctx.request_repaint_after(std::time::Duration::from_secs_f64(SLOW_SECS)); + } } } @@ -137,6 +195,7 @@ pub fn poll(app: &VectorcraftApp, ctx: &egui::Context) { refresh(app, Some(ctx)); } take(false); + state().mark_slow(crate::clock::now_secs()); let again = { let mut state = state(); let again = state.pending && state.reading.is_none(); @@ -157,14 +216,22 @@ fn take(wait: bool) { let listing = if wait { reading.recv().map_err(|_| TryRecvError::Disconnected) } else { reading.try_recv() }; match listing { Ok(listing) => { - if *state.listing != listing { + let changed = *state.listing != listing; + if changed { state.listing = Arc::new(listing); + } + // The first listing also takes the place of the loading note. + if changed || !state.loaded { state.revision += 1; } + (state.loaded, state.first_read, state.slow, state.failed) = (true, None, false, false); state.reading = None; } Err(TryRecvError::Empty) => {} - Err(TryRecvError::Disconnected) => state.reading = None, + Err(TryRecvError::Disconnected) => { + state.reading = None; + state.first_read_failed(); + } } } @@ -174,6 +241,27 @@ pub(crate) fn wait() { take(true); } +/// The read under way ends without a listing, as when its thread stops early. +#[cfg(test)] +pub(crate) fn lose_read() { + let mut state = state(); + if state.reading.is_some() { + state.reading = Some(std::sync::mpsc::channel::().1); + } +} + +/// When the first read started, while it is under way. +#[cfg(test)] +pub(crate) fn first_read_started() -> Option { + state().first_read +} + +/// What [`poll`] does about a slow first read, at `now` ([`crate::clock::now_secs`]). +#[cfg(test)] +pub(crate) fn check_slow(now: f64) { + state().mark_slow(now); +} + /// Wait for the read under way to end and leave its listing to be taken in, so the read is under /// way until the next [`poll`]. #[cfg(test)] @@ -188,7 +276,8 @@ pub(crate) fn end_untaken() { } /// File › Scripts' items: the listed scripts and subfolders, a note when some may be missing or -/// the folder cannot be read, then Check Script… and Other Script…. +/// the folder cannot be read, or one before the first listing, then Check Script… and Other +/// Script…. pub fn items() -> Vec { // A row whose name is past [`MAX_NAMES`] is left out (`dropped`). fn level(entries: &[Entry], dropped: &mut bool) -> Vec { @@ -208,7 +297,10 @@ pub fn items() -> Vec { } items } - let listing = state().listing.clone(); + let (listing, note) = { + let state = state(); + (state.listing.clone(), state.first_read_note()) + }; let mut dropped = false; let mut items = level(&listing.entries, &mut dropped); if listing.truncated || dropped { @@ -217,6 +309,7 @@ pub fn items() -> Vec { if listing.unreadable { items.push(Item::Header(UNREADABLE)); } + items.extend(note.map(Item::Header)); if !items.is_empty() { items.push(Item::Sep); } diff --git a/crates/ui-egui/src/scrub.rs b/crates/ui-egui/src/scrub.rs index 5a0a2ff4f9..a68759087f 100644 --- a/crates/ui-egui/src/scrub.rs +++ b/crates/ui-egui/src/scrub.rs @@ -1,4 +1,4 @@ -//! Scrubbing numeric fields (#400, beyond Illustrator; Photoshop's scrubby labels): a horizontal +//! Scrubbing numeric fields (#400): a horizontal //! drag on a numeric field's label (`W:`, `Opacity:`, the Character panel's size icon) steps the //! field's value by one unit every [`PX_PER_STEP`] points, ten with Shift and a tenth with //! Ctrl/Cmd, as the arrow keys step a focused field; a click on the label focuses the field. A diff --git a/crates/ui-egui/src/shortcut_editor.rs b/crates/ui-egui/src/shortcut_editor.rs index 84c1ff4fa0..7fc38179f4 100644 --- a/crates/ui-egui/src/shortcut_editor.rs +++ b/crates/ui-egui/src/shortcut_editor.rs @@ -152,12 +152,23 @@ pub fn sync(ui: &UiState) { crate::custom_toolbars::sync(ui); } -/// Registry default shortcut of a command (engine or UI command). +/// Registry default shortcut of a command (engine or UI command) on [`crate::keymap::platform`]. pub fn default_command_shortcut(id: &str) -> Option<&'static str> { + default_command_shortcut_on(id, crate::keymap::platform()) +} + +/// Registry default shortcut of a command on platform `p`. +fn default_command_shortcut_on(id: &str, p: craft_keymap::Platform) -> Option<&'static str> { if let Some(c) = vectorcraft_engine::find_command(id) { return c.shortcut; } - menus::UI_COMMANDS.iter().find(|c| c.0 == id).map(|c| c.2).filter(|s| !s.is_empty()) + menus::UI_COMMANDS.iter().find(|c| c.0 == id).map(|c| ui_command_default(c.0, c.2, p)).filter(|s| !s.is_empty()) +} + +/// The default shortcut `sc` of UI command `id` on platform `p` (empty for none). Select Last +/// Selection Tool has none on macOS, which takes Cmd+` to switch between an app's windows. +pub(crate) fn ui_command_default(id: &str, sc: &'static str, p: craft_keymap::Platform) -> &'static str { + if id == "tool.selectLastSelection" && p.is_mac() { "" } else { sc } } /// Window menu items that show a panel (`window.panel {panel}`) with a default shortcut: (panel @@ -184,15 +195,21 @@ pub const PANEL_SHORTCUTS: &[(&str, &str)] = &[ ("openType", "Cmd+Alt+Shift+T"), ]; -/// Default shortcut of an entry key (`tool:`, `panel:` or a command id). +/// Default shortcut of an entry key (`tool:`, `panel:` or a command id) on +/// [`crate::keymap::platform`]. pub fn default_of(key: &str) -> Option<&'static str> { + default_on(key, crate::keymap::platform()) +} + +/// Default shortcut of an entry key on platform `p`. +pub(crate) fn default_on(key: &str, p: craft_keymap::Platform) -> Option<&'static str> { if let Some(t) = key.strip_prefix("tool:") { return vectorcraft_tools::tool_info(t).and_then(|t| t.shortcut); } - if let Some(p) = key.strip_prefix("panel:") { - return PANEL_SHORTCUTS.iter().find(|(id, _)| *id == p).map(|(_, sc)| *sc); + if let Some(panel) = key.strip_prefix("panel:") { + return PANEL_SHORTCUTS.iter().find(|(id, _)| *id == panel).map(|(_, sc)| *sc); } - default_command_shortcut(key) + default_command_shortcut_on(key, p) } /// Effective shortcut of an entry key, honouring the user's overrides. diff --git a/crates/ui-egui/src/shortcuts/tests.rs b/crates/ui-egui/src/shortcuts/tests.rs index 4fad102f73..a74bfd8b4a 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -2693,6 +2693,36 @@ fn the_blend_tool_shortcut_finishes_the_blend() { assert_eq!(app.session.active().unwrap().doc.layers, layers, "no blend was made"); } +/// P, the Pen's shortcut, pressed between clicks while the Pen draws a path ends that path: the Pen +/// stays chosen, the path stays open, and the next click starts a new path. +#[test] +fn the_pen_shortcut_ends_the_path_being_drawn() { + use vectorcraft_tools::{PointerEvent, PointerKind}; + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 600, "height": 300})).unwrap(); + app.select_tool("pen"); + let click = |app: &mut VectorcraftApp, x: f64| { + let v = app.view_info(); + app.session.pointer(&PointerEvent::new(PointerKind::Down, x, 100.0), v).unwrap(); + app.session.pointer(&PointerEvent::new(PointerKind::Up, x, 100.0), v).unwrap(); + }; + let press = |key| egui::Event::Key { key, physical_key: Some(key), pressed: true, repeat: false, modifiers: Modifiers::NONE }; + let anchors = |app: &VectorcraftApp, id| { + let path = app.session.active().unwrap().doc.node(id).and_then(|n| n.path_data()); + path.map(|pd| pd.subpaths.iter().map(|sp| sp.anchors.len()).collect::>()) + }; + click(&mut app, 100.0); + click(&mut app, 200.0); + let first = app.session.active().unwrap().selection.objects[0]; + frame(&mut app, vec![press(Key::P), egui::Event::Text("p".into())]); + assert_eq!(app.session.tool_id(), "pen"); + click(&mut app, 300.0); + assert_eq!(anchors(&app, first), Some(vec![2]), "the path keeps its two anchors"); + let second = app.session.active().unwrap().selection.objects[0]; + assert_ne!(second, first, "the click starts a new path"); + assert_eq!(anchors(&app, second), Some(vec![1])); +} + /// A Blend tool shortcut that arrives only as text (Shift+~ types `~`) also finishes the blend, /// while another tool's shifted shortcut does not. #[test] @@ -3364,3 +3394,27 @@ fn artboard_navigation_commands_can_be_given_keys() { frame(&mut app, press(Key::PageUp)); assert_eq!(at(&app), 1, "Page Up goes to the previous artboard"); } + +/// Ctrl+` (Windows and Linux) chooses the selection tool chosen last; macOS gives the command no +/// default key. Edit › Keyboard Shortcuts lists it, and a chord the user assigns runs it. +#[test] +fn ctrl_backtick_chooses_the_last_selection_tool() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let mac = crate::keymap::platform().is_mac(); + let list = app.run("shortcuts.list", json!({ "query": "tool.selectLastSelection" })).unwrap(); + let listed = list.as_array().unwrap().iter().find(|e| e["id"] == "tool.selectLastSelection").cloned(); + let listed = listed.unwrap_or_else(|| panic!("listed: {list}")); + assert_eq!(listed["label"], "Select Last Selection Tool"); + assert_eq!(listed["default"], if mac { json!(null) } else { json!("Cmd+~") }); + app.select_tool("directSelection"); + app.select_tool("pen"); + frame(&mut app, press(Key::Backtick, cmd())); + assert_eq!(app.session.tool_id(), if mac { "pen" } else { "directSelection" }); + crate::keymap::set_override(&mut app.ui.shortcut_overrides, "tool.selectLastSelection", "Alt+~"); + app.select_tool("groupSelection"); + app.select_tool("rectangle"); + frame(&mut app, press(Key::Backtick, Modifiers::ALT)); + assert_eq!(app.session.tool_id(), "groupSelection", "the user's chord"); + crate::shortcut_editor::sync(&crate::state::UiState::default()); +} diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 8f9ca43741..f3e5103c19 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -101,7 +101,7 @@ pub fn sync_zoom_stops_display_print_size(v: bool) { ZOOM_STOPS_PRINT_SIZE.store(v, Ordering::Relaxed); } -/// Illustrator's preset zoom stops, in percent. +/// The preset zoom stops, in percent. pub const ZOOM_STOPS: [f64; 26] = [ 3.13, 4.17, 6.25, 8.33, 12.5, 16.67, 25.0, 33.33, 50.0, 66.67, 100.0, 150.0, 200.0, 300.0, 400.0, 600.0, 800.0, 1200.0, 1600.0, 2400.0, 3200.0, 4800.0, 6400.0, 12800.0, 25600.0, 64000.0, @@ -135,7 +135,7 @@ pub fn next_zoom_with_display(z: f64, up: bool, display_print_size: bool) -> f64 zoom_from_display_percent(stop, display_print_size) } -/// Format like Illustrator's tab/zoom field: up to 2 decimals, no trailing zeros. +/// Format for the tab/zoom field: up to 2 decimals, no trailing zeros. pub fn zoom_label(z: f64, display_print_size: bool) -> String { let s = format!("{:.2}", zoom_display_percent(z, display_print_size)); let s = s.trim_end_matches('0').trim_end_matches('.'); @@ -231,6 +231,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[ (crate::addons::pathtools::ID, "Anchor Inspector", "dc-anchor-smooth"), (crate::addons::pathtools::shape::ID, "Parametric Shape", "hexagon"), (crate::addons::pen::ID, "Smart Pen", "spline-pointer"), + (crate::addons::units::ID, "Unit Converter", "ruler"), ]; /// Groups of icon panels separated by dividers in the collapsed column. @@ -459,7 +460,7 @@ pub struct UiState { pub toolbar_advanced: bool, #[serde(default = "yes")] pub task_bar: bool, - /// Where the Contextual Task Bar was dragged or pinned. Not saved, as in Illustrator: the bar + /// Where the Contextual Task Bar was dragged or pinned. Not saved: the bar /// starts under the selection at every launch. #[serde(skip)] pub task_bar_place: TaskBarPlace, @@ -547,7 +548,9 @@ pub struct UiState { pub toolbar_pos: Option<[f32; 2]>, /// The docked Tools panel sits between the left-side panels and the canvas instead of at the /// window's left edge (Window › Toolbars › Keep Tools Beside the Canvas, - /// `window.toolsBesideCanvas`). Off by default, and off in state saved without it. + /// `window.toolsBesideCanvas`). Dropping Tools on the canvas's left edge, right of panels docked + /// on the left, turns it on, and on the window's left edge turns it off; with no panels docked on + /// the left, a drop leaves it as it is. Off by default, and off in state saved without it. #[serde(default)] pub tools_beside_canvas: bool, /// The docked Tools panel stands on the right, between the canvas and the panels, instead of on @@ -837,6 +840,11 @@ pub struct UiState { /// them (#1732). #[serde(default)] pub transform_each: Value, + /// The Expand choices OK last expanded with in this run of the app (object, fill, stroke, + /// gradient, steps; null: none yet): the Expand dialog opens on them, and Object › Expand… + /// chosen with Alt (Option) expands with them at once. They are not kept across launches. + #[serde(skip)] + pub expand_options: Value, /// The spacing used the last time Rearrange All Artboards was confirmed. #[serde(default)] pub rearrange_artboards_spacing: Value, @@ -1276,6 +1284,7 @@ impl Default for UiState { simplify: Value::Null, move_options: Value::Null, transform_each: Value::Null, + expand_options: Value::Null, rearrange_artboards_spacing: Value::Null, dxf_import: Value::Null, psd_import: Value::Null, diff --git a/crates/ui-egui/src/tests/recolor.rs b/crates/ui-egui/src/tests/recolor.rs index f4d2d6e85a..0d5bacd77c 100644 --- a/crates/ui-egui/src/tests/recolor.rs +++ b/crates/ui-egui/src/tests/recolor.rs @@ -1585,3 +1585,29 @@ fn row_context_menu_pick_from_swatches_and_limit_to_library() { assert_eq!(colors(h.state_mut()), 2, "Recolor Cancel restores the original artwork"); } } + +/// With the Color Groups list shown, the Color Picker opened from a row and closed with Cancel +/// leaves Recolor Artwork the size it was and where it was, in every frame. +#[test] +fn the_color_picker_leaves_the_dialog_in_place() { + use egui::accesskit::Role; + + let mut app = app(); + art(&mut app, &["#ff0000", "#0000ff"]); + let mut h = assign_harness(app, json!({})); + assert_eq!(field(h.state(), "groupStorage"), json!(true), "the list is shown"); + let window = egui::Id::unique(("dialog", "recolor")); + let rect = |h: &egui_kittest::Harness<'_, VectorcraftApp>| h.ctx.memory(|m| m.area_rect(window)); + let before = rect(&h).expect("dialog drawn"); + row_context_menu(&mut h, 1); + h.get_by_label(" Pick from Swatches").click(); + h.run_steps(3); + assert_eq!(h.state().ui.dialog.as_ref().map(|d| d.kind.as_str()), Some("colorPicker")); + assert_eq!(rect(&h), Some(before), "the dialog keeps its size while the picker is open"); + h.get_by_role_and_label(Role::Button, "Cancel").click(); + for step in 0..4 { + h.run_steps(1); + assert_eq!(rect(&h), Some(before), "frame {step} after Cancel"); + } + assert_eq!(h.state().ui.dialog.as_ref().map(|d| d.kind.as_str()), Some("recolor")); +} diff --git a/crates/ui-egui/src/tests/scripts_menu.rs b/crates/ui-egui/src/tests/scripts_menu.rs index 7cfa5fe2b5..93f0117eb8 100644 --- a/crates/ui-egui/src/tests/scripts_menu.rs +++ b/crates/ui-egui/src/tests/scripts_menu.rs @@ -80,19 +80,22 @@ fn finish(app: &mut VectorcraftApp) { const DRAW: &str = "vc.run('shape.rectangle', {x:0,y:0,width:10,height:10}); vc.run('shape.rectangle', {x:20,y:0,width:10,height:10});"; +/// The items File › Scripts always ends with. +const FIXED: &str = "Check Script…, Other Script…"; + #[test] fn the_folders_scripts_are_listed_above_check_script_and_other_script() { let dir = folder("listed"); let app = app(&dir); - assert_eq!(shape(&scripts()), "Check Script…, Other Script…", "before the first listing"); + assert_eq!(shape(&scripts()), FIXED, "before the first read"); read(&app); - assert_eq!(shape(&scripts()), "Check Script…, Other Script…", "an empty folder"); + assert_eq!(shape(&scripts()), FIXED, "an empty folder"); let draw = write(&dir, "Draw Two.jsx", DRAW); write(&dir, "Export/All Artboards.js", ""); write(&dir, "notes.txt", ""); read(&app); let items = scripts(); - assert_eq!(shape(&items), "Draw Two, Export/[All Artboards], -, Check Script…, Other Script…"); + assert_eq!(shape(&items), format!("Draw Two, Export/[All Artboards], -, {FIXED}")); assert!(matches!(&items[0], Item::Cmd(_, scripts_menu::COMMAND, p) if *p == json!({ "path": draw })), "{:?}", items[0]); // A script added to the folder is listed by the next read, with no restart. write(&dir, "Added.js", ""); @@ -201,7 +204,7 @@ fn a_script_that_left_the_folder_is_not_run_and_the_folder_is_read_again() { assert_eq!(e, "the script is no longer in the Scripts folder"); assert!(!app.session.script_running()); scripts_menu::wait(); - assert_eq!(shape(&scripts()), "kept, -, Check Script…, Other Script…"); + assert_eq!(shape(&scripts()), format!("kept, -, {FIXED}")); // A file outside the folder is not one of its scripts, and a call needs a path. let outside = dir.join("outside.js"); std::fs::write(&outside, DRAW).unwrap(); @@ -246,12 +249,12 @@ fn the_menu_notes_a_listing_that_stopped_and_a_folder_it_cannot_read() { read(&app); let items = scripts(); assert_eq!(items.len(), vectorcraft_engine::script::folder::MAX_SCRIPTS + 4); - assert_eq!(shape(&items[items.len() - 4..]), format!("({}), -, Check Script…, Other Script…", scripts_menu::TRUNCATED)); + assert_eq!(shape(&items[items.len() - 4..]), format!("({}), -, {FIXED}", scripts_menu::TRUNCATED)); // A file where the folder should be. std::fs::remove_dir_all(dir.join("Scripts")).unwrap(); std::fs::write(dir.join("Scripts"), "").unwrap(); read(&app); - assert_eq!(shape(&scripts()), format!("({}), -, Check Script…, Other Script…", scripts_menu::UNREADABLE)); + assert_eq!(shape(&scripts()), format!("({}), -, {FIXED}", scripts_menu::UNREADABLE)); let _ = std::fs::remove_dir_all(dir); } @@ -284,7 +287,7 @@ fn names_past_the_session_limit_are_left_out_with_the_note() { let app = app(&dir); write(&dir, "Kept.js", ""); read(&app); - assert_eq!(shape(&scripts()), "Kept, -, Check Script…, Other Script…"); + assert_eq!(shape(&scripts()), format!("Kept, -, {FIXED}")); // Names other listings showed fill what one session keeps. for n in 0..scripts_menu::MAX_NAMES { if scripts_menu::intern(&format!("renamed {n}")).is_none() { @@ -294,7 +297,7 @@ fn names_past_the_session_limit_are_left_out_with_the_note() { write(&dir, "New.js", ""); write(&dir, "Folder/Inside.js", ""); read(&app); - assert_eq!(shape(&scripts()), format!("Kept, ({}), -, Check Script…, Other Script…", scripts_menu::TRUNCATED)); + assert_eq!(shape(&scripts()), format!("Kept, ({}), -, {FIXED}", scripts_menu::TRUNCATED)); let _ = std::fs::remove_dir_all(dir); } @@ -305,7 +308,8 @@ fn the_macos_menu_bar_lists_the_same_scripts_and_follows_a_new_listing() { let path = write(&dir, "Export/All Artboards.js", ""); let before = scripts_menu::revision(); read(&app); - assert_eq!(scripts_menu::revision(), before + 1); + // The loading note showed, then the listing took its place. + assert_eq!(scripts_menu::revision(), before + 2); let bar = native_menu::from_tree(&app, &menus::menu_tree()); let file = bar.menus.iter().find(|m| m.title == "File").unwrap(); let scripts = file.children.iter().find_map(|n| match n { @@ -321,10 +325,10 @@ fn the_macos_menu_bar_lists_the_same_scripts_and_follows_a_new_listing() { assert!(script.enabled && script.shortcut.is_none()); // A read that finds the same scripts changes nothing the menu bar would rebuild for. read(&app); - assert_eq!(scripts_menu::revision(), before + 1); + assert_eq!(scripts_menu::revision(), before + 2); write(&dir, "More.jsx", ""); read(&app); - assert_eq!(scripts_menu::revision(), before + 2); + assert_eq!(scripts_menu::revision(), before + 3); let _ = std::fs::remove_dir_all(dir); } @@ -424,9 +428,130 @@ fn a_read_asked_for_during_another_runs_when_that_one_ends() { fn an_app_without_a_scripts_folder_keeps_the_two_fixed_items() { let mut app = VectorcraftApp::new(Session::new(), crate::Services::default()); read(&app); - assert_eq!(shape(&scripts()), "Check Script…, Other Script…"); + assert_eq!(shape(&scripts()), FIXED, "no loading note: there is no folder to read"); let e = menus::run_ui_command(&mut app, scripts_menu::COMMAND, &json!({ "path": "draw.js" })).unwrap().unwrap_err(); assert_eq!(e, "the script is no longer in the Scripts folder"); assert_eq!(menus::UI_COMMANDS.iter().filter(|c| c.0 == scripts_menu::COMMAND).count(), 1); let _: Value = app.run("script.listInstalled", json!({})).unwrap(); } + +/// File › Scripts in the macOS menu bar as text, as [`shape`] gives the in-window menu. +fn native_shape(app: &VectorcraftApp) -> String { + fn one(nodes: &[Node]) -> String { + let node = |n: &Node| match n { + Node::Item(it) if it.command.is_none() => format!("({})", it.label), + Node::Item(it) => it.label.clone(), + Node::Header(label) => format!("({label})"), + Node::Submenu { label, children } => format!("{label}/[{}]", one(children)), + Node::Separator => "-".to_string(), + Node::Standard(s) => format!("{s:?}"), + }; + nodes.iter().map(node).collect::>().join(", ") + } + let bar = native_menu::from_tree(app, &menus::menu_tree()); + let file = bar.menus.iter().find(|m| m.title == "File").unwrap(); + let scripts = file.children.iter().find_map(|n| match n { + Node::Submenu { label, children } if label == "Scripts" => Some(children), + _ => None, + }); + one(scripts.unwrap()) +} + +#[test] +fn the_first_read_shows_a_loading_note_until_its_listing_comes() { + let dir = folder("loading"); + let app = app(&dir); + write(&dir, "first.js", ""); + let before = scripts_menu::revision(); + scripts_menu::refresh(&app, None); + scripts_menu::end_untaken(); + let loading = format!("({}), -, {FIXED}", scripts_menu::LOADING); + assert_eq!(shape(&scripts()), loading); + assert_eq!(native_shape(&app), loading, "the macOS menu bar shows the same note"); + assert_eq!(scripts_menu::revision(), before + 1, "the macOS menu bar rebuilds for the note"); + scripts_menu::wait(); + assert_eq!(shape(&scripts()), format!("first, -, {FIXED}")); + assert_eq!(native_shape(&app), format!("first, -, {FIXED}")); + assert_eq!(scripts_menu::revision(), before + 2); + // A later read keeps the listing, with no note, while it is under way. + write(&dir, "second.js", ""); + scripts_menu::refresh(&app, None); + scripts_menu::end_untaken(); + assert_eq!(shape(&scripts()), format!("first, -, {FIXED}")); + assert_eq!(scripts_menu::revision(), before + 2); + scripts_menu::wait(); + assert_eq!(shape(&scripts()), format!("first, second, -, {FIXED}")); + let _ = std::fs::remove_dir_all(dir); +} + +#[test] +fn an_empty_or_unreadable_first_listing_takes_the_place_of_the_loading_note() { + let dir = folder("loading-empty"); + let app = app(&dir); + let before = scripts_menu::revision(); + read(&app); + assert_eq!(shape(&scripts()), FIXED); + assert_eq!(scripts_menu::revision(), before + 2, "the note went, though the listing is the empty one it started from"); + let _ = std::fs::remove_dir_all(dir); + // A thread of its own has a menu that has not listed yet. + let dir = folder("loading-unreadable"); + std::fs::remove_dir_all(dir.join("Scripts")).unwrap(); + std::fs::write(dir.join("Scripts"), "").unwrap(); + let there = dir.clone(); + std::thread::spawn(move || { + let app = self::app(&there); + read(&app); + assert_eq!(shape(&scripts()), format!("({}), -, {FIXED}", scripts_menu::UNREADABLE)); + }) + .join() + .unwrap(); + let _ = std::fs::remove_dir_all(dir); +} + +#[test] +fn a_slow_first_read_says_so_until_its_listing_comes() { + let dir = folder("slow"); + let app = app(&dir); + write(&dir, "first.js", ""); + scripts_menu::refresh(&app, None); + scripts_menu::end_untaken(); + let started = scripts_menu::first_read_started().unwrap(); + let before = scripts_menu::revision(); + scripts_menu::check_slow(started + scripts_menu::SLOW_SECS / 2.0); + assert_eq!(shape(&scripts()), format!("({}), -, {FIXED}", scripts_menu::LOADING)); + assert_eq!(scripts_menu::revision(), before); + scripts_menu::check_slow(started + scripts_menu::SLOW_SECS); + assert_eq!(shape(&scripts()), format!("({}), -, {FIXED}", scripts_menu::SLOW)); + assert_eq!(native_shape(&app), format!("({}), -, {FIXED}", scripts_menu::SLOW)); + assert_eq!(scripts_menu::revision(), before + 1); + // Asking again while it reads starts no second read. + scripts_menu::refresh(&app, None); + scripts_menu::check_slow(started + 10.0 * scripts_menu::SLOW_SECS); + assert_eq!(scripts_menu::revision(), before + 1); + scripts_menu::wait(); + assert_eq!(shape(&scripts()), format!("first, -, {FIXED}")); + assert_eq!(scripts_menu::first_read_started(), None); + let _ = std::fs::remove_dir_all(dir); +} + +#[test] +fn a_first_read_that_ends_without_a_listing_says_the_folder_cannot_be_read_and_the_next_read_tries_again() { + let dir = folder("lost"); + let app = app(&dir); + write(&dir, "first.js", ""); + scripts_menu::refresh(&app, None); + scripts_menu::end_untaken(); + scripts_menu::lose_read(); + let before = scripts_menu::revision(); + scripts_menu::wait(); + assert_eq!(shape(&scripts()), format!("({}), -, {FIXED}", scripts_menu::UNREADABLE), "no loading note left behind"); + assert_eq!(native_shape(&app), format!("({}), -, {FIXED}", scripts_menu::UNREADABLE)); + assert_eq!(scripts_menu::revision(), before + 1); + assert_eq!(scripts_menu::first_read_started(), None); + scripts_menu::refresh(&app, None); + scripts_menu::end_untaken(); + assert_eq!(shape(&scripts()), format!("({}), -, {FIXED}", scripts_menu::LOADING)); + scripts_menu::wait(); + assert_eq!(shape(&scripts()), format!("first, -, {FIXED}")); + let _ = std::fs::remove_dir_all(dir); +} diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 56de30acff..c7aeadcdc2 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -127,21 +127,20 @@ pub(crate) fn docked_width(ui: &crate::state::UiState) -> f32 { } } -/// With `UiState::tools_beside_canvas` on, the canvas-edge redocking target, registered even -/// while Tools floats, and the docked panel, which follows the canvas's left edge as dock columns -/// resize, collapse or hide. With it off, `app.rs` draws Tools before the docking layout. +/// The canvas-edge redocking targets, registered even while Tools floats, whichever way +/// `UiState::tools_beside_canvas` is (a drop on the left one turns it on), and, with it on, the +/// docked panel, which follows the canvas's left edge as dock columns resize, collapse or hide. +/// With it off, `app.rs` draws Tools before the docking layout. /// -/// The canvas's right edge, left of the panels, is a redocking target too, and Tools docked there -/// (`UiState::toolbar_right`) is drawn at it whichever way the setting is. +/// Tools docked on the canvas's right edge, left of the panels (`UiState::toolbar_right`), is +/// drawn there whichever way the setting is. pub(crate) fn show_beside_canvas(app: &mut VectorcraftApp, ui: &mut Ui) { if !app.ui.toolbar || app.ui.screen_mode >= 3 { return; } let canvas = ui.available_rect_before_wrap(); crate::tools_float::set_right_dock_zone(ui.ctx(), canvas, WIDTH); - if app.ui.tools_beside_canvas { - crate::tools_float::set_dock_zones(ui.ctx(), canvas, WIDTH); - } + crate::tools_float::set_dock_zones(ui.ctx(), canvas, WIDTH); if app.ui.toolbar_pos.is_none() && (app.ui.tools_beside_canvas || app.ui.toolbar_right) { show(app, ui); } diff --git a/crates/ui-egui/src/tools_float.rs b/crates/ui-egui/src/tools_float.rs index b5fb04d384..1511958ff1 100644 --- a/crates/ui-egui/src/tools_float.rs +++ b/crates/ui-egui/src/tools_float.rs @@ -1,10 +1,15 @@ //! The Tools panel floats by its title bar and docks again on the window's left edge //! ([`crate::toolbar`]). It stays outside the docking layout: dragging its title bar out of the //! docked panel floats it under the pointer, a floating panel's title bar moves it, and a release -//! over the strip along the window's left edge (lit up) docks it there. With Keep Tools Beside the -//! Canvas on (`UiState::tools_beside_canvas`), a release over the canvas's left edge docks it too, -//! and either release docks it beside the canvas. A release over the canvas's right edge (left of -//! the panels) or the window's right edge docks it on the right, between the canvas and the panels. +//! over the strip along the window's left edge (lit up) docks it there. A release over the strip +//! along the canvas's left edge, right of any panels docked on the left, docks it beside the +//! canvas. The release sets Keep Tools Beside the Canvas (`UiState::tools_beside_canvas`) to the +//! place it docked at. With no panels docked on the left, both strips put Tools in the same +//! place (left of any toolbars made with New Toolbar docked there), and a drop on either docks it +//! where the setting puts it and leaves the setting as it is; so does a drop in the column both +//! strips share when the panels are collapsed narrower than the window's strip. A release over +//! the canvas's right edge (left of the panels) or the window's right edge docks it on the right, +//! between the canvas and the panels. //! Escape or losing the window's focus puts it back where the drag began. //! //! `window.panel.float {panel: "tools"}` / `window.panel.dock {panel: "tools"}` do the same for @@ -32,6 +37,9 @@ struct Move { original: Option<[f32; 2]>, /// The side it was docked on before the drag. right: bool, + /// The frame that floated it from the window's left edge, whose canvas-edge strip was laid out + /// right of the docked panel and is not a target. + floated_from_edge: Option, } fn move_id() -> Id { @@ -53,8 +61,8 @@ pub(crate) fn mark_escape_cancelled(ctx: &egui::Context) { ctx.data_mut(|d| d.insert_temp(escape_cancel_id(), frame)); } -/// The strip along the canvas's left edge where the Tools panel docks while Keep Tools Beside the -/// Canvas is on, as last laid out. +/// The strip along the canvas's left edge where the Tools panel docks beside the canvas, as last +/// laid out. pub(crate) fn tools_zone_id() -> Id { Id::unique("tools-float-zone") } @@ -82,10 +90,14 @@ pub(crate) fn set_dock_zones(ctx: &egui::Context, canvas: Rect, width: f32) { }); } -/// Forget the canvas-edge target, so a strip laid out while Keep Tools Beside the Canvas was on -/// does not dock Tools after it is turned off. -pub(crate) fn clear_canvas_dock_zone(ctx: &egui::Context) { - ctx.data_mut(|d| d.remove::(tools_zone_id())); +fn dock_area_id() -> Id { + Id::unique("tools-float-dock-area-left") +} + +/// The left edge of the space the canvas and the panels share, as last laid out: right of the +/// lane of New Toolbar toolbars docked on the left, and of Tools docked at the window's edge. +pub(crate) fn set_dock_area_left(ctx: &egui::Context, left: f32) { + ctx.data_mut(|d| d.insert_temp(dock_area_id(), left)); } /// The legacy 48-point window-edge target spans the full layout below the bars, including @@ -113,9 +125,10 @@ pub(crate) fn cancel_move_on_escape(app: &mut VectorcraftApp, ctx: &egui::Contex } } -fn start(app: &VectorcraftApp, ctx: &egui::Context, grab: Vec2) { +fn start(app: &VectorcraftApp, ctx: &egui::Context, grab: Vec2, floated_from_edge: Option) { let Some(from) = ctx.input(|i| i.pointer.press_origin().or(i.pointer.interact_pos())) else { return }; - ctx.data_mut(|d| d.insert_temp(move_id(), Move { grab, from, original: app.ui.toolbar_pos, right: app.ui.toolbar_right })); + let m = Move { grab, from, original: app.ui.toolbar_pos, right: app.ui.toolbar_right, floated_from_edge }; + ctx.data_mut(|d| d.insert_temp(move_id(), m)); } /// The Tools panel's title bar was pressed (`title`, the panel's bounds `bounds`): docked, dragging @@ -126,11 +139,12 @@ pub(crate) fn drag_tools(app: &mut VectorcraftApp, ctx: &egui::Context, title: & } let Some(at) = ctx.input(|i| i.pointer.interact_pos()) else { return }; match floating { - Some(pos) if title.drag_started() => start(app, ctx, at - pos), + Some(pos) if title.drag_started() => start(app, ctx, at - pos, None), None if title.dragged() && !bounds.contains(at) => { // Held where the press grabbed the title bar. let grab = ctx.input(|i| i.pointer.press_origin()).map_or(vec2(10.0, 7.0), |p| p - bounds.min); - start(app, ctx, grab); + let at_edge = !app.ui.tools_beside_canvas && !app.ui.toolbar_right; + start(app, ctx, grab, at_edge.then(|| ctx.cumulative_frame_nr_for(ctx.viewport_id()))); let p = at - grab; app.ui.toolbar_pos = Some([p.x, p.y]); } @@ -138,23 +152,50 @@ pub(crate) fn drag_tools(app: &mut VectorcraftApp, ctx: &egui::Context, title: & } } -/// The docking strip under `at`, if any, and whether it docks the panel on the right: the window's -/// left edge, with `beside_canvas` the canvas's left edge as well, and on the right the canvas's -/// right edge or anywhere along the window's right edge (which lights up the strip left of the -/// panels, where it docks). -fn drop_zone(ctx: &egui::Context, at: Pos2, beside_canvas: bool) -> Option<(Rect, bool)> { - let (left, right) = ctx.data(|d| { - let canvas = d.get_temp::(tools_zone_id()).filter(|_| beside_canvas); - let left = [canvas, d.get_temp::(window_zone_id())].into_iter().flatten().find(|r| r.contains(at)); - (left, d.get_temp::(tools_zone_right_id())) +/// Where a release docks the Tools panel. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum Dock { + /// On the left: beside the canvas (`Some(true)`), at the window's edge (`Some(false)`), or + /// where Keep Tools Beside the Canvas puts it (`None`, where the two strips share a column). + Left(Option), + /// On the right, between the canvas and the panels. + Right, +} + +/// The docking strip under `at`, if any, and where it docks the panel: the window's left edge, +/// the canvas's left edge, and on the right the canvas's right edge or anywhere along the +/// window's right edge (which lights up the strip left of the panels, where it docks). With no +/// panels docked on the left, both left strips put Tools in the same place, and a drop on either +/// docks it where `beside_canvas` puts it; with panels collapsed narrower than the window's strip, +/// so does a drop in the column the two strips share. The canvas's strip lights up where both are +/// under `at` and `beside_canvas` is on; with no panels docked on the left, the window's strip lights +/// up, where Tools docks. Without `canvas_laid_out`, the canvas's strip is skipped. +fn drop_zone(ctx: &egui::Context, at: Pos2, beside_canvas: bool, canvas_laid_out: bool) -> Option<(Rect, Dock)> { + let (canvas, window, right, area_left) = ctx.data(|d| { + let canvas = d.get_temp::(tools_zone_id()).filter(|_| canvas_laid_out); + (canvas, d.get_temp::(window_zone_id()), d.get_temp::(tools_zone_right_id()), d.get_temp::(dock_area_id())) }); - if let Some(r) = left { - return Some((r, false)); + let panels_left = matches!((canvas, area_left), (Some(c), Some(left)) if c.left() > left + 0.5); + let shared = !panels_left || matches!((canvas, window), (Some(c), Some(w)) if c.x_range().contains(at.x) && w.x_range().contains(at.x)); + let follow = |beside: bool| Dock::Left((!shared).then_some(beside)); + // With no panels docked on the left, Tools docks at the window's edge either way. + let shown = |hit: Rect| if panels_left { hit } else { window.unwrap_or(hit) }; + match (canvas.filter(|r| r.contains(at)), window.filter(|r| r.contains(at))) { + (Some(c), Some(w)) => return Some((shown(if beside_canvas { c } else { w }), follow(beside_canvas))), + (Some(c), None) => return Some((shown(c), follow(true))), + (None, Some(w)) => return Some((w, follow(false))), + (None, None) => {} } let r = right?; // Read outside the data lock above: egui's context locks are not re-entrant. let at_edge = at.x >= ctx.content_rect().right() - crate::toolbar::WIDTH && r.y_range().contains(at.y); - (r.contains(at) || at_edge).then_some((r, true)) + (r.contains(at) || at_edge).then_some((r, Dock::Right)) +} + +/// The strip that lights up with the pointer at `at` during a move. +#[cfg(test)] +pub(crate) fn drop_highlight(ctx: &egui::Context, at: Pos2, beside_canvas: bool) -> Option { + drop_zone(ctx, at, beside_canvas, true).map(|(zone, _)| zone) } fn highlight(ctx: &egui::Context, zone: Rect) { @@ -179,7 +220,11 @@ pub fn track(app: &mut VectorcraftApp, ctx: &egui::Context) { return; } let at = ctx.input(|i| i.pointer.interact_pos()); - let zone = at.filter(|at| at.distance(m.from) > TRAVEL).and_then(|at| drop_zone(ctx, at, app.ui.tools_beside_canvas)); + // The frame after Tools floated from the window's edge reads the canvas-edge strip that frame + // laid out right of the docked panel. + let frame = ctx.cumulative_frame_nr_for(ctx.viewport_id()); + let canvas_laid_out = m.floated_from_edge.is_none_or(|f| frame > f + 1); + let zone = at.filter(|at| at.distance(m.from) > TRAVEL).and_then(|at| drop_zone(ctx, at, app.ui.tools_beside_canvas, canvas_laid_out)); if ctx.input(|i| i.pointer.primary_down()) { if let Some(p) = at.map(|at| at - m.grab) && p.x.is_finite() @@ -194,9 +239,19 @@ pub fn track(app: &mut VectorcraftApp, ctx: &egui::Context) { return; } ctx.data_mut(|d| d.remove::(move_id())); - if let Some((_, right)) = zone { - app.ui.toolbar_pos = None; - app.ui.toolbar_right = right; + match zone { + Some((_, Dock::Left(beside))) => { + app.ui.toolbar_pos = None; + app.ui.toolbar_right = false; + if let Some(beside) = beside { + app.ui.tools_beside_canvas = beside; + } + } + Some((_, Dock::Right)) => { + app.ui.toolbar_pos = None; + app.ui.toolbar_right = true; + } + None => {} } } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index fb291b8525..797602dcc5 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -607,7 +607,7 @@ mod decimal_point_tests { } assert_eq!(mm("1,000.5"), None, "a point and a comma"); assert_eq!(mm("1,2,3"), None, "two commas"); - for thousand in ["1,000", "12,500 mm", "-1,000", "999,999mm"] { + for thousand in ["1,000", "12,500 mm", "-1,000", "+1,000", "999,999mm", "1,000\"", "1,000'"] { assert_eq!(mm(thousand), None, "{thousand} reads as thousands: refused, not a thousand times too small"); } for (text, want) in [("0,125", 0.125), ("1,25", 1.25), ("1,0000", 1.0), ("1,500+2", 3.5)] { @@ -651,6 +651,15 @@ mod field_number_tests { assert_eq!(field_number("50% / 2", "%", false), Some(25.0)); } + /// A resolution field reads the unit it shows: "200 ppp" in a French interface. + #[test] + fn a_resolution_field_reads_its_translated_unit() { + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").unwrap()); + let read = [field_number("200 ppp", &crate::dialogs::ppi_suffix(), false), field_number("200", &crate::dialogs::ppi_suffix(), false)]; + crate::i18n::set_current(crate::i18n::Lang::EN); + assert_eq!(read, [Some(200.0), Some(200.0)]); + } + /// A thousands comma is refused inside Kerning's pair of parentheses and before `%` or the /// suffix, as it is in plain text, rather than read as a decimal comma (`(1,000)` as 1). #[test] diff --git a/crates/ui-egui/src/widgets/color.rs b/crates/ui-egui/src/widgets/color.rs index 2c7711321d..6b09d3da30 100644 --- a/crates/ui-egui/src/widgets/color.rs +++ b/crates/ui-egui/src/widgets/color.rs @@ -12,7 +12,7 @@ pub enum Live { } /// A colour slider with a gradient track (`track(t)` gives the colour at 0..1) and a triangular -/// thumb below it, like Illustrator's Color panel. Returns the new normalized value and the phase. +/// thumb below it, as in the Color panel. Returns the new normalized value and the phase. pub fn color_slider(ui: &mut Ui, id: impl std::hash::Hash, value: f32, width: f32, track: &dyn Fn(f32) -> Color32) -> (Option, Live) { color_slider_named(ui, id, "", value, width, track) } diff --git a/crates/ui-egui/src/widgets/labels.rs b/crates/ui-egui/src/widgets/labels.rs index 221d418a46..9843ffbf44 100644 --- a/crates/ui-egui/src/widgets/labels.rs +++ b/crates/ui-egui/src/widgets/labels.rs @@ -176,7 +176,7 @@ pub fn subheader(ui: &mut Ui, text: &str) { ui.label(egui::RichText::new(tl!(text)).size(12.5).color(t.text)); } -/// A label drawn with a dotted underline (Illustrator's link labels: "Stroke:", "Opacity:"). +/// A label drawn with a dotted underline (the panels' link labels: "Stroke:", "Opacity:"). pub fn link_label(ui: &mut Ui, text: &str) -> Response { let t = Tokens::get(ui.ctx()); let galley = ui.painter().layout_no_wrap(tl!(text).to_string(), egui::FontId::proportional(12.5), t.text_strong); diff --git a/crates/ui-egui/src/widgets/numeric.rs b/crates/ui-egui/src/widgets/numeric.rs index 89ce8d70d5..01ce18757f 100644 --- a/crates/ui-egui/src/widgets/numeric.rs +++ b/crates/ui-egui/src/widgets/numeric.rs @@ -22,29 +22,7 @@ pub(crate) fn typed_unit(ctx: &egui::Context, unit: Unit) -> Unit { if bare_points && unit == Unit::Picas { Unit::Points } else { unit } } -/// `text` typed in a numeric field, with a decimal comma read as a point: `0,1 mm` is `0.1 mm` -/// (#3837), and each number of a sum reads its own separator, so `100.5 mm-0,5` (a comma typed -/// after the value the field shows) is 100 mm (#5684). A number written with both separators has -/// two points once read, so `1,000.5` and `1.234,5` are refused rather than guessed at; so is a -/// number that reads as thousands ([`thousands`]). -pub(super) fn decimal_point(text: &str) -> std::borrow::Cow<'_, str> { - if text.contains(',') && !thousands(text) { text.replace(',', ".").into() } else { text.into() } -} - -/// Is `text` a number written with a thousands comma, as `1,000` or `12,500 mm`: one to three -/// digits (not a lone 0), a comma, exactly three digits, then at most a unit? Read as a decimal it -/// would be a thousand times too small, so the field refuses it instead (`0,125` and `1,25` are -/// decimals). -fn thousands(text: &str) -> bool { - let number = text.trim().trim_start_matches('-'); - let Some((whole, rest)) = number.split_once(',') else { return false }; - let (part, unit) = rest.split_at(rest.find(|c: char| !c.is_ascii_digit()).unwrap_or(rest.len())); - (1..=3).contains(&whole.len()) - && whole.bytes().all(|b| b.is_ascii_digit()) - && !whole.starts_with('0') - && part.len() == 3 - && unit.trim().chars().all(char::is_alphabetic) -} +pub(super) use vectorcraft_doc::decimal_point; /// A recessed numeric field showing `value` (points) in `unit`. Returns the new value (points) /// when the user commits (Enter / focus loss / Shift+Enter, which keeps the focus outside dialogs). @@ -142,7 +120,8 @@ fn unit_field( /// [`unit_field`] whose blank field (`value` is `None`) steps from `blank_from` (points) with /// ↑/↓ and the wheel instead of doing nothing. With `refuse_outside`, a value typed outside -/// `bounds` is refused as text that doesn't read is, rather than kept at the nearer end. +/// `bounds` is refused as text that doesn't read is, rather than kept at the nearer end. Armed +/// with id salt `id` ([`arm_field_focus`]), it takes the keyboard focus with its value selected. #[allow(clippy::too_many_arguments)] fn unit_field_from( ui: &mut Ui, @@ -160,10 +139,18 @@ fn unit_field_from( empty: &str, refuse_outside: bool, ) -> Option { + let armed = take_armed_focus(ui, &id); let id = id_with(ui.scope_id(), id); let shown = value.map(|v| unit.format(v)).unwrap_or_else(|| empty.to_string()); take_dialog_focus(ui, id, &shown); + if armed { + focus_field(ui, id, &shown); + } let (mut buf, commit, resp, rect) = recessed_text(ui, id, &shown, width, 1, label, name); + if armed { + // A field armed while it has focus keeps the text typed into it: select all of that text. + select_all(ui, id, &buf); + } select_all_on_focus(ui, &resp, &buf); // ↑/↓ and the wheel step in the field's unit; a drag on its label scrubs it. let typed = typed_unit(ui.ctx(), unit); @@ -293,8 +280,8 @@ pub(super) fn shown_alike(show: impl Fn(f64) -> String) -> impl Fn(f64, f64) -> /// goes to the next whole number in its direction (5.1 up to 6, down to 5), a Ctrl/Cmd step goes to /// the next tenth, and a Shift step adds or takes ten. Steps stop at the field's `bounds` (#3370: /// a weight stops at 0, a miter limit at 1), and a plain step also stops at each of `stops` -/// ([`step_through`]). The new value is applied at once, as in -/// Illustrator's panels and dialogs, and the new text replaces `buf`, all selected so typing +/// ([`step_through`]). The new value is applied at once, and +/// the new text replaces `buf`, all selected so typing /// replaces it when focused. Returns the new number when a step was taken. An enabled field takes /// the wheel without taking keyboard focus, and the panel under it doesn't scroll, when the wheel /// stream began over the field and the pointer was moved onto it, or pressed on it, after the @@ -745,7 +732,7 @@ impl egui::Plugin for WheelTailPlugin { /// A [`num_field`] for a width or height (Transform panel, Properties panel, Control bar): Ctrl/Cmd+Enter /// also commits it and ends its editing, as Enter does, and [`enter_modifiers`] reports Command. A -/// percentage typed alone (`50%`) is that share of the size shown, as in Illustrator (#2401). +/// percentage typed alone (`50%`) is that share of the size shown (#2401). pub fn size_field(ui: &mut Ui, id: impl std::hash::Hash, value: Option, unit: Unit, width: f32) -> Option { size_field_named(ui, id, None, value, unit, width) } diff --git a/crates/ui-egui/src/workspaces.rs b/crates/ui-egui/src/workspaces.rs index 2a764a6968..886589b5f0 100644 --- a/crates/ui-egui/src/workspaces.rs +++ b/crates/ui-egui/src/workspaces.rs @@ -94,7 +94,7 @@ pub const ESSENTIALS: &str = "Essentials"; /// Touch workspace (Window → Workspace → Touch; Preferences › Devices › Enable Touch Workspace). pub const TOUCH: &str = "Touch"; -/// Built-in workspaces, in Illustrator's menu order (Essentials first). +/// Built-in workspaces, in menu order (Essentials first). pub fn builtins() -> Vec { let base = Workspace::default(); let w = |name: &str, f: &dyn Fn(&mut Workspace)| { diff --git a/docs/control-protocol.md b/docs/control-protocol.md index adac088a13..23894fd6f6 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -302,7 +302,11 @@ right-click menu has Remove Color too. The base color can't be removed. A remove has current colors and art or a group is open: it then keeps them with `to: null`, that art keeps its colors, and the group's swatch at that place is removed. A row with no current colors recolors no art; with a group, the new color of one with `added: true` that is not excluded is added to the group after the group's other colors, and a row made with New Row adds none. -Setting `colors`, a preserve flag or `limitTo` reduces the rows again (also on `ui.dialog.confirm`). The dialog previews +`groupStorage` shows the Color Groups list (true when the dialog opens); setting `group` to a color group's name makes +it the group being edited, as opening on it does, and refuses a name no group has; `groupAction` (`save`, `new` or +`delete`) runs the list's Save Changes, New Color Group or Delete button on the next frame, or first on confirm (see +`docs/mcp.md`). Setting `colors`, a preserve flag or `limitTo` reduces the rows again (also on `ui.dialog.confirm`). +The dialog previews `recolor.apply` on the canvas; confirm keeps it as one undo step (with a group, the group is rewritten in the same step; with no art selected only the group changes). In the Swatches panel, double-clicking a colour group's folder, or the options button while a group is selected, opens it. @@ -496,7 +500,10 @@ the desktop each floating window is an OS window of its own; on the web and on W window. `ui.toolbar_pos` in `ui.inspect` is the Tools panel's corner (null: docked); `window.panel.float` and `window.panel.dock` with `panel: "tools"` float it at `x`, `y` or dock it on the window's left edge. With `window.toolsBesideCanvas {on?}` (Window › Toolbars › Keep Tools Beside the Canvas, off by default; `ui.tools_beside_canvas`) -the docked Tools panel sits between left-side panels and the canvas, and `window.panel.dock` docks it there. +the docked Tools panel sits between left-side panels and the canvas, and `window.panel.dock` docks it there. Dropping +a floating Tools panel on the canvas's left edge, right of panels docked on the left, turns the setting on, and on the +window's left edge turns it off; with no panels docked on the left, a drop leaves the setting as it is +(`docs/mcp.md` › Tools panel placement). Flatten Transparency: `ui.flattenTransparencyDialog` opens the `flattenTransparency` dialog for the selection (fields `preset`: a preset name, setting it loads that preset's options; the option keys of @@ -818,13 +825,21 @@ selected slices. Hidden or locked slices (`view.slices.hide`, `view.slices.lock` EPS Options: Export As… with the EPS format (`file.exportAs {format: "eps"}`, then the save dialog), or `ui.epsOptionsDialog {path?, …document.exportEps options}` for agents, opens the `epsOptions` dialog. Its fields are `document.export` params: `previewFormat` (`none`, `tiffBw`, `tiffColor`), `transparentPreview`, `overprints` -(`preserve`, `discard`), `flattenerPreset` (a built-in or saved preset's name), `includeLinkedFiles`, `thumbnails`, +(`preserve`, `discard`), `flattenerPreset` (a built-in or saved preset's name), `flattener` (custom flattener options +over the preset, as `object.flattenTransparency` takes them), `includeLinkedFiles`, `thumbnails`, `cmykPostScript`, `compatibleGradients`, `level` (`2`, `3`), plus `path` and the artboard choice (`useArtboards`, `range`). `ui.dialog.confirm` checks them (a bad value or an unknown preset keeps the dialog open), remembers them for the next EPS Options and writes the file(s), asking for a path when there is none. With Use Artboards and two or more artboards, it writes a central file of the whole document under the chosen name and one `{stem}_{artboard}.eps` per artboard. When no art shows, it writes only the artboard files. +The Custom… button beside the preset opens the `epsFlattenerOptions` dialog over EPS Options, on the options the +export would use. Its fields are the flattener options; `preserveAlpha` is always off, and overprints are kept only +with `overprints: "preserve"`. Its `ui.dialog.confirm` sets every option as `flattener` (the preset then shows +[Custom]) and goes back to EPS Options; `ui.dialog.cancel` goes back with the options unchanged. Choosing a preset, +in the dropdown or with `ui.dialog.set {flattenerPreset}`, drops `flattener`, and so does `ui.epsOptionsDialog` with +a `flattenerPreset` and no `flattener`. + Data Recovery: at launch, copies left behind by a crash open the `recovery` dialog (never copies another running instance keeps, so instances started side by side for screenshots don't get it). Fields: `copies` (`[{file, title, saved}]`, from `file.recovery.list`) and `discard`. `ui.dialog.confirm` restores them all (`file.recovery.restore` diff --git a/docs/development.md b/docs/development.md index 508c0aea06..50e5cbb972 100644 --- a/docs/development.md +++ b/docs/development.md @@ -84,6 +84,7 @@ The canvas is rasterized on the CPU (`vectorcraft-render`, vello_cpu); the GPU ( - On Linux with Mesa, `MESA_VK_DEVICE_SELECT=10de:2f04!` (vendor:device as `vulkaninfo --summary` or `lspci -nn` show it) leaves only that GPU to Vulkan, and `DRI_PRIME=1` picks the other GPU. - Help › About and the control channel's `ui.inspect` (`graphicsAdapter`) show the adapter in use, and the app logs it at startup. - **How frames reach the display.** By default the window presents with `autovsync` and lets the display queue one frame. With `autovsync`, wgpu uses relaxed vsync (FifoRelaxed, which tears a frame that arrives late) where the driver offers it, else vsync (Fifo). For a launch, `--present-mode` (or `VECTORCRAFT_PRESENT_MODE`) sets the present mode to `fifo` (vsync), `autovsync` or `novsync` (wgpu uses Immediate, else Mailbox, else Fifo, whichever the driver offers), and `--frame-latency` (or `VECTORCRAFT_FRAME_LATENCY`) sets the frames the display may queue, `1` to `3`. A flag overrides its variable, and a value that is not one of these stops the app with a message. On Windows and Linux, a launch with either one set opens its files in a new window, as with `--new-instance`, instead of handing them to a running VectorCraft. At startup the log records what the app asks the window surface for, for example `requested window surface: autovsync, frame latency 2 (override)`. The driver chooses the mode that `autovsync` and `novsync` resolve to and may clamp the latency, and on macOS egui uses at least 2 frames while the window is being resized. The code is `apps/vectorcraft/src/presentation.rs`. +- **Preferences › Performance › Low-Latency Drawing** (`lowLatencyDrawing`, off by default) presents with `novsync` and is read when the app starts, so a change applies after a restart. The present mode comes from `--present-mode` first, then `VECTORCRAFT_PRESENT_MODE`, then this preference, then the default (`autovsync`); `--frame-latency` and `VECTORCRAFT_FRAME_LATENCY` still set the latency with it on. The log names where the mode came from: `requested window surface: novsync (preference), frame latency 1`. Whenever the window presents without vsync (`novsync`, from the preference or an override), frames start at most 240 times a second (about 4.17 ms apart); with vsync the display paces them and no cap applies. ## Logs diff --git a/docs/mcp.md b/docs/mcp.md index 5ff0dbf2d0..6b1ae0738f 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -270,9 +270,22 @@ the suite) keep the agent to the folders you give it: selected objects only, and `clipboard.exportSvg` checks the copied objects, following a relative path from the document they came from while it is open; in a frame a request drives, Copy then puts no SVG on the system clipboard. An image whose pixels the document holds exports embedded, and a URL is not checked. -- With `preserveEditing`, the document an SVG or SVGZ of these outputs carries leaves out the Export for Screens - folder (`export_settings.folder`) when it is outside the read roots, as `document.exportSettings` does; the - other export settings and the art are kept, and the open document keeps the folder. +- The same error refuses, before any file or folder is written, every output of these commands and + `document.exportPdf` that carries the native document (the native file or template, EPS, `.ai`, `.ait` and + PDF files the JavaScript rule above lists, with `selectedOnly` and `document.exportSelection` the selected + objects' document) when that document names a file outside the read roots: a linked image or placed file, the + relative path kept of one (taken from the document's folder), or a data set's image, in every symbol, + pattern, graph design and brush, used or not. A stored brush entry that does not read as a brush is refused + too, since its links cannot be checked. Files that carry no native document are written as before, and the + document keeps every link and data set. +- The document these outputs carry (an SVG or SVGZ with `preserveEditing`, a native file or template, an EPS + file, a `.ai` or `.ait` file, a PDF with Preserve Editing, and the document `file.package` writes and the + linked native documents it rewrites) leaves out the Export for Screens folder (`export_settings.folder`) when + it is outside the read roots, as `document.exportSettings` does; the other export settings and the art are + kept, and the open document keeps the folder. `file.package` copies a linked PDF, `.ai` or EPS file, and a + linked native document with `relink: false`, as it is: when the native document such a file is or carries + keeps a folder outside the read roots, the package is refused before anything is written with "a linked + file's export folder is outside the read roots", which names no file or folder. - `plugin.list`, `plugin.safeMode`, `file.recovery.*` and `ui_inspect`'s `scriptReport` leave out the paths outside the read roots, also those the person or an earlier request put there. In `plugin.list`, the plug-in folder last loaded is `null` in `folder.folder`, and a failed file in `folder.failed` and a plug-in's `source` @@ -1754,7 +1767,8 @@ vectorcraft-cli run --cmd file.new --params '{"width":800,"height":600}' \ `run` prints one JSON line per step (`open`, `cmd`, `export`) and exits non-zero on the first failure, naming the step (counting from 0, as `"$N"` references do) and its command. `--params` applies to the `--cmd` just before it. `run` -also accepts the host commands `file.open`, `file.save`, `file.export`, `file.exportForScreens` and `tool.select`. +also accepts the host commands `file.open`, `file.save`, `file.export`, `file.exportForScreens`, `tool.select` and +`tool.selectLastSelection`. `run --in`, `convert` and `info` read every format `document.open` reads (`vectorcraft-cli --help` lists them). ### Steps from a file or standard input @@ -2774,6 +2788,10 @@ The rest of this section is VectorCraft's own rules: read finds new names after the menus have shown 16,384 different script and folder names since VectorCraft started. When the folder is there and cannot be read, the menu shows `The Scripts folder cannot be read`. +- Until the first read ends, the menu shows `Loading scripts…` in place of the listing, and + `The Scripts folder is still being read` once that read has taken 2 seconds. A first read that cannot start, or + ends without a listing, shows `The Scripts folder cannot be read`, and the next read tries again. Later reads keep + the last listing in the menu while they run. - A listed file is checked again when it is chosen. A file that is gone, is no longer a `.js` or `.jsx` file under the folder, or is or lies behind a link ends with `the script is no longer in the Scripts folder`, and nothing runs. The file is read once for that check, and the text that read checked is the text that runs; its `#include` lines @@ -3226,10 +3244,15 @@ By default the docked Tools panel sits at the window's left edge, outside any pa `window.toolsBesideCanvas {on?}` (Window › Toolbars › Keep Tools Beside the Canvas, remote mode, `invoke_menu`) docks it between those panels and the canvas instead (`on: true`), back at the window's edge (`on: false`), or toggles it (`on` omitted or null), and answers the new state. Any other value of `on` is an error and changes -nothing. With the setting on, a floating Tools panel docks when it is dropped on the canvas's left edge as well as -on the window's left edge, and `window.panel.dock {panel: "tools"}` docks it beside the canvas. A floating Tools -panel stays floating when the setting changes. The setting is VectorCraft's own layout option, off by default; it is -kept with the workspace, and built-in workspaces and workspaces saved without it keep Tools at the window's edge. +nothing. A floating Tools panel dropped on the canvas's left edge, right of any panels docked on the left, docks +beside the canvas and turns the setting on; dropped on the window's left edge, it docks there and turns the setting +off. With no panels docked on the left, both edges put Tools in the same place (left of any toolbars made with +New Toolbar docked there), and a drop on either docks it where the setting puts it and leaves the setting as it +is; so does a drop in the column both edges share when left-side panels are collapsed to icons narrower than the +window's edge strip. With the setting on, `window.panel.dock {panel: "tools"}` docks it beside the canvas. A +floating Tools panel stays floating when the setting changes. The setting is VectorCraft's own layout option, off +by default; it is kept with the workspace, and built-in workspaces and workspaces saved without it keep Tools at +the window's edge. ```json {"name":"invoke_menu","arguments":{"command":"window.toolsBesideCanvas","params":{"on":true}}} @@ -3667,7 +3690,7 @@ already walks Image Trace. Short agent entry points: - Data sets: `dataset.list`, `dataset.new {name, values?}`, `dataset.set {name, newName?, values?}` (`newName` also renames the row, in the same undo step; Edit Data Set's Name field sends it), `dataset.rename`, `dataset.delete`, `dataset.capture`, `dataset.update`, `dataset.select {name}`, `dataset.next` / - `dataset.prev` (each `dataset.select` / next / prev is one undo step over every bound object), `dataset.import {path|data|dataBase64|csv}` / + `dataset.prev` (each `dataset.select` / next / prev is one undo step over every bound object), `dataset.import {path|data|dataBase64|csv, base?}` / `dataset.export {path?}` (CSV: one column per variable, and no column of data set names). `dataset.import` also reads tab-separated files. Every header cell is a variable, whatever its case (`name` and `Name` included). The first row holds the field names, as the @@ -3675,16 +3698,33 @@ already walks Image Trace. Short agent entry points: describes. The rows replace every data set of the document and are named `Data Set 1`, `Data Set 2` and so on, in file order; the document's variables and their bindings stay, and the reply's `deletedDataSets` lists the data sets that were replaced. An import error about a row's values gives the file line the row starts on. A header cell that names no variable defines one, unbound, in the same undo step as the - rows. `#Shown` defines a visibility variable `Shown`, `@Photo` defines an image variable `Photo`, and a cell without - a prefix defines a text variable. `dataset.export` writes a visibility variable's header as `#Shown` and an image - variable's as `@Photo`, and a text or graph variable's as its name alone. Its reply's `warning` names the variables - whose header or values make an import into a document without them refuse the file (a `%` header, a `#` header - whose values aren't true or false). Otherwise it names the variables that such an import does not read back with - their kind: text variables whose names start with `#` or `@`, and graph variables. Export is refused, naming both variables, when a variable's header is - another variable's name (a visibility variable `Show` next to a text variable `#Show`). A prefixed cell whose name - is already a variable of the prefix's kind names it; - one whose name is a variable of another kind fails the import. A `%` cell that isn't a variable's exact name (graph - data files) is refused, and so are two cells that name one variable (`City` twice, or `Shown` and `#Shown`). The + rows. `#Shown` defines a visibility variable `Shown`, `@Photo` defines an image variable `Photo`, `%Sales` defines a + graph variable `Sales`, and a cell without a prefix defines a text variable. The cells of a `%` column are paths of + graph data files, as the set-up page's example shows. Each file is read as the Graph Data window's Import Data reads + one ([add graph data](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/visualize-data/add-graph-data.html)): + at most 1 MB; tab-separated when any line holds a tab, else comma-separated; the first row holds the series labels + and the first column the category labels; UTF-16 by the rule below, else UTF-8. The data becomes the data set's + graph value, which `dataset.select` applies as `graph.setData` applies it, so the graph gets the data that Import + Data and Apply give it. The files are read at import. A relative path is taken from `dataset.import`'s `base` + folder, else from the folder of the CSV file at `path`; with neither (`csv`, `data` or `dataBase64` and no `base`), + it fails the import. This is VectorCraft's own rule, and it differs from an `@` column's: an image path is kept as + the cell gives it, and a relative one is taken from the document's folder when a data set is selected. A `%` path is + followed as an image path is: a path on another computer, or on a network share other than the one `base` or the + CSV file is on, a device, and a URL other than a `file:` URL without a host fail the import with the line, the + column and the reason, and no file is read. A file that is missing, can't be read or is larger than 1 MB, a file + that gives a graph value longer than 256 KB, and `%` columns whose files and graph values hold more than 256 MB in all fail the import with + the line and the column, and the document is left as it was. Each file is read once per import, however many cells + name it, and counts once toward the 256 MB; each cell's graph value counts every time. `dataset.export` writes a + visibility variable's header as `#Shown` and an image variable's as `@Photo`, and a text or graph variable's as its + name alone. Its reply's `warning` names the variables whose header or values make an import into a document without + them refuse the file (a `%` header over values, which such an import reads as file paths, and a `#` header whose + values aren't true or false). Otherwise it names the variables that such an import does not read back with their + kind: variables whose names start with `#`, `@` or `%` and aren't of that prefix's kind, and graph variables. Export + is refused, naming both variables, when a variable's header is another variable's name (a visibility variable + `Show` next to a text variable `#Show`). A prefixed cell whose name is already a variable of the prefix's kind names + it; one whose name is a variable of another kind fails the import, and so do two cells that name one variable + (`City` twice, or `Shown` and `#Shown`). A cell that is a variable's exact name, prefix included, names that + variable, so the cells under a graph variable named `%Sales` are read as graph data in CSV form. The reply's `defined` lists the variables the import defined. While the variables are locked, an import whose header would define a variable fails with "variables are locked". A `dataset.import` file that isn't UTF-8 is read as Windows-1252, unless it starts with the UTF-8 byte-order mark. @@ -3804,6 +3844,19 @@ already walks Image Trace. Short agent entry points: than 8 MiB`. The Actions panel menu's Save Actions… and Load Actions… run these; Load Actions… is disabled where there is no open dialog (the web). `ui.actionSet.load` also reads the action sets other apps save as text (`.aia`); see "Action sets from other apps". + `ui.actionSet.replace {path? | data?}` is the Actions panel menu's Replace Actions…. It reads the file at `path`, else + a picked one, or the file's text `data`, as `ui.actionSet.load` does, with the same formats (`.vcactions` and `.aia`), + limits, errors and reports of left-out steps and unknown commands, and replaces every set in the panel, the built-in + Default Actions set included, with the file's set, which keeps its name. It returns `{changed, set: 0, name, + actions}` with `unknownCommands` and `unknownCount`, or `skipped` and `leftOut`, as a load does. The set becomes + current and selected, the panel's selected action and step and its expanded actions are cleared, and an open Set + Options, New Action, Batch or step dialog that names a set closes; when the panel already holds only a set that saves + alike, in that state, nothing changes, the set keeps its ids and `changed` is false. Omitted params count as `{}`. + Params of another type, another key, a `path` or `data` that is not a string, a file that can't be read or is + refused (an empty one too), a canceled pick (`cancelled`), or a replace while an action records or plays (also while + it waits at a stop) is an error and changes nothing. Replace records no undo step. The menu item asks no question + first, and it is disabled where there is no open dialog (the web) and while an action records or plays. These are + VectorCraft's own rules. - Actions: `ui.action.rename {set, action, name}` renames the Actions panel's action at `action` in set `set` (0 is the top set) to `name` with spaces trimmed from both ends, keeps its steps, function key and color, and returns `{name}`. An index past the last set or action, or an empty name, is an error, and then nothing is renamed. So is a @@ -4772,9 +4825,13 @@ linked moves and the Color Theme Picker leave its new color as it is, and Save A from colors alone leave its new color out. With `limitTo`, a row's `tint` (a percentage, default 100) gives the art linked to the global or spot swatch its new color is that share of its tint; `tint` must be a number. `recolor.randomize` moves a row's `tint` with its new color and removes it from a color it changes, and moves a row's `model` with its new color. `swatch.editGroup {group, colors, rename?}` rewrites a colour group in one undo -step (art linked to its global swatches follows), and `recolor.apply` with `group` recolours the art and rewrites the +step (art linked to its global swatches follows); a `null` in `colors` removes the group's swatch at that place, and +given the group's own colors in order and no new name, it records no undo step. A color key (`recolor.colors`) that +names a swatch's color, rounded to the key's steps, counts as that color, and the swatch keeps its color unrounded. And `recolor.apply` with `group` recolours the art and rewrites the group together. A `null` in `groupColors` removes the group's swatch at that place, and the swatches after it keep -their colors and names; art linked to a removed global swatch keeps its color and is no longer linked to it. Art linked to one of the group's global swatches stays linked when the swatch is rewritten with its +their colors and names; art linked to a removed global swatch keeps its color and is no longer linked to it. `"keep"` in +`groupColors` leaves the swatch at that place its color, without the Global Adjust; past the group's swatches it adds +nothing, and it is refused for a swatch that is not a color. Art linked to one of the group's global swatches stays linked when the swatch is rewritten with its row's new color (the default without `groupColors` when the rows follow the group's order), so a later `swatch.edit` still reaches it; the reply's `relinked` counts the other linked paints that took the group's new colors. Art in a row that is linked to a swatch rewritten with another color keeps its row's new color, even an unchanged one, and is no longer @@ -4840,6 +4897,35 @@ become the `weights` field, which moves the rows' current colors and previews th beside the link button runs `swatch.newGroup` right away, as its own undo step: Save All Colors saves the new colors of the rows that are not excluded and hold current colors, in row order, and Save Prominent Colors saves the bar's colors in the bar's order. +The Recolor Artwork dialog lists the document's color groups on its right, or under the tabs in a window too narrow +for both ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)). +The Show Color Groups button beside the tabs shows or hides the list (the `groupStorage` field, true when the dialog +opens). A click on a group, or `ui.dialog.set` of the `group` field to a group's name, makes it the group being +edited: with art the art is reduced again to a row per color of the group, which become the rows' new colors, and +without art the rows are the group's colors. A name that no group has is refused with `` no colour group `` ``, +and a `group` of null selects none. The buttons under the list are the `groupAction` field. Setting it checks the value, and the next frame of the +dialog runs it (OK with it set in the same request runs it first): +`save` (Save Changes) runs `swatch.editGroup` on the selected group with the colors OK would give it and the name in +`groupName`, `new` (New Color Group) saves the new colors of the rows that are not excluded as `swatch.newGroup` does, +and `delete` (Delete) runs `swatch.delete` on the selected group. Each is its own undo step, and the art keeps its +preview. An excluded row leaves its swatch its own color, with or without art, and an excluded row past the group's +swatches adds none. When several rows list a swatch's color, the swatch follows a row that gives the color a new color +before an excluded row or one that removes the color, as `recolor.apply` maps the art. When the art has colors of the group, +`save` and OK keep the group's swatches in order: a swatch whose color a row lists, or to which an earlier `save` gave +a row's new color, takes that row's new color (its own color when the row is +excluded), so art linked to the swatch takes the color its row shows, and every other swatch keeps its color. A row whose color was removed (`to: null`) and is not excluded +removes its swatch, and the colors added on the Edit tab follow the group's other colors, as at OK. After a `save` with art, the rows' new colors take the Global +Adjust and it goes back to 0%; when the save recolored linked art, the rows are read from the art again and a row with a +color the save gave the art is excluded, also when other art has that color, since a row recolors every use of its +colors alike. Until the rows or the Global Adjust change, OK changes the saved group only by the name +in `groupName`. `save` and `delete` with no group selected answer `` missing `group` ``. `save` on a group with a +swatch that is not a color (a gradient, pattern or None swatch) is refused, because the rows hold only the group's +colors. Any other value is refused. After a Delete without art, OK saves the rows as a new color group. + +```json +{"name":"answer_dialog","arguments":{"set":[{"field":"group","value":"Brights"},{"field":"groupAction","value":"save"}]}} +``` + ```json {"name":"run_command","arguments":{"command":"recolor.weigh","params":{"map":[{"from":["rgb 255 0 0","rgb 128 0 204"],"to":"#00ff00"},{"from":["rgb 0 0 255"],"to":"#ffff00"}],"weights":[1,1]}}} ``` @@ -4974,10 +5060,18 @@ spot or process swatches and keeps their color groups. A color book (such as a P CMYK or Lab colors named with the book's prefix and suffix ("PANTONE 185 C"), as spot colors unless the book marks them as process colors; `.acb` files are read, never written. A file in the user library folder, or a file with the same extension and bytes as one there, loads as that User Defined library (category `user`). +From a document, such as a `.ai` or `.eps` swatch library, it reads the colors, tints, gradients and pattern swatches +in the document's order and color groups; `swatch.library.add` brings a pattern swatch's pattern, with its tile and +art, into the document as a pattern swatch under the library swatch's name and in its color group. A global or spot +color the pattern's art links to keeps the library's color: when the document gives its name another color, it comes +in under a numbered name ("Ink 2") and the pattern links to that. A document with +no swatches, and a `.ai`, `.eps` or PostScript file whose swatches are only the default ones, are refused with +"`` has no swatches of its own". The Swatch Libraries filter of Other Library… lists `.ai`, `.ait` and `.eps` +(`.epsf`) files as well as the library files. `swatch.library.copyToUser {library}` copies a loaded library into the user library folder of the desktop app (a library file as it is; a document's swatches or a library loaded from `data` or `dataBase64` -as `.vcswatches`) under a name no file there has, and lists it as User Defined from then on; until the app -quits, commands given its loaded id use the copy → `{library, name, count, path, copied}` (`copied: false` +as `.vcswatches`; a library with pattern swatches is refused) under a name no file there has, and lists it as User +Defined from then on; until the app quits, commands given its loaded id use the copy → `{library, name, count, path, copied}` (`copied: false` when the folder already held the same file). Without a user library folder the command is disabled. These commands refuse a parameter of the wrong form with an error that names it: `library`, `apply`, `path`, `data`, `dataBase64`, `format` and `name` must be strings, `names` must be a list of names, and `focus`, `replace` and `user` @@ -5754,6 +5848,17 @@ link, the dimension stays where it was, no longer linked (see [dimensions.md](di `object.expand` rejects a param of the wrong type, such as `"fill": "yes"`, `"gradient": 3` or `"steps": "16"`, and changes nothing. Omitting a param or giving null keeps its default. +`ui.expandDialog {immediate?}` opens the Expand dialog (`object.expand` with no params opens it too). The dialog opens on +the Object, Fill, Stroke, Expand Gradient To and steps choices that OK last expanded with since the app started, and on +the defaults before that; Cancel and an OK that fails leave the kept choices as they were, and they are not kept across +launches. Choosing Object → Expand… in the in-window menu bar with Alt (Option on macOS) held sends `immediate: true`, which expands the selection +at once with those choices, or the defaults before any OK, in one undo step, as OK in the dialog would +([the help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/expand-objects.html) +describes this shortcut for a gradient; VectorCraft applies it to whatever the choices expand). When none of the kept +choices has something to expand in the selection, `immediate: true` opens the dialog on them instead and changes +nothing. A selection with appearance attributes refuses both, as the dimmed menu item does. An `immediate` of null is +treated as omitted, and any other value that is not true or false is an error. + ```json {"name":"run_command","arguments":{"command":"object.expand","params":{"stroke":false,"gradient":"mesh"}}} {"name":"run_command","arguments":{"command":"object.expand","params":{"steps":16}}} @@ -6090,6 +6195,15 @@ macOS, Ctrl elsewhere), drags with the selection tool chosen last (`select_tool` Curvature and anchor tools until one is chosen; the release gives the tool back as it was, so the Pen goes on drawing the path it had begun while that stays selected. Its reply's `tool` is the tool given back. +`tool.selectLastSelection` (Select Last Selection Tool, `{}`) chooses the selection tool chosen last, as Ctrl+` does on +Windows and Linux ([the help page](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) lists the +shortcut among those for selections). Only Selection, Direct Selection and Group Selection count: choosing Magic Wand, +Lasso or any other tool leaves the remembered one as it was. Before any of the three is chosen it chooses the Selection +tool; with the remembered tool already active it keeps it, so running it again does not cycle. It returns `{tool}` and +adds no undo step. On macOS it has no default shortcut, because the system uses Command+` to switch between an app's +windows; Edit › Keyboard Shortcuts can assign one. The Selection tool as the first choice and the macOS default are +VectorCraft's own rules. The headless backend and `vectorcraft-cli run` run it too. + ```json {"name":"pointer_gesture","arguments":{"tool":"pen","events":[{"kind":"down","x":100,"y":300},{"kind":"up","x":100,"y":300},{"kind":"down","x":200,"y":300},{"kind":"drag","x":250,"y":300},{"kind":"up","x":250,"y":300}]}} {"name":"pointer_gesture","arguments":{"mods":{"cmd":true},"events":[{"kind":"down","x":250,"y":300},{"kind":"drag","x":250,"y":260},{"kind":"up","x":250,"y":260}]}} @@ -6981,6 +7095,11 @@ is converted on its own. osManaged}`, where `source` is `profile`, `srgbProfile` (a profile that shows sRGB unchanged), `system`, `none`, `pending` or `unsupported`, `applied` says whether the canvas is converted, and `reason` says why not. +`lowLatencyDrawing` (Preferences › Performance › Low-Latency Drawing, off by default; desktop app) is read when the app +starts. On, the window presents without vsync (wgpu's `AutoNoVsync`) and frames start at most 240 times a second. +`--present-mode` and `VECTORCRAFT_PRESENT_MODE` take precedence over it (see `docs/development.md` › Desktop graphics +processor). A value that is not a boolean is an error. + `ctrlWheelScrollsSideways` (on by default): on, Cmd/Ctrl with a mouse wheel's whole notches scrolls the canvas sideways instead of zooming while `zoomWithMouseWheel` is off; off, Cmd/Ctrl-wheel zooms about the pointer. Alt + Cmd/Ctrl-wheel and a pinch on a Mac trackpad, on a touch screen or in the web build still zoom about the pointer. Under either @@ -7184,7 +7303,10 @@ Guides off, this drag leaves a 70 × 50 and a 90 × 50 copy and the 110 × 70 re `type.highlightTracking` (no default key) and `type.highlightFontName` (Cmd+Alt+Shift+F) show the Character panel and give its Kerning or Tracking field the keyboard focus with the value selected, or open its font family menu with the search field focused; each replies `{field: "kerning" | "tracking" | "fontName"}`. Without selected type or text the - Type tool edits, the panel shows and the command fails. + Type tool edits, the panel shows and the command fails. Type › Size › Other… runs `type.highlightFontSize` (`{}`, no + default key), which gives the Character panel's Font Size field the keyboard focus the same way (blank when the + selected sizes differ; the size typed and Enter apply through `text.setStyle {size}` as one undo step) and replies + `{field: "fontSize"}`; the menu item is dimmed without selected type or text the Type tool edits. The UI command `type.underline` (Cmd+Shift+U, in remote mode `press_key {key: "U", mods: {cmd: true, shift: true}}` or `invoke_menu`) does what the Character panel's Underline button does: it underlines the Type tool's selected text or the selected type objects, or removes @@ -8451,6 +8573,18 @@ every object in the layers each time the list is read. A `dcsTransparency` that returns `{id, onCanvas: false, owner}`, and the panel says the link has no place on the canvas. `links.embed {ids?}` keeps linked files' pixels in the document (an image whose file is missing stays linked: relink it first); `links.unembed {id, path}` writes an embedded image to a file (another extension converts it) and links to it, and without `path` returns `{name, dataBase64}`. +`ids` of one image works as `id` does. `links.unembed {ids?, folder}` writes each embedded image of `ids` (or of +`id`; default: the selected embedded images) to a new +file in `folder`, in the format it is stored in (as PNG when that format is not one of VectorCraft's raster file formats), and links each image to its file, keeping its bounds, in one undo +step; undo does not remove the files. A file is named after its image, with each character a file name can't hold +(`/ \ : * ? " < > |` and control characters) as `_` and `Image` when nothing is left; when the name is taken it is +`Name 2.png` … `Name 99.png`, and a file already in the folder is never replaced. Linked images among `ids` are left +as they are and listed in `skipped`. It returns `{unembedded: [{id, path}], skipped}`. When an image can't be written, +the files the call wrote are removed and the document does not change. A folder outside the automation write roots, +`id` given with `ids`, `path` given with `folder`, `ids` of more or fewer than one image without `folder`, an id given twice, and `ids` with +no embedded image are errors. The Links +panel menu's Unembed… with several embedded images selected asks for one folder and runs this form (on the web it +downloads each image instead and links none). `links.placementOptions {ids?, preserve?: transforms|bounds|fileDimensions|fit|fill, align?: topLeft…bottomRight, clip?}` decides how a relinked or updated file takes an image's place (default `bounds`: stretched into the old bounds; `clip` puts it in a clip group of the old bounds when it is larger). The UI commands `links.editOriginal` and @@ -8469,6 +8603,7 @@ malformed `ids`, or nothing to copy is an error, and the clipboard is left as it {"name":"run_command","arguments":{"command":"links.list","params":{"show":"missing"}}} {"name":"run_command","arguments":{"command":"links.placementOptions","params":{"ids":[12],"preserve":"fit","align":"top"}}} {"name":"run_command","arguments":{"command":"links.unembed","params":{"id":14,"path":"/tmp/logo.png"}}} +{"name":"run_command","arguments":{"command":"links.unembed","params":{"ids":[14,15],"folder":"/tmp/images"}}} ``` ## Package and Document Info @@ -8668,8 +8803,9 @@ Colorized grayscale and 1-bit images use their process or spot ink; the flattene PostScript has no transparency: it is flattened first with `flattenerPreset` (`high`, `medium` (default), `low` or a saved preset, see `flattener.presets.list`) and `flattener: {…}` options over it (those of -`object.flattenTransparency`); a warning says so. `previewFormat` adds a TIFF preview behind a binary header (`tiffColor` -(default), transparent unless `transparentPreview: false`, or 1-bit `tiffBw`; `none` writes plain PostScript), +`object.flattenTransparency`); a warning says so. EPS Options' Custom… button sets every `flattener` option. +`previewFormat` adds a TIFF preview behind a binary header (`tiffColor` (default), transparent unless +`transparentPreview: false`, or 1-bit `tiffBw`; `none` writes plain PostScript), `thumbnails` a PNG thumbnail in comments, and the native document always rides along in the trailer's comments (with linked images whole when `includeLinkedFiles`), so a later EPS import can reopen the file as it was. Export for Screens doesn't write EPS. @@ -9525,7 +9661,11 @@ stay square to it, as in the reference app. `object.distort` turns it as the war (see Free Distort on a turned bounding box). `object.rotate {angle, absolute: true}` turns the selection to an angle (the Transform and Properties panels' Rotate field), and `object.setBounds` measures width, height and the reference point along the turned box (x, y stay page coordinates). Objects turned together share the box. A new group starts -square to the page. `object.resetBoundingBox` squares the box again without moving the art. It also squares every +square to the page. `object.rotateBoundingBox {angle}` turns the selection's box by `angle` without moving the art +(`absolute: true` turns it to `angle`; the menu's Rotate Bounding Box… asks for the angle). Selected objects with +different angles get one shared angle, and the objects inside them keep their angle relative to them. A path of a +compound path selected on its own turns or squares only its own box. A box already at the angle adds no undo step. +`object.resetBoundingBox` squares the box again without moving the art. It also squares every object inside the selected ones: the children of groups, compound paths, clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks (an unlinked mask's art keeps its angle). Ungroup, Release Clipping Mask, Release Compound Path, Blend Expand, Release Envelope, Release Repeat, Release Intertwine and Release Opacity Mask @@ -10497,6 +10637,25 @@ after Remove Threading or Release Selection, in a frame converted to point type, duplicated, copied in the Layers panel, or taken out of a symbol or a placed file). A symbol made of a thread keeps the numbers in the symbol's art. +`text.setFormat {startNumber: 1..999999999}` gives a numbered paragraph a number of its own, and +`text.setFormat {restartNumbering: true}` gives it 1. Both are VectorCraft's own. The number goes to the first numbered +paragraph the call touches: the first that holds text, or the first when none does, taking the type objects in the +order of `ids`. A threaded frame's first paragraph is passed over when it continues from the frame before. The +paragraph given the number shows it, and the numbered paragraphs after it at its level count on from it, +through the frames of threaded type. Deeper levels count from 1 after it, as after any list paragraph, and a paragraph in +no list still starts the count again. `restartNumbering: false` takes the number away from every paragraph the call +touches except such a continued first paragraph, and they count on from the paragraph before. `startNumber` is a whole number (`5` or `5.0`); 0, a negative +number, a fraction, a number past 999999999 and any other type are errors, and giving both keys is an error. A call +that touches no numbered paragraph, or that gives the number the paragraph already has, changes nothing and records no +undo step. A call that also puts paragraphs in a numbered list gives the number after the list is set. Return in a +paragraph with a number of its own does not give the number to the new paragraph; Return, or pasted text that starts +new paragraphs, at the start of its text moves the number with the text. Making the paragraph bulleted or taking it out of its list removes the number, and Convert to +Text writes the numbers the paragraphs showed. The list saves the number (`"start": 5`) only when it is set; a file's +number below 1 or past 999999999 opens as the nearest of them. A paragraph style made from the paragraph does not keep +the number, and a paragraph style's `list` with a `start` is an error (`unknown attribute`). A graph keeps one paragraph +style for every label of a kind, so a graph label loses its number when the graph is drawn again. The canvas and the formats +that write the marker (below) write the number the paragraph shows. + The canvas, EPS, PDF and Type › Create Outlines draw the marker. PDF writes the marker as text of its own, where the canvas draws it, and a PDF viewer selects, copies and finds its characters. Each of its glyphs stands for the marker character that the glyph's font maps to that glyph in its character map. Glyphs that an OpenType feature such as @@ -10517,11 +10676,14 @@ More Options at the end of the Paragraph panel's Bullets and Numbered List prese dialog (`bulletsAndNumbering`) on the paragraphs the Paragraph panel acts on, on that tab; without `tab` it opens on Numbers when the paragraphs are a numbered list and on Bullets otherwise. On both tabs the Level field, above the presets, holds the paragraphs' list level (1 to 9; 1 for paragraphs in no list). The Bullets tab has the five bullet -presets and the Numbers tab has None and the seven number styles. The Position group has Alignment (Left or Right), +presets and the Numbers tab has None and the seven number styles, then Start at, a box with a number from 1 to +999999999 (1 until one is typed). The box is on when the paragraphs have the same number of their own, off when none +has one, and blank when they differ; on, OK sends `startNumber` with the number, and off, it sends +`restartNumbering: false`, unless a preset makes the paragraphs bulleted or takes them out of their list. The Position group has Alignment (Left or Right), Left Indent and First Line Indent. The dialog opens with the values the Paragraph panel shows; where the paragraphs differ, no preset is picked and the field is blank. Its fields are `tab`, `list` (`none`, `bullet` or `number`: the kind of the preset picked), `bullet`, `number`, `listAlign`, `listLevel`, `leftIndent` and `firstLineIndent` (points), -and `ui.dialog.set` sets them, including those the dialog opened blank or without. The type shows the dialog's values while it is open. A preset picked for paragraphs that are in no list and have +`startAt` (true or false) and `startNumber`, and `ui.dialog.set` sets them, including those the dialog opened blank or without. The type shows the dialog's values while it is open. A preset picked for paragraphs that are in no list and have no indents fills in 18 pt and -18 pt, and None takes them out again while they are unchanged. OK runs `text.setFormat` with the values that changed, as one undo step, and Cancel puts the type back as it was. When a preset puts the paragraphs in a list, OK also sends the indents the dialog shows, and the paragraphs take them, 0 included. OK does not @@ -10582,6 +10744,8 @@ the paragraph's text now starts; when the text before `at` starts no list, nothi {"name":"run_command","arguments":{"command":"text.setFormat","params":{"number":"upperRoman"}}} {"name":"run_command","arguments":{"command":"text.setFormat","params":{"listAlign":"right"}}} {"name":"run_command","arguments":{"command":"text.setFormat","params":{"listLevel":2,"start":4,"end":4}}} +{"name":"run_command","arguments":{"command":"text.setFormat","params":{"startNumber":5,"start":4,"end":4}}} +{"name":"run_command","arguments":{"command":"text.setFormat","params":{"restartNumbering":true,"start":12,"end":12}}} {"name":"invoke_menu","arguments":{"command":"ui.bulletsAndNumbering","params":{"tab":"numbers"}}} {"name":"run_command","arguments":{"command":"text.convertListToText","params":{}}} ``` @@ -12009,7 +12173,9 @@ EPS files hold its drawn steps, as they do for every blend: With the Blend tool active, `tool.select {tool: "blend"}` finishes the blend, as a click on the tool's button or W does: it drops the object clicked first and stops the next click adding to the blend just made. The document and the -selection stay as they are. Choosing any other tool that is already active leaves its work as it is. +selection stay as they are. With the Pen active, `tool.select {tool: "pen"}` ends the path being drawn as Escape does, +and so do P and a click on the Pen's button: the path stays open and selected (a path inside a compound path leaves +the compound path selected), and the next click starts a new path. Choosing any other tool that is already active leaves its work as it is. A blend's spine is the straight lines between its key centres until it is edited. `object.blend.info` lists it (`spine.anchors`, `keyAnchors`: the point each key sits on). `object.blend.spine.addAnchor {x, y}` adds a point where @@ -13613,6 +13779,45 @@ Path Options' Preview does (#5360). {"name":"run_command","arguments":{"command":"addon.type.releasePath","params":{"mode":"path","keepOriginal":true}}} ``` +## Unit Converter add-on + +Unit Converter is a built-in add-on that shows one length in every unit at once (#5528): its commands are +`addon.units.convert` and `addon.units.selectionSize`, and in the desktop app it lives in Object › Plug-ins › Unit +Converter and in its panel (`window.panel {panel: "unitConverter"}`). Neither command changes the document. + +`addon.units.convert {value, unit?}` reads `value` as a number field reads it: a number, or text with a unit suffix and +`+ - * /` arithmetic (`"10mm"`, `"1in/2"`, `"2p6"`, `"1080/2 px"`, `"3cm*50%"`, `"13q"`), a decimal comma read as a point +(`"0,5 mm"`) and a single number with a thousands comma (`"1,000 mm"`) refused, in at most 1024 bytes with at most 128 `+ - * /` signs. A +number without a suffix is in `unit` (a unit's name, suffix or key: `points`, `picas`, `inches`, `millimeters`, +`centimeters`, `pixels`, `feetInches`, `meters`, `yards`, `feet`, `q`, `ha`; default `points`); a suffix in the text +takes precedence over `unit`. It works without an open document. The command fails when `value` is missing, does not +read, or is not finite in every unit, and when `unit` is not a unit. Result: `{points, units: [{unit, label, number, +text}]}`: the length in points, then one row per unit of Preferences › Units › East Asian Type (pt, picas, in, mm, cm, +px, ft & in, m, yd, ft, Q, Ha) in that order, with the unit's key, its label, the number without its suffix and the +text with it, rounded as the number fields round them (3 decimals in pt, px, picas, Q and Ha, 4 in the others). Pixels +are points. + +`addon.units.selectionSize {}` gives the selection's width and height as the Transform panel shows them: the bounding +box (rotated with rotated objects), the visual bounds with Use Preview Bounds, or the box around the selected anchor +points with Direct Selection. It fails with nothing selected. Result: `{width, height}`, each as +`addon.units.convert` gives a length. + +The panel has one field per unit. A value typed in any field updates the others as it is typed, and text that does not +read leaves them as they were. Each field's copy button puts its value on the clipboard, with the unit when Copy with +Units is on. From Selection reads the selection's size (`addon.units.selectionSize`), and Width or Height picks which +of the two the fields show; the size read is dropped when the document, its selection, Use Preview Bounds or Measure +Type by Glyph Bounds changes, and the fields keep the length they show. Apply sets that side of the selection to the length with `object.setBounds`, as the Transform +panel's W or H field does: from its reference point (a symbol instance's registration point with Use Registration Point +for Symbol on), with the other side scaled too under Constrain Width and Height Proportions, and with the panel menu's +Transform Object Only, Transform Pattern Only or Transform Both. It is one undo step, and none when the size is already +that length. + +```json +{"name":"run_command","arguments":{"command":"addon.units.convert","params":{"value":"10mm"}}} +{"name":"run_command","arguments":{"command":"addon.units.convert","params":{"value":2.5,"unit":"in"}}} +{"name":"run_command","arguments":{"command":"addon.units.selectionSize","params":{}}} +``` + ## Save location errors A save refused by the filesystem with PermissionDenied or ReadOnlyFilesystem returns diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f9f6783d6d..7cf3914301 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -532,7 +532,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Raster effects (Effect Gallery, Document Raster Effects Settings) | 4 | 35% | ~36 Photoshop-style filters (Artistic, Brush Strokes, Sketch, Stylize) and Texturizer's Load Texture (since done, see the area table above, as is the Effect Gallery, #2883); Document Raster Effects Settings, raster effects in PDF, the pixel-filter pipeline, Radial Blur, Smart Blur (Normal, Edge Only and Overlay Edge), Unsharp Mask, Glowing Edges, Distort (Diffuse Glow, Glass, Ocean Ripple), Pixelate (Color Halftone, Crystallize, Mezzotint, Pointillize), Texture (Craquelure, Grain, Mosaic Tiles, Patchwork, Stained Glass, Texturizer) and Video (De-Interlace, NTSC Colors) are done | 8–14 | | 3D and Materials | 4 | ~25% | Initial Revolve, Extrude & Bevel, Inflate and Rotate, with simple lighting and four original lighting presets; materials, shadows, ray tracing, Rotate (Classic), Map Art and more complete visibility remain | 25–45 | | Type advanced | 4 | 50% | CJK composition for vertical type (mojikumi beyond Line-end Punctuation Half Width — the other sets (and their paragraph-start bracket and indent rules), custom kinsoku sets (beyond Hard, Soft and None) and the Mojikumi Settings dialog —, manual tate-chu-yoko is done, its up/down settings remain; No Break is done), tab leaders, Touch Type, Retype; vertical point/area/path type and Type Orientation have initial support (beyond parity, not scored: inline symbols in text) | 20–28 | -| Type core | 9 | 80% | Middle Eastern features beyond bidi layout, Paragraph Direction, digit types and Kashidas (editable bidirectional SVG text, a split caret where directions meet; the Middle Eastern & South Asian composers are done, #4935, but `.ai`/EPS/PDF files carry no composer); paint-only harakat keep joining with conditional GDEF-mark colour ownership, but fonts without GDEF mark classes and some AAT/`morx` ligatures can still leave marks painted as their letters; Every-line Composer fidelity for justified and ragged text (available per object; mixed type sizes in a paragraph still break single-line in non-rectangular area type and with text wrap), Optical Margin Alignment, paragraph spacing limit for vertically justified area type, hidden characters, paragraph attributes in the Type tool's copy and paste (the characters keep their styles, the paragraphs take the destination's), mixed-value display in the Paragraph panel for a selection across differing paragraphs, partial selection of type-area anchors by marquee, optional font-size preservation during group scaling (scaled character controls fixed in #1034). Hyphenation and Justification options, Fractional Widths, System Layout, styled Type-range canvas Paste (#5636), and pattern hyphenation for eleven Indian languages with grapheme/cluster protection (#4947) are done; Sanskrit automatic patterns remain pending an allowlisted source | 14–19 | +| Type core | 9 | 80% | Middle Eastern features beyond bidi layout, Paragraph Direction, digit types and Kashidas (editable bidirectional SVG text, a split caret where directions meet; the Middle Eastern & South Asian composers are done, #4935, but `.ai`/EPS/PDF files carry no composer); paint-only harakat keep joining with conditional GDEF-mark colour ownership, but fonts without GDEF mark classes and some AAT/`morx` ligatures can still leave marks painted as their letters; Every-line Composer fidelity for justified and ragged text (available per object; mixed type sizes in a paragraph still break single-line in non-rectangular area type and with text wrap), Optical Margin Alignment, paragraph spacing limit for vertically justified area type, paragraph attributes in the Type tool's copy and paste (the characters keep their styles, the paragraphs take the destination's), mixed-value display in the Paragraph panel for a selection across differing paragraphs, partial selection of type-area anchors by marquee, optional font-size preservation during group scaling (scaled character controls fixed in #1034). Hyphenation and Justification options, Fractional Widths, System Layout, styled Type-range canvas Paste (#5636), and pattern hyphenation for eleven Indian languages with grapheme/cluster protection (#4947) are done; Sanskrit automatic patterns remain pending an allowlisted source | 14–19 | | Symbols, blends, envelopes, Repeat, perspective | 5 | 90% | further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons and Weather Icons are done), dynamic symbols' `.ai` round trip, envelope Anti-Alias/Preserve Shape output and warp point editing, brush interpolation in blends (M8 fidelity pass done); Symbol Options › Registration and Export Type and on-canvas dynamic part paint (gradient/pattern, opacity, blend) are done; symbol editing shows draggable 9-slice guides (#5280), while guides outside the artwork remain unsupported | 4–7 | | Image Trace, graphs, image tools | 3 | 72% | graph Column designs (Graph Design, Marker designs and series colours set with Group Selection are done), Create Object Mosaic, per-feature stroke/fill choice and varying widths in Image Trace's Create Strokes (Vector Halftone and the Image Trace View modes, Palette and Create Strokes are done) | 6–10 | | Layers, artboards, document setup | 5 | 82% | Layers panel: a confirmation before deleting layers that hold art, row menu commands beyond Collect for Export (now on every layer, sublayer, group and object row), menus on guide and blend spine rows, the Layer Options dialog for several rows with mixed values, Paste Remembers Layers for sublayers; artboard preset polish (artboard escape routing and document setup modal handoff done; Move Artwork for artboard X/Y edits, Rearrange All Artboards, Document Setup, New Document and the rest of the Layers panel are done) | 4–7 | @@ -727,6 +727,7 @@ since 2026-10-01. - **Effects in the art's bounds:** Export with Use Artboards off, Fit to Artwork Bounds, and the other exports of the whole art (EPS without artboards, Export for Screens' Full Document, Save for Web (Legacy) with Clip to Artboard off) measure each visible object as the export crops above do. The drop shadows and other effects of groups, layers, type and images are inside the image or the artboard. A Shaper group without effects of its own is measured by the art it shows, and the hidden members of a group with a drop shadow, a glow or another raster effect do not count unless it is a Shaper group or also has a geometry, Pathfinder, Crop Marks or 3D effect or a visible effect on its own fill or stroke. The SVG of an artboard keeps an object whose effects alone reach the artboard. Tests measure a group, type and an image with a drop shadow, export a group and type with Use Artboards off and fit an artboard to them. - **EPS Save with Use Artboards:** Save As › EPS Options show Use Artboards with All or Range, for a separate file per artboard ([saving in EPS](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/save-artwork-in-eps-format.html)), unchecked by default (the scripting reference's EPS save options list `saveMultipleArtboards` with a default of false, [scripting reference](https://web.archive.org/web/20160803105056/https://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2015_3/Illustrator%20JavaScript%20Scripting%20Reference.pdf)). Unchecked, Save writes one file whose bounding box fits all the visible art, as Export does, without the artboards' background colors; when no art shows, the page is the first artboard in its color. An opened EPS saved back this way loses its page margins. Checked with two or more chosen artboards, the file at the path is the central file of the visible art and each artboard is also written to `_.eps` beside it. Checked with one chosen artboard, VectorCraft writes that artboard as the page of the file at the path alone (the behavior Save had since #4293). Evidence: `cmd::fileio::tests_artboard_fill::eps_save_draws_the_color_on_an_artboard_page`, `tests::save::eps_save_without_use_artboards_fits_the_box_to_art_past_the_artboard`, `tests::save::opened_eps_saves_to_its_own_file_around_its_art_or_on_its_page`, `tests::save::eps_save_with_use_artboards_writes_the_central_file_and_one_per_artboard`, `dialogs::save_options::tests::eps_save_as_shows_use_artboards_off_and_writes_the_art_or_the_artboard`. +- **EPS Options custom flattener settings:** the help page describes flattening an EPS's transparency with a preset or with custom options, adjusted through Custom ([saving in EPS](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/save-artwork-in-eps-format.html)). EPS Options now has Custom… beside the flattener Preset. It opens Custom Transparency Flattener Options on the settings the export would use: the raster/vector balance, both resolutions, the text and stroke outline switches, Clip Complex Regions and Anti-alias Rasters. OK goes back to EPS Options with the preset shown as [Custom], the export flattens with those settings, and the next EPS Options start from them; choosing a preset drops them, and Cancel goes back to EPS Options unchanged. Preserve Alpha Transparency stays off, and overprints are kept only with Overprints set to Preserve. The [Custom] label, the remembering, the Cancel behavior, Anti-alias Rasters and the ranges (balance 0 to 100, resolutions 1 to 2400 ppi) are VectorCraft's own. Evidence: `dialogs::tests_eps::custom_flattener_options_start_from_the_preset_and_cancel_goes_back_unchanged`, `custom_flattener_options_are_exported_and_remembered_until_a_preset_is_chosen`, `bad_custom_flattener_options_keep_the_dialog_open`. - **Raster export backgrounds (#6125):** a raster export draws its background under the finished art, and blend modes read only the art below them, as on the canvas. An Outer Glow in Screen mode on the bare page shows in a PNG on white and in a JPEG. Flatten Transparency puts its white under the finished art the same way. Evidence: `tests::file::a_screen_outer_glow_is_in_raster_exports`, `tests::objectfx::a_screen_outer_glow_on_the_bare_page_shows_on_a_background`, `tests::knockout::page_knockout_and_isolated_blending`, `tests::knockout::no_blend_mode_reads_the_background`, `tests::cmykflatten::every_blend_mode_flattens_to_the_canvas_pixels_in_cmyk`. @@ -766,6 +767,7 @@ since 2026-10-01. - **Justification… on type on a path:** each paragraph's Desired Word Spacing, Letter Spacing and Glyph Scaling set its glyphs on type on a path as on point and area type, so the text after a wider gap starts further along the path, alignment and overflow use the spaced length, and a list marker keeps its width. Minimum and Maximum are not used on a path, and vertical type is not glyph scaled. SVG export writes such type as outlines with a warning. Tests `tests::justify::type_on_a_path_takes_desired_spacing_and_scaling`, `type_on_a_path_is_aligned_and_fitted_at_desired_spacing`, `vertical_type_and_list_markers_on_a_path_are_not_glyph_scaled` and the SVG test `text_layout::justification_spacing_on_a_path_is_outlined`. Public reference: the help page (). - **Letter spacing and Full Justify between shaped clusters:** Desired Letter Spacing on any line, the letter spacing range of a justified line, and Single Word Justification's Full Justify add space only between shaped clusters, in horizontal, right-to-left and vertical type, so a combining mark stays on its letter and a Devanagari syllable's glyphs stay together. They add no space next to a zero-width format control (a soft hyphen, a bidi mark, embedding, override or isolate, a zero-width space, a joiner or non-joiner, a word joiner, a variation selector, a tag, the byte order mark), so a word wrapped in an override still reaches both edges of a justified line, and a Kinsoku push-in counts no gap at one either. A zero-width space is a line break opportunity but not a word separator ([CSS Text Level 3](https://www.w3.org/TR/css-text-3/#word-separator) does not list it), so a justified line gives it no share of its room. Desired Letter Spacing between the letters on either side of a zero-width space goes after the zero-width space, so a line that breaks there ends at its last letter, and the line breaker does not measure a gap after it. A line that Full Justify spreads and that ends in a drawn hyphen puts the same gap between its last letter and the hyphen. The cluster boundary is VectorCraft's own rule, based on the typographic character unit of [CSS Text Level 3](https://www.w3.org/TR/css-text-3/#typographic-character-unit). Tests `tests::justify::single_word_full_justify_keeps_combining_mark_with_base`, `desired_and_fitted_letter_spacing_skip_shaped_cluster`, `rtl_single_word_cluster_gap_follows_drawn_order`, `vertical_single_word_cluster_gap_follows_drawn_order`, `single_word_full_justify_keeps_conjunct_cluster`, `desired_letter_spacing_skips_bidi_format_controls`, `letter_spacing_and_full_justify_skip_joiners_and_soft_hyphens`, `format_controls_are_the_zero_width_default_ignorables`, `zero_width_space_takes_no_word_space_room`, `desired_letter_spacing_ends_a_line_broken_at_a_zero_width_space_without_a_gap`, `single_word_full_justify_spreads_up_to_the_drawn_hyphen` and `layout::wrapping_tests::kinsoku_shori_type_counts_no_gap_at_a_format_control`. Public reference: the help page (). - **Justified lines with tabs:** a tab is not a word space, so a justified area type line no longer gives it a share of its room that no glyph draws. On a justified line with a tab, the text up to the last tab keeps its spacing, each tab keeps its stop and its leader stays in its gap, and the text after the last tab takes the room (word spaces first, then letter spacing, glyph scaling and the gaps between its letters), so the line ends on the far edge. A tab separates two words, so Single Word Justification does not align a word-tab-word line. Right-to-left lines take the text drawn after the last tab drawn, and vertical lines work down the column. Spreading the room after the last tab is VectorCraft's own rule. Tests `tests::justify::a_justified_line_with_a_tab_spreads_the_text_after_it_to_the_edge`, `a_justified_tab_keeps_its_leader_inside_its_gap`, `a_justified_word_tab_word_line_reaches_the_edge`, `the_last_line_with_a_tab_fills_the_measure_only_with_justify_all`, `a_justified_line_takes_its_room_after_its_last_tab`, `a_justified_vertical_line_with_a_tab_reaches_the_end_of_its_column`, `a_justified_right_to_left_line_with_a_tab_spans_its_measure` and `justified_point_type_with_a_tab_keeps_its_width`. Public reference: the help pages (, ). +- **Show Hidden Characters marks every character that prints no ink:** [the help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/special-characters-glyphs/insert-white-space-and-break-characters.html) lists the characters that Type › Show Hidden Characters makes visible: paragraph returns, forced line breaks, tabs, spaces, nonbreaking spaces, discretionary hyphens and the end of the text. Besides the dot over a space, ¶ at a paragraph's end and # at the story's end, the canvas draws an arrow across each tab's advance to its stop, a ring over a nonbreaking space (U+00A0) and a smaller one over a narrow nonbreaking space (U+202F), a short tick over the spaces of a set width (U+2000 to U+200A, U+205F, U+3000), ¬ at a discretionary hyphen (U+00AD) whether or not the line breaks there, and a bent arrow after a line that a forced line break (U+2028) ends, which gets no ¶. The marks follow the baseline of vertical type and of type on a path, ¶ goes at the left end of a right-to-left line, and type on a path gets # after its last character when the path shows all of its text. The shapes of the marks, and marking U+202F and the spaces of a set width, are VectorCraft's own rules. The marks are drawn only on the canvas and are not saved or exported. Tests: `canvas::tests::hidden_characters_mark_tabs_nonbreaking_spaces_and_discretionary_hyphens`, `hidden_characters_mark_forced_line_breaks`, `hidden_characters_mark_a_discretionary_hyphen_at_a_break_once`, `hidden_characters_follow_vertical_type`, `hidden_characters_end_a_right_to_left_line_at_its_left`, `hidden_characters_mark_type_on_a_path` and `show_hidden_characters_draws_every_kind_of_mark`. - **The text style panel menus' Duplicate and Delete:** in the Character Styles and Paragraph Styles panel menus, Duplicate highlights the copy, as Create New Style highlights the new style, and Delete leaves no style highlighted, as the Delete button does, so Duplicate, Clear Overrides, Redefine and Style Options are disabled until another style is clicked. A highlighted style that is renamed in Style Options or deleted by a command is no longer highlighted either. The tests `panels::text_styles::tests::panel_menu_duplicate_and_delete_update_the_highlighted_style` and `a_highlighted_style_that_is_no_longer_listed_is_not_highlighted` cover this. Public reference: [Character and paragraph styles](https://web.archive.org/web/20261015081534/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html). - **Names of new styles and symbols:** `charStyle.new` and `paraStyle.new` trim the white space around the name they are given, as `charStyle.rename` and `paraStyle.rename` do, and refuse a name that is then empty; Duplicate names its copy from the trimmed name. `symbol.new` and `symbol.duplicate` trim the name as Symbol Options does, and `library.use` adds a library's text style under its trimmed name. Public reference: [Character and paragraph styles](https://web.archive.org/web/20260825113735/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html). - **Naming a new text style first:** Alt-click on New in the Character Styles or Paragraph Styles panel opens New Character Style or New Paragraph Style (`ui.newCharStyle`, `ui.newParaStyle`) with the name a plain click's style gets; OK makes the style from the text selected when the dialog opened, and Cancel adds none. Tests `panels::text_styles::tests::alt_clicking_new_character_style_asks_for_its_name` and `alt_clicking_new_paragraph_style_asks_for_its_name`. Public reference: [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), which lists Alt-click for opening panel options and names Actions, Brushes, Swatches and Symbols as exceptions. @@ -806,7 +808,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Preferences › General describes its settings:** the line under the Preferences fields shows a sentence for each of the 32 General settings, Enable Contextual Task Bar included, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. The sentences are VectorCraft's own and state what the app does with each setting. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Selection & Anchor Display describes its settings:** the line under the Preferences fields shows a sentence for each of the 14 Selection & Anchor Display settings, from Tolerance to the Curvature Tool rubber band, on hover and on keyboard focus, and a screen reader gets the same sentence. The Snap to Point sentence states that the Smart Guides Snapping Tolerance applies while Smart Guides is on. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Guides & Grid describes its settings:** the line under the Preferences fields shows a sentence for each of the 12 Guides & Grid settings, from Snap to Grid to Pattern Editing's Tile Edge Color, on hover and on keyboard focus, and a screen reader gets the same sentence. The Show Pixel Grid sentence states that the pixel grid shows from 600% zoom. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. -- **Preferences › Smart Guides describes its settings:** the line under the Preferences fields shows a sentence for the Smart Guides box and for each of the 14 Smart Guides settings, from Color to Snap to Perpendicular, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Pixel Preview turns Smart Guides off and Snap to Grid snaps instead; with Alignment Guides off, art still lines up without the line; Object Highlighting outlines only an unselected object while a selection tool is not dragging; Snapping Tolerance is a distance on screen at every zoom; Snap to Last Location does not return a copy. Units, General, Selection & Anchor Display, Guides & Grid and Smart Guides have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. +- **Preferences › Smart Guides describes its settings:** the line under the Preferences fields shows a sentence for the Smart Guides box and for each of the 14 Smart Guides settings, from Color to Snap to Perpendicular, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Pixel Preview turns Smart Guides off and Snap to Grid snaps instead; with Alignment Guides off, art still lines up without the line; Object Highlighting outlines only an unselected object while a selection tool is not dragging; Snapping Tolerance is a distance on screen at every zoom; Snap to Last Location does not return a copy. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides and Type have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. +- **Preferences › Type describes its settings:** the same line shows a sentence for each of the 23 Type settings, from Size/Leading to Measure Type by Glyph Bounds, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. Each sentence is VectorCraft's own and states what the app does with the setting: for example, which keys step by each increment, which panels show the East Asian and Indic options, and that the two pink highlights show only on screen. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Window › New Window (G7, #4116):** New Window (`window.newWindow`) opens another view of the current document ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html) describes showing one document in several windows at once), with its own zoom, center, rotation, artboard and Outline or Preview, as a tab of its own; an edit in one view shows in every view. Tile, Cascade, Float in Window, Float All in Windows and Consolidate All Windows arrange each view as they arrange a document, and Next and Previous Document step through the views. Closing a view leaves the document open; closing its last view closes the document, asking to save it first. The view's number after the name in its tab ("Name:2", while the document has more than one view) is VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`. - **Document Setup modal handoff:** Document Setup → Edit Artboards applies valid settings, closes the dialog and activates the Artboard tool. Pointer-click tests cover successful handoff, invalid settings, OK, Cancel and Undo in `dialogs/document_setup.rs`. @@ -879,6 +882,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Actions panel: Delete Selection deletes the selected action set with its actions and keeps the other sets ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html); `ui.actionSet.delete`). VectorCraft's own rules, which the overview does not cover: deleting a set asks first, Shift-click on a set's name selects a range of sets to delete together, the panel menu's Delete does the same, and Default Actions and the last set can be deleted. Undo does not bring a deleted set back. - Actions panel: the panel menu's Duplicate copies the selected action, else the current action set with all its actions ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html); `ui.actionSet.duplicate`). VectorCraft's own rules, which the overview does not cover: the copy goes right after the original, is named after it with " copy" added and is selected. - Actions panel: the panel menu's Reset Actions asks first; OK replaces the sets in the panel with the default set, and Append adds the default set after them ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/manage-a-set-of-actions.html); `ui.actionSet.reset`). VectorCraft's own rules, which the page does not cover: the default set is VectorCraft's own Default Actions set; after OK it is current and selected, and no action or step is selected; Append names its copy with the next free number (`Default Actions 2`) and keeps the current set; Cancel changes nothing; the item is off while an action records or plays, waiting at a stop included; Undo does not bring the old sets back. Tests `panels::actions::tests::{the_panel_menus_reset_actions_asks_first_and_is_off_while_an_action_runs, reset_replaces_every_set_with_the_built_in_set_and_clears_what_named_the_old_ones, reset_on_the_built_in_set_makes_it_current_then_changes_nothing, reset_append_adds_the_built_in_set_with_a_free_number_and_keeps_the_rest, reset_refuses_bad_params_and_a_running_action_and_changes_nothing}`, `dialogs::tests::reset_actions_ok_replaces_append_adds_and_cancel_keeps_the_sets`. + - Actions panel: the panel menu's Replace Actions… opens a file and puts the set it holds in place of every set in the panel ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html); `ui.actionSet.replace`). VectorCraft's own rules, which the page does not cover: the file is read as Load Actions… reads it (`.vcactions` and `.aia`, with the same limits and reports); the built-in Default Actions set goes too; the file's set keeps its name and becomes current and selected, and no action or step is selected; a canceled pick, a file that can't be read or is refused (an empty one too) changes nothing; the item asks no question first and is off while an action records or plays, waiting at a stop included; Undo does not bring the old sets back. Tests `panels::actions::tests::{the_panel_menus_replace_actions_puts_the_files_set_in_place_of_every_set, replace_actions_clears_what_named_the_old_sets_and_reads_aia_files, replace_actions_refuses_bad_params_bad_files_and_a_running_action}`. - Batch… over data sets names each file after the document and the data set (`action.batch`). It writes `/`, `\`, `:`, `<`, `>`, `"`, `|`, `?`, `*` and control characters in the data set's name as `-`, and adds `-2`, `-3`… to a name an earlier data set used. - Batch… offers File + Number, File + Data Set Name, and Data Set Name for a Data Sets source. The dialog defaults to File + Number; `action.batch` without `datasetFileNaming` keeps File + Data Set Name. An output already in a destination folder the batch may read and write gets the next free `-2`, `-3` suffix. [Batch options](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/batch-options.html). - The Batch dialog shows its data set File Name row only when Destination is Folder, and keeps the choice while another destination is picked. With None or Save and Close it does not send `datasetFileNaming`. @@ -901,6 +905,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Graphs: the Graph Data window's Import Data reads a UTF-16 text file without a byte-order mark by the same rule as Import Data Sets…, instead of filling the cells with NUL characters. It reads a file cut short by one byte, or with an unpaired surrogate, as it reads one after a byte-order mark. - Graphs: in the Graph Data window, the pointer becomes a column-resize arrow over a column's right edge, and dragging the edge sets that column's width in whole digits, from 0 to 20 as Cell Style's Column Width allows. The columns after it move along. Cell Style's Column Width still sets every column, the dragged ones included ([Adjust decimal digits and column width](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/visualize-data/adjust-column-width.html)). - Variables: Import Data Sets… (`dataset.import`) defines the variables a file's header names that the document lacks, unbound. `#Shown` defines a visibility variable, `@Photo` defines an image variable, and a header without a prefix defines a text variable. A header that is a variable's exact name keeps naming it, and any other `%` header (graph data files) is refused. + - Variables: Import Data Sets… (`dataset.import`) reads `%` columns instead of refusing them: `%Sales` defines or names the graph variable `Sales`, and each cell is the path of a graph data file, read as the Graph Data window's Import Data reads one and kept as the data set's graph value. A relative path is taken from the CSV file's folder, or from `base`. A missing, unreadable or larger than 1 MB file fails the import with its line and column, and the document is left as it was (`crates/engine/src/tests/variables.rs`). - Variables: Load Variable Library… in the Variables panel menu (`variable.loadLibrary`) replaces the document's variables and data sets with a variable library's, read from its XML file, in one undo step: every data set is deleted, and every variable is deleted with its bindings and values, except a variable the library also declares with the same kind, which stays bound so the library's data sets change its objects (#4136); then the library's other variables are defined, unbound: text, visibility, image (linked file) and graph variables, and variables without a known `trait` as unknown. Its data sets take text values from each value's `p` elements, one paragraph each, visibility values from `true` or `false`, image values from a file's absolute path or `file:` URL, and graph values from a `data` element of series names and rows. - Variables: Save Variable Library… in the Variables panel menu (`variable.saveLibrary`) writes the document's variables of every kind and its data sets as a variable library's XML file, which Load Variable Library reads back with the same variables, kinds, data set names and values. - Variables: Variable Options… in the Variables panel menu, or a double click on a variable, shows the variable's name and kind, and OK changes either or both in one undo step (`variable.rename {name, newName?, kind?}`), as the [Work with variables](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/work-with-variables.html) page describes. VectorCraft's own rule for a kind change: objects that can't hold the new kind are unbound, and the variable's values in every data set are dropped. @@ -937,6 +942,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Linked images in SVG output under `--automation-read-root`: the same outputs, and `clipboard.exportSvg`, refuse an SVG or SVGZ that would name a linked image's file outside the read roots (`images: link`, an image whose pixels the document doesn't hold, or `preserveEditing`), before any file or folder is written, with an error that names no file or folder; Copy in a frame a request drives then puts no SVG on the system clipboard. Embedded pixels, a file inside the roots, a relative path that leads inside them and a URL are written as before, and the person at the keyboard exports every link as stored. The check covers the art drawn for placed documents and leaves out what the file leaves out: hidden art in symbols, patterns and graph designs, opacity masks in SVG Tiny 1.2, and objects drawn as images for effects SVG has no filter for. `crates/engine/src/tests/links.rs` (`confined_svg_output_refuses_a_linked_image_file_outside_the_read_roots`, `svg_output_names_linked_image_files_a_caller_may_read`, `confined_clipboard_svg_refuses_a_linked_image_file_outside_the_read_roots`, `confined_preserve_editing_svg_refuses_a_brush_library_entry_it_cannot_read`, `confined_svg_output_checks_only_the_linked_images_it_writes`, `confined_svg_output_writes_a_colorized_gray_image_without_its_file`, `confined_svg_output_checks_the_images_of_placed_documents`, `confined_svg_output_leaves_hidden_symbol_art_unchecked`, `confined_svg_tiny_output_leaves_opacity_mask_images_unchecked`, `confined_svg_output_checks_the_images_drawn_for_pixel_effects`), `crates/ui-egui/src/tests/automation.rs` (`control_svg_export_refuses_a_linked_image_file_outside_the_read_root`), `crates/ui-egui/src/dialogs/svg_options.rs` (`show_code_leaves_out_a_linked_image_file_outside_the_read_roots`). - Clipboard flavors under `--automation-read-root`: `clipboard.flavours` leaves out the SVG, and its markup as text, that `clipboard.exportSvg` refuses. `crates/engine/src/tests/links.rs` (`confined_clipboard_flavours_leave_out_a_withheld_svg`). - Preserve Editing SVG under `--automation-read-root`: the native document an SVG or SVGZ carries leaves out an Export for Screens folder outside the read roots, and keeps the other export settings and the art; the open document keeps the folder, and a folder inside the roots is kept. `crates/engine/src/tests/links.rs` (`confined_preserve_editing_svg_leaves_out_an_export_folder_outside_the_read_roots`). + - Native document output and linked images under `--automation-read-root`: the outputs that carry the native document (a native file or template, an EPS file, a `.ai` or `.ait` file of every artboard, a PDF of every artboard with Preserve Editing, also from `document.exportPdf`, the saves and Export for Screens rows) are refused, before any file or folder is written, with an error that names no file or folder, when that document names a linked image or placed file, a kept relative path or a data set's image outside the read roots, or holds a stored brush entry that does not read as a brush; files without the native document are written. Those documents, and the documents Package writes or rewrites, leave out an Export for Screens folder outside the read roots, and Package refuses a linked file it copies as it is whose native document keeps one; the open document keeps its links, data sets and folder. An Export for Screens row that writes one artboard is checked against that artboard's art, and each asset, layer or selected object writes its own native, `.ai` or EPS file. `crates/engine/src/tests/links.rs` (`confined_native_output_refuses_a_linked_image_file_outside_the_read_roots`, `confined_native_output_refuses_a_data_set_image_outside_the_read_roots`, `confined_native_output_leaves_out_an_export_folder_outside_the_read_roots`, `confined_screens_rows_check_the_artboard_each_file_holds`), `crates/engine/src/tests/package.rs` (`a_confined_package_refuses_a_linked_file_that_keeps_an_export_folder_outside_the_read_root`), `crates/engine/src/cmd/fileio/tests_screens.rs` (`each_piece_writes_its_own_native_document`). - Linked-file and font-file searches under `--automation-read-root`: `links.findFiles` and `text.findFontFiles` replies, also later polls and stops of a search another client started, leave out the files found, a link's saved path and the folder searched outside the caller's read roots, and a failed search gives its reason without the path; `image.info` gives `link: null` for a linked file outside them; `text.addFontFiles` gives `folder: null` and the copies' file names when the Fonts folder is outside them. `crates/engine/src/tests/linkfiles.rs`, `crates/engine/src/tests/fontfiles.rs`, `crates/engine/tests/font_folder.rs`. - Swatch, brush, symbol and graphic style library lists under `--automation-read-root`: every library stays listed, the paths of library files and the user library folder outside the read roots are `null`, a library loaded from outside them is listed and found as `loaded/` and keeps that id for the session unless a library loaded later without a file shows that id itself, which moves it to the next free `loaded/ (N)`, and the app's own list is not changed. `crates/engine/src/tests/library_roots.rs`. - Preferences commands under `--automation-read-root`: `prefs.get`, `prefs.list`, `prefs.set` and `prefs.reset` show folder preferences outside the read roots as `null` and leave out an export preset's folder outside them, and the preferences are not changed. `crates/engine/src/tests/prefs_roots.rs`. @@ -1000,7 +1006,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Window › Toolbars › Manage Toolbars… and Manage Toolbars… in the All Tools drawer's menu open a dialog that lists the toolbars made with New Toolbar: a new name typed for the selected toolbar renames it, + copies it with its tools (with none selected, + makes a blank toolbar), and the trash can deletes it. Each change shows under Window › Toolbars and stays in the workspace (; `window.toolbar.manage`, `window.toolbar.rename`, `window.toolbar.duplicate`, `window.toolbar.delete`; `manage_toolbars_renames_duplicates_and_deletes`). - A toolbar made with New Toolbar docks in a lane along the window's left or right edge when its title bar is dropped on that edge, or with Dock to Left and Dock to Right in the title bar's context menu. Toolbars docked at one edge stack from the top, each with its share of the lane's height, and the lane is as wide as its widest toolbar; a lane too short for its stack wraps it into more columns, up to half the window's width, and past that the toolbars show only their title bars, which the mouse wheel scrolls through when even they do not fit. Dragging the title bar out of the lane, or Float Toolbar, floats it again, and Escape during the drag puts it back. Hiding and renaming keep its place, and the workspace keeps it. New toolbars still start floating. The lanes and the stacking are VectorCraft's own rules (#1759; `window.toolbar.dock`, `window.toolbar.float`; `toolbars_dock_and_float_by_their_commands`, `docked_toolbars_stack_in_lanes_along_the_window_edges`, `a_title_bar_dropped_on_an_edge_docks_the_toolbar`). - The status bar shows the errors of the toolbars made with New Toolbar (a missing, empty, too long or taken name, the 64-toolbar limit, a `side` or `order` that `window.toolbar.dock` does not take, and New Toolbar's dialog and Manage Toolbars) in every language that translates every message, with the toolbar's name, the parameter key and the value given kept as they are; the error the command returns stays English (`custom_toolbar_command_errors_are_translated`). - - Window › Toolbars › Keep Tools Beside the Canvas, a VectorCraft layout option that is off by default, docks the Tools panel between left-side panels and the canvas instead of at the window's left edge; the canvas's left edge then also docks a floating Tools panel, and workspaces keep the setting. Scores are unchanged (`window.toolsBesideCanvas`; `docked_tools_keep_the_window_edge_unless_kept_beside_the_canvas`, `tools_redock_at_the_targets_of_the_chosen_placement`). + - Window › Toolbars › Keep Tools Beside the Canvas, a VectorCraft layout option that is off by default, docks the Tools panel between left-side panels and the canvas instead of at the window's left edge, and workspaces keep the setting. A floating Tools panel dropped on the canvas's left edge, right of panels docked on the left, docks there and turns the setting on, and one dropped on the window's left edge docks there and turns it off; with no panels docked on the left, a drop leaves the setting as it is (#7837). Scores are unchanged (`window.toolsBesideCanvas`; `docked_tools_keep_the_window_edge_unless_kept_beside_the_canvas`, `tools_dropped_on_a_left_edge_dock_there_and_the_setting_follows`, `tools_dropped_where_the_left_edges_overlap_keep_the_setting`, `tools_dropped_beside_a_collapsed_left_dock_follow_the_strip_dropped_on`). - Hindi (2026-11-06): Hindi (`hi`): 7,877-row machine-assisted catalog, zero/one singular plurals, desktop font fallback and optional Devanagari craft-fonts fallback; all 55 translation tests pass; native review and a web font remain; scores and estimates unchanged. [Terminology and limitations](localization-hi.md). - Gujarati (2026-11-14, #6613): `gu` has 4,673 catalog rows, zero/one singular plurals, installed desktop font fallback and support for optional `Gujr` craft-font faces. The original 4,286 rows remain unchanged; all 387 additions are contributor-reviewed and approved, with 11 wording corrections. Status/error messages remain partial; the pinned fonts and web startup list have no Gujarati face, so web selection remains unavailable until one is bundled. Current-head validation is recorded in the PR; scores and estimates unchanged. - Hindi wording (2026-11-13): rows outside the plug-in messages keep their English's meaning, quantities and clauses, and use the catalog's save, swatch, crop, resolution, path and type terms; a test checks those terms and the point unit in every row; native review remains; scores and estimates unchanged. @@ -1051,6 +1057,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The Transform panel works out its Align to Pixel Grid checkbox once for each document revision and reuses it on later frames, and lists the selected objects' ids only when the box is clicked. The box shows the same state. With Select All of 99,500 objects (100,000 paths, 1,000 of them in 500 compound paths), working the state out on every frame took a median 33.5 ms of thread CPU time per frame in a release build on a loaded machine; the first frame after a change now takes 31.5 ms and later frames take about 1 ns (`panels::transform::tests::align_to_pixel_grid_kept_state_equals_a_full_measure`, `align_to_pixel_grid_state_is_measured_once_per_revision`, `pixel_aligned_state_timing`). - Break Link to Symbol and Object › Expand give a symbol instance's art the instance's own bounding box: after Reset Bounding Box the art stands square to the page, an object turned inside the symbol keeps its angle relative to the instance's box, a group added for the instance's opacity takes the instance's box, and the clip groups of 9-slice art take the angle of their cell. Compound shapes and Pathfinder receive an instance's art with the same angles (VectorCraft's own behavior; `bboxrotate::reset_bounding_box_then_expand_symbol_instance`, `reset_bounding_box_then_expand_keeps_the_angles_inside_the_symbol`, `expanding_a_faded_symbol_instance_gives_its_group_the_instance_box`, `expanding_a_reflected_symbol_instance_keeps_its_box`, `symbol_nine_slice::break_link_turns_the_cells_of_a_sliced_instance_with_its_box`, effects `outline_object_turns_an_instances_art_with_its_box`). - Object › Transform › Reset Bounding Box squares the box of every object inside the selected ones as well: the children of groups, compound paths, clip groups, blends, envelopes, repeats and intertwines, and the art of linked opacity masks. Ungroup and the release commands then bring back boxes square to the page (VectorCraft's own behavior; `bboxrotate::reset_bounding_box_squares_the_objects_inside_a_group`, `reset_bounding_box_squares_the_turned_members_of_a_square_group`, `reset_bounding_box_then_release_clipping_mask` and the other `reset_bounding_box_then_*` tests, `reset_bounding_box_leaves_the_art_of_an_unlinked_opacity_mask`). + - Object › Transform › Rotate Bounding Box… turns the selection's bounding box by the angle typed in its dialog without moving the art (`object.rotateBoundingBox`, `absolute: true` to set the angle). Objects with different angles get one shared angle, and the objects inside a group and the art of a linked opacity mask turn with it. A path of a compound path selected on its own turns only its own box, and Reset Bounding Box squares only that path's box too (VectorCraft's own behavior; `bboxrotate::rotate_bounding_box_turns_the_box_and_leaves_the_art`, `rotate_bounding_box_back_to_zero_stores_zero`, `rotate_bounding_box_gives_a_mixed_selection_one_angle`, `rotate_bounding_box_turns_the_objects_inside_a_group_with_it`, `rotate_bounding_box_turns_a_linked_masks_art_only`, `reset_bounding_box_squares_every_box_rotate_bounding_box_turned`, `rotate_bounding_box_refuses_bad_params`, `tests::rotate_bounding_box_of_a_compound_paths_member_turns_only_that_path`, ui-egui `panels::transform::tests::rotate_bounding_box_menu_item_turns_the_box_by_the_dialog_angle`). - After a rotation the Free Transform tool shows and drags the same turned bounding box as the Selection tool: its handles, their cursors and its rotate zone sit on the selection's own sides, a handle scales along those sides from the opposite handle ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-objects.html)), Cmd/Ctrl on a side handle shears along that side, and Perspective Distort and Free Distort start from the turned box's corners (`object.distort` takes `angle` with `from`) (`bboxrotate::free_transform_handles_turn_with_the_object_and_scale_along_its_axes`, `free_transform_shears_along_the_turned_side`, `free_transform_distort_starts_from_the_turned_box`, `xform::distort_reads_from_in_a_turned_frame_and_rejects_a_bad_angle`, tools `xform::free::tests::the_box_and_its_handles_turn_with_the_selection`). - After a rotation the Scale and Reflect tools, the Scale and Reflect dialogs, `object.scale`, `object.reflect` with a named axis and the Transform and Properties panels' flips act along the selection's turned bounding box until Reset Bounding Box: the horizontal and vertical scale stretch along its own width and height, and the vertical and horizontal reflection axes are its own. The Reflect tool's default axis and its Shift steps start from the box's axes, and an axis drawn with the tool is the line drawn on the page. `basis: "page"` keeps the page's axes (VectorCraft's own rules; `bboxrotate::scale_and_reflect_follow_the_turned_box`, tools `xform::transform::tests::scale_and_reflect_drags_follow_a_turned_bounding_box`). - Perspective Distort and Free Distort (`object.distort`) turn each warped object's bounding box as the warp turns the object at its own center, the objects inside groups, compound paths and clip groups and the art of linked opacity masks included, so the next Selection or Free Transform drag uses the tilted box; Object › Transform › Reset Bounding Box squares it again, and corners left where they are add no undo step (VectorCraft's own rule; `bboxrotate::distort_turns_an_upright_box_with_the_warp_at_its_center`, `distort_turns_each_member_and_linked_mask_by_its_own_warp`, `mirrored_and_collapsing_distorts_keep_valid_angles`, `distort_angles_undo_redo_and_reopen_together`, `xform::unchanged_distort_records_no_history`). @@ -1175,6 +1182,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Cmd/Ctrl+Alt+Shift+. and , (`type.size.increaseByFive`, `type.size.decreaseByFive`) step the font size of the selected type, or of the text the Type tool has selected, by five times the Size/Leading increment (Preferences › Type); Cmd/Ctrl+Shift+. and , still step it by one increment. - Cmd/Ctrl+Alt+Q (`type.resetTracking`) sets the tracking of the selected type, or of the text the Type tool has selected, to 0 and clears manual kerning while keeping the automatic method, in one undo step; at a caret it resets only the kerning there: of the character before it, or at the start of a line the space before the character after it (#5111). - Cmd/Ctrl+Alt+K (`type.highlightKerning`) and Cmd/Ctrl+Alt+Shift+F (`type.highlightFontName`) show the Character panel and give its Kerning field the keyboard focus with the value selected, or open its font family menu with the search field focused, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for highlighting kerning and the font name field. The page lists the same key for selecting the tracking value; `type.highlightTracking` focuses the Tracking field the same way and has no default key in Keyboard Shortcuts. + - Type › Size ends with Other… (`type.highlightFontSize`), for a size the list does not hold: it shows the Character panel and gives its Font Size field the keyboard focus with the value selected, and the size typed applies on Enter. [The help page](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=488) describes Other in the Size menu as the way to enter a new size in the Character panel. Selecting the field's value, the separator before Other… and the item being dimmed without selected type are VectorCraft's own choices. - Cmd/Ctrl+Alt+L (`ui.newLayer`) opens Layer Options for a new layer, as an Alt-click on the Layers panel's New Layer button does, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for adding a layer through the New Layer dialog box. OK adds the layer above the current layer, and Cancel adds none. Cmd/Ctrl+L still adds a layer without the dialog. - F8 (`ui.symbolOptions`) opens Symbol Options for a new symbol made from the selection, as the Symbols panel's New Symbol button does, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for making a new symbol. OK makes the symbol and puts an instance of it in place of the art, and Cancel makes none. With nothing selected, F8 opens no dialog, and the status bar says that nothing is selected. Shift+F8 and Cmd/Ctrl+F8 still show the Transform and Info panels. - Cmd/Ctrl+Shift+X (`type.resetHorizontalScale`) sets the horizontal scale of the selected type, or of the text the Type tool has selected, to 100% as the Character panel shows it (the object's own stretch included), in one undo step; at a caret it leaves the text as it is. @@ -1182,6 +1190,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Cmd/Ctrl+Alt+N (`file.newWithoutDialog`) makes a document without opening the New Document dialog, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page assigns to creating a document directly. The page does not say which settings the document gets. VectorCraft gives it the settings the dialog opens on (the first Recent entry, or the Print category's Letter while Recent is empty) and the next untitled name. - Cmd/Ctrl+F6 (`window.nextDocument`) and Cmd/Ctrl+Shift+F6 (`window.previousDocument`) make the next and the previous open document the current one, in tab order and as a click on its tab does, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for navigating to the next and the previous document. After the last document comes the first, and before the first document comes the last. From the Home screen the keys go to the first and the last document. Keyboard Shortcuts lists both under Window. - Cmd/Ctrl+Alt+Shift+U (`document.switchUnits`) switches the document to the next unit of measurement, in one undo step, on the key the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for switching units of measurement. The page does not give an order. VectorCraft steps through the units in the order a right-click on a ruler lists them (Points, Picas, Inches, Millimeters, Centimeters, Pixels, Feet & Inches, Meters, Yards, Feet) and goes from Feet back to Points. + - Ctrl+` (`tool.selectLastSelection`, Select Last Selection Tool) on Windows and Linux chooses the selection tool chosen last of Selection, Direct Selection and Group Selection, on the key [the help page](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) lists for switching to the last-used selection tool; Magic Wand and Lasso do not count. Before one is chosen it chooses the Selection tool, and it keeps the remembered tool when that tool is already active. On macOS it has no default shortcut, because the system uses Command+` to switch between an app's windows; Edit › Keyboard Shortcuts can assign one. The first choice and the macOS default are VectorCraft's own rules. - Shortcut sets other apps save as text (`.kys`) open in Import Shortcut Set from File › Open, from Edit › Keyboard Shortcuts › Import… in the desktop app, or from a drop on the window. It matches each entry to a tool, command or panel by name and decodes the file's key and modifier codes where VectorCraft's default shortcuts agree on them; the user answers the rest, and Apply fills the Keyboard Shortcuts dialog's working set. The answers are kept with the preferences for the next import (`shortcutSet.read`, `importMatches.*`). - Edit › Keyboard Shortcuts › Export Text… saves the set shown in the dialog as a UTF-8 text file, as the reference app's [Export keyboard shortcuts list as a text document](https://helpx.adobe.com/illustrator/desktop/get-started/preferences-and-settings/export-keyboard-shortcuts-list.html) page describes (`shortcuts.exportText {path?, format?, pageSize?}`). The layout is VectorCraft's own: the set's name, then the Tools and Menu Commands rows in the dialog's order, each with its name, a tab and its shortcuts as the dialog shows them, and nothing after the tab for a row with no shortcut. In the desktop app its save dialog also offers a printable shortcut sheet as a PDF, which `format: "sheet"` also picks (`pageSize: "letter" | "a4"`, A4 when the current document prints on A4): the rows with a shortcut under a colored band per group, in columns on landscape pages, a layout of VectorCraft's own. It also offers a CSV file of the same rows (`format: "csv"`; Group, Command and Shortcut columns). Tests `shortcut_editor::tests::export_text_*`, `shortcut_editor::tests::export_sections_*`, `shortcut_editor::tests::the_save_dialogs_answer_picks_the_export_text_format`, `shortcut_editor::tests::the_sheet_is_on_a4_when_the_document_prints_on_a4`, `shortcut_sheet::tests::*`, `tests::picks::keyboard_shortcuts_export_text_*` and `tests::picks::export_text_with_a_format_gives_the_answered_name_its_extension`. - On Windows and Linux the app bar is the window's title bar (its own minimize, maximize and close buttons, drag to move, edges to resize), with the dragon app icon as the brand mark; dialogs and menus size to their content. As on a native menu bar, once one menu is open, moving the pointer onto another title opens that one. @@ -1281,6 +1290,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Transform Each opens on the scale, move, rotate, reflect, Random, reference point, Transform Objects and Preview it was last confirmed with (kept with the UI state; Copy never is), and its Copy button, left of Cancel, transforms a copy of each object as the [Scale multiple objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-multiple-objects.html) help page has it; the Copy checkbox is gone (#1732; the remembered values follow a maintainer comment on the issue, not the help page). Its Scale section has the Relative and Absolute radio buttons the same page describes: percentages of each object's size, or the width and height it becomes (`object.transformEach` `relative`, which Transform Again repeats); Absolute measures each object's own box, and the scales act along its axes about that box's reference point, so a turned shape keeps its shape and objects of different sizes come out alike; the fields show the width and height the selected objects share and read "Mixed" when they differ or a side is 0 (a line's), each object measured by its own box, rotated with it, as the Transform panel and the Control bar show it (sizes they show alike count as the same), and a size typed into them sets every object to it (a side left Mixed keeps its size), our choices where the page leaves them open; a live Repeat scales its spacing by the geometric mean of the two factors, so its Absolute size is approximate. The link beside the two scales keeps them in proportion, as the shape dialogs' Width and Height link does (`__constrain`, kept with the dialog's values; where it sits is our choice, the public pages don't establish it). The panel lists Scale, Move and Rotate, then the Options in two columns (Transform Objects, Transform Patterns, Scale Strokes & Effects, Scale Corners; Reflect X, Reflect Y, Random), the Reference Point, and Preview at the left of the button row, level with Copy, Cancel and OK. Transform Again uses the Copy, Transform Patterns, Scale Strokes & Effects and Scale Corners choices of the transform it repeats; after a bounding-box handle drag on area type, it resizes the type area again and the type keeps its size (`object.transformAgain`). With anchors selected with Direct Selection, Move, Rotate, Scale, Reflect, Shear and Transform Again (the commands, their dialogs and the four tools' drags) transform only those anchors, their handles with them, about the centre of the box around them unless a point was clicked; a copy still copies the whole object (#1408; behaviour reference: [adjust path segments](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html); the default reference point and the copy are our choices). The Move, Rotate, Scale, Reflect and Shear dialogs have a Preview checkbox, off when they open: while it is on the canvas follows the values, Cancel rolls it back and OK is still one undo step; Up/Down step the Rotate and Shear angles and the Scale percentages by 1, Shift by 10 (#1412). The five dialogs and Transform Each have Transform Objects beside Transform Patterns: off, the art stays and only its pattern tiles transform (`objects` on the transform commands), and Transform Again repeats the choice (#1448; behaviour reference: [scale objects](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/scale-objects.html); the checkboxes are always enabled and the Scale page's pair is applied to all of them, our choices). Reflect's axis is Horizontal, Vertical or an angle (#1460; [reflect objects along an axis](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/reflect-objects-along-an-axis.html)). - **Pen:** Alt pressed in the middle of dragging out an anchor splits its handles and keeps the curve already shaped into it (only the outgoing handle follows the pointer); Space held while dragging out an anchor moves it, handles and all. A press on the first anchor of the path being drawn closes it whatever the drag then does: the drag shapes the closing curve and the release closes the path wherever it ends (#501). The first anchor's incoming handle mirrors the pointer, and a click leaves it retracted and the anchor a corner. Its outgoing handle stays where it is on a corner, so the first segment keeps its shape, and on a smooth anchor it turns to stay in line at its own length; Alt makes the anchor a corner and leaves the outgoing handle where it was when Alt went down. The Smart Pen's closing drag does the same (fixes #6634; `path.close`'s `in` and `out`; behavior reference: [draw with the Pen, Curvature, or Pencil tool](https://web.archive.org/web/20220614224656/https://helpx.adobe.com/illustrator/using/drawing-pen-curvature-or-pencil.html), where a click or drag on the first anchor closes the path and Alt breaks the pairing of the closing anchor's handles; which handles the drag sets are our choices). Space held during the Pen's closing drag moves the first anchor, handles and all, as that page also describes (`path.close`'s `at`). Clicking the last anchor of the path being drawn retracts its outgoing handle (convert cursor), and dragging from it pulls out a new one on its own. Auto Add/Delete: over a selected path, a click on a segment adds an anchor and a click on an anchor deletes it (add and delete cursors); Shift held, or Preferences › General › Disable Auto Add/Delete, starts a new path instead. Alt held over a handle end or an anchor of a selected path (the one being drawn too) works as the Anchor Point tool, with its convert cursor: dragging a handle moves it alone, clicking a smooth anchor makes it a corner, dragging an anchor pulls out new symmetric handles, dragging a segment reshapes it; drawing then goes on. Cmd (Ctrl) held drags with the selection tool chosen last, Direct Selection until one is (handles, anchors and segments of the path being drawn or another), and the Pen then goes on drawing its path while that stays selected; the pointer shows that tool's while Cmd is held. The same holds for agents (`pointer_gesture` with `mods.cmd`), as the borrowing now lives in the engine (#494). A drag's preview (the Pen's, the Anchor Point tool's, Direct Selection's handles and anchors) follows every position the pointer is seen at (#834): the canvas sends the tool a drag whenever the pointer's document position differs from the last one it sent, not only when egui's frame delta is non-zero (zero when a compositor coalesces motion and in the frame the pointer comes back into the window after leaving it), and a move that arrives in the release's own frame shapes the preview before the release commits it, once the press has dragged. With the Pen, a press that moves under 3 screen pixels is a click (a corner without handles), and a Precise Cursors command toggles the existing preference and can take a shortcut (#1663). + Choosing the Pen again while it draws a path (P, a click on its button, `tool.select`) ends the path as Escape does: the path stays open and selected (a path inside a compound path leaves the compound path selected), the Pen stays chosen, and the next click starts a new path. The [help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/preview-paths-drawn.html) describes P doing this with the preview off; doing it with Rubber Band on and for the button and `tool.select` are VectorCraft's own rules. - **Direct Selection (#1278):** clicking a segment picks its connection, with hollow endpoint anchors and only that curve's direction handles. Delete leaves the neighboring curves and appearance intact, opens/splits contours in one undo step, and another Delete removes the remaining selected path. A whole-path drag and deliberate anchor selection keep their existing behavior; egui frames and native control/art checked, OS mouse/visual QA pending. Where anchors of overlapping objects coincide, a click or drag takes the anchor of the selected object, also when another object lies over it (#1509, fixes #1508). Delete removes every selected anchor of a closed path (it used to remove the wrong ones), removes objects selected whole along with the selected anchors of others, and keeps the remainder selected so a second Delete removes it (#1674). In isolation mode Direct Selection and Group Selection pick only inside the isolated object (#1666). Escape cancels a Direct Selection drag (#1803, #1743). Double-clicking type (including type nested inside a group) switches to the Type tool and puts the caret at the clicked character. With Direct Selection and Group Selection, a drag that starts on an object while the selection also holds direct-selected anchors or segments moves those anchors and the objects selected whole in one undo step (`path.moveAnchors`), as a drag of a selected anchor does, and the other anchors of a partly selected path stay in place. While Alt is held during the drag, it copies the selected objects instead (`object.transform`). When direct-selected anchors are moved or transformed together with objects selected whole (such a drag, an anchor drag, an arrow key, or Move, Rotate, Scale, Reflect and Shear without a copy), a path inside a selected group is transformed once, with the group. A path segment with a control point whose x or y is infinite or larger in size than `f64::MAX / 16` is measured by its control points, so its bounds hold the whole curve and the canvas check refuses an edit that leaves such a path selected (`path.create` included). @@ -1384,6 +1394,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The Command Palette shows each result as a 20-point row, with no gap between rows, and shows 12 rows at a time in a list that scrolls; a short window shows fewer. A name too long for its row ends with "…". The list holds up to 50 results, and the line under it says how many matched ("14 results", "50 of 120 results. Keep typing to narrow them." or "No commands match"). Up and Down move the highlight and wrap at the ends, Page Up and Page Down move it by the rows shown and stop at the ends, and the highlighted row scrolls into view; after a scroll with the wheel, the highlight moves to the nearest row in view. A click anywhere on a row runs it. Screen readers stay on the search field, whose description names the highlighted result and its place among every match ("2 of 14: …", or "2 of 120: …" when the list holds 50); the rows are list items, the highlighted one selected, and the keyboard focus goes back to where it was when the palette closes, unless a pick opened a dialog (`palette` tests `results_are_compact_rows_that_touch`, `the_footer_counts_the_results`, `with_no_match_enter_runs_nothing`, `the_sixteenth_result_is_reached_by_keyboard_and_runs`, `page_keys_move_by_a_page_without_wrapping`, `a_wheel_scroll_keeps_the_highlight_in_view`, `the_row_under_the_pointer_is_the_one_highlighted`, `a_long_name_ends_with_an_ellipsis`, `the_popup_stays_inside_a_short_window`, `a_click_anywhere_on_a_row_runs_it`, `screen_readers_hear_the_highlighted_result_and_the_count`, `closing_gives_the_focus_back`). A press of any pointer button outside the Command Palette closes it: a click, a right-click or the start of a drag. While the palette is open, the canvas, the toolbars, the docked panels and the app bar under it do not respond to the pointer, so the press that closes the palette does not press a tool button or another control there. A window drawn above them, such as a progress window, still gets its click, and that click also closes the palette (`palette` tests `a_click_on_the_canvas_closes_the_palette`, `a_click_on_another_control_closes_the_palette_without_pressing_it`, `a_right_click_or_a_drag_outside_closes_the_palette`, `a_click_on_a_window_above_closes_the_palette_and_reaches_it`, `the_click_that_opens_the_palette_does_not_close_it`). The Command Palette ranks its results by how well they match. A query that is a result's id lists that result first (`view.goto1` lists Saved View 1 above Saved View 10); then come results whose name is the query, results whose name without its menu path starts with it, and results whose initials it is ("ea" finds Export As…). Within each of those, a result where every word of the query is a whole word of its name ranks above one where a word only starts a word of the name, then one where it is a word of the menu that holds it, then of its id, then text inside a word, so a query that is a menu's title ("object") lists results named with that word above the items of that menu. A tool ranks above a menu command, panel, effect or filter plug-in that matches as well, so "rect" lists the Rectangle Tool above Effect › Convert to Shape › Rectangle…, and of two results of the same kind the shorter name comes first. Words of the menu bar item that runs a result also find it, the item's own label included ("exit" finds Quit VectorCraft, which File › Exit runs); with the native macOS menu bar, the items that bar moves into its application menu are found under it (Preferences… under Settings). Every result the earlier search found is still found, and the highlight stays on its result when a plug-in is installed, a shortcut changes or the language changes while the palette is open (`palette::search` tests `a_better_word_grade_ranks_first`, `a_better_whole_query_tier_ranks_first`, `kind_and_length_never_lift_a_worse_grade`, `a_menu_title_does_not_lift_its_items`, `common_queries_list_the_command_near_the_top`, `every_result_is_found_first_by_its_name_and_its_id`, `every_result_found_before_is_still_found_and_shown`, `results_know_their_place_in_the_menu_bar`, `native_homes_follow_the_native_application_menu`; `palette` test `the_highlight_stays_on_its_result_when_the_results_change`). + A Command Palette query word in an English plural or verb form finds a result whose English name or menu path holds the base word: "rounded corners" lists Effect › Stylize › Round Corners… first, and "scaling" finds Object › Transform › Scale…. The search drops `'s`; `es` after `s`, `x`, `z`, `ch` or `sh` (also trying the word with only its `s` dropped, so "rasterizes" finds Rasterize…); a final `s` in words of more than 3 letters, except after `ss`, `us` or `is`; `ing` in words of more than 5 letters and `ed` in words of more than 4. After `ing` or `ed`, a doubled `b`, `d`, `g`, `m`, `n`, `p`, `r` or `t` is tried both single and doubled, the single letter only when at least 3 letters are left ("cutting" meets Cut, "added" meets Add); otherwise the word is also tried with an `e` ("scaling" meets Scale…). It turns `ies` into `y` or `ie` in words of more than 5 letters and `sses` into `ss`, and leaves `series` and `species` as they are. Among results that the whole query matches the same way (as an id, as a label, at the start of a label, as initials, or none of these), a result whose name holds the base word of a query word ranks below one that holds the query word whole and above one where the query word only starts a word of the name, so "scale zz" lists a name with "Zz Scaling" above one with "Zz Scalers". "scale" alone still lists "Scalers" above "Scaling", because "Scalers" starts with the query. A partly typed word that is not itself a word of any result ("scal") does not meet a base word. Names shown in other languages and ids are not changed this way, and every result found before is still found (`palette::search` tests `plurals_and_verb_forms_meet_their_base_word`, `a_plural_or_verb_form_finds_the_result`, `a_better_word_grade_ranks_first`, `a_partly_typed_word_does_not_lift_a_verb_form`, `a_whole_query_tier_comes_before_a_stem_form`, `results_matched_without_a_stem_keep_their_order`). `object.setProps` with `visible: false` or `locked: true` deselects every selected object that is then hidden or locked, the key object included, as the eye and lock columns do. Ctrl/Cmd+Alt-clicking an eye switches the other layers to Outline and the row's layer to Preview, or switches all layers back to Preview when the others are in Outline (`layer.outlineOthers`, `layer.previewAll`). Ctrl/Cmd+Alt-clicking New Layer adds a layer directly below the current layer, at its level (`layer.new {below: true}`), and Ctrl/Cmd+Alt-clicking New Sublayer adds a sublayer under the contents of the layer it goes into (`layer.newSublayer {bottom: true}`), each in one undo step. The reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists these clicks for placing a layer below the selected layer and a new sublayer at the bottom of the layer list. @@ -1596,6 +1607,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The Paragraph panel's Numbered List button, Type › Bullets and Numbering › Apply Numbers and the context menu's Apply Numbers (`text.setFormat {list, number}`, `type.applyNumbers`) make paragraphs a numbered list with the documented presets (1, A, a, I, i, 01, 001, and None, which turns the list off; [Bullets and numbering](https://web.archive.org/web/20250807202418/https://helpx.adobe.com/illustrator/using/bullets-numbering.html), [Create bulleted or numbered lists](https://web.archive.org/web/20260417034638/https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/create-bulleted-or-numbered-lists.html)): each paragraph starts with its number and a period, counted through the list paragraphs of the story and its threaded frames, with the text and indents as in a bulleted list; letters go on from Z to AA, and roman numerals go on from III to IV, an empty paragraph is not numbered, and a paragraph in no list starts the count again at 1. More Options in the Bullets and Numbered List presets (`ui.bulletsAndNumbering`) opens the Bullets and Numbering dialog ([Create bulleted or numbered lists](https://web.archive.org/web/20260417034638/https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/create-bulleted-or-numbered-lists.html)): a Bullets tab and a Numbers tab with the presets, and the Position group's Alignment, Left Indent and First Line Indent, shown on the type while the dialog is open; OK applies them with `text.setFormat` (Alignment is its `listAlign`) as one undo step, and Cancel puts the type back. Alignment Left starts the marker at the first line's start, and Right ends it where the text starts. The cited page does not say where the marker sits for each choice, so these meanings are VectorCraft's own rule. Paragraph styles and the native file keep the alignment. Tab and Shift+Tab with the caret at the start of a list paragraph (`text.setFormat {listLevel}`), and the Bullets and Numbering dialog's Level field (OK sends it as `listLevel`), move the paragraph down and up the list's nine levels ([Create bulleted or numbered lists](https://web.archive.org/web/20260417034638/https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/create-bulleted-or-numbered-lists.html), [Bullets and numbering](https://web.archive.org/web/20250807202418/https://helpx.adobe.com/illustrator/using/bullets-numbering.html)): each level past the first sets the paragraph 18 pt further in, each level counts its own numbers from 1, and a paragraph back at a shallower level goes on with that level's count, through threaded frames too. Elsewhere Tab inserts a tab as before; one Undo takes a level change back, and paragraph styles and the native file keep the level. Convert to Text writes each level's numbers and keeps a deeper paragraph's indent. + VectorCraft's own (the help pages above show no such control; requested in #2473): the Bullets and Numbering dialog's Start at box (`text.setFormat {startNumber}`, and `restartNumbering` for 1) gives a numbered paragraph a number from 1 to 999999999, and the numbered paragraphs after it at its level count on from it, through threaded frames too; off, the paragraphs count on from the one before. One Undo takes it back, the native file keeps it, a paragraph made with Return and a paragraph style do not take it, and Convert to Text and the exports write the numbers shown. Type › Bullets and Numbering › Convert to Text (`type.convertListToText`, `text.convertListToText`) makes the bullets and numbers of the list paragraphs editable characters of their text ([Create bulleted or numbered lists](https://web.archive.org/web/20260417034638/https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/create-bulleted-or-numbered-lists.html), [December 2022 release notes](https://web.archive.org/web/20260203094741/https://helpx.adobe.com/illustrator/using/whats-new/2023-1.html)): each marker becomes its characters and a tab at the start of its paragraph, in the marker's font, size and color, the list is turned off, and a left tab stop at the left indent keeps the text after the tab where it started; threaded type keeps the numbers its story counted. While no type is being edited, a press with Shift held makes new type with the horizontal or vertical counterpart of the Type, Area Type or Type on a Path tool chosen, and a press with Alt (Option) held makes it with Type on a Path in place of Area Type or the reverse, in the chosen tool's writing direction; with both keys held, both switch ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). The pointer shows the tool the press acts as, and the tool chosen stays selected. The Type tool starts a list from the characters [Create bulleted or numbered lists](https://web.archive.org/web/20260417034638/https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/create-bulleted-or-numbered-lists.html) names (`text.startList`): a space typed on its own after `1.`, `1)`, `A.` or `A)` at the start of a paragraph in no list makes the paragraph a numbered list in 1, 2, 3 or A, B, C, and a space typed after `*`, `+`, `#` or `>` makes it a bulleted list with the filled dot, the hollow circle, the filled square or the dash (a VectorCraft choice: the page does not say which bullet each character gives). The typed characters are removed, and one Undo puts them back as text with no list. The same characters later in a paragraph, and pasted list characters, start nothing. @@ -1767,6 +1779,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Recolor Artwork Add Color and Remove Color tools:** under the display buttons beside the Edit tab's wheel, the Add Color tool adds the color clicked on either wheel to the color group, and the Remove Color tool removes the color whose marker is clicked; a color bar's right-click menu has Remove Color, and the base color can't be removed ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html), [Edit swatch groups using the color wheel](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/edit-color-groups-using-the-color-wheel.html)). An added color is a new row with no current colors and `added: true`; unlike a row made with New Row, it adds its new color to a rewritten color group, after the group's other colors. VectorCraft's own rules: an added color takes the base color's brightness, and with art or a group a removed color's row stays with its current colors and no new color, so that art keeps its colors and the group's swatch at that place is removed. `wheelTool` (`add`, `remove`) is the dialog field. Tests: `the_add_color_tool_adds_a_row_with_no_current_colors`, `an_added_color_joins_the_color_group`, `the_remove_color_tool_removes_a_marker_but_not_the_base_colors` and `a_color_bars_menu_removes_its_color` in `crates/ui-egui/src/tests/recolor.rs`, `apply_params_give_the_group_added_colors_and_keep_its_other_colors` in `crates/ui-egui/src/dialogs/recolor.rs`, and `an_added_empty_row_gives_the_group_its_color_after_the_others` in `crates/engine/src/tests/recolor.rs`. Scores and estimates unchanged. - **Recolor Artwork brightness and hue wheel:** a button under the Edit tab's wheel tools switches the wheel between hue with saturation and hue with brightness; a marker's angle sets its hue, and its distance from the center sets the component the wheel shows ([Recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/recolor-options-overview.html), [archived help, Edit colors](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=144)). VectorCraft's own rules: brightness runs from black at the center to full at the edge, the segmented wheel's five rings become brightness steps, the slider under the wheel edits the component the wheel leaves out (Saturation on the brightness wheel), Add Color takes the hue and brightness clicked at the base color's saturation, the choice holds for both wheels while the dialog is open and the button is off for the color bars, and each opening shows hue and saturation. `wheelAxes` (`hueSaturation`, `hueBrightness`) is the dialog field. Tests: `the_brightness_and_hue_wheel_swaps_the_wheel_axis_and_the_slider`, `a_marker_on_the_brightness_wheel_sets_hue_and_brightness`, `the_add_color_tool_on_the_brightness_wheel_adds_the_brightness_clicked` and `the_segmented_brightness_wheel_has_24_hues_by_5_brightnesses` in `crates/ui-egui/src/tests/recolor.rs`, and `an_added_color_on_the_brightness_wheel_takes_the_base_colors_saturation` in `crates/ui-egui/src/dialogs/recolor.rs`. Scores and estimates unchanged. - **Recolor Artwork Find:** the Assign tab's Find button finds the colors of the selected rows in the art ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)): while it is on, their art shows as the preview shows it and the rest of the selected art shows dimmed, until a second click ([archived help, Recolor Artwork](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=149)). VectorCraft's own rules: a dimmed color is a 25% tint of its current color (or the nearest lighter tint when that one is a color a selected row lists), a color a selected row also lists is not dimmed, and Find records no undo step. `findColors` is the dialog field. Tests: `find_dims_the_colors_of_the_rows_not_selected` and `find_shows_the_selected_rows_art_and_dims_the_rest` in `crates/ui-egui/src/dialogs/recolor.rs`. Scores and estimates unchanged. + - **Recolor Artwork color groups list:** a list on the right of the dialog shows the document's color groups, and the Show Color Groups button beside the tabs shows or hides it. A click on a group makes it the group being edited, and the rows take its colors. Save Changes rewrites the selected group with the new colors, New Color Group saves them as a new group, and Delete removes the selected group; the Swatches panel shows each change ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html)). VectorCraft's own rules: when the art has colors of the group, Save Changes and OK keep the group's swatches in order, and a swatch no row lists keeps its color; an excluded row leaves its swatch its own color; after a save with art, the rows' new colors take the Global Adjust, which goes back to 0%. `group`, `groupStorage` and `groupAction` are the dialog fields. Tests: `the_color_groups_list_selects_saves_and_deletes_groups`, `a_group_picked_in_the_list_recolors_the_art` and the `saving_a_group_` tests in `crates/ui-egui/src/dialogs/recolor.rs`, and `edit_color_group_with_its_own_colors_records_no_undo_step` and `edit_color_group_with_its_own_color_keys_keeps_the_colors` in `crates/engine/src/tests/swatchcmds.rs`. - **Recolor Artwork New Row:** the Assign tab's New Row button adds a row with no current colors, so current colors can be moved into it and take its new color ([Advanced recolor options overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/learn-color-basics/edit-colors-dialog-overview.html), [Assign new colors to selected artworks](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/assign-new-colors-to-selected-artwork.html)). VectorCraft's own rules: the row goes above the first selected row (at the top when none is selected) with that row's new color and becomes the selection, and Merge with it as the first selected row moves the other rows' colors into it. The button needs selected art. An empty row recolors nothing, does not count toward Colors, adds no library swatch and gives a rewritten color group no color. While it is empty, Save All Colors and a new color group saved from colors alone leave its new color out, the Edit tab's wheel, bars and chips do not show it and its sliders edit the base color instead, the harmony rules and linked moves leave its new color as it is, and the Color Theme Picker gives it no color. Tests: `a_new_row_goes_above_the_selection_and_takes_merged_colors`, `an_empty_row_gives_the_group_no_color`, `an_empty_row_gives_a_new_group_no_color`, `an_empty_row_takes_no_harmony_or_wheel_color`, `theme_picks_leave_an_empty_row_out`, `save_all_colors_leaves_an_empty_row_out` and `colors_merged_into_a_new_row_take_its_new_color` in `crates/ui-egui/src/dialogs/recolor.rs`, `an_empty_row_recolors_nothing` and `an_empty_row_adds_no_swatch_and_no_group_color` in `crates/engine/src/tests/recolor.rs`. - **Edit Colors parameters:** `edit.colors.saturate` needs a number `intensity`, the value from -100% to 100% that Saturate takes ([Adjusting colors](https://web.archive.org/web/20230128232631/https://helpx.adobe.com/illustrator/using/adjusting-colors.html)), and answers "missing number `intensity`" without one; a number outside the range counts as its nearest end. A value that is not a number, such as `"40"`, is refused with `` `intensity` must be a number, not "40" ``, as in every command that needs a number (`tests::params::a_malformed_required_number_is_not_reported_as_missing`). `edit.colors.adjustBalance` refuses a channel and `color.harmony` refuses `steps` or `amount` that is not a number; both read `null` as a value left out. `tests::editcolors` and `tests::colorguide` cover them. - **Convert to Indexed Color:** Edit › Edit Colors › Convert to Indexed Color… (`edit.colors.toIndexed`) stores the embedded images in the selection as indexed-color PNGs of at most 256 colors. The palette is chosen as for a PNG-8 export, as evenly spaced levels of red, green and blue, or from the document's swatches, with diffusion, pattern or noise dithering; pixels under half opacity become transparent. The dialog previews live, and OK is one undo step. This is VectorCraft's own command and counts toward no score. `tests::editcolors` and `encode::tests_palette` cover it. Scores and estimates unchanged. @@ -1967,6 +1980,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur A symbol instance written as its art, and a blend, mesh, repeat, placed document, intertwine or envelope written as a group of its art, likewise still wraps area type by its bounds when the file is opened, as it did before saving, not by the members of that art: the group starts with the same unpainted rectangle, which takes the object's lock and visibility, and the group keeps the object's name and transparency without options of its own. Area type in that art is above the rectangle, so the rectangle does not wrap it. The rectangle takes its place in the object limit before the art; without room for it, the options are left out with the limit's warning. An object without finite bounds keeps the options on its group. This is VectorCraft's own round-trip rule (`crates/eps/src/ai_editing/tests.rs` `live_art_written_as_a_group_keeps_wrapping_by_its_bounds`, `wrap_bounds_of_live_art_fit_the_object_limit_and_leave_area_type_in_the_art_unwrapped`, `live_art_without_bounds_keeps_its_text_wrap_on_the_group`). In a `.ai` or EPS opened from its editing data, type has its text object's opacity, blend mode and knockout shape flag, whether it is made from the file's text document or taken from the page, and type made from the text document takes its text object's lock. Where such type has transparency and comes in with other art (the rest of its look, or page type and strokes that go with it), a group of them has it. Where the page draws its type, or the strokes around it, with transparency that is neither its text object's nor its text object's combined with that of the objects around it, the page's type and strokes keep their own instead (`crates/eps/src/import/tests_native.rs`). Where the page draws type of no text object over text objects made from the text document, with their words in any case, that type is theirs as the page draws it and is left out; the page's other type of no text object goes only to text objects whose type the text document can't make, or else is left out with a warning. `.ai` editing-data import restores the document's listed graphic styles in panel order and links objects that use a listed style; unsupported appearances keep their drawn look (`crates/eps/src/import/ai/tests.rs`). + Swatches › Open Swatch Library › Other Library… lists `.ai` and `.eps` files in its Swatch Libraries filter and loads another document's swatches ([importing swatches from another document](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=134)): its colors, tints, gradients and pattern swatches, in its order and color groups. Adding a pattern swatch from such a library brings the pattern with its tile and art as a pattern swatch, under the library swatch's name and in its color group. A document with no swatches, and a `.ai` or EPS whose swatches are only the default ones, are refused with a message (`cmd::fileio::tests_aiimport::a_swatch_library_in_a_ai_file_lists_and_adds_its_pattern_swatches`, `a_pattern_from_a_ai_library_keeps_a_color_the_library_lacks`, `swatch_library_documents_without_swatches_or_damaged_are_refused`, `cmd::fileio::tests::the_swatch_library_filter_lists_ai_and_eps_files`). A `.ai` or EPS graphic style library, whose editing data holds the styles and their list but no layers, opens with those styles in list order. Other Library… loads another document's graphic styles ([Apply graphic styles](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-graphic-styles/apply-graphic-styles.html)) and lists such a library's styles in a library panel. A `.ai` or EPS read as its PDF part or page because its layers can't be used also gets the styles of its list in place of the default ones (`crates/eps/src/import/tests_native.rs`, `cmd::fileio::tests_aiimport::a_graphic_style_library_in_a_ai_file_without_layers_loads_its_styles`). A `.ai` or EPS symbol library, whose editing data holds symbol definitions and their list but no layers, opens with those symbols in list order, each with its registration point. Other Library… in the Symbols panel's Symbol Libraries Menu imports the symbols of the file you pick ([Create or import symbol libraries](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-or-import-symbol-libraries.html)) and lists such a library's symbols in a library panel. A `.ai` or EPS read as its PDF part or page because its layers can't be used also gets the symbols defined before its layers (`crates/eps/src/import/tests_native.rs`, `crates/eps/src/import/ai/tests.rs`, `cmd::fileio::tests_aiimport::a_symbol_library_in_a_ai_file_without_layers_loads_its_symbols`). In a large canvas `.ai` or EPS ([Large canvas FAQ](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/start-a-new-file/large-canvas-faq.html)), or a `.ai` whose page is in larger units, opened from its editing data, VectorCraft reads the symbol definitions in the same units as the layers. When the file opens at its full size, each symbol's art, strokes and effects are scaled with the layers, and each instance keeps its own scale and rotation and draws where and as large as before. A new instance comes in at the symbol's full size, the size of an instance at 100% in the file. A symbol library from such a file comes in at the same size, and opacity masks on the layers that don't move with their object are scaled with the layers too. Editing data that VectorCraft wrote keeps its symbols and those masks at their own size, as its `.ai` save writes them (`tests_native::a_large_canvas_eps_keeps_its_symbols_at_the_pages_size`, `a_large_canvas_ai_keeps_its_symbols_at_the_pages_size`, `a_large_canvas_ai_vectorcraft_wrote_keeps_its_symbols_at_their_own_size`, `a_symbol_library_in_larger_units_comes_in_at_the_pages_size`, `build::candidate_tests::scaling_the_symbols_keeps_their_instances_in_place`, `scaling_a_read_document_scales_unlinked_opacity_masks`). @@ -2135,6 +2149,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Missing linked files can be looked for in a folder and its subfolders: Find in Folder… in the Linked File Not Found dialog and in the Links panel menu lists the files with each one's name, those with the size and contents saved with the link first, and relinks the files chosen, copying an image's file into the document's folder when asked, without replacing a file there (`links.findFiles`, `links.relink {copy}`). In the Links panel it looks for the selected linked files when any are selected. - The Links panel's Relink… opens a Relink dialog whose Replace menu picks which links take the new file: Selected Instances (the selected images, as before), All Instances (every image linked to the same file), Missing Links from This Folder (then every other missing link whose file name is in the new file's folder) and Each Link Separately (a file for each selected link in turn). Each relinks as one undo step (`links.relink {scope}`, `ui.relinkDialog`). Relink to Folder… stays as it is. - The Links panel menu's Copy Info ([Links panel](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-from-other-apps/links-panel-in-illustrator.html)) copies the selected link's file name to the clipboard (`links.copyInfo`). VectorCraft's own rules: with several rows selected it copies one name per line in the order the panel shows them, an embedded image gives the name its row shows, and the item is off with no row selected. + - The Links panel menu's Unembed… works on several selected embedded images at once and writes them all to one chosen folder ([Embed and unembed images and files](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/manage-linked-and-embedded-files/embed-images-and-files.html)): it asks for a folder once, writes a file for each image there and links each image to its file in one undo step (`links.unembed {ids, folder}`). VectorCraft's own rules: each file keeps the format its image is stored in (or PNG when that format is not one of VectorCraft's raster file formats) and is named after the image, a taken name gets a number (`Name 2`) and a file already in the folder is never replaced, linked rows in the selection are left as they are, and when one image can't be written the files already written are removed and nothing is unembedded. On the web each image is downloaded instead. Evidence: `unembed_to_a_folder_writes_each_image_and_links_it_in_one_undo_step`, `unembed_to_a_folder_that_fails_leaves_no_file_and_no_change`, `unembed_writes_several_images_to_one_picked_folder`. - Linked files inside symbols, graph designs, patterns and opacity masks are saved with their paths relative to the document, as linked files in the layers are, so they are found after the document and its files move to another folder together; on open each of those links takes the path where its file was found. Update Links, and opening with Update Links: Automatically, read a modified file again for that art too, and saving a document refreshes its placed copies inside symbols and patterns of the other open documents. Evidence: `links_outside_the_layers_find_their_files_after_the_folder_moves`, `update_links_reads_files_again_inside_symbols_patterns_and_masks`, `saving_a_document_refreshes_its_placed_copies_inside_symbols_and_patterns`. - A linked file that is missing when a moved document is saved keeps the folder its relative path names, instead of a relative path worked out from the out-of-date absolute path, also for a `.ai` file another app wrote (such as `src/`), so the file is found once it is back in that folder. Evidence: `a_missing_link_keeps_its_relative_path_when_the_moved_document_is_saved`, `links_of_an_imported_file_are_found_by_their_relative_folder`, `a_missing_link_of_a_moved_document_keeps_its_relative_place`. - On Windows, a document opened from a mapped network drive finds its links stored with the share's own path (`\\server\share\…`), as the same document opened from the share does; links on other computers stay missing. @@ -2240,6 +2255,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Pattern fills in Expand:** Object › Expand with Fill turns a pattern fill into the pattern's tiles in a clip group shaped like the object, with the fill's opacity and blend mode, and the object's other fills and strokes stay above or below it in paint order, in one undo step (`object.expand`). - **Gradient options for type in Expand:** the Expand dialog enables its gradient options for type, symbol art included, only when the outline of at least one character, ruby character, underline or strikethrough gets a gradient that Fill turns into art. A gradient that repeats or reflects in more than 256 runs across a character's outline, VectorCraft's own limit, stays a gradient after Expand (`object.expand.info`, `crates/engine/src/tests/objexpand.rs`). +- **Expand with Alt (Option):** choosing Object › Expand… in the in-window menu bar with Alt (Option on macOS) held expands the selection at once, in one undo step, with the choices OK last expanded with in the Expand dialog ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/expand-objects.html) describes this shortcut for a gradient), and the dialog opens on those choices. VectorCraft's own rules: the shortcut applies to every expandable selection, the choices are kept until the app quits, the dialog's defaults apply before the first OK, and when none of the choices has something to expand in the selection the dialog opens instead (`ui.expandDialog`'s `immediate`). - **Type with transparency or effects:** type at less than 100% opacity, in a blend mode other than Normal, or with raster effects such as a drop shadow keeps its glyph outlines between frames, as opaque type does, and is laid out again when it is edited or the fonts change. At 2880 × 1800 on 8 threads, a page of 1,000 type objects takes 13 ms a frame instead of 23 ms at 80% opacity, 31 ms instead of 41 ms in Multiply and 16 ms instead of 26 ms with a drop shadow, with the same pixels. @@ -2252,6 +2268,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Live objects in documents with many symbols:** a live object, or an object with effects, that shows symbols or patterns is not walked again in a later frame to find them while the document's symbols and patterns stay the same. One that shows a placed file is walked in every frame. At 1000 × 1000 pixels, a page of 2,000 envelopes around instances of the last 2,000 of 10,000 symbols takes 30 ms a frame, and 83 ms when every frame walks them again, with the same pixels. - **Control bar and task bar on large paths:** the Control bar and the contextual task bar read the first selected object in place each frame instead of copying it; the task bar copies the object only when it is a basic shape, for its Shape Properties. With one selected open path of 200,000 anchors, an idle frame with both bars shown takes 3.8 ms in a release build instead of 8.0 ms (medians of five interleaved runs). Tests: `the_control_bar_label_follows_edits_undo_documents_and_selection`, `the_task_bar_follows_the_active_document`, `the_task_bar_follows_edits_and_undo`. +- **Panels on large selections:** the Properties, Transform, Brushes, Appearance, Transparency and Image Trace panels read the selected object where the document holds it each frame instead of copying it, and the Transparency panel removes the mask from a copy of the object only when it draws the object's thumbnail again. With one selected open path of 200,000 anchors, an idle repaint uses 72.9 µs of CPU time in a release build instead of 88.4 µs for the Properties panel, 27.5 µs instead of 37.2 µs for the Appearance panel and 19.6 µs instead of 29.8 µs for the Transparency panel with its thumbnails shown (medians of seven interleaved runs). Tests: `first_selected_is_the_node_the_document_holds`, `first_subject_is_the_node_the_document_holds`, `panels_show_the_selected_object_after_an_edit_and_after_undo`, `state_holds_the_documents_node_and_the_object_thumbnail_leaves_out_the_mask`. - **Paste of many objects:** Paste leaves pasted copies as they are when no resource has another name or color in the document and the objects link no graphic style. It looks up the pasted type in one walk of the tree. A paste and undo of 20,000 rectangles in 200 groups uses 49.2 ms of CPU time in a release build instead of 59.4 ms, and of 5,000 point type objects 25.3 ms instead of 29.4 ms (medians of seven interleaved rounds, each round the CPU time of a 61-paste run minus a 1-paste run, divided by 60). Tests: `crates/engine/tests/it/paste_many.rs`. - **Type drawn as glyph outlines:** under a geometry effect, in EMF and WMF export, in DXF export when it is written as outlines, flattened with Convert All Text to Outlines, and inside an envelope, type keeps its underline and strikethrough, the weight and dashes of its character strokes when it is scaled, and the placement of its gradients and patterns, as the canvas draws it. A group's or layer's own fills and strokes also paint the underline and strikethrough of the type in it. @@ -2342,6 +2359,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **The command sweep sends file and folder params into its temp folder by the command catalog:** the sweeps in `crates/engine/tests/command_sweep.rs` take each command's file and folder keys from the catalog (`cmd::location_keys`, the same key list the plug-in call rules use, less the keys that name part of the document in a command), read every key a params description names (`{path | name …}`, `{folder? (…)}` included) and its schema's params, and send every string under such a key, in arrays and in objects inside them (`paths: [{ids, path}]`), as a location in the temp folder, so a command added later is swept and checked without editing the sweep. `diffPath` counts as a file key, and Slice Options' `url` and Export for Screens' `folders` do not. Regressions: `sweep_cases_name_files_only_inside_the_temp_folder` and `sweep_cases_send_the_file_keys_of_the_command_catalog` in `command_sweep`, `location_keys_come_from_the_command_catalog` in `cmd::plugin_call`. Scores and hours unchanged. - **A drag ended by a command with Real-time Drawing off:** when Undo, Redo, a filter that calls commands or a plug-in command that calls commands ends a drag whose preview Real-time Drawing off has not applied yet, the preview is applied first and kept as an undo step of its own, as releasing the drag keeps it; a preview that fails cancels the drag. The filter or plug-in command is then given the objects where the drag left them. Regressions: `crates/engine/src/tests/plugins.rs`, `crates/engine/src/tests/prefs.rs`. Scores and hours unchanged. - **The warning of a preview applied when a command ends a drag:** a preview that Real-time Drawing off left unapplied, and that Undo, Clear History or another command applies before it runs, keeps its warning: the command's result carries it as `previewWarning`, and as `warning` when the command has none of its own, and the status bar shows it, as releasing the drag shows it. Typing kept as its own step when a tool's drag begins, or when Cmd lends the Selection tool, shows its applied preview's warning in the status bar too. Regressions: `settling_a_deferred_preview_keeps_its_warning` and `settling_typing_for_a_tool_shows_its_preview_warning` in `crates/engine/src/tests/prefs.rs`, `settled_warnings_join_the_result` in `crates/engine/src/session/execute.rs`. Scores and hours unchanged. +- **Typing kept when a dialog or a panel previews, with Real-time Drawing off:** a dialog's Preview, a panel's live slider, the Effect Gallery's preview, the font menus' preview, a paint for the characters the Type tool selected and an inline graphic inserted while typing first apply the typing that Real-time Drawing off left unapplied, as an undo step of its own, and the status bar shows that typing's preview warning. The Character, Paragraph and Tabs panels, Bullets and Numbering, Justification and the inline graphic then act on the characters the Type tool selected in the typed text. When the typing can't be kept, the status bar shows the error and the dialog's preview does not start. Regressions: `settling_typing_for_a_dialog_returns_its_preview_warning` in `crates/engine/src/tests/prefs.rs`, `ending_deferred_typing_for_another_edit_keeps_the_typing` in `crates/engine/src/tests/textedit.rs`, `inserting_while_deferred_typing_keeps_the_typing` in `crates/engine/src/tests/inline.rs`, `settled_typing_tests` in `crates/ui-egui/src/dialogs/form.rs`, `stack_preview_keeps_typing_in_progress` in `crates/ui-egui/src/dialogs/effect_gallery.rs`. Scores and hours unchanged. - **Plug-in progress, Cancel and log lines (G17):** at plug-in API level 2 a plug-in with the `progress` permission imports `env.vc_progress`, `env.vc_cancelled` and `env.vc_log`. A heavy filter's and an export's progress windows show its progress as a percentage bar, their Cancel reaches it through `vc_cancelled`, a light filter with `progress` and no `commandAllowlist` runs in the background with the same progress window when it runs at once or OK runs it with Preview off, and its log lines go to the app's log with its id, capped per line and per run. Installing checks every import and names the one it refuses. Regressions: `crates/plugins/src/host.rs`, `crates/plugins/tests/abi.rs`, `crates/engine/src/tests/plugins.rs`, `crates/engine/tests/plugin_fuzz.rs`, `crates/ui-egui/src/tests/plugin_runs.rs`. Scores and hours unchanged. - **Live-effect plug-ins paint their output (G17, #121):** a live effect whose manifest has `"api": 2` and `"paintOutput": true` returns pieces, each drawn by itself in order with fills and strokes of its own in the filter's paint forms (a piece without them keeps the object's; an empty list paints none; an effect on a fill returns only fills, one on a stroke only strokes). The whole result is checked first: limits, numbers in range with nothing clamped, known keys only, and the swatches and patterns it names in the document; one fault draws that step of the stack unchanged, keeps the effect record and puts the plug-in's name and the field in `plugin.info`'s `lastError`. The pieces are drawn, measured and exported to PDF and SVG from the appearance stack without changing the document, and Expand Appearance writes them as ordinary paths in one undo step. Effects without the key behave as before. Regressions: `crates/plugins/src/painted/tests.rs`, `crates/plugins/src/manifest.rs`, `crates/engine/src/tests/plugins.rs`, `crates/engine/tests/plugin_fuzz.rs`. Scores and hours unchanged. - **Painted effects refuse gradient stop plates without a spot link (G17):** a gradient stop with process `plates` in a painted live effect's fill or stroke must link to a spot swatch of the document itself; a stop with no link, a `null` link or only the gradient's own `swatch` refuses the whole result, and so does a link to a process swatch or Registration, also when a cached result's swatch stops being a spot swatch. `lastError` names the stop's `plates`. Regressions: `crates/plugins/src/painted/tests.rs`, `crates/plugins/src/effect.rs` (`cached_painted_plates_refuse_after_spot_becomes_process`). Scores and hours unchanged. @@ -2629,6 +2647,10 @@ A VectorCraft addition, not a feature of the reference app, so no area score mov A VectorCraft addition, not a feature of the reference app (it has no command for this), so no area score moves. Object › Plug-ins › Type Tools › Release Type on a Path… splits each selected type on a path into point type holding the same text and the plain path it was set on, or keeps only one of them (#5532). The path keeps its exact shape (open or closed, anchors and handles, the object's transform), layer and place in the stacking order, with no fill and no stroke since type paths carry no paint of their own. The text keeps its runs, character and paragraph attributes and becomes point type on one straight line whose baseline starts where the first character sat on the path; Type on a Path Options don't apply to point type and are dropped. Keep Original leaves the type on a path and adds the released objects above it. Other objects are left alone and a selection with no type on a path makes no undo step; otherwise the run is one undo step, the released objects are selected, and the dialog's Preview works as Type on a Path Options' does (#5360). Tests: `cmd::addons::typetools::tests::release` in `vectorcraft-engine` (each mode, Keep Original, mixed and empty selections, closed, open, curved and flipped paths, transformed and grouped type, multi-style and unicode text with a centred paragraph, empty type, undo and redo, preview, cancel and commit, bad params refused), `release_type_on_a_path_previews_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Type Tools add-on › Release Type on a Path. +## Unit Converter add-on (2026-11-14) + +A VectorCraft addition, so no area score moves. Object › Plug-ins › Unit Converter opens a panel with one number field per unit of Preferences › Units › East Asian Type (pt, picas, in, mm, cm, px, ft & in, m, yd, ft, Q, Ha), as proposed in #5528. A length typed in any field, with units and arithmetic as every number field reads them, updates the others as it is typed; text that does not read leaves them as they were. From Selection reads the selection's width and height as the Transform panel measures them, Width or Height picks which one the fields show, and Apply sets that side of the selection through `object.setBounds` as the Transform panel's W or H field does (its reference point, Constrain Width and Height Proportions and its Transform Object Only, Pattern Only or Both choice) as one undo step, with no step when the size is already that length. Each field's copy button copies its value, with its unit when Copy with Units is on. Agents use `addon.units.convert` and `addon.units.selectionSize`, which change nothing in the document (`docs/mcp.md`). Tests: `cmd::addons::units::tests` in `vectorcraft-engine` (every unit, number-field syntax, preview bounds and selected anchors, bad params and unknown keys refused), `addons::units::tests` in `vectorcraft-ui-egui` (typing, From Selection and a changed selection, Apply with the Transform panel's reference point, proportions, pattern choice and a symbol's registration point, copy, screen-reader names) and `command_sweep`. + ## Cutting Tools add-on: Stencil Bridges (2026-11-12) A VectorCraft addition, so no area score moves. Object › Plug-ins › Cutting Tools › Stencil Bridges… cuts strips of a set width (0.01 to 1000 pt, 2 by default) out of the selected art so that a stencil cut from it keeps its islands, such as the inside of an O or a hole in a shape, attached to the sheet ([stencil islands and bridges](https://en.wikipedia.org/wiki/Stencil)). Every island is joined to the sheet, directly or through another island, by the shortest crossings that fit, then gets more bridges spread around it up to the count asked for (1 to 16); bridges run vertically, horizontally or along the shortest crossing among 12 directions 15° apart. The art is measured by the area its outlines enclose (hidden objects left out), type by its glyph outlines without converting the type, and becomes one compound path with the gaps cut; the selected objects that make up the art go to a new hidden layer, Stencil Original, or are replaced, and selected objects with no outlines stay where they are. Art with no islands is left as it is with a message and no undo step, islands the cut result still encloses are counted and reported, and the run is one undo step. Tests: `addons::stencil::tests` in `vectorcraft-pathops` (an O, two holes, nested islands, curved outlines, width, direction, the shortest crossing at an angle, more bridges per island and their spacing, narrow islands, slivers, outlines that touch at a corner, the curve tolerance, open outlines, limits and the work budget), `cmd::addons::cutting::stencil::tests` in `vectorcraft-engine` (the hidden layer and undo, replacing, width with units, type, hidden group members, objects with no outlines, the result's paint, kind and place in the stacking order, no islands, narrow islands, bad params refused), `stencil_bridges_opens_its_dialog_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Cutting Tools add-on › Stencil Bridges. diff --git a/docs/type-parity.md b/docs/type-parity.md index 5317d1e4cc..d6b9ff54ba 100644 --- a/docs/type-parity.md +++ b/docs/type-parity.md @@ -50,7 +50,7 @@ against Illustrator's public documentation; **estimated** unless noted. | Roman Hanging Punctuation | done | Paragraph panel menu › Roman Hanging Punctuation, `text.setFormat {romanHangingPunctuation}` (#2756): per paragraph, Optical Margin Alignment's punctuation and amounts without the letters; paragraph styles carry it. Evidence: `tests::roman_hanging_punctuation_hangs_punctuation_but_not_letters`, `typecmd::area_tests::roman_hanging_punctuation_is_set_per_paragraph_and_saved_only_when_on` | | Hyphenation… and Justification… options | done | Eleven Indian languages use attributed patterns and preserve syllables in both composers (#4947). Hyphenation… (`ui.hyphenation`, `text.setFormat`) sets each paragraph's Words Longer Than, After First, Before Last, Hyphen Limit, Hyphenation Zone (Single-line Composer only) and Hyphenate Capitalized Words, and paragraph styles carry them (#2310). Justification… (`ui.justification`, `text.setFormat`, #2755) sets Word Spacing, Letter Spacing and Glyph Scaling (Minimum, Desired, Maximum), Auto Leading and Single Word Justification; Desired applies to every line, justified lines and the Every-line Composer use the ranges. Vertical type isn't glyph scaled. Auto Leading also sets the Leading the Character panel shows for Auto type, the leading Alt+↑/↓ (`type.step`) steps from, per paragraph, and the lines Fill with Placeholder Text counts. Evidence: `crates/text/src/tests/justify.rs`, `dialogs::justification::tests`, `tests_prefs::auto_leading_steps_and_fills_from_the_paragraph_auto_leading`, `panels::character` test `leading_field_shows_the_paragraph_auto_leading` | | Tab stops and leaders; Tabs panel | partial | Tabs panel and stops with leaders in the model (`text.tabs.set`); a stop drags from where the press landed (#1458); leaders fill the tab's gap, repeated on a grid so they line up from line to line (#1877); Ctrl-dragging a stop (Command on macOS) moves all the stops together; in right-aligned area type the text before a line's last tab sits at its stops, from the left edge, and the text after it against the right edge, as Illustrator's own layout in a user's `.ai` sets a price list (evidence: `tests::right_aligned_area_type_sets_the_text_after_its_last_tab_against_the_edge`; centred lines are still aligned as a whole); in justified area type the text up to a line's last tab keeps its spacing and its tabs their stops, and the text after the last tab takes the line's room to the far edge, VectorCraft's own rule (evidence: `tests::justify::a_justified_line_with_a_tab_spreads_the_text_after_it_to_the_edge` and the other tab tests in `crates/text/src/tests/justify.rs`) | -| Hidden characters (Show Hidden Characters) | done | `type.hiddenCharacters` | +| Hidden characters (Show Hidden Characters) | done | `type.hiddenCharacters`: marks spaces, tabs, nonbreaking and narrow nonbreaking spaces, the spaces of a set width, discretionary hyphens, forced line breaks, paragraph ends and the story's end, in horizontal, vertical and right-to-left type and on a path; the mark shapes are VectorCraft's own. Evidence: `canvas::tests::hidden_characters_*` | | Spell check (Check Spelling, Auto Spell Check, custom dictionary) | done | the engine (#4936): `text.spelling.check` lists the unknown words of the document's type, each run in its Language, at the bytes `text.editRange` changes, and `text.spelling.suggest` gives suggestions, both from craft-proof, each paragraph on its own (English from the first dictionary it finds: a Hunspell dictionary in the user's dictionaries folder, the SCOWL dictionary built in from craft-i18n, a system Hunspell dictionary, and last the public-domain Moby word list built into it; other languages from the dictionaries craft-proof finds for them). The custom dictionary commands are done: `text.spelling.addWord`, `removeWord` and `changeWord` (Add, and Edit Custom Dictionary's Add, Delete and Change), and `text.spelling.dictionary` lists the words, saved to `Custom Dictionary.txt` beside the preferences; Ignore All: `text.spelling.ignoreAll` skips a word in the active document while it is open. Auto Spell Check is done: Edit › Spelling › Auto Spell Check (`edit.autoSpellCheck`, off at first, saved with the view settings) draws a red wavy line under the unknown words of the visible type, leaves out type with effects, and follows edits, the custom dictionary and Ignore All. A right-click on an underlined word lists the words its dictionary suggests (each replaces it in one undo step, `text.editRange`), or No Suggestions, then Ignore All and Add to Dictionary, and a right-click on type has Spelling › Auto Spell Check, checked while it is on. Edit › Edit Custom Dictionary… lists the custom dictionary's words, with an Entry field and Add, Delete and Change, applied on Done (Cancel leaves the dictionary as it was). The modal Check Spelling dialog is done: Edit › Spelling › Check Spelling… (`Cmd+I`, `ui.checkSpelling`) opens a modal dialog displaying the unrecognized word in sentence context ("Not in Dictionary"), a list of suggestions with double-click or selection to replace ("Change to" field), and action buttons: Ignore, Ignore All, Change (one-step Undo/Redo via `text.editRange`), Change All (batched across occurrences in a single undo step), Add to Dictionary (`text.spelling.addWord`), Done and Cancel, with keyboard navigation (Tab between controls, Enter to Change or Done, Escape to close). Evidence: `crates/engine/src/tests/spelling.rs`, `crates/ui-egui/src/canvas/tests.rs` (`auto_spell_check_*`), `crates/ui-egui/src/tests/contextmenu.rs` (the right-click), `crates/ui-egui/src/dialogs/custom_dictionary.rs` (the dialog), `crates/ui-egui/src/dialogs/check_spelling.rs` (the Check Spelling dialog). | | Smart Punctuation, Change Case, Find & Replace | done | Type › Smart Punctuation… opens a dialog with the ff, fi, ffi and ff, fl, ffl ligatures, Smart Quotes, Smart Spaces, En, Em Dashes, Ellipses and Expert Fractions, Replace In and Report Results, which lists the count of each replacement; ligatures and fractions are written only where the font has a glyph for them. Evidence: `tests::menucmds::smart_punctuation_ligatures_spaces_and_fractions_are_counted`, `smart_punctuation_skips_ligatures_and_fractions_the_font_lacks`, `smart_spaces_keeps_one_space_after_a_period`, `dialogs::smart_punctuation::tests::menu_item_opens_the_dialog_and_ok_reports_the_counts` | | Alt + numeric-keypad codes while typing (Windows: `Alt+0176` → °) | partial | #5108: on Windows the character Windows posts when Alt comes up after keypad digits is typed at the caret like any other, in the typing's undo step, and the keypad digits typed with Alt run no shortcut. With NumLock off the keypad keys (Insert, End, arrows, Clear, Home, Page Up/Down without the extended-key flag) count as digits too and don't move the caret (`windows_alt_codes` unit tests; neither NumLock on nor off has been tried on a Windows machine yet). `type.insert {code}` (Windows Alt+0 code, Windows-1252 for 128–159) and `{unicode}` (hex code point) insert a character by its code (`menucmds::insert_a_character_by_its_code`). macOS and Linux have no such system convention and egui reports a keypad digit as the top-row digit, so there it does nothing; a floating panel window doesn't receive the character | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 82547ae7ba..9862447371 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -167,6 +167,7 @@ tools, never checked side by side) isn't captured row by row. | Cmd/Ctrl lends the last-used selection tool | done | the path being drawn continues afterwards; with Direct Selection (the default until a selection tool is chosen) a Cmd drag moves an anchor of the path being drawn, moves a straight segment or bends a curved one, one undo step each, and a Cmd-click away from art ends the path; with Selection the hidden bounding box of the path being drawn takes no press, so the drag moves the path (#4980); anchors or segments the lent Direct Selection picks are what Copy and Cut take, as with Direct Selection chosen, while Copy with the Pen's own last anchor selected takes the whole path (#6123) | | Click an open path's end to continue it; click another path's end to join | done | #776 | | Rubber Band preview | done | Preferences option | +| P while the Pen draws a path ends the path, as Escape does | done | the [help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/preview-paths-drawn.html) describes P with the preview off; VectorCraft's own rules: it does the same with Rubber Band on, a click on the active Pen's button and `tool.select` do the same, and the Pen stays chosen | | Auto Add/Delete on a selected path; Shift or the preference disables it | done | | | Pen cursors (new path ×, continue /, close o, add +, delete −, convert ^) | done | the nib is a fountain-pen nib, tip on the hotspot, with the slit widening into the breather hole and the heel clipped square to its axis; bitmap tests at 1× and 2× pin the nib and the new-path asterisk, and in-app screenshots compare the Pen with Direct Selection | | Node-editing cursors: Direct Selection's white arrow with a hollow or filled square over an anchor (path unselected or selected); the Reshape Segment cursor over a curved segment (Direct Selection, Anchor Point, the Pen with Alt); the Anchor Point caret for the Pen with Alt; Group Selection's plus (also Direct Selection with Alt); a filled arrow while dragging that turns hollow on a snap; a double arrowhead for an Alt-drag copy | partial | as the public manual describes them, drawn in code; no cue over handles (none documented) | @@ -428,7 +429,8 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Live trace result bounds and selection highlights exclude the retained bitmap; source-image views retain it | done | All TraceView modes and rotated result bounds regression-covered; ordinary hidden group behavior retained | | Image Trace panel: the Preview checkbox before Trace chooses whether a setting change traces the selected Image Trace object again at once | done | Per the public documentation, Preview shows the result of the current settings and Trace traces with them (). Preview is on by default and kept with the UI preferences; Reset to Default leaves it. Off, changes wait in the panel until Trace applies them as one undo step, or until Preview is turned on again. Changes stay with the object they were made for while another object is selected, and come back when it is selected again. `imageTrace.preview {on?}`, `ui.set {imageTracePreview}`; `panels/image_trace.rs` headless tests (`with_preview_off_a_slider_change_waits_for_trace`, `turning_preview_on_traces_the_changes_that_waited`, `preview_turned_on_with_nothing_selected_traces_when_the_object_is_selected_again`, `settings_that_wait_stay_with_their_object`, `settings_that_wait_come_back_when_their_object_is_selected_again`, `settings_that_wait_are_dropped_when_their_object_changed_since`, `preview_is_kept_with_the_preferences_and_reset_to_default_leaves_it`) | | Toolbar without group labels by default, one or two columns; All Tools drawer by flyout group with shortcuts, its menu (Reset, Basic, Advanced) and Show section | done | #1751; a preference brings the labels back; `toolbar.show` sets the Fill/Stroke, Coloring, Draw Mode and Screen Mode controls | -| Actions panel: ≡ › Save Actions… saves the current set with all its actions to a file and ≡ › Load Actions… adds a saved set ([Manage a set of actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/manage-a-set-of-actions.html)) | partial | `ui.actionSet.save`, `ui.actionSet.load`; `panels/actions.rs` tests. The file is VectorCraft's own `.vcactions` JSON; Clear and Replace Actions remain | +| Actions panel: ≡ › Save Actions… saves the current set with all its actions to a file and ≡ › Load Actions… adds a saved set ([Manage a set of actions](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/manage-a-set-of-actions.html)) | partial | `ui.actionSet.save`, `ui.actionSet.load`; `panels/actions.rs` tests. The file is VectorCraft's own `.vcactions` JSON; Clear Actions remains | +| Actions panel: ≡ › Replace Actions… puts the set of a saved file in place of every set in the panel ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | done | `ui.actionSet.replace`; `panels/actions.rs` tests. The file is read as Load Actions… reads it; the item asks no question first | | Actions panel: ≡ › Reset Actions asks first; OK replaces the sets in the panel with the default set and Append adds the default set after them ([the help page](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/manage-a-set-of-actions.html)) | done | `ui.actionSet.reset`; `panels/actions.rs` and `dialogs/tests.rs` tests. The default set is VectorCraft's own Default Actions set | | Actions panel: ≡ › Load Actions… also reads action sets saved as `.aia` files ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `actionSet.read`, `ui.actionSet.load`; `tests/actionset.rs`, `panels/actions.rs` tests, `import_fuzz`. Steps with a label and no recorded values come in as menu commands that run with no values and open no dialog, matched by label, and Set Selection steps come in as Select Object steps; the other steps, recorded menu items included, are left out and counted | | Actions panel: ≡ › Action Options… renames the selected action and sets its function key and color ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html)) | partial | `ui.action.options`; `panels/actions.rs` tests (part of #1629). Button Mode shows the color |