Merge main into feat/scripts-api-d3-layers-artboards

This commit is contained in:
dotCooCoo committed 2026-12-02 11:39:00 -08:00
commit cd3a0da644
375 files changed
+24589 -3335

No files matched your search

+18 -1
View File
@@ -498,11 +498,13 @@ struct World {
/// The choices outside the documents that a script's commands can change: the preferences, the
/// global edit options, the Select Similar Objects attribute, the recent URLs, the chosen gradient stop, freeform point and appearance
/// item, the Eyedropper's sample, the envelope defaults and the Caps Lock state.
/// item, the Eyedropper's sample, the envelope defaults, the Caps Lock state and whether Overprint
/// Preview turns on when the run ends.
#[derive(Clone)]
struct Choices {
prefs: crate::Prefs,
caps_lock: bool,
overprint_after_run: bool,
eyedropper_sample: Option<Arc<vectorcraft_doc::Node>>,
global_edit_options: cmd::globaledit::Options,
select_similar: &'static str,
@@ -518,6 +520,7 @@ impl Choices {
Self {
prefs: s.prefs.clone(),
caps_lock: s.caps_lock,
overprint_after_run: s.overprint_after_run,
eyedropper_sample: s.eyedropper_sample.clone(),
global_edit_options: s.global_edit_options.clone(),
select_similar: s.select_similar,
@@ -532,6 +535,7 @@ impl Choices {
fn put(self, s: &mut Session) {
s.prefs = self.prefs;
s.caps_lock = self.caps_lock;
s.overprint_after_run = self.overprint_after_run;
s.eyedropper_sample = self.eyedropper_sample;
s.global_edit_options = self.global_edit_options;
s.select_similar = self.select_similar;
@@ -546,6 +550,7 @@ impl Choices {
use std::mem::swap;
swap(&mut self.prefs, &mut s.prefs);
swap(&mut self.caps_lock, &mut s.caps_lock);
swap(&mut self.overprint_after_run, &mut s.overprint_after_run);
swap(&mut self.eyedropper_sample, &mut s.eyedropper_sample);
swap(&mut self.global_edit_options, &mut s.global_edit_options);
swap(&mut self.select_similar, &mut s.select_similar);
@@ -659,6 +664,8 @@ pub(crate) struct Savepoint {
pending_paint: Option<crate::Paint>,
choices: Choices,
journal: usize,
/// The plug-in events queued before the command ([`Session::plugin_events_mark`]).
plugin_events: u64,
}
impl Savepoint {
@@ -693,6 +700,7 @@ impl Savepoint {
pending_paint: s.pending_paint.clone(),
choices: Choices::of(s),
journal: s.journal.len(),
plugin_events: s.plugin_events_mark(),
}
}
@@ -745,6 +753,8 @@ impl Savepoint {
s.pending_paint = self.pending_paint;
self.choices.put(s);
s.journal.truncate(self.journal);
// The documents the command opened are closed again: plug-ins are not told of them.
s.forget_plugin_opens_since(self.plugin_events);
s.sync_front_profiles();
exact
}
@@ -2197,6 +2207,8 @@ impl Session {
lost
});
drop(lost);
// The job's working copy went with it, with the documents the run opened.
self.plugin_events_script_ended(false);
raise_ids(self);
self.script_stop.clear();
self.reset_tool();
@@ -2592,6 +2604,7 @@ impl Session {
let mut report = failure_report(&job.name, &e, file.as_deref(), &job.host, fuel_left, job.realm.limits().fuel.saturating_sub(fuel_left));
close_run(self, &job.host, &mut report, ending(&e.kind));
self.end_job(job, e.kind == RunErrorKind::Internal);
self.plugin_events_script_ended(false);
raise_ids(self);
self.script_stop.clear();
self.reset_tool();
@@ -2668,6 +2681,9 @@ impl Session {
self.script_stop.clear();
self.reset_tool();
cmd::compositefonts::sync(self);
if std::mem::take(&mut self.overprint_after_run) {
cmd::colormgmt::turn_on_overprint_preview(self);
}
let host = &job.host;
let mut report = json!({
"ok": true,
@@ -2697,6 +2713,7 @@ impl Session {
close_run(self, host, &mut report, console::Ending::Finished);
let tool = host.dom.chosen_tool();
self.end_job(job, false);
self.plugin_events_script_ended(true);
// The tool `app.selectTool` chose last becomes the current tool, as a choice on the
// toolbar makes it; the run's changes are kept when the tool cannot be chosen.
if let Some(id) = tool