Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

TOC-6: toggle advanced table of contents options

moppeeer8cc92a50b63f
diff --git a/ROADMAP.md b/ROADMAP.md
index 9bd0274ef..6be95b6ad 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -348,6 +348,8 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.m
Newest first.
+- **2026-10-18** · Table of Contents offers More Options / Fewer Options, preserving page-number, separator, sorting and level settings while their controls are hidden. No readiness percentage change.
+
- **2026-10-16** · Threading: the loaded text cursor threads into a text frame inside a group (it hit the group and showed it could not thread); a plain click still selects the group (#1075). Gap 27 closed. No readiness percentage change.
- **2026-10-16** · Greek text hyphenates. The patterns were never compiled in, so Greek set unhyphenated however narrow the column; `"Greek"`, `"Greek: Greece"`, `el` and `el-GR` all resolve now and ανθρωπος breaks αν-θρω-πος. They are the monotonic patterns (hyph-el-monoton, Dimitrios Filippou, under MIT), which is what polytonic text hyphenates by too. Five of InDesign's ~40 hyphenation languages. No readiness percentage change.
- **2026-10-16** · A swatch applied to a placed greyscale or bitmap image colours it, as in InDesign: IDML's `<Image FillColor>` is read and written, greyscale pixels become a tint of the swatch on opaque white and a bitmap's white lets the frame show through, on screen and in PDF (spot swatches print on their plate). Colour images keep their colours. Applying the swatch from the Swatches panel comes next. No readiness percentage change.
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index 358416a4b..f4be6cf2a 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -6328,6 +6328,7 @@ fn toc_dialog(app: &mut DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {
let tr = |s: &str| crate::i18n::tr(&lang, s).to_string();
let styles: Vec<String> = d.fields.get("styles").cloned().and_then(|v| serde_json::from_value(v).ok()).unwrap_or_default();
let char_styles: Vec<String> = d.fields.get("charStyles").cloned().and_then(|v| serde_json::from_value(v).ok()).unwrap_or_default();
+ let mut expanded = d.fields.get("moreOptions").and_then(Value::as_bool).unwrap_or(true);
let mut rows = toc_rows(d);
let mut sel = d.n("selected").map_or(0, |n| n.max(0.0) as usize);
let mut other = d.s("other");
@@ -6340,7 +6341,12 @@ fn toc_dialog(app: &mut DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {
ui.end_row();
});
ui.add_space(8.0);
- crate::rtl::label(ui, egui::RichText::new(tr("Styles in Table of Contents")).font(semibold(12.0)));
+ ui.horizontal(|ui| {
+ crate::rtl::label(ui, egui::RichText::new(tr("Styles in Table of Contents")).font(semibold(12.0)));
+ if ui.button(tr(if expanded { "Fewer Options" } else { "More Options" })).clicked() {
+ expanded = !expanded;
+ }
+ });
let others: Vec<&String> = styles.iter().filter(|n| !rows.iter().any(|r| &r.style == *n)).collect();
ui.horizontal_top(|ui| {
ui.vertical(|ui| {
@@ -6393,6 +6399,9 @@ fn toc_dialog(app: &mut DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {
let auto = format!("TOC Level {}", r.level.clamp(1, 9));
toc_style_combo(ui, "entry", &styles, &auto, &mut r.entry_style);
ui.end_row();
+ if !expanded {
+ return;
+ }
crate::rtl::label(ui, tr("Page Number:"));
let choices = [("after", "After Entry"), ("before", "Before Entry"), ("none", "No Page Number")];
let cur = choices.iter().find(|(v, _)| *v == r.page_number).map_or("After Entry", |(_, l)| l);
@@ -6433,6 +6442,7 @@ fn toc_dialog(app: &mut DesignApp, ui: &mut egui::Ui, d: &mut Dialog) {
ui.add_space(6.0);
crate::rtl::label(ui, egui::RichText::new(st).color(crate::theme::Tokens::get(ui.ctx()).text_dim));
}
+ d.fields.insert("moreOptions".into(), json!(expanded));
d.fields.insert("included".into(), json!(rows));
d.fields.insert("selected".into(), json!(sel));
d.fields.insert("other".into(), json!(other));
@@ -7957,6 +7967,43 @@ mod tests {
assert_eq!(opts(&app), before);
}
+ /// Collapsing advanced TOC controls changes visibility without discarding their values.
+ #[test]
+ fn toc_more_options_preserves_hidden_settings() {
+ let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
+ app.run("file.newSample", json!({})).unwrap();
+ open_toc(&mut app);
+ app.ui.dialog.as_mut().unwrap().fields.insert(
+ "included".into(),
+ json!([{
+ "style": "Headline", "level": 3, "separator": " ^t", "pageNumber": "before",
+ "pageNumberStyle": "Accent", "separatorStyle": "Emphasis", "sort": true
+ }]),
+ );
+ let before = toc_params(&app, app.ui.dialog.as_ref().unwrap());
+ let revision = app.session.doc().unwrap().revision;
+ let ctx = dialog_context("en");
+ let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1440.0, 900.0));
+ for _ in 0..3 {
+ dialog_frame(&mut app, &ctx, screen, vec![]);
+ }
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ visible_label(&labels, screen, "Between Entry and Number:");
+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "Fewer Options").center());
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ assert!(!labels.iter().any(|(text, _, _)| text == "Between Entry and Number:"));
+ visible_label(&labels, screen, "Entry Style:");
+ assert_eq!(toc_params(&app, app.ui.dialog.as_ref().unwrap()), before);
+ click_dialog(&mut app, &ctx, screen, visible_label(&labels, screen, "More Options").center());
+ for _ in 0..3 {
+ dialog_frame(&mut app, &ctx, screen, vec![]);
+ }
+ let labels = dialog_frame(&mut app, &ctx, screen, vec![]);
+ visible_label(&labels, screen, "Between Entry and Number:");
+ assert_eq!(toc_params(&app, app.ui.dialog.as_ref().unwrap()), before);
+ assert_eq!(app.session.doc().unwrap().revision, revision);
+ }
+
#[test]
fn toc_dialog_adds_a_style_and_ok_makes_the_table_of_contents() {
let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index efe089ef9..514f68da2 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -1351,7 +1351,8 @@ const TABLE: &[(&str, [&str; 5])] = &[
"适合框架高度到文本",
],
),
- ("More Options", ["More Options", "Plus d'options", "More Options", "More Options", "更多选项"]),
+ ("More Options", ["Weitere Optionen", "Plus d'options", "Más opciones", "その他のオプション", "更多选项"]),
+ ("Fewer Options", ["Weniger Optionen", "Moins d'options", "Menos opciones", "オプションを減らす", "较少选项"]),
("Flip Horizontal", ["Flip Horizontal", "Retourner horizontalement", "Flip Horizontal", "Flip Horizontal", "水平翻转"]),
(
"Rotate 90° Clockwise",
diff --git a/crates/ui-egui/src/i18n/ar.rs b/crates/ui-egui/src/i18n/ar.rs
index b050de38b..eb98ea711 100644
--- a/crates/ui-egui/src/i18n/ar.rs
+++ b/crates/ui-egui/src/i18n/ar.rs
@@ -1,5 +1,6 @@
//! Original Arabic interface translations, stored in logical Unicode order.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "خيارات أقل"),
("File", "ملف"),
("Edit", "تحرير"),
("Layout", "تخطيط"),
diff --git a/crates/ui-egui/src/i18n/cs.rs b/crates/ui-egui/src/i18n/cs.rs
index e77e72a1c..8781a7025 100644
--- a/crates/ui-egui/src/i18n/cs.rs
+++ b/crates/ui-egui/src/i18n/cs.rs
@@ -3,6 +3,7 @@
//! product's localization was used). Phrases shared with the MIT OR Apache-2.0 Czech catalogs of
//! the ArtCraft siblings (VectorCraft, PhotoCraft) are kept identical; see ASSETS.md for sources.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "Méně možností"),
("File", "Soubor"),
("Edit", "Úpravy"),
("Layout", "Rozvržení"),
diff --git a/crates/ui-egui/src/i18n/de.rs b/crates/ui-egui/src/i18n/de.rs
index efc128858..aeed5daa9 100644
--- a/crates/ui-egui/src/i18n/de.rs
+++ b/crates/ui-egui/src/i18n/de.rs
@@ -3,6 +3,7 @@
//! Brazilian Portuguese, Italian and Ukrainian tables has a row here; the German column of the shared
//! table is carried over and stays the fallback for keys added there after this table.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "Weniger Optionen"),
("File", "Datei"),
("Edit", "Bearbeiten"),
("Layout", "Layout"),
diff --git a/crates/ui-egui/src/i18n/it.rs b/crates/ui-egui/src/i18n/it.rs
index a918a9829..820ebe9cf 100644
--- a/crates/ui-egui/src/i18n/it.rs
+++ b/crates/ui-egui/src/i18n/it.rs
@@ -1,6 +1,7 @@
//! Original Italian interface translations, written from the English source
//! using ordinary Italian desktop-publishing vocabulary.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "Meno opzioni"),
("File", "File"),
("Edit", "Modifica"),
("Layout", "Layout"),
diff --git a/crates/ui-egui/src/i18n/ja.rs b/crates/ui-egui/src/i18n/ja.rs
index 5647ca940..d4e65dab1 100644
--- a/crates/ui-egui/src/i18n/ja.rs
+++ b/crates/ui-egui/src/i18n/ja.rs
@@ -3,6 +3,7 @@
//! Portuguese tables has a row here; the menu titles and panel names that were already Japanese in the
//! shared table are carried over unchanged.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "オプションを減らす"),
("File", "ファイル"),
("Edit", "編集"),
("Layout", "レイアウト"),
diff --git a/crates/ui-egui/src/i18n/ka.rs b/crates/ui-egui/src/i18n/ka.rs
index 975da9ca1..157339a31 100644
--- a/crates/ui-egui/src/i18n/ka.rs
+++ b/crates/ui-egui/src/i18n/ka.rs
@@ -4,6 +4,7 @@
//! Portuguese, Japanese, Italian and Ukrainian tables has a row here, plus a few labels that only
//! the code or the command table use.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "ნაკლები პარამეტრი"),
("File", "ფაილი"),
("Edit", "რედაქტირება"),
("Layout", "განლაგება"),
diff --git a/crates/ui-egui/src/i18n/pl.rs b/crates/ui-egui/src/i18n/pl.rs
index 68d685d99..6b0e60473 100644
--- a/crates/ui-egui/src/i18n/pl.rs
+++ b/crates/ui-egui/src/i18n/pl.rs
@@ -2,6 +2,7 @@
//! are welcome. Terminology follows common Polish DTP usage
//! (rozkładówka, łam, strona wzorcowa, obszar informacyjny) and the sibling ArtCraft catalogs.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "Mniej opcji"),
("File", "Plik"),
("Edit", "Edycja"),
("Layout", "Układ"),
diff --git a/crates/ui-egui/src/i18n/pt_br.rs b/crates/ui-egui/src/i18n/pt_br.rs
index 8521de594..2bb8c8de3 100644
--- a/crates/ui-egui/src/i18n/pt_br.rs
+++ b/crates/ui-egui/src/i18n/pt_br.rs
@@ -1,6 +1,7 @@
//! Original Brazilian Portuguese interface translations, written from the English source
//! using ordinary Brazilian Portuguese computing vocabulary.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "Menos opções"),
("File", "Arquivo"),
("Edit", "Editar"),
("Layout", "Layout"),
diff --git a/crates/ui-egui/src/i18n/ru.rs b/crates/ui-egui/src/i18n/ru.rs
index 251555ca5..9ab1e23be 100644
--- a/crates/ui-egui/src/i18n/ru.rs
+++ b/crates/ui-egui/src/i18n/ru.rs
@@ -3,6 +3,7 @@
//! The translations are our own; counted nouns are genitive plurals because the caption puts the
//! category before the number ("страниц: 5"), see `count_label`.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "Меньше параметров"),
("File", "Файл"),
("Edit", "Редактирование"),
("Can't Open the File", "Не удалось открыть файл"),
diff --git a/crates/ui-egui/src/i18n/uk.rs b/crates/ui-egui/src/i18n/uk.rs
index dd4a1434d..67c33cb8a 100644
--- a/crates/ui-egui/src/i18n/uk.rs
+++ b/crates/ui-egui/src/i18n/uk.rs
@@ -2,6 +2,7 @@
//! Common phrases are adapted from the MIT OR Apache-2.0 ArtCraft sibling catalogs
//! (VectorCraft, PhotoCraft, WordCraft and DeckCraft); see ASSETS.md for pinned sources.
pub(super) const TABLE: &[(&str, &str)] = &[
+ ("Fewer Options", "Менше параметрів"),
("File", "Файл"),
("Edit", "Редагування"),
("Layout", "Макет"),
diff --git a/docs/ui-parity.md b/docs/ui-parity.md
index 2dcf4687a..32fe9c5ab 100644
--- a/docs/ui-parity.md
+++ b/docs/ui-parity.md
@@ -126,3 +126,6 @@ covers checking the sampled and redefined settings in the styles tutorial (2:45
| 2026-10-11 | minor | Added held Cmd+Space / Cmd+Alt+Space Zoom navigation and canvas input regression tests |
| 2026-10-10 | minor | Threading row corrected to ✗ after checking the code (no out-port interaction, no thread command) |
| 2026-10-10 | major | Created: measured menu coverage, 27-row interaction checklist from the code and issues |
+
+The Table of Contents dialog can collapse to its entry-style controls or expand to show page
+number, separator, sorting and level controls. Toggling visibility preserves their settings.