diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e3c58d1e1..c4427cf86 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -280,6 +280,10 @@ jobs:
run: cargo xtask licences --check
- name: Dependency layers
run: cargo xtask layers
+ - name: Universal UI containers
+ run: |
+ cargo xtask ui-containers
+ cargo test -p xtask ui_containers --locked
- name: Sorted lists
run: cargo xtask lists
- name: Design format pending changes
diff --git a/AGENTS.md b/AGENTS.md
index c4063d8cd..5551a0e9e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -88,6 +88,14 @@ People trust SolidCraft with their designs; a crash loses their work. **This out
egui/eframe/winit/wgpu/rfd. **The UI crate is swappable.** Only `crates/kernel` may use `truck`.
- **The UI is thin**: panels read engine state and act through `app.run(id, params)` /
`app.start(id)`. Colours come from `theme::Tokens`.
+- **One outer UI container**: all panels, floating sheets, menus, overlays and platform UI
+ windows use `ui_kit::Container` (directly or through `Panel`, `Window`, `Confirm`, `Menu`).
+ Declare the semantic `Surface`; workspace panels use its shared layout policy and chrome.
+ System/report windows use `ui_kit::Window`; its low-level host builder is kit-private.
+ Do not construct raw egui hosts, outer popup/window frames or shadows in feature modules.
+ `cargo xtask ui-containers` recursively checks source/examples in all current and future crates
+ and apps. It runs in the fast repository CI job and `cargo xtask ci`, with no caller allowances.
+ See `docs/ui-container-audit.md` for the inventory and legitimate content/native exceptions.
- **One set of camera controls**: every page or canvas with a camera (viewport, Render
preview, future flat pattern or drawing pages) calls `navigation::handle` with its `NavCaps`
(orbit off for flat 2D pages). New canvases must use `navigation::handle`; never hand-roll
diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md
index f012c139f..e069b4280 100644
--- a/ATTRIBUTION.md
+++ b/ATTRIBUTION.md
@@ -319,6 +319,9 @@ Editable drawing code, native projects and shipped exports are collected under `
| assets/icons/ui/design/svg/model/offset_symmetric.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/flat/import_tray.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/flat/export_tray.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
+| assets/icons/ui/design/svg/flat/send.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
+| assets/icons/ui/design/svg/flat/stop.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
+| assets/icons/ui/design/svg/flat/shield.svg | SolidCraft contributors | original icon master (64 grid) | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/placeholder.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/plane.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
| assets/icons/ui/design/svg/model/plane_angle.svg | SolidCraft contributors | two-tone modelling icon master (64 grid), original SolidCraft artwork | MIT OR Apache-2.0 |
diff --git a/Cargo.lock b/Cargo.lock
index fb70a05cc..d6246f988 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5923,8 +5923,10 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7"
name = "xtask"
version = "0.18.4"
dependencies = [
+ "proc-macro2",
"serde_json",
"sha2 0.10.9",
+ "syn 2.0.119",
]
[[package]]
diff --git a/ROADMAP.md b/ROADMAP.md
index 12016e862..dfa81b55c 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -329,6 +329,18 @@ completed drawings publish atomically. The browser still exports synchronously.
- Saved projections from a removed strip retain their geometry and report the lost
reference. Explicitly reselect the wall to repair that projection.
+## Workspace layouts (#2029)
+
+- General preferences save Floating or Compact using the universal UI containers.
+ Compact joins the workspace selector and ribbon, docks the content-hugging Browser
+ flush beneath them with a square join, and opens tool sheets below the compass.
+ Sheets remain draggable, rounding all corners away from their right dock; footer
+ backgrounds follow the same corners. A separate preference hides ribbon icon labels
+ for a shorter ribbon in either layout.
+ Assistant keeps the outermost edge and History keeps its chosen dock. Switching
+ retains the active tool, camera, selection and design; system windows and menus
+ keep their existing behavior.
+
## View navigation
- Navigation has an opt-in Free orbit preference for mouse and 3D-mouse rotation through
diff --git a/apps/solidcraft-web/src/main.rs b/apps/solidcraft-web/src/main.rs
index 49414f2d2..7722a20bc 100644
--- a/apps/solidcraft-web/src/main.rs
+++ b/apps/solidcraft-web/src/main.rs
@@ -23,7 +23,7 @@ mod web {
use solidcraft_engine::Session;
use solidcraft_engine::io::vfs;
- use solidcraft_ui_egui::{Services, SolveApp};
+ use solidcraft_ui_egui::{Services, SolveApp, ui_kit};
use wasm_bindgen::JsCast as _;
use crate::api::Api;
@@ -229,24 +229,21 @@ mod web {
if !self.files.panel.get() {
return;
}
- let mut open = true;
let mut act: Option<(&'static str, String)> = None;
- egui::Window::new("Files in this browser")
- .open(&mut open)
- .collapsible(false)
- .resizable(true)
- .default_width(520.0)
- .pivot(egui::Align2::CENTER_CENTER)
- .default_pos(ctx.content_rect().center())
- .show(ctx, |ui| {
+ let closed = solidcraft_ui_egui::ui_kit::Window::new(egui::Id::new("sc_browser_files"), "folder", "Files in this browser")
+ .cards(3.0)
+ .show_body(ctx, |ui| {
ui.horizontal(|ui| {
- if ui.button("Open from computer…").clicked() {
+ if ui_kit::button(ui, "Open from computer…", ui_kit::Button::Normal).clicked() {
files::pick_from_disk(&self.files, Intent::Open);
}
- if ui.button("Insert from computer…").on_hover_text("STEP, 3MF or STL into the open design").clicked() {
+ if ui_kit::button(ui, "Insert from computer…", ui_kit::Button::Normal)
+ .on_hover_text("STEP, 3MF or STL into the open design")
+ .clicked()
+ {
files::pick_from_disk(&self.files, Intent::Insert);
}
- if ui.button("Download open design").clicked() {
+ if ui_kit::button(ui, "Download open design", ui_kit::Button::Normal).clicked() {
act = Some(("download_open", String::new()));
}
});
@@ -270,7 +267,7 @@ mod web {
for e in &entries {
match &mut self.renaming {
Some((from, to)) if *from == e.name => {
- let r = ui.add(egui::TextEdit::singleline(to).desired_width(200.0));
+ let r = ui_kit::cell_editor(ui, ui.make_persistent_id(("stored_file_name", from.as_str())), to, "", false);
if std::mem::take(&mut self.rename_focus) {
r.request_focus();
}
@@ -288,28 +285,31 @@ mod web {
}
ui.label(format!("{:.1} KB", e.size as f64 / 1024.0));
ui.horizontal(|ui| {
- if ui.small_button("Open").clicked() {
+ if ui_kit::button(ui, "Open", ui_kit::Button::Small).clicked() {
act = Some(("open", e.name.clone()));
}
let design = solidcraft_engine::io::is_design_path(&e.name);
- if !design && ui.small_button("Insert").on_hover_text("Into the open design (STEP, 3MF, STL)").clicked() {
+ if !design
+ && ui_kit::button(ui, "Insert", ui_kit::Button::Small)
+ .on_hover_text("Into the open design (STEP, 3MF, STL)")
+ .clicked()
+ {
act = Some(("insert", e.name.clone()));
}
- if ui.small_button("Rename").clicked() {
+ if ui_kit::button(ui, "Rename", ui_kit::Button::Small).clicked() {
self.renaming = Some((e.name.clone(), e.name.clone()));
self.rename_focus = true;
}
- if ui
- .small_button("Save to computer…")
+ if ui_kit::button(ui, "Save to computer…", ui_kit::Button::Small)
.on_hover_text("A copy in a file you choose; the stored design stays here")
.clicked()
{
act = Some(("save_copy", e.name.clone()));
}
- if ui.small_button("Download").clicked() {
+ if ui_kit::button(ui, "Download", ui_kit::Button::Small).clicked() {
act = Some(("download", e.name.clone()));
}
- if ui.small_button("Delete").clicked() {
+ if ui_kit::button(ui, "Delete", ui_kit::Button::Small).clicked() {
act = Some(("delete", e.name.clone()));
}
});
@@ -318,7 +318,7 @@ mod web {
});
});
});
- if !open {
+ if closed {
self.files.panel.set(false);
self.renaming = None;
}
@@ -386,20 +386,19 @@ mod web {
fn recovery_prompt(&mut self, ctx: &egui::Context) {
let Some((name, path)) = self.files.recovery.borrow().clone() else { return };
let mut answer = None;
- egui::Window::new("Recover unsaved work?").collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, 0.0]).show(
- ctx,
- |ui| {
+ let _ = solidcraft_ui_egui::ui_kit::Window::new(egui::Id::new("sc_browser_recovery"), "restore", "Recover unsaved work?")
+ .required()
+ .show_body(ctx, |ui| {
ui.label(format!("“{name}” had unsaved changes when this page last closed."));
ui.horizontal(|ui| {
- if ui.button("Recover").clicked() {
+ if ui_kit::button(ui, "Recover", ui_kit::Button::Normal).clicked() {
answer = Some(true);
}
- if ui.button("Discard").clicked() {
+ if ui_kit::button(ui, "Discard", ui_kit::Button::Normal).clicked() {
answer = Some(false);
}
});
- },
- );
+ });
let Some(recover) = answer else { return };
*self.files.recovery.borrow_mut() = None;
if recover {
diff --git a/assets/README.md b/assets/README.md
index 99be8dc59..372f3500d 100644
--- a/assets/README.md
+++ b/assets/README.md
@@ -84,7 +84,7 @@ The CLI still supports arbitrary PNG/ICO exports with `solidcraft-cli icon`.
## Code and provenance
Resources remain compiled by their owning layer through existing APIs:
-`ui-egui::icons::paint` and `Tokens` at L5, model presets in L2 `doc`, and sketch
+`ui-egui::icons::paint_icon` and `Tokens` at L5, model presets in L2 `doc`, and sketch
fonts at L1. State, projection, interaction, commands and GPU bindings stay in
their current modules. Embedded data uses `CARGO_MANIFEST_DIR`; application code
needs no runtime resource registry or repository lookup.
diff --git a/assets/icons/ui/README.md b/assets/icons/ui/README.md
index 8e4aede02..4a9d954c4 100644
--- a/assets/icons/ui/README.md
+++ b/assets/icons/ui/README.md
@@ -91,7 +91,7 @@ Palette changes preserve accepted artwork and never update review hashes.
| `source/` | Rust viewport glyphs, markers, navigation and pointer; not command icons |
`crates/ui-egui/build.rs` embeds SVGs, palette and aliases. `icon_svg.rs` parses and
-rasterises them for `icons::paint`; adding an icon still requires its registry or
+rasterises them for `icons::paint_icon`; adding an icon still requires its registry or
UI assignment and an application rebuild. Review status never controls rendering.
## Checks and reports
diff --git a/assets/icons/ui/design/requested_icons.txt b/assets/icons/ui/design/requested_icons.txt
index de7275524..2751731a2 100644
--- a/assets/icons/ui/design/requested_icons.txt
+++ b/assets/icons/ui/design/requested_icons.txt
@@ -203,9 +203,11 @@ scale false
screw false
section false
select false
+send false
settings false
sheet_rules false
shell false
+shield false
silhouette false
sketch false
sketch_break false
diff --git a/assets/icons/ui/design/svg/flat/send.svg b/assets/icons/ui/design/svg/flat/send.svg
new file mode 100644
index 000000000..93a9a3973
--- /dev/null
+++ b/assets/icons/ui/design/svg/flat/send.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/icons/ui/design/svg/flat/shield.svg b/assets/icons/ui/design/svg/flat/shield.svg
new file mode 100644
index 000000000..beaacf03a
--- /dev/null
+++ b/assets/icons/ui/design/svg/flat/shield.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/icons/ui/design/svg/flat/stop.svg b/assets/icons/ui/design/svg/flat/stop.svg
new file mode 100644
index 000000000..20cdd5375
--- /dev/null
+++ b/assets/icons/ui/design/svg/flat/stop.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/locales/cs.json b/assets/locales/cs.json
index 8933c00fc..ba1e2a85b 100644
--- a/assets/locales/cs.json
+++ b/assets/locales/cs.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Připojit soubory",
"ui.agent_chat_add_file": "Vybrat soubor…",
"ui.agent_chat_allow": "Povolit",
+ "ui.agent_chat_allow_once": "Povolit jednou",
"ui.agent_chat_allowed": "Povoleno",
"ui.agent_chat_answered": "Odpověď: {option}",
"ui.agent_chat_approval": "Povolit agentovi tuto akci?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Vlevo",
"ui.agent_chat_limit": "Agent dosáhl limitu {limit} změn na jednu zprávu. Pošlete další zprávu, aby mohl pokračovat.",
"ui.agent_chat_minimize": "Minimalizovat do pruhu",
+ "ui.agent_chat_mode_all": "Vše",
+ "ui.agent_chat_mode_ask": "Ptát se",
+ "ui.agent_chat_mode_edits": "Úpravy",
"ui.agent_chat_model_tip": "Model, který agent používá. Vaše volba se pro tohoto agenta zapamatuje.",
"ui.agent_chat_new": "Nový chat",
"ui.agent_chat_new_confirm": "Začít nový chat? Aktuální bude vymazán.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Agent nenalezen",
"ui.agent_chat_not_installed": "Není nainstalován",
"ui.agent_chat_not_signed_in": "nepřihlášen",
+ "ui.agent_chat_open_settings": "Otevřít předvolby",
"ui.agent_chat_own_window": "Vlastní okno",
"ui.agent_chat_paste_picture": "Vložit obrázek",
"ui.agent_chat_permission": "Agent žádá o spuštění: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Odeslat",
"ui.agent_chat_send_now": "Odeslat hned",
"ui.agent_chat_send_now_tip": "Zastavit aktuální krok agenta a poslat tuto zprávu jako další (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft komunikuje s programovacím agentem nainstalovaným v tomto počítači. Vyberte ho v části Předvolby › AI.",
+ "ui.agent_chat_setup_title": "Nastavit asistenta",
"ui.agent_chat_side": "Strana chatu s agentem",
"ui.agent_chat_signed_in": "přihlášen",
"ui.agent_chat_state_auth": "Vyžadováno přihlášení",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Chat s agentem: {message}",
"ui.agent_chat_undone": "(vráceno)",
"ui.agent_chat_view_attached": "Pohled přiložen",
+ "ui.agent_chat_waiting": "Čeká na vás",
"ui.agent_cursor": "Kurzor agenta",
"ui.agent_cursor_speed": "Rychlost kurzoru agenta",
"ui.ai_add": "Přidat",
@@ -1551,6 +1559,8 @@
"ui.joints": "Klouby",
"ui.keyboard_shortcuts": "Klávesové zkratky",
"ui.language": "Jazyk",
+ "ui.layout_compact": "Kompaktní",
+ "ui.layout_floating": "Plovoucí",
"ui.length_decimals": "Desetinná místa délky",
"ui.light": "Světlý",
"ui.line": "Úsečka",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Obrátit směr přiblížení",
"ui.revolve": "Rotace",
"ui.ribbon_exit": "Ukončit",
+ "ui.ribbon_labels": "Zobrazovat text pod ikonami pásu karet",
"ui.ribbon_pin_footer": "Připnuté příkazy se zobrazují na pásu karet. Najetím na řádek jej připnete nebo odepnete.",
"ui.ribbon_workspace": "Pracovní prostředí",
"ui.right": "Zprava",
@@ -1867,6 +1878,7 @@
"ui.workspace_design_tabs": "Model · Plocha · Sestava · Vložit · Kontrola · Správa · Zobrazení",
"ui.workspace_drawing_description": "2D výkresy s pohledy, kótami a popisovými poli",
"ui.workspace_footer": "Všechna pracovní prostředí pracují se stejným návrhem, historií a výběrem; mění se pouze karty pásu karet. Přepínač je zamknutý, dokud se upravuje náčrt nebo prvek.",
+ "ui.workspace_layout": "Rozložení pracovní plochy",
"ui.workspace_manufacture_description": "Slicing, dráhy nástroje a nastavení",
"ui.workspace_planned": "Plánováno",
"ui.workspace_render_description": "Náhled produktu, nastavení scény a renderované obrázky",
diff --git a/assets/locales/da.json b/assets/locales/da.json
index 3117b6b44..f2cc366bf 100644
--- a/assets/locales/da.json
+++ b/assets/locales/da.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Vedhæft filer",
"ui.agent_chat_add_file": "Vælg en fil…",
"ui.agent_chat_allow": "Tillad",
+ "ui.agent_chat_allow_once": "Tillad én gang",
"ui.agent_chat_allowed": "Tilladt",
"ui.agent_chat_answered": "Svar: {option}",
"ui.agent_chat_approval": "Tillad agenten at gøre dette?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Venstre",
"ui.agent_chat_limit": "Agenten nåede grænsen på {limit} ændringer for én besked. Send en ny besked for at lade den fortsætte.",
"ui.agent_chat_minimize": "Minimér til en stribe",
+ "ui.agent_chat_mode_all": "Alt",
+ "ui.agent_chat_mode_ask": "Spørg",
+ "ui.agent_chat_mode_edits": "Ændringer",
"ui.agent_chat_model_tip": "Modellen, som agenten bruger. Dit valg huskes for denne agent.",
"ui.agent_chat_new": "Ny chat",
"ui.agent_chat_new_confirm": "Start en ny chat? Den aktuelle chat ryddes.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Ingen agent fundet",
"ui.agent_chat_not_installed": "Ikke installeret",
"ui.agent_chat_not_signed_in": "ikke logget ind",
+ "ui.agent_chat_open_settings": "Åbn indstillinger",
"ui.agent_chat_own_window": "Eget vindue",
"ui.agent_chat_paste_picture": "Indsæt et billede",
"ui.agent_chat_permission": "Agenten beder om at køre: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Send",
"ui.agent_chat_send_now": "Send nu",
"ui.agent_chat_send_now_tip": "Stop agentens aktuelle trin, og send denne som den næste (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft kommunikerer med en kodeagent, der er installeret på denne computer. Vælg en under Indstillinger › AI.",
+ "ui.agent_chat_setup_title": "Opsæt en assistent",
"ui.agent_chat_side": "Agentchattens side",
"ui.agent_chat_signed_in": "logget ind",
"ui.agent_chat_state_auth": "Login kræves",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Agentchat: {message}",
"ui.agent_chat_undone": "(fortrudt)",
"ui.agent_chat_view_attached": "Visning vedhæftet",
+ "ui.agent_chat_waiting": "Venter på dig",
"ui.agent_cursor": "Agentmarkør",
"ui.agent_cursor_speed": "Agentmarkørens hastighed",
"ui.ai_add": "Tilføj",
@@ -1551,6 +1559,8 @@
"ui.joints": "Led",
"ui.keyboard_shortcuts": "Tastaturgenveje",
"ui.language": "Sprog",
+ "ui.layout_compact": "Kompakt",
+ "ui.layout_floating": "Flydende",
"ui.length_decimals": "Længdedecimaler",
"ui.light": "Lys",
"ui.line": "Linje",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Vend zoomretning",
"ui.revolve": "Omdrejning",
"ui.ribbon_exit": "Afslut",
+ "ui.ribbon_labels": "Vis tekst under ikonerne på båndet",
"ui.ribbon_pin_footer": "Fastgjorte kommandoer vises på båndet. Hold musen over en række for at fastgøre eller frigøre den.",
"ui.ribbon_workspace": "Arbejdsområde",
"ui.right": "Fra højre",
@@ -1842,6 +1853,7 @@
"ui.workspace_design_tabs": "Model · Overflade · Saml · Indsæt · Undersøg · Administrér · Visning",
"ui.workspace_drawing_description": "2D-tegninger med visninger, mål og tegningshoveder",
"ui.workspace_footer": "Alle arbejdsområder arbejder på det samme design, den samme historik og den samme markering; kun båndets faner ændres. Skifteren er låst, mens en skitse eller feature redigeres.",
+ "ui.workspace_layout": "Arbejdsområdets layout",
"ui.workspace_manufacture_description": "Slicing, værktøjsbaner og opsætning",
"ui.workspace_planned": "Planlagt",
"ui.workspace_render_description": "Produktforhåndsvisning, scene-indstillinger og renderede billeder",
diff --git a/assets/locales/de.json b/assets/locales/de.json
index 258e427bd..ab618e41e 100644
--- a/assets/locales/de.json
+++ b/assets/locales/de.json
@@ -1097,6 +1097,7 @@
"ui.agent_chat_add": "Dateien anhängen",
"ui.agent_chat_add_file": "Datei auswählen…",
"ui.agent_chat_allow": "Erlauben",
+ "ui.agent_chat_allow_once": "Einmal erlauben",
"ui.agent_chat_allowed": "Erlaubt",
"ui.agent_chat_answered": "Antwort: {option}",
"ui.agent_chat_approval": "Darf der Agent das tun?",
@@ -1154,6 +1155,9 @@
"ui.agent_chat_left": "Links",
"ui.agent_chat_limit": "Der Agent hat die Grenze von {limit} Änderungen für eine Nachricht erreicht. Senden Sie eine weitere Nachricht, damit er weitermacht.",
"ui.agent_chat_minimize": "Zu einer Leiste minimieren",
+ "ui.agent_chat_mode_all": "Alles",
+ "ui.agent_chat_mode_ask": "Fragen",
+ "ui.agent_chat_mode_edits": "Ändern",
"ui.agent_chat_model_tip": "Das vom Agenten verwendete Modell. Ihre Auswahl wird für diesen Agenten gespeichert.",
"ui.agent_chat_new": "Neuer Chat",
"ui.agent_chat_new_confirm": "Neuen Chat starten? Der aktuelle wird geleert.",
@@ -1166,6 +1170,7 @@
"ui.agent_chat_none_found_short": "Kein Agent gefunden",
"ui.agent_chat_not_installed": "Nicht installiert",
"ui.agent_chat_not_signed_in": "nicht angemeldet",
+ "ui.agent_chat_open_settings": "Einstellungen öffnen",
"ui.agent_chat_own_window": "Eigenes Fenster",
"ui.agent_chat_paste_picture": "Bild einfügen",
"ui.agent_chat_permission": "Der Agent möchte ausführen: {title}",
@@ -1190,6 +1195,8 @@
"ui.agent_chat_send": "Senden",
"ui.agent_chat_send_now": "Jetzt senden",
"ui.agent_chat_send_now_tip": "Den aktuellen Schritt des Agenten stoppen und dies als Nächstes senden (Strg+Eingabe)",
+ "ui.agent_chat_setup_body": "SolidCraft kommuniziert mit einem auf diesem Computer installierten Programmieragenten. Wählen Sie einen unter Einstellungen › KI aus.",
+ "ui.agent_chat_setup_title": "Assistenten einrichten",
"ui.agent_chat_side": "Seite des Agenten-Chats",
"ui.agent_chat_signed_in": "angemeldet",
"ui.agent_chat_state_auth": "Anmeldung nötig",
@@ -1206,6 +1213,7 @@
"ui.agent_chat_undo_label": "Agenten-Chat: {message}",
"ui.agent_chat_undone": "(rückgängig gemacht)",
"ui.agent_chat_view_attached": "Ansicht angehängt",
+ "ui.agent_chat_waiting": "Wartet auf Sie",
"ui.agent_cursor": "Agent-Cursor",
"ui.agent_cursor_speed": "Agent-Cursor-Geschwindigkeit",
"ui.ai_add": "Hinzufügen",
@@ -1555,6 +1563,8 @@
"ui.joints": "Gelenke",
"ui.keyboard_shortcuts": "Tastenkürzel",
"ui.language": "Sprache",
+ "ui.layout_compact": "Kompakt",
+ "ui.layout_floating": "Schwebend",
"ui.length_decimals": "Längen-Dezimalstellen",
"ui.light": "Hell",
"ui.line": "Linie",
@@ -1692,6 +1702,7 @@
"ui.reverse_zoom_direction": "Zoomrichtung umkehren",
"ui.revolve": "Drehen",
"ui.ribbon_exit": "Beenden",
+ "ui.ribbon_labels": "Text unter den Symbolen im Menüband anzeigen",
"ui.ribbon_pin_footer": "Angeheftete Befehle erscheinen im Menüband. Fahren Sie über eine Zeile, um sie anzuheften oder zu lösen.",
"ui.ribbon_workspace": "Arbeitsbereich",
"ui.right": "Rechts",
@@ -1871,6 +1882,7 @@
"ui.workspace_design_tabs": "Modell · Fläche · Zusammenbau · Einfügen · Prüfen · Verwalten · Ansicht",
"ui.workspace_drawing_description": "2D-Zeichnungen mit Ansichten, Bemaßungen und Schriftfeldern",
"ui.workspace_footer": "Jeder Arbeitsbereich arbeitet am selben Design, Verlauf und derselben Auswahl; nur die Menüband-Register ändern sich. Der Umschalter ist gesperrt, solange eine Skizze oder ein Merkmal bearbeitet wird.",
+ "ui.workspace_layout": "Arbeitsbereich-Layout",
"ui.workspace_manufacture_description": "Slicing, Werkzeugbahnen und Einrichtung",
"ui.workspace_planned": "Geplant",
"ui.workspace_render_description": "Produktvorschau, Szeneneinstellungen und gerenderte Bilder",
diff --git a/assets/locales/en-GB.json b/assets/locales/en-GB.json
index 8dfbaab36..d22d4aab7 100644
--- a/assets/locales/en-GB.json
+++ b/assets/locales/en-GB.json
@@ -21,7 +21,11 @@
"ui.customizeToolbar": "Customise Toolbar…",
"ui.design_properties.license": "Licence",
"ui.design_properties.organization": "Organisation",
+ "ui.layout_compact": "Compact",
+ "ui.layout_floating": "Floating",
+ "ui.ribbon_labels": "Show text under ribbon icons",
"ui.space_mouse_step_pull": "Pull the cap towards you, hold it, then let go.",
+ "ui.workspace_layout": "Workspace layout",
"ui.zoom_to_cursor_tip": "The wheel zooms towards the point under the cursor (off: towards the view's centre)",
"update.prefs_flatpak": "Flatpak updates this copy ({version}): run {command} or use your software centre. SolidCraft doesn't check."
}
diff --git a/assets/locales/en.json b/assets/locales/en.json
index 61b14e890..db6a1d2fe 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -1127,6 +1127,7 @@
"ui.agent_chat_add": "Attach files",
"ui.agent_chat_add_file": "Choose a file…",
"ui.agent_chat_allow": "Allow",
+ "ui.agent_chat_allow_once": "Allow once",
"ui.agent_chat_allowed": "Allowed",
"ui.agent_chat_answered": "Answer: {option}",
"ui.agent_chat_approval": "Allow the agent to do this?",
@@ -1184,6 +1185,9 @@
"ui.agent_chat_left": "Left",
"ui.agent_chat_limit": "The agent reached the limit of {limit} changes for one message. Send another message to let it go on.",
"ui.agent_chat_minimize": "Minimise to a strip",
+ "ui.agent_chat_mode_all": "All",
+ "ui.agent_chat_mode_ask": "Ask",
+ "ui.agent_chat_mode_edits": "Edits",
"ui.agent_chat_model_tip": "The model the agent uses. Your choice is remembered for this agent.",
"ui.agent_chat_new": "New chat",
"ui.agent_chat_new_confirm": "Start a new chat? The current one is cleared.",
@@ -1196,6 +1200,7 @@
"ui.agent_chat_none_found_short": "No agent found",
"ui.agent_chat_not_installed": "Not installed",
"ui.agent_chat_not_signed_in": "not signed in",
+ "ui.agent_chat_open_settings": "Open Preferences",
"ui.agent_chat_own_window": "Own window",
"ui.agent_chat_paste_picture": "Paste a picture",
"ui.agent_chat_permission": "The agent asks to run: {title}",
@@ -1220,6 +1225,8 @@
"ui.agent_chat_send": "Send",
"ui.agent_chat_send_now": "Send now",
"ui.agent_chat_send_now_tip": "Stop the agent's current step and send this next (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft talks to a coding agent installed on this computer. Pick one in Preferences › AI.",
+ "ui.agent_chat_setup_title": "Set up an assistant",
"ui.agent_chat_side": "Agent chat side",
"ui.agent_chat_signed_in": "signed in",
"ui.agent_chat_state_auth": "Sign-in needed",
@@ -1236,6 +1243,7 @@
"ui.agent_chat_undo_label": "Agent chat: {message}",
"ui.agent_chat_undone": "(undone)",
"ui.agent_chat_view_attached": "View attached",
+ "ui.agent_chat_waiting": "Waiting for you",
"ui.agent_cursor": "Agent cursor",
"ui.agent_cursor_speed": "Agent cursor speed",
"ui.agent_off_thread": "Keep the window responsive while agents run commands",
@@ -1594,6 +1602,8 @@
"ui.joints": "Joints",
"ui.keyboard_shortcuts": "Keyboard Shortcuts",
"ui.language": "Language",
+ "ui.layout_compact": "Compact",
+ "ui.layout_floating": "Floating",
"ui.length_decimals": "Length decimals",
"ui.light": "Light",
"ui.line": "Line",
@@ -1731,6 +1741,7 @@
"ui.reverse_zoom_direction": "Reverse zoom direction",
"ui.revolve": "Revolve",
"ui.ribbon_exit": "Exit",
+ "ui.ribbon_labels": "Show text under ribbon icons",
"ui.ribbon_pin_footer": "Pinned commands show on the ribbon. Hover a row to pin or unpin it.",
"ui.ribbon_workspace": "Workspace",
"ui.right": "Right",
@@ -1910,6 +1921,7 @@
"ui.workspace_design_tabs": "Model · Surface · Assemble · Insert · Inspect · Manage · View",
"ui.workspace_drawing_description": "2D drawings with views, dimensions and title blocks",
"ui.workspace_footer": "Every workspace works on the same design, history and selection; only the ribbon tabs change. The switcher is locked while a sketch or feature is being edited.",
+ "ui.workspace_layout": "Workspace layout",
"ui.workspace_manufacture_description": "Slicing, toolpaths and setup",
"ui.workspace_planned": "Planned",
"ui.workspace_render_description": "Product preview, scene settings and rendered images",
diff --git a/assets/locales/es.json b/assets/locales/es.json
index 366165d7f..71fabc566 100644
--- a/assets/locales/es.json
+++ b/assets/locales/es.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Adjuntar archivos",
"ui.agent_chat_add_file": "Elegir un archivo…",
"ui.agent_chat_allow": "Permitir",
+ "ui.agent_chat_allow_once": "Permitir una vez",
"ui.agent_chat_allowed": "Permitido",
"ui.agent_chat_answered": "Respuesta: {option}",
"ui.agent_chat_approval": "¿Permitir que el agente haga esto?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Izquierda",
"ui.agent_chat_limit": "El agente ha alcanzado el límite de {limit} cambios por mensaje. Envía otro mensaje para que continúe.",
"ui.agent_chat_minimize": "Minimizar a una franja",
+ "ui.agent_chat_mode_all": "Todo",
+ "ui.agent_chat_mode_ask": "Preguntar",
+ "ui.agent_chat_mode_edits": "Ediciones",
"ui.agent_chat_model_tip": "Modelo que utiliza el agente. Se recuerda tu elección para este agente.",
"ui.agent_chat_new": "Nuevo chat",
"ui.agent_chat_new_confirm": "¿Iniciar un nuevo chat? Se borrará la conversación actual.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "No se ha encontrado ningún agente",
"ui.agent_chat_not_installed": "No instalado",
"ui.agent_chat_not_signed_in": "sesión no iniciada",
+ "ui.agent_chat_open_settings": "Abrir preferencias",
"ui.agent_chat_own_window": "Ventana propia",
"ui.agent_chat_paste_picture": "Pegar una imagen",
"ui.agent_chat_permission": "El agente solicita ejecutar: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Enviar",
"ui.agent_chat_send_now": "Enviar ahora",
"ui.agent_chat_send_now_tip": "Detener el paso actual del agente y enviar esto a continuación (Ctrl+Intro)",
+ "ui.agent_chat_setup_body": "SolidCraft se comunica con un agente de programación instalado en este equipo. Elige uno en Preferencias › AI.",
+ "ui.agent_chat_setup_title": "Configurar un asistente",
"ui.agent_chat_side": "Lado del chat del agente",
"ui.agent_chat_signed_in": "sesión iniciada",
"ui.agent_chat_state_auth": "Se requiere iniciar sesión",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Chat del agente: {message}",
"ui.agent_chat_undone": "(deshecho)",
"ui.agent_chat_view_attached": "Vista adjunta",
+ "ui.agent_chat_waiting": "Esperando tu respuesta",
"ui.agent_cursor": "Cursor del agente",
"ui.agent_cursor_speed": "Velocidad del cursor del agente",
"ui.ai_add": "Añadir",
@@ -1551,6 +1559,8 @@
"ui.joints": "Uniones",
"ui.keyboard_shortcuts": "Atajos de teclado",
"ui.language": "Idioma",
+ "ui.layout_compact": "Compacta",
+ "ui.layout_floating": "Flotante",
"ui.length_decimals": "Decimales de longitud",
"ui.light": "Claro",
"ui.line": "Línea",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Invertir dirección del zoom",
"ui.revolve": "Revolución",
"ui.ribbon_exit": "Salir",
+ "ui.ribbon_labels": "Mostrar texto bajo los iconos de la cinta",
"ui.ribbon_pin_footer": "Los comandos anclados se muestran en la cinta. Pasa el ratón sobre una fila para anclarla o desanclarla.",
"ui.ribbon_workspace": "Espacio de trabajo",
"ui.right": "Derecha",
@@ -1867,6 +1878,7 @@
"ui.workspace_design_tabs": "Modelo · Superficie · Ensamblaje · Insertar · Inspeccionar · Gestionar · Vista",
"ui.workspace_drawing_description": "Dibujos 2D con vistas, cotas y cajetines",
"ui.workspace_footer": "Todos los espacios de trabajo usan el mismo diseño, historial y selección; solo cambian las pestañas de la cinta. El selector está bloqueado mientras se edita un boceto o una operación.",
+ "ui.workspace_layout": "Disposición del espacio de trabajo",
"ui.workspace_manufacture_description": "Laminado, trayectorias de herramienta y configuración",
"ui.workspace_planned": "Previsto",
"ui.workspace_render_description": "Vista previa del producto, ajustes de escena e imágenes renderizadas",
diff --git a/assets/locales/fr.json b/assets/locales/fr.json
index 79008268e..07731cea4 100644
--- a/assets/locales/fr.json
+++ b/assets/locales/fr.json
@@ -1099,6 +1099,7 @@
"ui.agent_chat_add": "Joindre des fichiers",
"ui.agent_chat_add_file": "Choisir un fichier…",
"ui.agent_chat_allow": "Autoriser",
+ "ui.agent_chat_allow_once": "Autoriser une fois",
"ui.agent_chat_allowed": "Autorisé",
"ui.agent_chat_answered": "Réponse : {option}",
"ui.agent_chat_approval": "Autoriser l'agent à effectuer cette action ?",
@@ -1156,6 +1157,9 @@
"ui.agent_chat_left": "Gauche",
"ui.agent_chat_limit": "L'agent a atteint la limite de {limit} modifications pour un message. Envoyez un autre message pour qu'il poursuive.",
"ui.agent_chat_minimize": "Réduire en bandeau",
+ "ui.agent_chat_mode_all": "Tout",
+ "ui.agent_chat_mode_ask": "Demander",
+ "ui.agent_chat_mode_edits": "Édition",
"ui.agent_chat_model_tip": "Le modèle utilisé par l'agent. Votre choix est mémorisé pour cet agent.",
"ui.agent_chat_new": "Nouveau chat",
"ui.agent_chat_new_confirm": "Démarrer un nouveau chat ? Le chat actuel sera effacé.",
@@ -1168,6 +1172,7 @@
"ui.agent_chat_none_found_short": "Aucun agent trouvé",
"ui.agent_chat_not_installed": "Non installé",
"ui.agent_chat_not_signed_in": "non authentifié",
+ "ui.agent_chat_open_settings": "Ouvrir les préférences",
"ui.agent_chat_own_window": "Fenêtre séparée",
"ui.agent_chat_paste_picture": "Coller une image",
"ui.agent_chat_permission": "L'agent demande à exécuter : {title}",
@@ -1192,6 +1197,8 @@
"ui.agent_chat_send": "Envoyer",
"ui.agent_chat_send_now": "Envoyer maintenant",
"ui.agent_chat_send_now_tip": "Arrêter l'étape en cours de l'agent et envoyer celui-ci ensuite (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft communique avec un agent de programmation installé sur cet ordinateur. Choisissez-en un dans Préférences › IA.",
+ "ui.agent_chat_setup_title": "Configurer un assistant",
"ui.agent_chat_side": "Côté du chat de l'agent",
"ui.agent_chat_signed_in": "authentifié",
"ui.agent_chat_state_auth": "Authentification requise",
@@ -1208,6 +1215,7 @@
"ui.agent_chat_undo_label": "Chat de l'agent : {message}",
"ui.agent_chat_undone": "(annulé)",
"ui.agent_chat_view_attached": "Vue jointe",
+ "ui.agent_chat_waiting": "En attente de votre réponse",
"ui.agent_cursor": "Curseur de l'agent",
"ui.agent_cursor_speed": "Vitesse du curseur de l'agent",
"ui.ai_add": "Ajouter",
@@ -1557,6 +1565,8 @@
"ui.joints": "Liaisons",
"ui.keyboard_shortcuts": "Raccourcis clavier",
"ui.language": "Langue",
+ "ui.layout_compact": "Compacte",
+ "ui.layout_floating": "Flottante",
"ui.length_decimals": "Décimales des longueurs",
"ui.light": "Clair",
"ui.line": "Ligne",
@@ -1694,6 +1704,7 @@
"ui.reverse_zoom_direction": "Inverser le sens du zoom",
"ui.revolve": "Révolution",
"ui.ribbon_exit": "Quitter",
+ "ui.ribbon_labels": "Afficher le texte sous les icônes du ruban",
"ui.ribbon_pin_footer": "Les commandes épinglées s’affichent dans le ruban. Survolez une ligne pour l’épingler ou la détacher.",
"ui.ribbon_workspace": "Espace de travail",
"ui.right": "Droite",
@@ -1873,6 +1884,7 @@
"ui.workspace_design_tabs": "Modèle · Surface · Assemblage · Insérer · Inspecter · Gérer · Vue",
"ui.workspace_drawing_description": "Mises en plan 2D avec vues, cotes et cartouches",
"ui.workspace_footer": "Chaque espace de travail s’applique à la même conception, au même historique et à la même sélection ; seuls les onglets du ruban changent. Le sélecteur est verrouillé pendant la modification d’une esquisse ou d’une entité.",
+ "ui.workspace_layout": "Disposition de l’espace de travail",
"ui.workspace_manufacture_description": "Tranchage, parcours d’outil et configuration",
"ui.workspace_planned": "Prévu",
"ui.workspace_render_description": "Aperçu du produit, paramètres de scène et images rendues",
diff --git a/assets/locales/gl.json b/assets/locales/gl.json
index 39fc3c8c4..e5b818c14 100644
--- a/assets/locales/gl.json
+++ b/assets/locales/gl.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Anexar ficheiros",
"ui.agent_chat_add_file": "Escoller un ficheiro…",
"ui.agent_chat_allow": "Permitir",
+ "ui.agent_chat_allow_once": "Permitir unha vez",
"ui.agent_chat_allowed": "Permitido",
"ui.agent_chat_answered": "Resposta: {option}",
"ui.agent_chat_approval": "Permitir que o axente faga isto?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Esquerda",
"ui.agent_chat_limit": "O axente chegou ao límite de {limit} cambios por mensaxe. Envía outra mensaxe para que continúe.",
"ui.agent_chat_minimize": "Minimizar nunha franxa",
+ "ui.agent_chat_mode_all": "Todo",
+ "ui.agent_chat_mode_ask": "Preguntar",
+ "ui.agent_chat_mode_edits": "Edicións",
"ui.agent_chat_model_tip": "O modelo que usa o axente. A túa escolla lémbrase para este axente.",
"ui.agent_chat_new": "Chat novo",
"ui.agent_chat_new_confirm": "Comezar un chat novo? Borrarase o actual.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Non se atopou ningún axente",
"ui.agent_chat_not_installed": "Non instalado",
"ui.agent_chat_not_signed_in": "sen sesión iniciada",
+ "ui.agent_chat_open_settings": "Abrir preferencias",
"ui.agent_chat_own_window": "Xanela propia",
"ui.agent_chat_paste_picture": "Pegar unha imaxe",
"ui.agent_chat_permission": "O axente pide executar: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Enviar",
"ui.agent_chat_send_now": "Enviar agora",
"ui.agent_chat_send_now_tip": "Detén o paso actual do axente e envía isto a continuación (Ctrl+Intro)",
+ "ui.agent_chat_setup_body": "SolidCraft comunícase cun axente de programación instalado neste equipo. Escolle un en Preferencias › IA.",
+ "ui.agent_chat_setup_title": "Configurar un asistente",
"ui.agent_chat_side": "Lado do chat co axente",
"ui.agent_chat_signed_in": "sesión iniciada",
"ui.agent_chat_state_auth": "Hai que iniciar sesión",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Chat co axente: {message}",
"ui.agent_chat_undone": "(desfeito)",
"ui.agent_chat_view_attached": "Vista achegada",
+ "ui.agent_chat_waiting": "Agardando a túa resposta",
"ui.agent_cursor": "Cursor do axente",
"ui.agent_cursor_speed": "Velocidade do cursor do axente",
"ui.ai_add": "Engadir",
@@ -1551,6 +1559,8 @@
"ui.joints": "Unións",
"ui.keyboard_shortcuts": "Atallos de teclado",
"ui.language": "Idioma",
+ "ui.layout_compact": "Compacta",
+ "ui.layout_floating": "Flotante",
"ui.length_decimals": "Decimais das lonxitudes",
"ui.light": "Claro",
"ui.line": "Liña",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Inverter a dirección do zoom",
"ui.revolve": "Revolución",
"ui.ribbon_exit": "Saír",
+ "ui.ribbon_labels": "Mostrar texto baixo as iconas da cinta",
"ui.ribbon_pin_footer": "As ordes fixadas móstranse na cinta. Pasa o cursor sobre unha fila para fixala ou soltala.",
"ui.ribbon_workspace": "Espazo de traballo",
"ui.right": "Dereita",
@@ -1867,6 +1878,7 @@
"ui.workspace_design_tabs": "Modelo · Superficie · Montaxe · Inserir · Inspeccionar · Xestionar · Vista",
"ui.workspace_drawing_description": "Planos 2D con vistas, cotas e cartelas",
"ui.workspace_footer": "Todos os espazos de traballo usan o mesmo deseño, historial e selección; só cambian as pestanas da cinta. O selector bloquéase mentres se edita un bosquexo ou unha operación.",
+ "ui.workspace_layout": "Disposición do espazo de traballo",
"ui.workspace_manufacture_description": "Laminado, traxectorias de ferramenta e configuración",
"ui.workspace_planned": "Previsto",
"ui.workspace_render_description": "Vista previa do produto, axustes de escena e imaxes renderizadas",
diff --git a/assets/locales/hu.json b/assets/locales/hu.json
index 9c56b3242..f96d615b5 100644
--- a/assets/locales/hu.json
+++ b/assets/locales/hu.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "Fájlok csatolása",
"ui.agent_chat_add_file": "Válasszon fájlt…",
"ui.agent_chat_allow": "Engedélyezés",
+ "ui.agent_chat_allow_once": "Egyszer engedélyezi",
"ui.agent_chat_allowed": "Engedélyezve",
"ui.agent_chat_answered": "Válasz: {option}",
"ui.agent_chat_approval": "Engedélyezi az ügynöknek ezt?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "Bal",
"ui.agent_chat_limit": "Az ügynök elérte az egy üzenetre eső {limit} módosítás korlátját. Küldjön újabb üzenetet a folytatáshoz.",
"ui.agent_chat_minimize": "Összecsukás sávvá",
+ "ui.agent_chat_mode_all": "Minden",
+ "ui.agent_chat_mode_ask": "Kérdez",
+ "ui.agent_chat_mode_edits": "Szerkesztés",
"ui.agent_chat_model_tip": "Az ügynök által használt modell. A választás megmarad ennél az ügynöknél.",
"ui.agent_chat_new": "Új csevegés",
"ui.agent_chat_new_confirm": "Új csevegést indít? A jelenlegi törlődik.",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "Nincs ügynök",
"ui.agent_chat_not_installed": "Nincs telepítve",
"ui.agent_chat_not_signed_in": "nincs bejelentkezve",
+ "ui.agent_chat_open_settings": "Beállítások megnyitása",
"ui.agent_chat_own_window": "Saját ablak",
"ui.agent_chat_paste_picture": "Kép beillesztése",
"ui.agent_chat_permission": "Az ügynök futtatást kér: {title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "Küldés",
"ui.agent_chat_send_now": "Küldés most",
"ui.agent_chat_send_now_tip": "Az ügynök jelenlegi lépésének leállítása és ennek küldése következőként (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "A SolidCraft a számítógépre telepített programozóügynökkel kommunikál. Válasszon egyet itt: Beállítások › AI.",
+ "ui.agent_chat_setup_title": "Asszisztens beállítása",
"ui.agent_chat_side": "Ügynök-csevegés oldala",
"ui.agent_chat_signed_in": "bejelentkezve",
"ui.agent_chat_state_auth": "Bejelentkezés szükséges",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "Ügynök-csevegés: {message}",
"ui.agent_chat_undone": "(visszavonva)",
"ui.agent_chat_view_attached": "Nézet csatolva",
+ "ui.agent_chat_waiting": "Önre vár",
"ui.agent_cursor": "Ügynök kurzora",
"ui.agent_cursor_speed": "Ügynök kurzorának sebessége",
"ui.ai_add": "Hozzáadás",
@@ -1550,6 +1558,8 @@
"ui.joints": "Csuklók",
"ui.keyboard_shortcuts": "Billentyűparancsok",
"ui.language": "Nyelv",
+ "ui.layout_compact": "Kompakt",
+ "ui.layout_floating": "Lebegő",
"ui.length_decimals": "Hossz tizedesjegyei",
"ui.light": "Világos",
"ui.line": "Vonal",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "Nagyítási irány megfordítása",
"ui.revolve": "Forgatás",
"ui.ribbon_exit": "Kilépés",
+ "ui.ribbon_labels": "Szöveg megjelenítése a menüszalag ikonjai alatt",
"ui.ribbon_pin_footer": "A rögzített parancsok megjelennek a menüszalagon. Egy sor fölé víve rögzíthető vagy feloldható.",
"ui.ribbon_workspace": "Munkaterület",
"ui.right": "Jobb",
@@ -1841,6 +1852,7 @@
"ui.workspace_design_tabs": "Modell · Felület · Összeszerelés · Beszúrás · Vizsgálat · Kezelés · Nézet",
"ui.workspace_drawing_description": "2D rajzok nézetekkel, méretekkel és címblokkokkal",
"ui.workspace_footer": "Minden munkaterület ugyanazon a terven, előzményeken és kijelölésen dolgozik; csak a menüszalag lapjai változnak. A váltó zárolva van, amíg vázlatot vagy elemet szerkeszt.",
+ "ui.workspace_layout": "Munkaterület elrendezése",
"ui.workspace_manufacture_description": "Szeletelés, szerszámutak és beállítás",
"ui.workspace_planned": "Tervezett",
"ui.workspace_render_description": "Terméknézet, jelenetbeállítások és renderelt képek",
diff --git a/assets/locales/id.json b/assets/locales/id.json
index 0e9039f4c..3847d7a1a 100644
--- a/assets/locales/id.json
+++ b/assets/locales/id.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "Lampirkan file",
"ui.agent_chat_add_file": "Pilih file…",
"ui.agent_chat_allow": "Izinkan",
+ "ui.agent_chat_allow_once": "Izinkan sekali",
"ui.agent_chat_allowed": "Diizinkan",
"ui.agent_chat_answered": "Jawaban: {option}",
"ui.agent_chat_approval": "Izinkan agen melakukan ini?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "Kiri",
"ui.agent_chat_limit": "Agen mencapai batas {limit} perubahan untuk satu pesan. Kirim pesan lain agar agen melanjutkan.",
"ui.agent_chat_minimize": "Kecilkan menjadi strip",
+ "ui.agent_chat_mode_all": "Semua",
+ "ui.agent_chat_mode_ask": "Tanya",
+ "ui.agent_chat_mode_edits": "Edit",
"ui.agent_chat_model_tip": "Model yang dipakai agen. Pilihan Anda diingat untuk agen ini.",
"ui.agent_chat_new": "Chat baru",
"ui.agent_chat_new_confirm": "Mulai chat baru? Chat saat ini akan dibersihkan.",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "Agen tidak ditemukan",
"ui.agent_chat_not_installed": "Belum terpasang",
"ui.agent_chat_not_signed_in": "belum masuk",
+ "ui.agent_chat_open_settings": "Buka preferensi",
"ui.agent_chat_own_window": "Jendela sendiri",
"ui.agent_chat_paste_picture": "Tempel gambar",
"ui.agent_chat_permission": "Agen meminta menjalankan: {title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "Kirim",
"ui.agent_chat_send_now": "Kirim sekarang",
"ui.agent_chat_send_now_tip": "Hentikan langkah agen saat ini dan kirim ini berikutnya (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft berkomunikasi dengan agen pemrograman yang terpasang di komputer ini. Pilih agen di Preferensi › AI.",
+ "ui.agent_chat_setup_title": "Siapkan asisten",
"ui.agent_chat_side": "Sisi chat agen",
"ui.agent_chat_signed_in": "sudah masuk",
"ui.agent_chat_state_auth": "Perlu masuk",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "Chat agen: {message}",
"ui.agent_chat_undone": "(diurungkan)",
"ui.agent_chat_view_attached": "Tampilan dilampirkan",
+ "ui.agent_chat_waiting": "Menunggu Anda",
"ui.agent_cursor": "Kursor agen",
"ui.agent_cursor_speed": "Kecepatan kursor agen",
"ui.ai_add": "Tambah",
@@ -1550,6 +1558,8 @@
"ui.joints": "Sambungan",
"ui.keyboard_shortcuts": "Pintasan Keyboard",
"ui.language": "Bahasa",
+ "ui.layout_compact": "Ringkas",
+ "ui.layout_floating": "Mengambang",
"ui.length_decimals": "Desimal panjang",
"ui.light": "Terang",
"ui.line": "Garis",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "Balik arah zoom",
"ui.revolve": "Revolve",
"ui.ribbon_exit": "Keluar",
+ "ui.ribbon_labels": "Tampilkan teks di bawah ikon pita",
"ui.ribbon_pin_footer": "Perintah yang disematkan tampil di ribbon. Arahkan kursor ke baris untuk menyematkan atau melepas sematan.",
"ui.ribbon_workspace": "Workspace",
"ui.right": "Kanan",
@@ -1841,6 +1852,7 @@
"ui.workspace_design_tabs": "Model · Permukaan · Rakit · Sisipkan · Inspeksi · Kelola · Tampilan",
"ui.workspace_drawing_description": "Gambar kerja 2D dengan tampilan, dimensi, dan title block",
"ui.workspace_footer": "Setiap workspace bekerja pada desain, riwayat, dan pilihan yang sama; hanya tab ribbon yang berubah. Pengalih terkunci saat sketsa atau fitur sedang diedit.",
+ "ui.workspace_layout": "Tata letak ruang kerja",
"ui.workspace_manufacture_description": "Slicing, toolpath, dan setup",
"ui.workspace_planned": "Direncanakan",
"ui.workspace_render_description": "Pratinjau produk, pengaturan scene, dan gambar render",
diff --git a/assets/locales/it.json b/assets/locales/it.json
index 5d18bc177..6a772ff66 100644
--- a/assets/locales/it.json
+++ b/assets/locales/it.json
@@ -1096,6 +1096,7 @@
"ui.agent_chat_add": "Allega file",
"ui.agent_chat_add_file": "Scegli un file…",
"ui.agent_chat_allow": "Consenti",
+ "ui.agent_chat_allow_once": "Consenti una volta",
"ui.agent_chat_allowed": "Consentito",
"ui.agent_chat_answered": "Risposta: {option}",
"ui.agent_chat_approval": "Consentire questa azione all'agente?",
@@ -1153,6 +1154,9 @@
"ui.agent_chat_left": "Sinistra",
"ui.agent_chat_limit": "L'agente ha raggiunto il limite di {limit} modifiche per messaggio. Invia un altro messaggio per farlo proseguire.",
"ui.agent_chat_minimize": "Riduci a una striscia",
+ "ui.agent_chat_mode_all": "Tutto",
+ "ui.agent_chat_mode_ask": "Chiedi",
+ "ui.agent_chat_mode_edits": "Modifiche",
"ui.agent_chat_model_tip": "Il modello usato dall'agente. La scelta viene memorizzata per questo agente.",
"ui.agent_chat_new": "Nuova chat",
"ui.agent_chat_new_confirm": "Avviare una nuova chat? Quella corrente verrà cancellata.",
@@ -1165,6 +1169,7 @@
"ui.agent_chat_none_found_short": "Nessun agente trovato",
"ui.agent_chat_not_installed": "Non installato",
"ui.agent_chat_not_signed_in": "accesso non effettuato",
+ "ui.agent_chat_open_settings": "Apri preferenze",
"ui.agent_chat_own_window": "Finestra separata",
"ui.agent_chat_paste_picture": "Incolla un'immagine",
"ui.agent_chat_permission": "L'agente chiede di eseguire: {title}",
@@ -1189,6 +1194,8 @@
"ui.agent_chat_send": "Invia",
"ui.agent_chat_send_now": "Invia subito",
"ui.agent_chat_send_now_tip": "Interrompi il passo corrente dell'agente e invia questo messaggio come successivo (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft comunica con un agente di programmazione installato su questo computer. Scegline uno in Preferenze › IA.",
+ "ui.agent_chat_setup_title": "Configura un assistente",
"ui.agent_chat_side": "Lato della chat con l'agente",
"ui.agent_chat_signed_in": "accesso effettuato",
"ui.agent_chat_state_auth": "Accesso richiesto",
@@ -1205,6 +1212,7 @@
"ui.agent_chat_undo_label": "Chat con l'agente: {message}",
"ui.agent_chat_undone": "(annullato)",
"ui.agent_chat_view_attached": "Vista allegata",
+ "ui.agent_chat_waiting": "In attesa della tua risposta",
"ui.agent_cursor": "Cursore dell'agente",
"ui.agent_cursor_speed": "Velocità del cursore dell'agente",
"ui.ai_add": "Aggiungi",
@@ -1554,6 +1562,8 @@
"ui.joints": "Giunti",
"ui.keyboard_shortcuts": "Scorciatoie da tastiera",
"ui.language": "Lingua",
+ "ui.layout_compact": "Compatta",
+ "ui.layout_floating": "Flottante",
"ui.length_decimals": "Decimali delle lunghezze",
"ui.light": "Chiaro",
"ui.line": "Linea",
@@ -1691,6 +1701,7 @@
"ui.reverse_zoom_direction": "Inverti direzione dello zoom",
"ui.revolve": "Rivoluzione",
"ui.ribbon_exit": "Esci",
+ "ui.ribbon_labels": "Mostra il testo sotto le icone della barra multifunzione",
"ui.ribbon_pin_footer": "I comandi fissati compaiono sulla barra multifunzione. Passa sopra una riga per fissarla o rimuoverla.",
"ui.ribbon_workspace": "Area di lavoro",
"ui.right": "Destra",
@@ -1870,6 +1881,7 @@
"ui.workspace_design_tabs": "Modello · Superficie · Assembla · Inserisci · Ispeziona · Gestisci · Vista",
"ui.workspace_drawing_description": "Disegni 2D con viste, quote e cartigli",
"ui.workspace_footer": "Ogni area di lavoro opera sullo stesso progetto, cronologia e selezione; cambiano solo le schede della barra multifunzione. Il selettore è bloccato durante la modifica di uno schizzo o di una feature.",
+ "ui.workspace_layout": "Disposizione dello spazio di lavoro",
"ui.workspace_manufacture_description": "Slicing, percorsi utensile e impostazione",
"ui.workspace_planned": "Pianificata",
"ui.workspace_render_description": "Anteprima del prodotto, impostazioni della scena e immagini renderizzate",
diff --git a/assets/locales/ja.json b/assets/locales/ja.json
index a089aa8eb..697c15101 100644
--- a/assets/locales/ja.json
+++ b/assets/locales/ja.json
@@ -1127,6 +1127,7 @@
"ui.agent_chat_add": "ファイルを添付",
"ui.agent_chat_add_file": "ファイルを選択…",
"ui.agent_chat_allow": "許可",
+ "ui.agent_chat_allow_once": "今回のみ許可",
"ui.agent_chat_allowed": "許可しました",
"ui.agent_chat_answered": "回答: {option}",
"ui.agent_chat_approval": "エージェントにこの操作を許可しますか?",
@@ -1184,6 +1185,9 @@
"ui.agent_chat_left": "左",
"ui.agent_chat_limit": "エージェントが1メッセージあたりの変更上限 {limit} に達しました。続けさせるには、もう一度メッセージを送ってください。",
"ui.agent_chat_minimize": "細いバーに最小化",
+ "ui.agent_chat_mode_all": "すべて",
+ "ui.agent_chat_mode_ask": "確認",
+ "ui.agent_chat_mode_edits": "編集",
"ui.agent_chat_model_tip": "エージェントが使うモデル。選択はこのエージェントに対して記憶されます。",
"ui.agent_chat_new": "新しいチャット",
"ui.agent_chat_new_confirm": "新しいチャットを始めますか? 現在のチャットは消去されます。",
@@ -1196,6 +1200,7 @@
"ui.agent_chat_none_found_short": "エージェントが見つかりません",
"ui.agent_chat_not_installed": "未インストール",
"ui.agent_chat_not_signed_in": "未サインイン",
+ "ui.agent_chat_open_settings": "環境設定を開く",
"ui.agent_chat_own_window": "独立したウィンドウ",
"ui.agent_chat_paste_picture": "画像を貼り付け",
"ui.agent_chat_permission": "エージェントが実行の許可を求めています: {title}",
@@ -1220,6 +1225,8 @@
"ui.agent_chat_send": "送信",
"ui.agent_chat_send_now": "今すぐ送信",
"ui.agent_chat_send_now_tip": "エージェントの現在のステップを止めて、これを次に送信します(Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft は、このコンピューターにインストールされたコーディングエージェントと連携します。「環境設定 › AI」で選択してください。",
+ "ui.agent_chat_setup_title": "アシスタントを設定",
"ui.agent_chat_side": "エージェントチャットの位置",
"ui.agent_chat_signed_in": "サインイン済み",
"ui.agent_chat_state_auth": "サインインが必要",
@@ -1236,6 +1243,7 @@
"ui.agent_chat_undo_label": "エージェントチャット: {message}",
"ui.agent_chat_undone": "(元に戻しました)",
"ui.agent_chat_view_attached": "ビューを添付済み",
+ "ui.agent_chat_waiting": "確認待ち",
"ui.agent_cursor": "エージェントカーソル",
"ui.agent_cursor_speed": "エージェントカーソル速度",
"ui.agent_off_thread": "エージェントのコマンド実行中もウィンドウを操作可能にする",
@@ -1594,6 +1602,8 @@
"ui.joints": "ジョイント",
"ui.keyboard_shortcuts": "キーボードショートカット",
"ui.language": "言語",
+ "ui.layout_compact": "コンパクト",
+ "ui.layout_floating": "フローティング",
"ui.length_decimals": "長さの小数点以下の桁数",
"ui.light": "ライト",
"ui.line": "線分",
@@ -1731,6 +1741,7 @@
"ui.reverse_zoom_direction": "ズーム方向を反転",
"ui.revolve": "回転",
"ui.ribbon_exit": "終了",
+ "ui.ribbon_labels": "リボンのアイコンの下にテキストを表示",
"ui.ribbon_pin_footer": "ピン留めしたコマンドはリボンに表示されます。行にポインターを合わせて、ピン留めや解除ができます。",
"ui.ribbon_workspace": "ワークスペース",
"ui.right": "右側面",
@@ -1910,6 +1921,7 @@
"ui.workspace_design_tabs": "モデル · サーフェス · アセンブリ · 挿入 · 検査 · 管理 · 表示",
"ui.workspace_drawing_description": "ビュー、寸法、表題欄を含む2D図面",
"ui.workspace_footer": "すべてのワークスペースで同じデザイン、履歴、選択を使用し、リボンのタブだけが変わります。スケッチやフィーチャーの編集中は切り替えできません。",
+ "ui.workspace_layout": "ワークスペースのレイアウト",
"ui.workspace_manufacture_description": "スライス、ツールパス、セットアップ",
"ui.workspace_planned": "予定",
"ui.workspace_render_description": "製品プレビュー、シーン設定、レンダリング画像",
diff --git a/assets/locales/ko.json b/assets/locales/ko.json
index b08c59f34..dcd938260 100644
--- a/assets/locales/ko.json
+++ b/assets/locales/ko.json
@@ -1097,6 +1097,7 @@
"ui.agent_chat_add": "파일 첨부",
"ui.agent_chat_add_file": "파일 선택…",
"ui.agent_chat_allow": "허용",
+ "ui.agent_chat_allow_once": "한 번 허용",
"ui.agent_chat_allowed": "허용함",
"ui.agent_chat_answered": "응답: {option}",
"ui.agent_chat_approval": "에이전트가 이 작업을 하도록 허용할까요?",
@@ -1154,6 +1155,9 @@
"ui.agent_chat_left": "왼쪽",
"ui.agent_chat_limit": "에이전트가 메시지당 변경 한도 {limit}에 도달했습니다. 계속하게 하려면 메시지를 하나 더 보내세요.",
"ui.agent_chat_minimize": "얇은 막대로 최소화",
+ "ui.agent_chat_mode_all": "모두",
+ "ui.agent_chat_mode_ask": "확인",
+ "ui.agent_chat_mode_edits": "편집",
"ui.agent_chat_model_tip": "에이전트가 사용하는 모델입니다. 선택은 이 에이전트에 기억됩니다.",
"ui.agent_chat_new": "새 채팅",
"ui.agent_chat_new_confirm": "새 채팅을 시작할까요? 현재 채팅은 지워집니다.",
@@ -1166,6 +1170,7 @@
"ui.agent_chat_none_found_short": "에이전트를 찾지 못함",
"ui.agent_chat_not_installed": "설치되지 않음",
"ui.agent_chat_not_signed_in": "로그인 안 됨",
+ "ui.agent_chat_open_settings": "환경 설정 열기",
"ui.agent_chat_own_window": "별도 창",
"ui.agent_chat_paste_picture": "이미지 붙여넣기",
"ui.agent_chat_permission": "에이전트가 실행 허락을 요청합니다: {title}",
@@ -1190,6 +1195,8 @@
"ui.agent_chat_send": "보내기",
"ui.agent_chat_send_now": "지금 보내기",
"ui.agent_chat_send_now_tip": "에이전트의 현재 단계를 중지하고 이것을 다음으로 보냅니다 (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft는 이 컴퓨터에 설치된 코딩 에이전트와 통신합니다. 환경 설정 › AI에서 에이전트를 선택하세요.",
+ "ui.agent_chat_setup_title": "어시스턴트 설정",
"ui.agent_chat_side": "에이전트 채팅 위치",
"ui.agent_chat_signed_in": "로그인됨",
"ui.agent_chat_state_auth": "로그인 필요",
@@ -1206,6 +1213,7 @@
"ui.agent_chat_undo_label": "에이전트 채팅: {message}",
"ui.agent_chat_undone": "(취소됨)",
"ui.agent_chat_view_attached": "뷰 첨부됨",
+ "ui.agent_chat_waiting": "확인 대기 중",
"ui.agent_cursor": "에이전트 커서",
"ui.agent_cursor_speed": "에이전트 커서 속도",
"ui.ai_add": "추가",
@@ -1555,6 +1563,8 @@
"ui.joints": "조인트",
"ui.keyboard_shortcuts": "키보드 단축키",
"ui.language": "언어",
+ "ui.layout_compact": "컴팩트",
+ "ui.layout_floating": "플로팅",
"ui.length_decimals": "길이 소수점 자릿수",
"ui.light": "밝게",
"ui.line": "선",
@@ -1692,6 +1702,7 @@
"ui.reverse_zoom_direction": "확대/축소 방향 반전",
"ui.revolve": "회전",
"ui.ribbon_exit": "종료",
+ "ui.ribbon_labels": "리본 아이콘 아래에 텍스트 표시",
"ui.ribbon_pin_footer": "고정된 명령은 리본에 표시됩니다. 행 위에 마우스를 올려 고정하거나 해제하세요.",
"ui.ribbon_workspace": "작업 공간",
"ui.right": "우측면",
@@ -1871,6 +1882,7 @@
"ui.workspace_design_tabs": "모델 · 곡면 · 조립 · 삽입 · 검사 · 관리 · 보기",
"ui.workspace_drawing_description": "뷰, 치수, 표제란이 있는 2D 도면",
"ui.workspace_footer": "모든 작업 공간은 같은 디자인, 히스토리, 선택 항목에서 작동하며 리본 탭만 바뀝니다. 스케치나 피처를 편집하는 동안에는 전환기가 잠깁니다.",
+ "ui.workspace_layout": "작업 공간 레이아웃",
"ui.workspace_manufacture_description": "슬라이싱, 툴패스 및 설정",
"ui.workspace_planned": "예정",
"ui.workspace_render_description": "제품 미리보기, 장면 설정 및 렌더링 이미지",
diff --git a/assets/locales/ms.json b/assets/locales/ms.json
index ea47d78cd..e1d38cf7a 100644
--- a/assets/locales/ms.json
+++ b/assets/locales/ms.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Lampirkan fail",
"ui.agent_chat_add_file": "Pilih fail…",
"ui.agent_chat_allow": "Benarkan",
+ "ui.agent_chat_allow_once": "Benarkan sekali",
"ui.agent_chat_allowed": "Dibenarkan",
"ui.agent_chat_answered": "Jawapan: {option}",
"ui.agent_chat_approval": "Benarkan ejen melakukan ini?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Kiri",
"ui.agent_chat_limit": "Ejen telah mencapai had {limit} perubahan untuk satu mesej. Hantar mesej lain untuk meneruskan.",
"ui.agent_chat_minimize": "Kecilkan kepada bar",
+ "ui.agent_chat_mode_all": "Semua",
+ "ui.agent_chat_mode_ask": "Tanya",
+ "ui.agent_chat_mode_edits": "Suntingan",
"ui.agent_chat_model_tip": "Model yang digunakan oleh ejen. Pilihan anda disimpan untuk ejen ini.",
"ui.agent_chat_new": "Sembang baharu",
"ui.agent_chat_new_confirm": "Mulakan sembang baharu? Sembang semasa akan dikosongkan.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Tiada ejen ditemui",
"ui.agent_chat_not_installed": "Tidak dipasang",
"ui.agent_chat_not_signed_in": "belum log masuk",
+ "ui.agent_chat_open_settings": "Buka tetapan",
"ui.agent_chat_own_window": "Tetingkap sendiri",
"ui.agent_chat_paste_picture": "Tampal gambar",
"ui.agent_chat_permission": "Benarkan ejen jalankan: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Hantar",
"ui.agent_chat_send_now": "Hantar terus",
"ui.agent_chat_send_now_tip": "Hentikan langkah semasa ejen dan hantar mesej ini selepas itu (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft berkomunikasi dengan ejen pengekodan yang dipasang pada komputer ini. Pilih ejen dalam Tetapan › AI.",
+ "ui.agent_chat_setup_title": "Sediakan pembantu",
"ui.agent_chat_side": "Sisi sembang ejen",
"ui.agent_chat_signed_in": "sudah log masuk",
"ui.agent_chat_state_auth": "Perlu log masuk",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Sembang ejen: {message}",
"ui.agent_chat_undone": "(dibatalkan)",
"ui.agent_chat_view_attached": "Paparan dilampirkan",
+ "ui.agent_chat_waiting": "Menunggu anda",
"ui.agent_cursor": "Kursor ejen",
"ui.agent_cursor_speed": "Kelajuan kursor ejen",
"ui.ai_add": "Tambah",
@@ -1551,6 +1559,8 @@
"ui.joints": "Sendi",
"ui.keyboard_shortcuts": "Pintasan Kekunci",
"ui.language": "Bahasa",
+ "ui.layout_compact": "Padat",
+ "ui.layout_floating": "Terapung",
"ui.length_decimals": "Perpuluhan panjang",
"ui.light": "Cerah",
"ui.line": "Garis",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Songsangkan arah zum",
"ui.revolve": "Putar",
"ui.ribbon_exit": "Keluar",
+ "ui.ribbon_labels": "Tunjukkan teks di bawah ikon reben",
"ui.ribbon_pin_footer": "Arahan tersemat dipaparkan pada reben. Lalukan tetikus pada baris untuk menyemat atau menyahsemat.",
"ui.ribbon_workspace": "Ruang kerja",
"ui.right": "Kanan",
@@ -1842,6 +1853,7 @@
"ui.workspace_design_tabs": "Model · Permukaan · Pasang · Sisip · Periksa · Urus · Pandangan",
"ui.workspace_drawing_description": "Lukisan 2D dengan pandangan, dimensi dan blok tajuk",
"ui.workspace_footer": "Setiap ruang kerja berfungsi pada reka bentuk, sejarah dan pilihan yang sama; hanya tab reben berubah. Penukar dikunci semasa lakaran atau ciri sedang disunting.",
+ "ui.workspace_layout": "Susun atur ruang kerja",
"ui.workspace_manufacture_description": "Pemotongan lapisan, laluan alat dan persediaan",
"ui.workspace_planned": "Dirancang",
"ui.workspace_render_description": "Pratonton produk, tetapan adegan dan imej render",
diff --git a/assets/locales/nl.json b/assets/locales/nl.json
index a61476c96..ab69c00db 100644
--- a/assets/locales/nl.json
+++ b/assets/locales/nl.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "Bestanden bijvoegen",
"ui.agent_chat_add_file": "Een bestand kiezen…",
"ui.agent_chat_allow": "Toestaan",
+ "ui.agent_chat_allow_once": "Eenmalig toestaan",
"ui.agent_chat_allowed": "Toegestaan",
"ui.agent_chat_answered": "Antwoord: {option}",
"ui.agent_chat_approval": "De agent dit laten doen?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "Links",
"ui.agent_chat_limit": "De agent heeft de limiet van {limit} wijzigingen voor één bericht bereikt. Stuur nog een bericht om hem verder te laten gaan.",
"ui.agent_chat_minimize": "Minimaliseren tot een strook",
+ "ui.agent_chat_mode_all": "Alles",
+ "ui.agent_chat_mode_ask": "Vragen",
+ "ui.agent_chat_mode_edits": "Bewerken",
"ui.agent_chat_model_tip": "Het model dat de agent gebruikt. Uw keuze wordt voor deze agent onthouden.",
"ui.agent_chat_new": "Nieuwe chat",
"ui.agent_chat_new_confirm": "Een nieuwe chat starten? De huidige wordt gewist.",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "Geen agent gevonden",
"ui.agent_chat_not_installed": "Niet geïnstalleerd",
"ui.agent_chat_not_signed_in": "niet aangemeld",
+ "ui.agent_chat_open_settings": "Voorkeuren openen",
"ui.agent_chat_own_window": "Eigen venster",
"ui.agent_chat_paste_picture": "Een afbeelding plakken",
"ui.agent_chat_permission": "De agent vraagt om uit te voeren: {title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "Verzenden",
"ui.agent_chat_send_now": "Nu verzenden",
"ui.agent_chat_send_now_tip": "De huidige stap van de agent stoppen en dit nu verzenden (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft communiceert met een programmeeragent die op deze computer is geïnstalleerd. Kies er een via Voorkeuren › AI.",
+ "ui.agent_chat_setup_title": "Een assistent instellen",
"ui.agent_chat_side": "Zijde van agentchat",
"ui.agent_chat_signed_in": "aangemeld",
"ui.agent_chat_state_auth": "Aanmelden vereist",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "Agentchat: {message}",
"ui.agent_chat_undone": "(ongedaan gemaakt)",
"ui.agent_chat_view_attached": "Weergave bijgevoegd",
+ "ui.agent_chat_waiting": "Wacht op jou",
"ui.agent_cursor": "Agentcursor",
"ui.agent_cursor_speed": "Snelheid agentcursor",
"ui.ai_add": "Toevoegen",
@@ -1550,6 +1558,8 @@
"ui.joints": "Verbindingen",
"ui.keyboard_shortcuts": "Sneltoetsen",
"ui.language": "Taal",
+ "ui.layout_compact": "Compact",
+ "ui.layout_floating": "Zwevend",
"ui.length_decimals": "Lengtedecimalen",
"ui.light": "Licht",
"ui.line": "Lijn",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "Zoomrichting omkeren",
"ui.revolve": "Revolve",
"ui.ribbon_exit": "Afsluiten",
+ "ui.ribbon_labels": "Tekst onder lintpictogrammen tonen",
"ui.ribbon_pin_footer": "Vastgepinde opdrachten verschijnen in het lint. Beweeg over een rij om vast te pinnen of los te maken.",
"ui.ribbon_workspace": "Werkruimte",
"ui.right": "Rechts",
@@ -1841,6 +1852,7 @@
"ui.workspace_design_tabs": "Model · Oppervlak · Assembleren · Invoegen · Inspecteren · Beheren · Beeld",
"ui.workspace_drawing_description": "2D-tekeningen met weergaven, maatvoering en titelblokken",
"ui.workspace_footer": "Elke werkruimte werkt op hetzelfde ontwerp, dezelfde geschiedenis en selectie; alleen de lintabbladen veranderen. De schakelaar is vergrendeld terwijl een schets of kenmerk wordt bewerkt.",
+ "ui.workspace_layout": "Werkruimte-indeling",
"ui.workspace_manufacture_description": "Slicen, gereedschapspaden en opstelling",
"ui.workspace_planned": "Gepland",
"ui.workspace_render_description": "Productvoorbeeld, sceneinstellingen en gerenderde afbeeldingen",
diff --git a/assets/locales/pl.json b/assets/locales/pl.json
index 4ca63d120..d0577f54a 100644
--- a/assets/locales/pl.json
+++ b/assets/locales/pl.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Załącz pliki",
"ui.agent_chat_add_file": "Wybierz plik…",
"ui.agent_chat_allow": "Zezwól",
+ "ui.agent_chat_allow_once": "Zezwól raz",
"ui.agent_chat_allowed": "Zezwolono",
"ui.agent_chat_answered": "Odpowiedź: {option}",
"ui.agent_chat_approval": "Zezwolić agentowi na to działanie?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Lewa",
"ui.agent_chat_limit": "Agent osiągnął limit {limit} zmian na jedną wiadomość. Wyślij kolejną wiadomość, aby mógł kontynuować.",
"ui.agent_chat_minimize": "Zminimalizuj do paska",
+ "ui.agent_chat_mode_all": "Wszystko",
+ "ui.agent_chat_mode_ask": "Pytaj",
+ "ui.agent_chat_mode_edits": "Edycje",
"ui.agent_chat_model_tip": "Model używany przez agenta. Twój wybór jest zapamiętywany dla tego agenta.",
"ui.agent_chat_new": "Nowy czat",
"ui.agent_chat_new_confirm": "Rozpocząć nowy czat? Bieżący zostanie wyczyszczony.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Nie znaleziono agenta",
"ui.agent_chat_not_installed": "Nie zainstalowano",
"ui.agent_chat_not_signed_in": "nie zalogowano",
+ "ui.agent_chat_open_settings": "Otwórz preferencje",
"ui.agent_chat_own_window": "Osobne okno",
"ui.agent_chat_paste_picture": "Wklej obraz",
"ui.agent_chat_permission": "Agent prosi o uruchomienie: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Wyślij",
"ui.agent_chat_send_now": "Wyślij teraz",
"ui.agent_chat_send_now_tip": "Zatrzymaj bieżący krok agenta i wyślij tę wiadomość jako następną (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft komunikuje się z agentem programistycznym zainstalowanym na tym komputerze. Wybierz go w Preferencje › AI.",
+ "ui.agent_chat_setup_title": "Skonfiguruj asystenta",
"ui.agent_chat_side": "Strona czatu z agentem",
"ui.agent_chat_signed_in": "zalogowano",
"ui.agent_chat_state_auth": "Wymagane logowanie",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Czat z agentem: {message}",
"ui.agent_chat_undone": "(cofnięto)",
"ui.agent_chat_view_attached": "Dołączono widok",
+ "ui.agent_chat_waiting": "Czeka na Ciebie",
"ui.agent_cursor": "Kursor agenta",
"ui.agent_cursor_speed": "Szybkość kursora agenta",
"ui.ai_add": "Dodaj",
@@ -1551,6 +1559,8 @@
"ui.joints": "Złącza",
"ui.keyboard_shortcuts": "Skróty klawiszowe",
"ui.language": "Język",
+ "ui.layout_compact": "Kompaktowy",
+ "ui.layout_floating": "Pływający",
"ui.length_decimals": "Miejsca dziesiętne długości",
"ui.light": "Jasny",
"ui.line": "Linia",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Odwróć kierunek powiększania",
"ui.revolve": "Obrót",
"ui.ribbon_exit": "Wyjdź",
+ "ui.ribbon_labels": "Pokazuj tekst pod ikonami wstążki",
"ui.ribbon_pin_footer": "Przypięte polecenia są widoczne na wstążce. Najedź na wiersz, aby go przypiąć lub odpiąć.",
"ui.ribbon_workspace": "Przestrzeń robocza",
"ui.right": "Prawy",
@@ -1842,6 +1853,7 @@
"ui.workspace_design_tabs": "Model · Powierzchnia · Złożenie · Wstaw · Sprawdź · Zarządzaj · Widok",
"ui.workspace_drawing_description": "Rysunki 2D z widokami, wymiarami i tabliczkami rysunkowymi",
"ui.workspace_footer": "Każda przestrzeń robocza działa na tym samym projekcie, historii i zaznaczeniu; zmieniają się tylko karty wstążki. Przełącznik jest zablokowany podczas edycji szkicu lub elementu.",
+ "ui.workspace_layout": "Układ obszaru roboczego",
"ui.workspace_manufacture_description": "Cięcie na warstwy, ścieżki narzędzia i przygotowanie",
"ui.workspace_planned": "Planowane",
"ui.workspace_render_description": "Podgląd produktu, ustawienia sceny i renderowane obrazy",
diff --git a/assets/locales/pt-BR.json b/assets/locales/pt-BR.json
index 795332233..9416e1eca 100644
--- a/assets/locales/pt-BR.json
+++ b/assets/locales/pt-BR.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Anexar arquivos",
"ui.agent_chat_add_file": "Escolher um arquivo…",
"ui.agent_chat_allow": "Permitir",
+ "ui.agent_chat_allow_once": "Permitir uma vez",
"ui.agent_chat_allowed": "Permitido",
"ui.agent_chat_answered": "Resposta: {option}",
"ui.agent_chat_approval": "Permitir que o agente faça isto?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Esquerda",
"ui.agent_chat_limit": "O agente atingiu o limite de {limit} alterações por mensagem. Envie outra mensagem para que ele continue.",
"ui.agent_chat_minimize": "Minimizar para uma faixa",
+ "ui.agent_chat_mode_all": "Tudo",
+ "ui.agent_chat_mode_ask": "Perguntar",
+ "ui.agent_chat_mode_edits": "Edições",
"ui.agent_chat_model_tip": "O modelo que o agente usa. Sua escolha é lembrada para este agente.",
"ui.agent_chat_new": "Novo chat",
"ui.agent_chat_new_confirm": "Começar um novo chat? O atual será apagado.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Nenhum agente encontrado",
"ui.agent_chat_not_installed": "Não instalado",
"ui.agent_chat_not_signed_in": "não conectado",
+ "ui.agent_chat_open_settings": "Abrir preferências",
"ui.agent_chat_own_window": "Janela própria",
"ui.agent_chat_paste_picture": "Colar uma imagem",
"ui.agent_chat_permission": "O agente pede para executar: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Enviar",
"ui.agent_chat_send_now": "Enviar agora",
"ui.agent_chat_send_now_tip": "Parar o passo atual do agente e enviar esta em seguida (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "O SolidCraft se comunica com um agente de programação instalado neste computador. Escolha um em Preferências › IA.",
+ "ui.agent_chat_setup_title": "Configurar um assistente",
"ui.agent_chat_side": "Lado do chat com agente",
"ui.agent_chat_signed_in": "conectado",
"ui.agent_chat_state_auth": "É preciso entrar",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Chat com agente: {message}",
"ui.agent_chat_undone": "(desfeito)",
"ui.agent_chat_view_attached": "Vista anexada",
+ "ui.agent_chat_waiting": "Aguardando sua resposta",
"ui.agent_cursor": "Cursor do agente",
"ui.agent_cursor_speed": "Velocidade do cursor do agente",
"ui.ai_add": "Adicionar",
@@ -1551,6 +1559,8 @@
"ui.joints": "Juntas",
"ui.keyboard_shortcuts": "Atalhos de teclado",
"ui.language": "Idioma",
+ "ui.layout_compact": "Compacto",
+ "ui.layout_floating": "Flutuante",
"ui.length_decimals": "Casas decimais de comprimento",
"ui.light": "Claro",
"ui.line": "Linha",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Inverter direção do zoom",
"ui.revolve": "Revolução",
"ui.ribbon_exit": "Sair",
+ "ui.ribbon_labels": "Mostrar texto abaixo dos ícones da faixa de opções",
"ui.ribbon_pin_footer": "Os comandos fixados aparecem na faixa de opções. Passe o mouse sobre uma linha para fixar ou desafixar.",
"ui.ribbon_workspace": "Espaço de trabalho",
"ui.right": "Direita",
@@ -1867,6 +1878,7 @@
"ui.workspace_design_tabs": "Modelo · Superfície · Montagem · Inserir · Inspecionar · Gerenciar · Vista",
"ui.workspace_drawing_description": "Desenhos 2D com vistas, cotas e legendas",
"ui.workspace_footer": "Todo espaço de trabalho usa o mesmo projeto, histórico e seleção; só as guias da faixa de opções mudam. O seletor fica bloqueado enquanto um esboço ou recurso está sendo editado.",
+ "ui.workspace_layout": "Layout do espaço de trabalho",
"ui.workspace_manufacture_description": "Fatiamento, trajetórias de ferramenta e configuração",
"ui.workspace_planned": "Planejado",
"ui.workspace_render_description": "Pré-visualização do produto, configurações de cena e imagens renderizadas",
diff --git a/assets/locales/ro.json b/assets/locales/ro.json
index e62ec4590..05fb3a9cc 100644
--- a/assets/locales/ro.json
+++ b/assets/locales/ro.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "Atașează fișiere",
"ui.agent_chat_add_file": "Alegeți un fișier…",
"ui.agent_chat_allow": "Permite",
+ "ui.agent_chat_allow_once": "Permite o dată",
"ui.agent_chat_allowed": "Permis",
"ui.agent_chat_answered": "Răspuns: {option}",
"ui.agent_chat_approval": "Permiteți agentului să facă asta?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "Stânga",
"ui.agent_chat_limit": "Agentul a atins limita de {limit} modificări pentru un mesaj. Trimiteți alt mesaj pentru a-l lăsa să continue.",
"ui.agent_chat_minimize": "Minimizează într-o bandă",
+ "ui.agent_chat_mode_all": "Tot",
+ "ui.agent_chat_mode_ask": "Întreabă",
+ "ui.agent_chat_mode_edits": "Modificări",
"ui.agent_chat_model_tip": "Modelul folosit de agent. Alegerea dumneavoastră este reținută pentru acest agent.",
"ui.agent_chat_new": "Chat nou",
"ui.agent_chat_new_confirm": "Începeți un chat nou? Cel curent este șters.",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "Niciun agent găsit",
"ui.agent_chat_not_installed": "Neinstalat",
"ui.agent_chat_not_signed_in": "neautentificat",
+ "ui.agent_chat_open_settings": "Deschide preferințele",
"ui.agent_chat_own_window": "Fereastră proprie",
"ui.agent_chat_paste_picture": "Lipește o imagine",
"ui.agent_chat_permission": "Agentul cere să ruleze: {title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "Trimite",
"ui.agent_chat_send_now": "Trimite acum",
"ui.agent_chat_send_now_tip": "Oprește pasul curent al agentului și trimite acest mesaj următorul (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft comunică cu un agent de programare instalat pe acest computer. Alege unul în Preferințe › AI.",
+ "ui.agent_chat_setup_title": "Configurează un asistent",
"ui.agent_chat_side": "Partea chatului cu agentul",
"ui.agent_chat_signed_in": "autentificat",
"ui.agent_chat_state_auth": "Autentificare necesară",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "Chat cu agentul: {message}",
"ui.agent_chat_undone": "(anulat)",
"ui.agent_chat_view_attached": "Vizualizare atașată",
+ "ui.agent_chat_waiting": "Așteaptă răspunsul tău",
"ui.agent_cursor": "Cursorul agentului",
"ui.agent_cursor_speed": "Viteza cursorului agentului",
"ui.ai_add": "Adaugă",
@@ -1550,6 +1558,8 @@
"ui.joints": "Îmbinări",
"ui.keyboard_shortcuts": "Scurtături de tastatură",
"ui.language": "Limbă",
+ "ui.layout_compact": "Compact",
+ "ui.layout_floating": "Plutitor",
"ui.length_decimals": "Zecimale lungime",
"ui.light": "Luminos",
"ui.line": "Linie",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "Inversează direcția zoomului",
"ui.revolve": "Revoluție",
"ui.ribbon_exit": "Ieșire",
+ "ui.ribbon_labels": "Afișează text sub pictogramele panglicii",
"ui.ribbon_pin_footer": "Comenzile fixate apar pe bandă. Treceți cursorul peste un rând pentru a-l fixa sau defixa.",
"ui.ribbon_workspace": "Spațiu de lucru",
"ui.right": "Dreapta",
@@ -1841,6 +1852,7 @@
"ui.workspace_design_tabs": "Model · Suprafață · Asamblare · Inserare · Inspectare · Gestionare · Vizualizare",
"ui.workspace_drawing_description": "Desene 2D cu vederi, cote și indicatoare",
"ui.workspace_footer": "Fiecare spațiu de lucru lucrează pe același proiect, istoric și selecție; se schimbă doar filele benzii. Comutatorul este blocat cât timp se editează o schiță sau o operație.",
+ "ui.workspace_layout": "Aspectul spațiului de lucru",
"ui.workspace_manufacture_description": "Feliere, trasee de sculă și configurare",
"ui.workspace_planned": "Planificat",
"ui.workspace_render_description": "Previzualizare produs, setări de scenă și imagini randate",
diff --git a/assets/locales/ru.json b/assets/locales/ru.json
index bc45bb01d..6ce9b280f 100644
--- a/assets/locales/ru.json
+++ b/assets/locales/ru.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "Прикрепить файлы",
"ui.agent_chat_add_file": "Выбрать файл…",
"ui.agent_chat_allow": "Разрешить",
+ "ui.agent_chat_allow_once": "Разрешить один раз",
"ui.agent_chat_allowed": "Разрешено",
"ui.agent_chat_answered": "Ответ: {option}",
"ui.agent_chat_approval": "Разрешить агенту сделать это?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "Слева",
"ui.agent_chat_limit": "Агент достиг предела в {limit} изменений на одно сообщение. Отправьте ещё одно сообщение, чтобы он продолжил.",
"ui.agent_chat_minimize": "Свернуть в полосу",
+ "ui.agent_chat_mode_all": "Всё",
+ "ui.agent_chat_mode_ask": "Спросить",
+ "ui.agent_chat_mode_edits": "Правки",
"ui.agent_chat_model_tip": "Модель, которую использует агент. Ваш выбор запоминается для этого агента.",
"ui.agent_chat_new": "Новый чат",
"ui.agent_chat_new_confirm": "Начать новый чат? Текущий будет очищен.",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "Агент не найден",
"ui.agent_chat_not_installed": "Не установлен",
"ui.agent_chat_not_signed_in": "вход не выполнен",
+ "ui.agent_chat_open_settings": "Открыть настройки",
"ui.agent_chat_own_window": "Отдельное окно",
"ui.agent_chat_paste_picture": "Вставить изображение",
"ui.agent_chat_permission": "Агент просит выполнить: {title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "Отправить",
"ui.agent_chat_send_now": "Отправить сейчас",
"ui.agent_chat_send_now_tip": "Остановить текущий шаг агента и отправить это следующим (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft взаимодействует с агентом программирования, установленным на этом компьютере. Выберите его в разделе «Настройки › ИИ».",
+ "ui.agent_chat_setup_title": "Настроить ассистента",
"ui.agent_chat_side": "Сторона чата с агентом",
"ui.agent_chat_signed_in": "вход выполнен",
"ui.agent_chat_state_auth": "Требуется вход",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "Чат с агентом: {message}",
"ui.agent_chat_undone": "(отменено)",
"ui.agent_chat_view_attached": "Вид прикреплён",
+ "ui.agent_chat_waiting": "Ожидает вашего ответа",
"ui.agent_cursor": "Курсор агента",
"ui.agent_cursor_speed": "Скорость курсора агента",
"ui.ai_add": "Добавить",
@@ -1550,6 +1558,8 @@
"ui.joints": "Сопряжения",
"ui.keyboard_shortcuts": "Сочетания клавиш",
"ui.language": "Язык",
+ "ui.layout_compact": "Компактная",
+ "ui.layout_floating": "Плавающая",
"ui.length_decimals": "Знаков после запятой (длины)",
"ui.light": "Светлая",
"ui.line": "Линия",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "Обратить направление масштабирования",
"ui.revolve": "Вращение",
"ui.ribbon_exit": "Выход",
+ "ui.ribbon_labels": "Показывать текст под значками ленты",
"ui.ribbon_pin_footer": "Закреплённые команды отображаются на ленте. Наведите курсор на строку, чтобы закрепить или открепить её.",
"ui.ribbon_workspace": "Рабочая область",
"ui.right": "Справа",
@@ -1866,6 +1877,7 @@
"ui.workspace_design_tabs": "Модель · Поверхность · Сборка · Вставка · Проверка · Управление · Вид",
"ui.workspace_drawing_description": "2D-чертежи с видами, размерами и основными надписями",
"ui.workspace_footer": "Все рабочие среды работают с одним дизайном, историей и выбором; меняются только вкладки ленты. Переключатель заблокирован, пока редактируется эскиз или операция.",
+ "ui.workspace_layout": "Компоновка рабочей области",
"ui.workspace_manufacture_description": "Слайсинг, траектории инструмента и наладка",
"ui.workspace_planned": "Запланировано",
"ui.workspace_render_description": "Предпросмотр изделия, настройки сцены и отрендеренные изображения",
diff --git a/assets/locales/sv.json b/assets/locales/sv.json
index 1190c7463..2cc4f221c 100644
--- a/assets/locales/sv.json
+++ b/assets/locales/sv.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "Bifoga filer",
"ui.agent_chat_add_file": "Välj en fil…",
"ui.agent_chat_allow": "Tillåt",
+ "ui.agent_chat_allow_once": "Tillåt en gång",
"ui.agent_chat_allowed": "Tillåten",
"ui.agent_chat_answered": "Svar: {option}",
"ui.agent_chat_approval": "Tillåta agenten att göra detta?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "Vänster",
"ui.agent_chat_limit": "Agenten nådde gränsen på {limit} ändringar för ett meddelande. Skicka ett nytt meddelande så att den kan fortsätta.",
"ui.agent_chat_minimize": "Minimera till ett fält",
+ "ui.agent_chat_mode_all": "Allt",
+ "ui.agent_chat_mode_ask": "Fråga",
+ "ui.agent_chat_mode_edits": "Ändringar",
"ui.agent_chat_model_tip": "Modellen som agenten använder. Ditt val kommer ihåg för den här agenten.",
"ui.agent_chat_new": "Ny chatt",
"ui.agent_chat_new_confirm": "Starta en ny chatt? Den nuvarande rensas.",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "Ingen agent hittades",
"ui.agent_chat_not_installed": "Inte installerad",
"ui.agent_chat_not_signed_in": "inte inloggad",
+ "ui.agent_chat_open_settings": "Öppna inställningar",
"ui.agent_chat_own_window": "Eget fönster",
"ui.agent_chat_paste_picture": "Klistra in en bild",
"ui.agent_chat_permission": "Agenten ber om att få köra: {title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "Skicka",
"ui.agent_chat_send_now": "Skicka nu",
"ui.agent_chat_send_now_tip": "Stoppa agentens nuvarande steg och skicka detta härnäst (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft kommunicerar med en kodningsagent som är installerad på den här datorn. Välj en under Inställningar › AI.",
+ "ui.agent_chat_setup_title": "Konfigurera en assistent",
"ui.agent_chat_side": "Agentchattens sida",
"ui.agent_chat_signed_in": "inloggad",
"ui.agent_chat_state_auth": "Inloggning krävs",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "Agentchatt: {message}",
"ui.agent_chat_undone": "(ångrad)",
"ui.agent_chat_view_attached": "Vy bifogad",
+ "ui.agent_chat_waiting": "Väntar på dig",
"ui.agent_cursor": "Agentmarkör",
"ui.agent_cursor_speed": "Agentmarkörens hastighet",
"ui.ai_add": "Lägg till",
@@ -1550,6 +1558,8 @@
"ui.joints": "Leder",
"ui.keyboard_shortcuts": "Kortkommandon",
"ui.language": "Språk",
+ "ui.layout_compact": "Kompakt",
+ "ui.layout_floating": "Flytande",
"ui.length_decimals": "Längddecimaler",
"ui.light": "Ljust",
"ui.line": "Linje",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "Vänd zoomriktning",
"ui.revolve": "Rotation",
"ui.ribbon_exit": "Avsluta",
+ "ui.ribbon_labels": "Visa text under menyfliksikoner",
"ui.ribbon_pin_footer": "Fästa kommandon visas i menyfliken. Håll muspekaren över en rad för att fästa eller lossa den.",
"ui.ribbon_workspace": "Arbetsyta",
"ui.right": "Höger",
@@ -1841,6 +1852,7 @@
"ui.workspace_design_tabs": "Modell · Yta · Montera · Infoga · Granska · Hantera · Vy",
"ui.workspace_drawing_description": "2D-ritningar med vyer, mått och titelrutor",
"ui.workspace_footer": "Varje arbetsyta arbetar med samma konstruktion, historik och markering; endast menyflikarna ändras. Växlaren är låst medan en skiss eller funktion redigeras.",
+ "ui.workspace_layout": "Arbetsytans layout",
"ui.workspace_manufacture_description": "Slicing, verktygsbanor och uppsättning",
"ui.workspace_planned": "Planerad",
"ui.workspace_render_description": "Produktförhandsvisning, sceninställningar och renderade bilder",
diff --git a/assets/locales/tr.json b/assets/locales/tr.json
index f4b549b4c..da0faf0e3 100644
--- a/assets/locales/tr.json
+++ b/assets/locales/tr.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "Dosya ekle",
"ui.agent_chat_add_file": "Dosya seç…",
"ui.agent_chat_allow": "İzin ver",
+ "ui.agent_chat_allow_once": "Bir kez izin ver",
"ui.agent_chat_allowed": "İzin verildi",
"ui.agent_chat_answered": "Yanıt: {option}",
"ui.agent_chat_approval": "Ajanın bunu yapmasına izin verilsin mi?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "Sol",
"ui.agent_chat_limit": "Ajan, bir mesaj için {limit} değişiklik sınırına ulaştı. Devam etmesi için başka bir mesaj gönderin.",
"ui.agent_chat_minimize": "Bir çubuğa küçült",
+ "ui.agent_chat_mode_all": "Tümü",
+ "ui.agent_chat_mode_ask": "Sor",
+ "ui.agent_chat_mode_edits": "Düzenle",
"ui.agent_chat_model_tip": "Ajanın kullandığı model. Seçiminiz bu ajan için hatırlanır.",
"ui.agent_chat_new": "Yeni sohbet",
"ui.agent_chat_new_confirm": "Yeni bir sohbet başlatılsın mı? Geçerli sohbet temizlenir.",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "Ajan bulunamadı",
"ui.agent_chat_not_installed": "Yüklü değil",
"ui.agent_chat_not_signed_in": "oturum açık değil",
+ "ui.agent_chat_open_settings": "Ayarları aç",
"ui.agent_chat_own_window": "Ayrı pencere",
"ui.agent_chat_paste_picture": "Görsel yapıştır",
"ui.agent_chat_permission": "Ajan şunu çalıştırmak istiyor: {title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "Gönder",
"ui.agent_chat_send_now": "Şimdi gönder",
"ui.agent_chat_send_now_tip": "Ajanın geçerli adımını durdurur ve bunu sonraki olarak gönderir (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft, bu bilgisayarda yüklü bir kodlama aracısıyla iletişim kurar. Ayarlar › AI bölümünden birini seçin.",
+ "ui.agent_chat_setup_title": "Asistan ayarla",
"ui.agent_chat_side": "Ajan sohbeti konumu",
"ui.agent_chat_signed_in": "oturum açık",
"ui.agent_chat_state_auth": "Oturum açılması gerekiyor",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "Ajan sohbeti: {message}",
"ui.agent_chat_undone": "(geri alındı)",
"ui.agent_chat_view_attached": "Görünüm eklendi",
+ "ui.agent_chat_waiting": "Yanıtınız bekleniyor",
"ui.agent_cursor": "Ajan imleci",
"ui.agent_cursor_speed": "Ajan imleci hızı",
"ui.ai_add": "Ekle",
@@ -1550,6 +1558,8 @@
"ui.joints": "Bağlantılar",
"ui.keyboard_shortcuts": "Klavye kısayolları",
"ui.language": "Dil",
+ "ui.layout_compact": "Kompakt",
+ "ui.layout_floating": "Kayan",
"ui.length_decimals": "Uzunluk ondalık basamakları",
"ui.light": "Açık",
"ui.line": "Çizgi",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "Yakınlaştırma yönünü tersine çevir",
"ui.revolve": "Döndür",
"ui.ribbon_exit": "Çıkış",
+ "ui.ribbon_labels": "Şerit simgelerinin altında metin göster",
"ui.ribbon_pin_footer": "Sabitlenen komutlar şeritte görünür. Sabitlemek veya kaldırmak için bir satırın üzerine gelin.",
"ui.ribbon_workspace": "Çalışma alanı",
"ui.right": "Sağ",
@@ -1866,6 +1877,7 @@
"ui.workspace_design_tabs": "Modelle · Yüzey · Montajla · Ekle · İncele · Yönet · Görünüm",
"ui.workspace_drawing_description": "Görünümler, ölçüler ve başlık bloklarıyla 2B teknik resimler",
"ui.workspace_footer": "Her çalışma alanı aynı tasarım, geçmiş ve seçim üzerinde çalışır; yalnızca şerit sekmeleri değişir. Bir eskiz veya özellik düzenlenirken geçiş kilitlidir.",
+ "ui.workspace_layout": "Çalışma alanı düzeni",
"ui.workspace_manufacture_description": "Dilimleme, takım yolları ve kurulum",
"ui.workspace_planned": "Planlanan",
"ui.workspace_render_description": "Ürün önizlemesi, sahne ayarları ve render görüntüleri",
diff --git a/assets/locales/uk.json b/assets/locales/uk.json
index c22a70c77..c65514fe2 100644
--- a/assets/locales/uk.json
+++ b/assets/locales/uk.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Прикріпити файли",
"ui.agent_chat_add_file": "Вибрати файл…",
"ui.agent_chat_allow": "Дозволити",
+ "ui.agent_chat_allow_once": "Дозволити один раз",
"ui.agent_chat_allowed": "Дозволено",
"ui.agent_chat_answered": "Відповідь: {option}",
"ui.agent_chat_approval": "Дозволити агенту це зробити?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Ліворуч",
"ui.agent_chat_limit": "Агент досяг межі {limit} змін на одне повідомлення. Надішліть інше повідомлення, щоб дозволити йому продовжити.",
"ui.agent_chat_minimize": "Згорнути до смужки",
+ "ui.agent_chat_mode_all": "Усе",
+ "ui.agent_chat_mode_ask": "Запит",
+ "ui.agent_chat_mode_edits": "Зміни",
"ui.agent_chat_model_tip": "Модель, яку використовує агент. Ваш вибір запам'ятовується для цього агента.",
"ui.agent_chat_new": "Новий чат",
"ui.agent_chat_new_confirm": "Почати новий чат? Поточний буде очищено.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Агента не знайдено",
"ui.agent_chat_not_installed": "Не встановлено",
"ui.agent_chat_not_signed_in": "не виконано вхід",
+ "ui.agent_chat_open_settings": "Відкрити налаштування",
"ui.agent_chat_own_window": "Власне вікно",
"ui.agent_chat_paste_picture": "Вставити зображення",
"ui.agent_chat_permission": "Агент просить виконати: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Надіслати",
"ui.agent_chat_send_now": "Надіслати зараз",
"ui.agent_chat_send_now_tip": "Зупинити поточний крок агента й надіслати це наступним (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft взаємодіє з агентом програмування, установленим на цьому комп’ютері. Виберіть його в розділі «Налаштування › ШІ».",
+ "ui.agent_chat_setup_title": "Налаштувати асистента",
"ui.agent_chat_side": "Сторона чату з агентом",
"ui.agent_chat_signed_in": "виконано вхід",
"ui.agent_chat_state_auth": "Потрібен вхід",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Чат з агентом: {message}",
"ui.agent_chat_undone": "(скасовано)",
"ui.agent_chat_view_attached": "Вид прикріплено",
+ "ui.agent_chat_waiting": "Очікує на вашу відповідь",
"ui.agent_cursor": "Курсор агента",
"ui.agent_cursor_speed": "Швидкість курсора агента",
"ui.ai_add": "Додати",
@@ -1551,6 +1559,8 @@
"ui.joints": "З'єднання",
"ui.keyboard_shortcuts": "Комбінації клавіш",
"ui.language": "Мова",
+ "ui.layout_compact": "Компактне",
+ "ui.layout_floating": "Плаваюче",
"ui.length_decimals": "Знаки після коми для довжин",
"ui.light": "Світла",
"ui.line": "Пряма",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Змінити напрямок масштабування",
"ui.revolve": "Обертання",
"ui.ribbon_exit": "Вихід",
+ "ui.ribbon_labels": "Показувати текст під піктограмами стрічки",
"ui.ribbon_pin_footer": "Закріплені команди відображаються на стрічці. Наведіть курсор на рядок, щоб закріпити або відкріпити його.",
"ui.ribbon_workspace": "Робоча область",
"ui.right": "Справа",
@@ -1867,6 +1878,7 @@
"ui.workspace_design_tabs": "Модель · Поверхня · Збірка · Вставка · Перевірка · Керування · Вигляд",
"ui.workspace_drawing_description": "2D-креслення з видами, розмірами та штампами",
"ui.workspace_footer": "Кожне робоче середовище працює з тим самим проєктом, історією та вибором; змінюються лише вкладки стрічки. Перемикач заблоковано, поки редагується ескіз або елемент.",
+ "ui.workspace_layout": "Компонування робочої області",
"ui.workspace_manufacture_description": "Нарізання, траєкторії та налаштування",
"ui.workspace_planned": "Заплановано",
"ui.workspace_render_description": "Перегляд виробу, налаштування сцени та відтворені зображення",
diff --git a/assets/locales/vi.json b/assets/locales/vi.json
index 389258bfe..892776813 100644
--- a/assets/locales/vi.json
+++ b/assets/locales/vi.json
@@ -1093,6 +1093,7 @@
"ui.agent_chat_add": "Đính kèm tệp",
"ui.agent_chat_add_file": "Chọn một tệp…",
"ui.agent_chat_allow": "Cho phép",
+ "ui.agent_chat_allow_once": "Cho phép một lần",
"ui.agent_chat_allowed": "Đã cho phép",
"ui.agent_chat_answered": "Câu trả lời: {option}",
"ui.agent_chat_approval": "Cho phép AI thực hiện thao tác này?",
@@ -1150,6 +1151,9 @@
"ui.agent_chat_left": "Trái",
"ui.agent_chat_limit": "AI Agent đã đạt giới hạn {limit} thay đổi cho một tin nhắn. Hãy gửi tin nhắn tiếp theo để tiếp tục.",
"ui.agent_chat_minimize": "Thu nhỏ thành thanh công cụ",
+ "ui.agent_chat_mode_all": "Tất cả",
+ "ui.agent_chat_mode_ask": "Hỏi",
+ "ui.agent_chat_mode_edits": "Chỉnh sửa",
"ui.agent_chat_model_tip": "Mô hình AI đang sử dụng. Lựa chọn của bạn sẽ được ghi nhớ cho Agent này.",
"ui.agent_chat_new": "Cuộc trò chuyện mới",
"ui.agent_chat_new_confirm": "Bắt đầu cuộc trò chuyện mới? Cuộc trò chuyện hiện tại sẽ bị xóa.",
@@ -1162,6 +1166,7 @@
"ui.agent_chat_none_found_short": "Không tìm thấy tác tử nào",
"ui.agent_chat_not_installed": "Chưa cài đặt",
"ui.agent_chat_not_signed_in": "chưa đăng nhập",
+ "ui.agent_chat_open_settings": "Mở tùy chọn cài đặt",
"ui.agent_chat_own_window": "Cửa sổ riêng",
"ui.agent_chat_paste_picture": "Dán hình ảnh",
"ui.agent_chat_permission": "AI Agent yêu cầu thực thi: {title}",
@@ -1186,6 +1191,8 @@
"ui.agent_chat_send": "Gửi",
"ui.agent_chat_send_now": "Gửi ngay",
"ui.agent_chat_send_now_tip": "Dừng bước hiện tại của tác tử và gửi tin nhắn này ngay (Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft giao tiếp với một tác nhân lập trình được cài đặt trên máy tính này. Chọn một tác nhân trong Tùy chọn cài đặt › AI.",
+ "ui.agent_chat_setup_title": "Thiết lập trợ lý",
"ui.agent_chat_side": "Vị trí bảng trò chuyện AI",
"ui.agent_chat_signed_in": "đã đăng nhập",
"ui.agent_chat_state_auth": "Cần đăng nhập",
@@ -1202,6 +1209,7 @@
"ui.agent_chat_undo_label": "Trò chuyện AI: {message}",
"ui.agent_chat_undone": "(hoàn tácne)",
"ui.agent_chat_view_attached": "Đã đính kèm góc nhìn",
+ "ui.agent_chat_waiting": "Đang chờ bạn",
"ui.agent_cursor": "Con trỏ AI",
"ui.agent_cursor_speed": "Tốc độ con trỏ AI",
"ui.ai_add": "Thêm",
@@ -1551,6 +1559,8 @@
"ui.joints": "Các khớp nối",
"ui.keyboard_shortcuts": "Phím tắt bàn phím",
"ui.language": "Ngôn ngữ (Language)",
+ "ui.layout_compact": "Gọn",
+ "ui.layout_floating": "Nổi",
"ui.length_decimals": "Số chữ số thập phân cho chiều dài",
"ui.light": "Sáng",
"ui.line": "Đoạn thẳng",
@@ -1688,6 +1698,7 @@
"ui.reverse_zoom_direction": "Đảo chiều thu phóng",
"ui.revolve": "Xoay tròn tạo khối",
"ui.ribbon_exit": "Thoát",
+ "ui.ribbon_labels": "Hiển thị văn bản bên dưới biểu tượng dải băng",
"ui.ribbon_pin_footer": "Các lệnh đã ghim hiển thị trên ruy-băng. Rê chuột lên một hàng để ghim hoặc bỏ ghim.",
"ui.ribbon_workspace": "Không gian làm việc",
"ui.right": "Phải (Hình chiếu cạnh)",
@@ -1842,6 +1853,7 @@
"ui.workspace_design_tabs": "Mô hình · Bề mặt · Lắp ráp · Chèn · Kiểm tra · Quản lý · Xem",
"ui.workspace_drawing_description": "Bản vẽ 2D với các hình chiếu, kích thước và khung tên",
"ui.workspace_footer": "Mọi không gian làm việc đều dùng chung một thiết kế, lịch sử và vùng chọn; chỉ các thẻ ruy-băng thay đổi. Bộ chuyển đổi bị khóa khi đang chỉnh sửa phác thảo hoặc tính năng.",
+ "ui.workspace_layout": "Bố cục không gian làm việc",
"ui.workspace_manufacture_description": "Cắt lớp, đường chạy dao và thiết lập",
"ui.workspace_planned": "Dự kiến",
"ui.workspace_render_description": "Xem trước sản phẩm, cài đặt cảnh và hình ảnh kết xuất",
diff --git a/assets/locales/zh-TW.json b/assets/locales/zh-TW.json
index 938140f00..8f253abcb 100644
--- a/assets/locales/zh-TW.json
+++ b/assets/locales/zh-TW.json
@@ -1092,6 +1092,7 @@
"ui.agent_chat_add": "附加檔案",
"ui.agent_chat_add_file": "選擇檔案…",
"ui.agent_chat_allow": "允許",
+ "ui.agent_chat_allow_once": "僅允許一次",
"ui.agent_chat_allowed": "已允許",
"ui.agent_chat_answered": "回答:{option}",
"ui.agent_chat_approval": "允許代理執行此操作嗎?",
@@ -1149,6 +1150,9 @@
"ui.agent_chat_left": "左側",
"ui.agent_chat_limit": "代理已達到每條訊息 {limit} 項變更的上限。再傳送一條訊息可讓它繼續。",
"ui.agent_chat_minimize": "最小化為細條",
+ "ui.agent_chat_mode_all": "全部",
+ "ui.agent_chat_mode_ask": "詢問",
+ "ui.agent_chat_mode_edits": "編輯",
"ui.agent_chat_model_tip": "代理使用的模型。您的選擇會為此代理記住。",
"ui.agent_chat_new": "新對話",
"ui.agent_chat_new_confirm": "開始新對話?目前對話將被清除。",
@@ -1161,6 +1165,7 @@
"ui.agent_chat_none_found_short": "未找到代理",
"ui.agent_chat_not_installed": "未安裝",
"ui.agent_chat_not_signed_in": "未登入",
+ "ui.agent_chat_open_settings": "開啟偏好設定",
"ui.agent_chat_own_window": "獨立視窗",
"ui.agent_chat_paste_picture": "貼上圖片",
"ui.agent_chat_permission": "代理請求執行:{title}",
@@ -1185,6 +1190,8 @@
"ui.agent_chat_send": "傳送",
"ui.agent_chat_send_now": "立即傳送",
"ui.agent_chat_send_now_tip": "停止代理目前的步驟,並接著傳送這條訊息(Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft 會與安裝在這部電腦上的程式設計代理程式通訊。請在「偏好設定 › AI」中選擇一個。",
+ "ui.agent_chat_setup_title": "設定助理",
"ui.agent_chat_side": "代理聊天位置",
"ui.agent_chat_signed_in": "已登入",
"ui.agent_chat_state_auth": "需要登入",
@@ -1201,6 +1208,7 @@
"ui.agent_chat_undo_label": "代理聊天:{message}",
"ui.agent_chat_undone": "(已復原)",
"ui.agent_chat_view_attached": "已附加檢視",
+ "ui.agent_chat_waiting": "等待您的回應",
"ui.agent_cursor": "代理游標",
"ui.agent_cursor_speed": "代理游標速度",
"ui.ai_add": "新增",
@@ -1550,6 +1558,8 @@
"ui.joints": "接頭",
"ui.keyboard_shortcuts": "鍵盤快捷鍵",
"ui.language": "語言",
+ "ui.layout_compact": "精簡",
+ "ui.layout_floating": "浮動",
"ui.length_decimals": "長度小數位數",
"ui.light": "淺色",
"ui.line": "直線",
@@ -1687,6 +1697,7 @@
"ui.reverse_zoom_direction": "反轉縮放方向",
"ui.revolve": "旋轉",
"ui.ribbon_exit": "結束",
+ "ui.ribbon_labels": "顯示功能區圖示下的文字",
"ui.ribbon_pin_footer": "固定的命令會顯示在功能區中。將指標停留在某列上即可固定或取消固定。",
"ui.ribbon_workspace": "工作區",
"ui.right": "右視",
@@ -1841,6 +1852,7 @@
"ui.workspace_design_tabs": "模型 · 曲面 · 組裝 · 插入 · 檢查 · 管理 · 檢視",
"ui.workspace_drawing_description": "含檢視、尺寸和標題欄的 2D 工程圖",
"ui.workspace_footer": "所有工作區使用同一設計、歷程記錄和選擇,僅功能區索引標籤會變化。編輯草圖或特徵時,切換器將被鎖定。",
+ "ui.workspace_layout": "工作區配置",
"ui.workspace_manufacture_description": "切片、刀具路徑和設定",
"ui.workspace_planned": "規劃中",
"ui.workspace_render_description": "產品預覽、場景設定和彩現影像",
diff --git a/assets/locales/zh.json b/assets/locales/zh.json
index 8e25bf27d..08c5b5c72 100644
--- a/assets/locales/zh.json
+++ b/assets/locales/zh.json
@@ -1127,6 +1127,7 @@
"ui.agent_chat_add": "附加文件",
"ui.agent_chat_add_file": "选择文件…",
"ui.agent_chat_allow": "允许",
+ "ui.agent_chat_allow_once": "仅允许一次",
"ui.agent_chat_allowed": "已允许",
"ui.agent_chat_answered": "回答:{option}",
"ui.agent_chat_approval": "允许智能体执行此操作吗?",
@@ -1184,6 +1185,9 @@
"ui.agent_chat_left": "左侧",
"ui.agent_chat_limit": "智能体已达到每条消息 {limit} 项更改的上限。再发送一条消息可让它继续。",
"ui.agent_chat_minimize": "最小化为细条",
+ "ui.agent_chat_mode_all": "全部",
+ "ui.agent_chat_mode_ask": "询问",
+ "ui.agent_chat_mode_edits": "编辑",
"ui.agent_chat_model_tip": "智能体使用的模型。你的选择会为此智能体记住。",
"ui.agent_chat_new": "新对话",
"ui.agent_chat_new_confirm": "开始新对话?当前对话将被清除。",
@@ -1196,6 +1200,7 @@
"ui.agent_chat_none_found_short": "未找到智能体",
"ui.agent_chat_not_installed": "未安装",
"ui.agent_chat_not_signed_in": "未登录",
+ "ui.agent_chat_open_settings": "打开首选项",
"ui.agent_chat_own_window": "独立窗口",
"ui.agent_chat_paste_picture": "粘贴图片",
"ui.agent_chat_permission": "智能体请求运行:{title}",
@@ -1220,6 +1225,8 @@
"ui.agent_chat_send": "发送",
"ui.agent_chat_send_now": "立即发送",
"ui.agent_chat_send_now_tip": "停止智能体当前的步骤,并接着发送这条消息(Ctrl+Enter)",
+ "ui.agent_chat_setup_body": "SolidCraft 会与安装在此计算机上的编程代理通信。请在“首选项 › AI”中选择一个。",
+ "ui.agent_chat_setup_title": "设置助手",
"ui.agent_chat_side": "智能体聊天位置",
"ui.agent_chat_signed_in": "已登录",
"ui.agent_chat_state_auth": "需要登录",
@@ -1236,6 +1243,7 @@
"ui.agent_chat_undo_label": "智能体聊天:{message}",
"ui.agent_chat_undone": "(已撤销)",
"ui.agent_chat_view_attached": "已附加视图",
+ "ui.agent_chat_waiting": "等待您的回复",
"ui.agent_cursor": "代理光标",
"ui.agent_cursor_speed": "代理光标速度",
"ui.agent_off_thread": "代理运行命令时保持窗口响应",
@@ -1594,6 +1602,8 @@
"ui.joints": "关节",
"ui.keyboard_shortcuts": "键盘快捷键",
"ui.language": "语言",
+ "ui.layout_compact": "紧凑",
+ "ui.layout_floating": "浮动",
"ui.length_decimals": "长度小数位",
"ui.light": "浅色",
"ui.line": "直线",
@@ -1731,6 +1741,7 @@
"ui.reverse_zoom_direction": "反转缩放方向",
"ui.revolve": "旋转",
"ui.ribbon_exit": "退出",
+ "ui.ribbon_labels": "显示功能区图标下的文字",
"ui.ribbon_pin_footer": "固定的命令显示在功能区中。将指针悬停在行上可固定或取消固定。",
"ui.ribbon_workspace": "工作区",
"ui.right": "右视",
@@ -1910,6 +1921,7 @@
"ui.workspace_design_tabs": "模型 · 曲面 · 装配 · 插入 · 检查 · 管理 · 视图",
"ui.workspace_drawing_description": "包含视图、尺寸和标题栏的二维图纸",
"ui.workspace_footer": "所有工作区使用同一设计、历史记录和选择,仅功能区选项卡发生变化。编辑草图或特征时,切换器将被锁定。",
+ "ui.workspace_layout": "工作区布局",
"ui.workspace_manufacture_description": "切片、刀具路径和设置",
"ui.workspace_planned": "计划中",
"ui.workspace_render_description": "产品预览、场景设置和渲染图像",
diff --git a/assets/styles/ui/palettes.rs b/assets/styles/ui/palettes.rs
index 6cd46af07..939e7cd7b 100644
--- a/assets/styles/ui/palettes.rs
+++ b/assets/styles/ui/palettes.rs
@@ -107,7 +107,6 @@ impl Tokens {
error: Color32::from_rgb(214, 54, 54),
warning: Color32::from_rgb(222, 150, 30),
icon: Color32::from_rgb(70, 78, 92),
- icon_fill: Color32::from_rgb(178, 196, 222),
timeline: Color32::from_rgb(232, 235, 240),
hover: Color32::from_rgb(226, 234, 246),
sel_face: Color32::from_rgb(76, 127, 203),
@@ -157,8 +156,6 @@ impl Tokens {
dialog_bg: Color32::from_rgb(250, 251, 252),
dialog_border: Color32::from_rgb(213, 219, 227),
chip: Color32::from_rgb(38, 120, 218),
- heading_bg: Color32::from_rgb(218, 223, 231),
- subheading_bg: Color32::from_rgb(234, 237, 242),
profile_fill: Color32::from_rgba_unmultiplied_const(255, 196, 120, 70),
glyph_bg: Color32::WHITE,
glyph_edge: Color32::from_rgb(190, 110, 100),
@@ -203,30 +200,7 @@ impl Tokens {
Color32::from_rgb(204, 0, 140),
],
analysis: AnalysisColors::DEFAULT,
- icons: IconColors {
- sheet: Color32::from_rgb(170, 200, 240),
- sheet_2: Color32::from_rgb(150, 185, 235),
- sheet_light: Color32::from_rgb(214, 229, 248),
- sheet_line: Color32::from_rgb(127, 166, 218),
- highlight: Color32::WHITE,
- glint: Color32::from_rgba_premultiplied(160, 160, 160, 160),
- folder: Color32::from_rgb(236, 200, 110),
- plane: Color32::from_rgb(244, 214, 150),
- fold: Color32::from_rgb(130, 140, 160),
- stripe: Color32::from_gray(30),
- sky: Color32::from_rgb(190, 205, 230),
- floor: Color32::from_rgb(60, 62, 70),
- paint: [Color32::from_rgb(220, 70, 60), Color32::from_rgb(70, 150, 230), Color32::from_rgb(240, 200, 60)],
- axes: [Color32::from_rgb(210, 60, 60), Color32::from_rgb(60, 160, 60), Color32::from_rgb(60, 100, 220)],
- access: [Color32::from_rgb(70, 180, 90), Color32::from_rgb(220, 70, 60)],
- draft: [Color32::from_rgb(70, 180, 90), Color32::from_rgb(235, 200, 50)],
- curvature: [Color32::from_rgb(60, 110, 230), Color32::from_rgb(70, 190, 90), Color32::from_rgb(225, 60, 45)],
- interference: Color32::from_rgb(225, 70, 60),
- warning: Color32::from_rgb(250, 200, 60),
- agent: Color32::from_rgb(168, 85, 247),
- marker_halo: Color32::from_black_alpha(150),
- },
- app_bar_icon: [Color32::from_rgb(225, 230, 238), Color32::from_rgb(120, 140, 170), Color32::from_rgb(120, 190, 255)],
+ icons: IconColors { highlight: Color32::WHITE, agent: Color32::from_rgb(168, 85, 247), marker_halo: Color32::from_black_alpha(150) },
logo: [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197), Color32::WHITE],
}
}
@@ -306,7 +280,6 @@ impl Tokens {
t.error = Color32::from_rgb(240, 100, 96);
t.warning = Color32::from_rgb(236, 170, 70);
t.icon = Color32::from_rgb(208, 214, 226);
- t.icon_fill = Color32::from_rgb(86, 112, 150);
t.timeline = Color32::from_rgb(33, 37, 45);
t.hover = Color32::from_rgb(54, 61, 74);
t.hover_edge_halo = Color32::from_rgb(203, 203, 203);
@@ -328,8 +301,6 @@ impl Tokens {
t.dialog_bg = Color32::from_rgb(59, 68, 83);
t.dialog_border = Color32::from_rgb(72, 83, 99);
t.chip = Color32::from_rgb(59, 101, 168);
- t.heading_bg = Color32::from_rgb(38, 44, 55);
- t.subheading_bg = Color32::from_rgb(48, 55, 68);
t.glyph_bg = Color32::from_rgb(44, 50, 60);
t.glyph_edge = Color32::from_rgb(200, 130, 120);
t.glyph_text = icon_primary(crate::icon_svg::CONSTRAINT_PRIMARY[1]);
@@ -373,15 +344,8 @@ impl Tokens {
if !dark {
t.form_success = Color32::from_rgb(39, 88, 78);
}
- // The icons that show the same meanings follow; on the dark toolbar the blue is a little
- // stronger, to stay clear of the icon fill.
- let good = if dark { Color32::from_rgb(35, 115, 245) } else { Color32::from_rgb(51, 115, 230) };
- t.icons.axes[0] = t.triad[0];
- t.icons.axes[1] = t.triad[1];
- t.icons.access = [good, Color32::from_rgb(217, 102, 13)];
t.construction_geom = icon_primary(crate::icon_svg::CONSTRUCTION_RED_GREEN[dark as usize]);
t.glyph_text = icon_primary(crate::icon_svg::CONSTRAINT_RED_GREEN[dark as usize]);
- t.icons.draft = [good, Color32::from_rgb(242, 230, 153)];
t.surface_accent = if dark { Color32::from_rgb(200, 135, 55) } else { Color32::from_rgb(164, 80, 0) };
t.mesh_accent = if dark { Color32::from_rgb(190, 175, 70) } else { Color32::from_rgb(130, 103, 0) };
t.form_accent = if dark { Color32::from_rgb(165, 135, 220) } else { Color32::from_rgb(115, 73, 205) };
diff --git a/assets/styles/ui/themes/gruvbox-dark-hard.json b/assets/styles/ui/themes/gruvbox-dark-hard.json
index 29033943d..646057927 100644
--- a/assets/styles/ui/themes/gruvbox-dark-hard.json
+++ b/assets/styles/ui/themes/gruvbox-dark-hard.json
@@ -16,7 +16,6 @@
"error": "#fb4934",
"warning": "#fabd2f",
"icon": "#d5c4a1",
- "icon_fill": "#458588",
"timeline": "#141617",
"hover": "#46403e",
"sel_face": "#458588",
@@ -62,8 +61,6 @@
"dialog_bg": "#3c3836",
"dialog_border": "#504945",
"chip": "#458588",
- "heading_bg": "#1d2021",
- "subheading_bg": "#2c2c2c",
"section_cap": "#d65d0e",
"profile_fill": "#83a59828",
"glyph_bg": "#2c2c2c",
@@ -96,24 +93,6 @@
"#b8bb26",
"#83a598"
],
- "app_bar_icon": [
- "#ebdbb2",
- "#928374",
- "#83a598"
- ],
- "icons.folder": "#d79921",
- "icons.axes": [
- "#fb4934",
- "#b8bb26",
- "#83a598"
- ],
- "icons.agent": "#d3869b",
- "icons.warning": "#fabd2f",
- "icons.interference": "#fb4934",
- "icons.paint": [
- "#fb4934",
- "#83a598",
- "#fabd2f"
- ]
+ "icons.agent": "#d3869b"
}
}
diff --git a/assets/styles/ui/themes/gruvbox-dark-soft.json b/assets/styles/ui/themes/gruvbox-dark-soft.json
index ac5042e19..34a895cc9 100644
--- a/assets/styles/ui/themes/gruvbox-dark-soft.json
+++ b/assets/styles/ui/themes/gruvbox-dark-soft.json
@@ -16,7 +16,6 @@
"error": "#fb4934",
"warning": "#fabd2f",
"icon": "#d5c4a1",
- "icon_fill": "#458588",
"timeline": "#1d2021",
"hover": "#46403e",
"sel_face": "#458588",
@@ -62,8 +61,6 @@
"dialog_bg": "#3c3836",
"dialog_border": "#504945",
"chip": "#458588",
- "heading_bg": "#32302f",
- "subheading_bg": "#373432",
"section_cap": "#d65d0e",
"profile_fill": "#83a59828",
"glyph_bg": "#373432",
@@ -96,24 +93,6 @@
"#b8bb26",
"#83a598"
],
- "app_bar_icon": [
- "#ebdbb2",
- "#928374",
- "#83a598"
- ],
- "icons.folder": "#d79921",
- "icons.axes": [
- "#fb4934",
- "#b8bb26",
- "#83a598"
- ],
- "icons.agent": "#d3869b",
- "icons.warning": "#fabd2f",
- "icons.interference": "#fb4934",
- "icons.paint": [
- "#fb4934",
- "#83a598",
- "#fabd2f"
- ]
+ "icons.agent": "#d3869b"
}
}
diff --git a/assets/styles/ui/themes/gruvbox-dark.json b/assets/styles/ui/themes/gruvbox-dark.json
index 4c55a6b23..320f9ed96 100644
--- a/assets/styles/ui/themes/gruvbox-dark.json
+++ b/assets/styles/ui/themes/gruvbox-dark.json
@@ -16,7 +16,6 @@
"error": "#fb4934",
"warning": "#fabd2f",
"icon": "#d5c4a1",
- "icon_fill": "#458588",
"timeline": "#1d2021",
"hover": "#46403e",
"sel_face": "#458588",
@@ -62,8 +61,6 @@
"dialog_bg": "#3c3836",
"dialog_border": "#504945",
"chip": "#458588",
- "heading_bg": "#282828",
- "subheading_bg": "#32302f",
"section_cap": "#d65d0e",
"profile_fill": "#83a59828",
"glyph_bg": "#32302f",
@@ -96,24 +93,6 @@
"#b8bb26",
"#83a598"
],
- "app_bar_icon": [
- "#ebdbb2",
- "#928374",
- "#83a598"
- ],
- "icons.folder": "#d79921",
- "icons.axes": [
- "#fb4934",
- "#b8bb26",
- "#83a598"
- ],
- "icons.agent": "#d3869b",
- "icons.warning": "#fabd2f",
- "icons.interference": "#fb4934",
- "icons.paint": [
- "#fb4934",
- "#83a598",
- "#fabd2f"
- ]
+ "icons.agent": "#d3869b"
}
}
diff --git a/assets/styles/ui/themes/gruvbox-light-hard.json b/assets/styles/ui/themes/gruvbox-light-hard.json
index adbe04d4b..902121fb6 100644
--- a/assets/styles/ui/themes/gruvbox-light-hard.json
+++ b/assets/styles/ui/themes/gruvbox-light-hard.json
@@ -16,7 +16,6 @@
"error": "#9d0006",
"warning": "#b57614",
"icon": "#504945",
- "icon_fill": "#bdae93",
"timeline": "#ebdbb2",
"hover": "#f1e5c1",
"sel_face": "#458588",
@@ -62,8 +61,6 @@
"dialog_bg": "#f9f5d7",
"dialog_border": "#d5c4a1",
"chip": "#458588",
- "heading_bg": "#d5c4a1",
- "subheading_bg": "#ebdbb2",
"section_cap": "#d65d0e",
"profile_fill": "#fabd2f46",
"glyph_bg": "#fcfaeb",
@@ -96,24 +93,6 @@
"#98971a",
"#458588"
],
- "app_bar_icon": [
- "#fbf1c7",
- "#a89984",
- "#83a598"
- ],
- "icons.folder": "#d79921",
- "icons.axes": [
- "#cc241d",
- "#98971a",
- "#458588"
- ],
- "icons.agent": "#8f3f71",
- "icons.warning": "#d79921",
- "icons.interference": "#cc241d",
- "icons.paint": [
- "#cc241d",
- "#458588",
- "#d79921"
- ]
+ "icons.agent": "#8f3f71"
}
}
diff --git a/assets/styles/ui/themes/gruvbox-light-soft.json b/assets/styles/ui/themes/gruvbox-light-soft.json
index 14891bc6b..d8c1c9783 100644
--- a/assets/styles/ui/themes/gruvbox-light-soft.json
+++ b/assets/styles/ui/themes/gruvbox-light-soft.json
@@ -16,7 +16,6 @@
"error": "#9d0006",
"warning": "#b57614",
"icon": "#504945",
- "icon_fill": "#bdae93",
"timeline": "#ebdbb2",
"hover": "#eedfb6",
"sel_face": "#458588",
@@ -62,8 +61,6 @@
"dialog_bg": "#f2e5bc",
"dialog_border": "#d5c4a1",
"chip": "#458588",
- "heading_bg": "#d5c4a1",
- "subheading_bg": "#ebdbb2",
"section_cap": "#d65d0e",
"profile_fill": "#fabd2f46",
"glyph_bg": "#f8f2de",
@@ -96,24 +93,6 @@
"#98971a",
"#458588"
],
- "app_bar_icon": [
- "#fbf1c7",
- "#a89984",
- "#83a598"
- ],
- "icons.folder": "#d79921",
- "icons.axes": [
- "#cc241d",
- "#98971a",
- "#458588"
- ],
- "icons.agent": "#8f3f71",
- "icons.warning": "#d79921",
- "icons.interference": "#cc241d",
- "icons.paint": [
- "#cc241d",
- "#458588",
- "#d79921"
- ]
+ "icons.agent": "#8f3f71"
}
}
diff --git a/assets/styles/ui/themes/gruvbox-light.json b/assets/styles/ui/themes/gruvbox-light.json
index bd5191a46..c3789e80d 100644
--- a/assets/styles/ui/themes/gruvbox-light.json
+++ b/assets/styles/ui/themes/gruvbox-light.json
@@ -16,7 +16,6 @@
"error": "#9d0006",
"warning": "#b57614",
"icon": "#504945",
- "icon_fill": "#bdae93",
"timeline": "#ebdbb2",
"hover": "#f1e4ba",
"sel_face": "#458588",
@@ -62,8 +61,6 @@
"dialog_bg": "#fbf1c7",
"dialog_border": "#d5c4a1",
"chip": "#458588",
- "heading_bg": "#d5c4a1",
- "subheading_bg": "#ebdbb2",
"section_cap": "#d65d0e",
"profile_fill": "#fabd2f46",
"glyph_bg": "#fdf8e3",
@@ -96,24 +93,6 @@
"#98971a",
"#458588"
],
- "app_bar_icon": [
- "#fbf1c7",
- "#a89984",
- "#83a598"
- ],
- "icons.folder": "#d79921",
- "icons.axes": [
- "#cc241d",
- "#98971a",
- "#458588"
- ],
- "icons.agent": "#8f3f71",
- "icons.warning": "#d79921",
- "icons.interference": "#cc241d",
- "icons.paint": [
- "#cc241d",
- "#458588",
- "#d79921"
- ]
+ "icons.agent": "#8f3f71"
}
}
diff --git a/crates/engine/src/cmd/view_navigation.rs b/crates/engine/src/cmd/view_navigation.rs
index a8b9d3d32..2101e4d60 100644
--- a/crates/engine/src/cmd/view_navigation.rs
+++ b/crates/engine/src/cmd/view_navigation.rs
@@ -7,6 +7,8 @@ use crate::params::{bad, num, req_vec2, req_vec3, vec3};
use crate::{Result, Sel, Session};
pub static COMMANDS: &[CommandSpec] = &[
+CommandSpec::new("view.layout", "Workspace layout", layout)
+ .icon("settings").noundo().doc_only().params("mode: floating|compact → validated workspace layout; display only, never opens a dialog"),
CommandSpec::new("view.history_layout", "History layout", history_layout)
.icon("settings").noundo().doc_only().params("width?: 1..1000000; dock?: bottom|left|under_browser; collapsed?: bool → validated layout request; display only, never opens a dialog"),
CommandSpec::new("view.graphics_preset", "Graphics Preset", graphics_preset)
@@ -60,6 +62,15 @@ fn normal_to(s: &mut Session, p: &Value) -> Result {
Ok(json!({"camera": to}))
}
+fn layout(_s: &mut Session, p: &Value) -> Result {
+ let mode = p
+ .get("mode")
+ .and_then(Value::as_str)
+ .filter(|mode| matches!(*mode, "floating" | "compact"))
+ .ok_or_else(|| bad("view.layout", "mode must be floating or compact"))?;
+ Ok(json!({"mode": mode}))
+}
+
fn history_layout(_s: &mut Session, p: &Value) -> Result {
let cmd = "view.history_layout";
let mut result = serde_json::Map::new();
@@ -587,3 +598,18 @@ fn history_layout_validates_geometry_without_changing_the_design() {
assert_eq!(s.doc, doc);
assert!(s.undo.is_empty());
}
+
+#[cfg(test)]
+#[test]
+fn workspace_layout_validates_modes_without_mutating_the_design() {
+ let mut session = Session::default();
+ let before = session.doc.to_json();
+ for mode in ["floating", "compact"] {
+ assert_eq!(session.execute("view.layout", &json!({"mode":mode})).unwrap(), json!({"mode":mode}));
+ }
+ for params in [json!({}), json!({"mode":"wide"}), json!({"mode":true}), json!({"mode":null}), json!({"mode":42})] {
+ assert!(session.execute("view.layout", ¶ms).is_err());
+ }
+ assert_eq!(session.doc.to_json(), before);
+ assert!(session.undo.is_empty());
+}
diff --git a/crates/ui-egui/src/agent_chat/markdown_view.rs b/crates/ui-egui/src/agent_chat/markdown_view.rs
index ba8647329..8c6d6da58 100644
--- a/crates/ui-egui/src/agent_chat/markdown_view.rs
+++ b/crates/ui-egui/src/agent_chat/markdown_view.rs
@@ -101,7 +101,7 @@ pub fn show(ui: &mut egui::Ui, slot: usize, src: &str) {
.selectable(true)
.wrap(),
);
- if ui.small_button(tr("ui.agent_chat_copy")).clicked() {
+ if crate::ui_kit::button(ui, tr("ui.agent_chat_copy"), crate::ui_kit::Button::Small).clicked() {
ui.ctx().copy_text(text.clone());
}
});
diff --git a/crates/ui-egui/src/agent_chat/mod.rs b/crates/ui-egui/src/agent_chat/mod.rs
index b1f8bb606..e73f401fa 100644
--- a/crates/ui-egui/src/agent_chat/mod.rs
+++ b/crates/ui-egui/src/agent_chat/mod.rs
@@ -45,6 +45,7 @@ use crate::i18n::{format as trf, tr};
use crate::{ControlRequest, SolveApp};
use backend::{ChatBackend, Event, PermissionOption, PromptPart, ToolStatus};
+pub(crate) use panel::{left_inset, tool_space};
pub use panel::{show, tip as panel_tip, toggle};
/// Most entries kept in the conversation; older ones are dropped.
@@ -331,6 +332,8 @@ pub struct AgentChat {
pub confirm_new: bool,
/// Where the panel was drawn last (for its shortcuts).
pub panel_rect: Option,
+ /// Unreserved sheet space, shared by the actual dock and its drag preview.
+ pub(crate) dock_space: Option,
/// The last message sent, kept to send again after a sign-in (its files too).
last: Option<(String, bool, Option, Vec)>,
/// Files for the next message (pictures, text files, imported parts), shown as chips.
diff --git a/crates/ui-egui/src/agent_chat/panel.rs b/crates/ui-egui/src/agent_chat/panel.rs
index a85fa1517..b225fbe49 100644
--- a/crates/ui-egui/src/agent_chat/panel.rs
+++ b/crates/ui-egui/src/agent_chat/panel.rs
@@ -3,6 +3,7 @@
//! width and fold are preferences, so they come back next time.
use crate::fonts::RichTextExt as _;
+use crate::ui_kit::{Container, Edge, Surface};
use egui::{Align, Align2, Color32, Id, Layout, Rect, RichText, Sense, Stroke, pos2, vec2};
use super::*;
@@ -60,6 +61,10 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
poll(app, &ctx);
// Set again below if the chat is drawn this frame.
app.agent_chat.drop_rect = None;
+ // Retain the previous card for shortcut hover routing below; clear it when hidden.
+ if !shown(app) || !app.agent_chat.open {
+ app.agent_chat.panel_rect = None;
+ }
// With AI features off nothing of the chat is drawn, and the shortcut does nothing.
if !shown(app) {
return;
@@ -91,14 +96,22 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
show_drop_hint(app, &ctx);
return;
}
+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {
+ floating(app, ui);
+ show_drop_hint(app, &ctx);
+ return;
+ }
+ let available = ui.available_rect_before_wrap();
+ let screen = ctx.content_rect();
+ app.agent_chat.dock_space = Some(Rect::from_x_y_ranges(screen.x_range(), available.y_range()));
let t = Tokens::get();
let left = app.preferences.agent_chat_side == "left";
- let side = |id: Id| if left { egui::Panel::left(id) } else { egui::Panel::right(id) };
+ let side = |id: Id| Container::new(ui.ctx(), Surface::Panel).edge(id, if left { Edge::Left } else { Edge::Right });
if app.preferences.agent_chat_minimized {
let r = side(Id::new("sc_agent_chat_strip"))
.exact_size(STRIP)
.resizable(false)
- .frame(egui::Frame::NONE.fill(t.panel))
+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.panel))
.show(ui, |ui| strip(app, ui));
app.agent_chat.drop_rect = Some(r.response.rect);
show_drop_hint(app, &ctx);
@@ -109,7 +122,7 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
.default_size(width)
.size_range(MIN_WIDTH..=MAX_WIDTH)
.resizable(true)
- .frame(egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(8, 6)))
+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.dialog_body))
.show(ui, |ui| ui_kit::scope(ui, |ui| body(app, ui, left)));
crate::scenario::publish_rect("agent_chat:panel", r.response.rect);
app.agent_chat.panel_rect = Some(r.response.rect);
@@ -123,6 +136,112 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
}
}
+/// Horizontal room reserved before the history and browser when Assistant is on the left.
+pub(crate) fn left_inset(app: &SolveApp, available: Rect) -> f32 {
+ if Container::for_layout(app.ui.layout, Surface::Panel).floating()
+ && shown(app)
+ && app.agent_chat.open
+ && !app.preferences.agent_chat_popped
+ && app.preferences.agent_chat_side == "left"
+ {
+ let width = if app.preferences.agent_chat_minimized { STRIP } else { app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH) };
+ (width + crate::shell::SHELL_GAP).min(available.width().max(0.0))
+ } else {
+ 0.0
+ }
+}
+
+/// Assistant-specific precedence over tool sheets. Keep this out of the shared container:
+/// ordinary tool panels never reserve an outside rail for themselves.
+pub(crate) fn tool_space(app: &SolveApp, mut available: Rect) -> Rect {
+ if Container::for_layout(app.ui.layout, Surface::Panel).floating()
+ && shown(app)
+ && app.agent_chat.open
+ && !app.preferences.agent_chat_popped
+ && let Some(chat) = app.agent_chat.panel_rect.filter(|r| r.is_finite() && r.is_positive())
+ {
+ if app.preferences.agent_chat_side == "left" {
+ available.min.x = (chat.right() + crate::shell::SHELL_GAP).clamp(available.left(), available.right());
+ } else {
+ available.max.x = (chat.left() - crate::shell::SHELL_GAP).clamp(available.left(), available.right());
+ }
+ }
+ available
+}
+
+/// The same outer rectangle is used for the floating sheet and its docking preview.
+fn floating_bounds(app: &SolveApp, available: Rect, left: bool) -> Rect {
+ let t = Tokens::get();
+ let gap = crate::shell::SHELL_GAP;
+ let mut bounds = available.shrink(gap);
+ // The ribbon already supplies the top gap shared by browser and history cards.
+ bounds.min.y = available.top();
+ if let Some(history) = app.shell.history.filter(|_| app.ui.show_timeline && !app.preferences.timeline_left) {
+ bounds.max.y = (history.top() - gap).min(bounds.bottom()).max(bounds.top());
+ }
+ // Assistant owns the outside edge on either side. Tool sheets reserve space beside it.
+ if !left {
+ // Match the shared Panel's right-edge clearance.
+ bounds.max.x = bounds.right().min(available.right() - t.space_8).max(bounds.left());
+ }
+ let width = if app.preferences.agent_chat_minimized { STRIP } else { app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH) };
+ let height = if app.preferences.agent_chat_minimized { (t.space_24 * 3.0 + t.space_16).min(bounds.height()) } else { bounds.height() };
+ let width = width.min(bounds.width().max(0.0));
+ Rect::from_min_size(pos2(if left { bounds.left() } else { bounds.right() - width }, bounds.top()), vec2(width, height.max(0.0)))
+}
+
+/// Use the same bounded, rounded floating surface as feature panels. The sheet overlays
+/// the viewport, leaving the model's rendering and picking projection unchanged.
+fn floating(app: &mut SolveApp, ui: &mut egui::Ui) {
+ let ctx = ui.ctx().clone();
+ let t = Tokens::get();
+ let available = ui.available_rect_before_wrap();
+ app.agent_chat.dock_space = Some(available);
+ let left = app.preferences.agent_chat_side == "left";
+ let side = if left { crate::frame::Side::Left } else { crate::frame::Side::Right };
+ let minimized = app.preferences.agent_chat_minimized;
+ let bounds = floating_bounds(app, available, left);
+ if !bounds.is_positive() {
+ app.agent_chat.panel_rect = None;
+ return;
+ }
+ let width = bounds.width();
+ let height = bounds.height();
+ let anchor = if left { bounds.left_top() } else { bounds.right_top() };
+ let frame = ui_kit::Panel::feature_frame(&ctx, app.ui.layout, side);
+ let inner = (vec2(width, height) - frame.total_margin().sum()).max(egui::Vec2::ZERO);
+ let panel = ui_kit::Panel::new(tr("ui.assistant"), Id::new("sc_agent_chat_floating"), anchor, available, side, frame).width(width);
+ if let Some(card) = panel.window(&ctx).fixed_size(inner).show(&ctx, |ui| {
+ ui.set_min_size(inner);
+ ui.set_max_size(inner);
+ ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, inner)));
+ ui_kit::scope(ui, |ui| if minimized { strip(app, ui) } else { body(app, ui, left) });
+ if !minimized {
+ let rect = ui.max_rect();
+ let rail = if left {
+ Rect::from_x_y_ranges(rect.right() - t.space_4..=rect.right(), rect.y_range())
+ } else {
+ Rect::from_x_y_ranges(rect.left()..=rect.left() + t.space_4, rect.y_range())
+ };
+ let response = ui.interact(rail, Id::new("sc_agent_chat_resize"), Sense::drag()).on_hover_cursor(egui::CursorIcon::ResizeHorizontal);
+ crate::scenario::publish_handle("agent_chat:resize", rail.center());
+ if response.dragged() {
+ let delta = ui.input(|i| i.pointer.delta().x) * if left { 1.0 } else { -1.0 };
+ if delta.is_finite() {
+ app.preferences.agent_chat_width = (width + delta).clamp(MIN_WIDTH, MAX_WIDTH);
+ }
+ }
+ }
+ }) {
+ let rect = card.response.rect;
+ app.agent_chat.panel_rect = Some(rect);
+ app.agent_chat.drop_rect = Some(rect);
+ crate::scenario::publish_rect("agent_chat:panel", rect);
+ }
+ #[cfg(not(target_arch = "wasm32"))]
+ gallery_window(app, &ctx);
+}
+
/// The pictures of a message as small thumbnails in a row. Hovering one shows it bigger for as long
/// as the pointer stays; a click returns its place in the row, to open the viewer there.
#[cfg(not(target_arch = "wasm32"))]
@@ -182,7 +301,7 @@ fn gallery_window(app: &mut SolveApp, ctx: &egui::Context) {
let mut step: isize = if left { -1 } else { isize::from(right) };
let t = Tokens::get();
let max = ctx.content_rect().size() * vec2(0.8, 0.7);
- let modal = egui::Modal::new(Id::new("sc_agent_chat_gallery")).show(ctx, |ui| {
+ let modal = ui_kit::Container::new(ctx, ui_kit::Surface::Window).modal(Id::new("sc_agent_chat_gallery")).show(ctx, |ui| {
ui.set_max_width(max.x);
ui.horizontal(|ui| {
let prev = ui_kit::button(ui, tr("ui.agent_chat_previous_picture"), ui_kit::Button::Enabled(count > 1));
@@ -301,8 +420,8 @@ fn window(app: &mut SolveApp, ctx: &egui::Context) {
app.agent_chat.panel_rect = None;
ctx.show_viewport_immediate(egui::ViewportId::from_hash_of("sc_agent_chat_window"), builder, |ui, class| {
let t = Tokens::get();
- let frame = egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(8, 6));
- let r = egui::CentralPanel::default().frame(frame).show(ui, |ui| ui_kit::scope(ui, |ui| body(app, ui, false)));
+ let frame = Container::new(ui.ctx(), Surface::Panel).edge_frame(t.dialog_body);
+ let r = Container::new(ui.ctx(), Surface::Viewport).central().frame(frame).show(ui, |ui| ui_kit::scope(ui, |ui| body(app, ui, false)));
// The picture viewer opens over this window, where the click was, not over the main one.
gallery_window(app, ui.ctx());
if class == egui::ViewportClass::EmbeddedWindow {
@@ -351,7 +470,7 @@ pub fn take_focus_for_text(popped: bool, over_text: bool, chat_active: Option egui::Response {
let t = Tokens::get();
- let (r, resp) = ui.allocate_exact_size(vec2(22.0, 22.0), Sense::click());
+ let (r, resp) = ui.allocate_exact_size(vec2(t.form_close_size, t.form_close_size), Sense::click());
if resp.hovered() {
ui.painter().rect_filled(r, 4.0, t.hover);
}
@@ -392,6 +511,7 @@ fn glyph_button(ui: &mut egui::Ui, kind: &str, tip: &str) -> egui::Response {
}
_ => {}
}
+ crate::scenario::publish_rect(&format!("agent_chat:{kind}"), r);
crate::scenario::publish_handle(&format!("agent_chat:{kind}"), r.center());
resp.on_hover_text(tip)
}
@@ -445,70 +565,67 @@ fn strip(app: &mut SolveApp, ui: &mut egui::Ui) {
/// Pop out (or Dock, in its own window), Minimise and Close. In its own window the system moves
/// and minimises it, so there is no grip and no Minimise.
fn header(app: &mut SolveApp, ui: &mut egui::Ui, left: bool) {
+ let t = Tokens::get();
let state = app.agent_chat.state();
let popped = app.preferences.agent_chat_popped;
- ui.horizontal(|ui| {
- let title = {
- let grip = if popped { ui.allocate_exact_size(vec2(0.0, 18.0), Sense::hover()).0 } else { ui_kit::panel_grip(ui).rect };
- let l = ui.label(
- RichText::new(tr("ui.agent_chat")).semibold().color(crate::theme::Tokens::get().text).size(crate::theme::Tokens::get().font_heading),
- );
- grip.union(l.rect)
- };
- let mut s = state.label().to_string();
- if let Some(turn) = &app.agent_chat.turn
- && state == State::Busy
- {
- let limit = app.preferences.agent_chat_turn_limit;
- s = format!("{s} {}", trf("ui.agent_chat_changes_of", &[("n", &turn.changes.to_string()), ("limit", &limit.to_string())]));
- }
- ui.label(RichText::new(s).color(state_color(state)).small());
- // Drag the header across the window to dock on the other side.
- if !popped {
- let drag = ui.interact(title, Id::new("sc_agent_chat_grip"), Sense::drag());
- crate::scenario::publish_handle("agent_chat:grip", title.center());
- dock_drag(app, ui, &drag, left);
- }
- ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
- if glyph_button(ui, "close", tr("ui.agent_chat_close")).clicked() {
- app.agent_chat.open = false;
- }
- if !popped && glyph_button(ui, "minimize", tr("ui.agent_chat_minimize")).clicked() {
- app.preferences.agent_chat_minimized = true;
- }
- #[cfg(not(target_arch = "wasm32"))]
- if glyph_button(
- ui,
- "newchat",
- &format!("{} ({})", tr("ui.agent_chat_new"), if cfg!(target_os = "macos") { "Cmd+Shift+L" } else { "Ctrl+Shift+L" }),
- )
- .clicked()
- {
- request_new_chat(app);
- }
- #[cfg(not(target_arch = "wasm32"))]
- {
- let (kind, tip) = if popped { ("dock", "ui.agent_chat_dock") } else { ("pop_out", "ui.agent_chat_pop_out") };
- if glyph_button(ui, kind, tr(tip)).clicked() {
- app.preferences.agent_chat_popped = !popped;
- }
- }
- #[cfg(not(target_arch = "wasm32"))]
- {
- let b = if state.running() {
- ui_kit::button(ui, tr("ui.agent_chat_stop"), ui_kit::Button::Normal).on_hover_text(tr("ui.agent_chat_stop_tip"))
- } else {
- ui_kit::button(ui, tr("ui.agent_chat_connect"), ui_kit::Button::Normal)
- };
- crate::scenario::publish_handle("agent_chat:connect", b.rect.center());
- if b.clicked() {
- if state.running() {
- disconnect(app);
+ ui_kit::assistant_header(ui, |ui| {
+ ui.horizontal(|ui| {
+ let title = {
+ let grip =
+ if popped { ui.allocate_exact_size(vec2(0.0, t.space_16 + t.space_2), Sense::hover()).0 } else { ui_kit::panel_grip(ui).rect };
+ let l = ui.label(RichText::new(tr("ui.assistant")).semibold().color(t.text).size(t.font_heading));
+ grip.union(l.rect)
+ };
+ let waiting = app.agent_chat.waiting();
+ let s = if waiting > 0 { tr("ui.agent_chat_waiting").to_string() } else { state.label().to_string() };
+ if ui.available_width() > t.space_24 * 9.0 {
+ ui_kit::assistant_badge(
+ ui,
+ &s,
+ if waiting > 0 {
+ ui_kit::AssistantTone::Warning
} else {
- connect(app, ui.ctx());
+ match state {
+ State::Ready => ui_kit::AssistantTone::Success,
+ State::Busy => ui_kit::AssistantTone::Working,
+ State::NeedsAuth => ui_kit::AssistantTone::Warning,
+ State::Exited => ui_kit::AssistantTone::Error,
+ _ => ui_kit::AssistantTone::Neutral,
+ }
+ },
+ );
+ }
+ // Drag the header across the window to dock on the other side.
+ if !popped {
+ let drag = ui.interact(title, Id::new("sc_agent_chat_grip"), Sense::drag());
+ crate::scenario::publish_handle("agent_chat:grip", title.center());
+ dock_drag(app, ui, &drag, left);
+ }
+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
+ if glyph_button(ui, "close", tr("ui.agent_chat_close")).clicked() {
+ app.agent_chat.open = false;
+ }
+ if !popped && glyph_button(ui, "minimize", tr("ui.agent_chat_minimize")).clicked() {
+ app.preferences.agent_chat_minimized = true;
+ }
+ #[cfg(not(target_arch = "wasm32"))]
+ if glyph_button(
+ ui,
+ "newchat",
+ &format!("{} ({})", tr("ui.agent_chat_new"), if cfg!(target_os = "macos") { "Cmd+Shift+L" } else { "Ctrl+Shift+L" }),
+ )
+ .clicked()
+ {
+ request_new_chat(app);
+ }
+ #[cfg(not(target_arch = "wasm32"))]
+ {
+ let (kind, tip) = if popped { ("dock", "ui.agent_chat_dock") } else { ("pop_out", "ui.agent_chat_pop_out") };
+ if glyph_button(ui, kind, tr(tip)).clicked() {
+ app.preferences.agent_chat_popped = !popped;
}
}
- }
+ });
});
});
}
@@ -526,16 +643,17 @@ fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Response, left: boo
{
ui.ctx().set_cursor_icon(egui::CursorIcon::Grabbing);
let to_left = target(p.x);
- let w = app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH);
- let top = screen.top() + crate::toolbar::APP_BAR_HEIGHT;
- let zone = if to_left {
- Rect::from_min_max(pos2(screen.left(), top), pos2(screen.left() + w, screen.bottom()))
+ let available = app.agent_chat.dock_space.unwrap_or(screen);
+ let zone = if Container::for_layout(app.ui.layout, Surface::Panel).floating() {
+ floating_bounds(app, available, to_left)
} else {
- Rect::from_min_max(pos2(screen.right() - w, top), pos2(screen.right(), screen.bottom()))
+ let w = app.preferences.agent_chat_width.clamp(MIN_WIDTH, MAX_WIDTH).min(available.width());
+ Rect::from_min_size(pos2(if to_left { available.left() } else { available.right() - w }, available.top()), vec2(w, available.height()))
};
+ crate::scenario::publish_rect("agent_chat:dock_hint", zone);
let t = Tokens::get();
let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Foreground, Id::new("sc_agent_chat_dock_hint")));
- painter.rect(zone.shrink(4.0), 8.0, t.accent.gamma_multiply(0.18), Stroke::new(2.0, t.accent), egui::StrokeKind::Inside);
+ painter.rect(zone, t.radius_xl, t.accent.gamma_multiply(0.18), Stroke::new(2.0, t.accent), egui::StrokeKind::Inside);
painter.text(
zone.center(),
Align2::CENTER_CENTER,
@@ -555,7 +673,7 @@ fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Response, left: boo
fn body(app: &mut SolveApp, ui: &mut egui::Ui, left: bool) {
header(app, ui, left);
#[cfg(not(target_arch = "wasm32"))]
- switcher(app, ui);
+ ui_kit::assistant_controls(ui, |ui| switcher(app, ui));
#[cfg(target_arch = "wasm32")]
{
ui.label(tr("ui.agent_chat_desktop_only"));
@@ -586,11 +704,16 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {
});
});
}
- picker(app, ui);
+ // Discovery/install guidance must leave room for the pinned composer even when
+ // several agents are listed, or when a long message grows the editor.
+ egui::ScrollArea::vertical()
+ .id_salt("sc_agent_chat_picker_scroll")
+ .max_height(ui.available_height() / 3.0)
+ .auto_shrink([false, true])
+ .show(ui, |ui| picker(app, ui));
if state == State::NeedsAuth {
auth_box(app, ui);
}
- ui.separator();
// The input sits at the bottom of the panel and grows upwards: a long message makes its box
// taller up to `edit_max`, then it scrolls, and the conversation takes what is left above. It
// is a panel of its own at the bottom, as high as its content this frame, so the buttons under
@@ -606,55 +729,127 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {
(false, false)
};
let (mut send_clicked, mut stop_clicked, mut enter) = (false, false, false);
- egui::Panel::bottom(Id::new("sc_agent_chat_composer")).resizable(false).show_separator_line(false).frame(egui::Frame::NONE).show(ui, |ui| {
- ui.separator();
- // The files for the next message (#1744), as chips of their own.
- attachment_chips(app, ui);
- // Ctrl/Cmd+V: files and pictures on the clipboard attach; text goes to the box below.
- #[cfg(not(target_arch = "wasm32"))]
- if focused {
- super::paste::handle(app, ui);
- }
- let r = egui::ScrollArea::vertical()
- .id_salt("sc_agent_chat_input_scroll")
- .max_height(edit_max)
- .auto_shrink([false, true])
- .show(ui, |ui| {
- ui_kit::message_field(
- ui,
- Id::new("sc_agent_chat_input"),
- &mut app.agent_chat.input,
- tr(if busy { "ui.agent_chat_placeholder_busy" } else { "ui.agent_chat_placeholder" }),
- )
- })
- .inner;
- crate::scenario::publish_rect("agent_chat:input", r.rect);
- // macOS shows a window's cursors only while it is the active window: over the text box of a
- // chat window that isn't, the pointer stays an arrow. Coming from the main window, the chat
- // window becomes active, so the text cursor shows and the first click places the caret.
- let (chat_active, main_active) =
- (ui.ctx().input(|i| i.viewport().focused), ui.ctx().input_for(egui::ViewportId::ROOT, |i| i.viewport().focused));
- if take_focus_for_text(app.preferences.agent_chat_popped, r.hovered(), chat_active, main_active) {
- ui.ctx().send_viewport_cmd(egui::ViewportCommand::Focus);
- }
- enter = r.has_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter) && !i.modifiers.shift);
- ui.horizontal(|ui| {
- add_menu(app, ui);
- // A message waits for files still being read.
- let reading = !app.agent_chat.loading.is_empty();
- let send_b = ui_kit::button(ui, tr(if busy { "ui.agent_chat_queue" } else { "ui.agent_chat_send" }), ui_kit::Button::Enabled(!reading))
- .on_disabled_hover_text(tr("ui.agent_chat_files_loading"));
- crate::scenario::publish_handle("agent_chat:send", send_b.rect.center());
- send_clicked = send_b.clicked();
- stop_clicked = busy && glyph_button(ui, "stopturn", tr("ui.agent_chat_stop_turn_tip")).clicked();
- // A picture of the view goes with the message to agents that take pictures.
- let images = app.agent_chat.images || !state.running();
- let attach = ui
- .add_enabled_ui(images, |ui| ui_kit::checkbox(ui, tr("ui.agent_chat_attach_view"), &mut app.agent_chat.attach_view))
- .inner
- .on_hover_text(tr("ui.agent_chat_attach_view_tip"))
- .on_disabled_hover_text(tr("ui.agent_chat_no_images"));
- crate::scenario::publish_handle("agent_chat:attach", attach.rect.center());
+ let frame = Container::new(ui.ctx(), Surface::Viewport).edge_frame(egui::Color32::TRANSPARENT);
+ let composer = Container::new(ui.ctx(), Surface::Viewport).edge(Id::new("sc_agent_chat_composer"), Edge::Bottom);
+ composer.resizable(false).show_separator_line(false).frame(frame).show(ui, |ui| {
+ ui_kit::assistant_composer_footer(ui, |ui| {
+ ui_kit::assistant_composer(ui, focused, |ui| {
+ // The files for the next message (#1744), as chips of their own.
+ attachment_chips(app, ui);
+ // Ctrl/Cmd+V: files and pictures on the clipboard attach; text goes to the box below.
+ #[cfg(not(target_arch = "wasm32"))]
+ if focused {
+ super::paste::handle(app, ui);
+ }
+ let r = egui::ScrollArea::vertical()
+ .id_salt("sc_agent_chat_input_scroll")
+ .max_height(edit_max)
+ // Grow the bottom panel to the editor's scroll limit instead of letting
+ // its previous short-message height clip the action rows below it.
+ .min_scrolled_height(edit_max)
+ .auto_shrink([false, true])
+ .show(ui, |ui| {
+ ui_kit::assistant_input(
+ ui,
+ Id::new("sc_agent_chat_input"),
+ &mut app.agent_chat.input,
+ tr(if busy { "ui.agent_chat_placeholder_busy" } else { "ui.agent_chat_placeholder" }),
+ )
+ })
+ .inner;
+ crate::scenario::publish_rect("agent_chat:input", r.rect);
+ // macOS shows a window's cursors only while it is the active window: over the text box of a
+ // chat window that isn't, the pointer stays an arrow. Coming from the main window, the chat
+ // window becomes active, so the text cursor shows and the first click places the caret.
+ let (chat_active, main_active) =
+ (ui.ctx().input(|i| i.viewport().focused), ui.ctx().input_for(egui::ViewportId::ROOT, |i| i.viewport().focused));
+ if take_focus_for_text(app.preferences.agent_chat_popped, r.hovered(), chat_active, main_active) {
+ ui.ctx().send_viewport_cmd(egui::ViewportCommand::Focus);
+ }
+ enter = r.has_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter) && !i.modifiers.shift);
+ ui.allocate_ui_with_layout(
+ vec2(ui.available_width(), Tokens::get().control_height + Tokens::get().space_2),
+ Layout::left_to_right(Align::Center),
+ |ui| {
+ ui.set_min_height(Tokens::get().control_height + Tokens::get().space_2);
+ add_menu(app, ui);
+ let agent =
+ if state.running() { Some(app.agent_chat.running_id.clone()) } else { agents::current(app).map(|entry| entry.id) };
+ let mode = agent.as_deref().map_or(app.preferences.ai_permissions, |id| agents::mode_for(&app.preferences, id));
+ let permissions = ui
+ .allocate_ui(vec2(Tokens::get().space_24 * 4.0, Tokens::get().control_height), |ui| {
+ ui_kit::dropdown_menu(
+ ui,
+ "sc_agent_permissions",
+ tr(match mode {
+ agents::Mode::Ask => "ui.agent_chat_mode_ask",
+ agents::Mode::Edits => "ui.agent_chat_mode_edits",
+ agents::Mode::All => "ui.agent_chat_mode_all",
+ }),
+ |ui| {
+ for choice in agents::Mode::ALL {
+ if ui_kit::list_picker(ui, choice.id(), choice.label(), mode == choice).clicked() {
+ if let Some(id) = &agent {
+ app.preferences.agent_permissions.insert(id.clone(), choice);
+ } else {
+ app.preferences.ai_permissions = choice;
+ }
+ }
+ }
+ },
+ )
+ })
+ .inner;
+ let permissions = permissions.on_hover_text(mode.label());
+ crate::scenario::publish_rect("agent_chat:permissions", permissions.rect);
+ crate::scenario::publish_handle("agent_chat:permissions", permissions.rect.center());
+ // A message waits for files still being read.
+ let reading = !app.agent_chat.loading.is_empty();
+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
+ let action = ui_kit::assistant_send(
+ ui,
+ busy || !reading,
+ busy,
+ tr(if busy { "ui.agent_chat_stop_turn_tip" } else { "ui.agent_chat_send" }),
+ );
+ if busy {
+ crate::scenario::publish_handle("agent_chat:stopturn", action.rect.center());
+ stop_clicked = action.clicked();
+ let queued = ui_kit::button(ui, tr("ui.agent_chat_queue"), ui_kit::Button::Enabled(!reading));
+ crate::scenario::publish_rect("agent_chat:send", queued.rect);
+ crate::scenario::publish_handle("agent_chat:send", queued.rect.center());
+ send_clicked = queued.clicked();
+ } else {
+ crate::scenario::publish_rect("agent_chat:send", action.rect);
+ crate::scenario::publish_handle("agent_chat:send", action.rect.center());
+ send_clicked = action.clicked();
+ }
+ });
+ },
+ );
+ ui.allocate_ui_with_layout(
+ vec2(ui.available_width(), Tokens::get().control_height),
+ Layout::left_to_right(Align::Center).with_main_wrap(true),
+ |ui| {
+ ui.set_min_height(Tokens::get().control_height);
+ // A picture of the view goes with the message to agents that take pictures.
+ let images = app.agent_chat.images || !state.running();
+ let attach = ui
+ .add_enabled_ui(images, |ui| ui_kit::checkbox(ui, tr("ui.agent_chat_attach_view"), &mut app.agent_chat.attach_view))
+ .inner
+ .on_hover_text(tr("ui.agent_chat_attach_view_tip"))
+ .on_disabled_hover_text(tr("ui.agent_chat_no_images"));
+ crate::scenario::publish_handle("agent_chat:attach", attach.rect.center());
+ if let Some(turn) = &app.agent_chat.turn {
+ let count = trf(
+ "ui.agent_chat_changes_of",
+ &[("n", &turn.changes.to_string()), ("limit", &app.preferences.agent_chat_turn_limit.to_string())],
+ );
+ ui.label(RichText::new(count).color(Tokens::get().text_dim).size(Tokens::get().font_small));
+ }
+ },
+ );
+ });
});
});
egui::ScrollArea::vertical()
@@ -663,7 +858,10 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {
.auto_shrink([false, false])
.stick_to_bottom(true)
.show(ui, |ui| {
- conversation(app, ui);
+ egui::Frame::NONE.inner_margin(egui::Margin::same(Tokens::get().space_12 as i8)).show(ui, |ui| {
+ ui.spacing_mut().item_spacing.y = Tokens::get().space_10;
+ conversation(app, ui);
+ });
});
if esc || stop_clicked {
cancel(app);
@@ -706,7 +904,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
let t = Tokens::get();
let all = agents::entries(app);
let current = agents::current(app);
- ui.horizontal(|ui| {
+ ui.horizontal_wrapped(|ui| {
let label = current.as_ref().map_or_else(
|| tr(if app.agent_chat.detecting.is_some() { "ui.agent_chat_detecting" } else { "ui.agent_chat_none_found_short" }).to_string(),
|e| e.name.clone(),
@@ -718,6 +916,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
let mut add = false;
let combo = ui
.allocate_ui(vec2(w, t.control_height), |ui| {
+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);
ui_kit::dropdown_menu(ui, "sc_agent_switch", &label, |ui| {
for e in &all {
let sel = current.as_ref().is_some_and(|c| c.id == e.id);
@@ -737,6 +936,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
})
})
.inner;
+ crate::scenario::publish_rect("agent_chat:switcher", combo.rect);
crate::scenario::publish_handle("agent_chat:switcher", combo.rect.center());
combo.on_hover_text(tr("ui.ai_switch_tip"));
if add {
@@ -755,6 +955,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
let mut pick: Option = None;
let r = ui
.allocate_ui(vec2(t.form_label_width, t.control_height), |ui| {
+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);
ui_kit::dropdown_menu(ui, "sc_agent_mode", &cur, |ui| {
for (id, name) in &modes {
if ui_kit::list_picker(ui, id, name, *id == app.agent_chat.mode).clicked() {
@@ -764,6 +965,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
})
})
.inner;
+ crate::scenario::publish_rect("agent_chat:mode", r.rect);
crate::scenario::publish_handle("agent_chat:mode", r.rect.center());
r.on_hover_text(tr("ui.ai_agent_mode_tip"));
if let Some(m) = pick {
@@ -777,6 +979,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
let mut pick: Option = None;
let r = ui
.allocate_ui(vec2(t.form_label_width, t.control_height), |ui| {
+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Truncate);
ui_kit::dropdown_menu(ui, "sc_agent_model", &cur, |ui| {
for m in &list {
let row = ui_kit::list_picker(ui, &m.id, &m.name, m.id == app.agent_chat.model);
@@ -789,6 +992,7 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
})
})
.inner;
+ crate::scenario::publish_rect("agent_chat:model", r.rect);
crate::scenario::publish_handle("agent_chat:model", r.rect.center());
r.on_hover_text(tr("ui.agent_chat_model_tip"));
if let Some(m) = pick {
@@ -796,6 +1000,21 @@ fn switcher(app: &mut SolveApp, ui: &mut egui::Ui) {
}
}
});
+ ui.horizontal(|ui| {
+ let b = if app.agent_chat.state().running() {
+ ui_kit::button(ui, tr("ui.agent_chat_stop"), ui_kit::Button::Normal).on_hover_text(tr("ui.agent_chat_stop_tip"))
+ } else {
+ ui_kit::button(ui, tr("ui.agent_chat_connect"), ui_kit::Button::Normal)
+ };
+ crate::scenario::publish_handle("agent_chat:connect", b.rect.center());
+ if b.clicked() {
+ if app.agent_chat.state().running() {
+ disconnect(app);
+ } else {
+ connect(app, ui.ctx());
+ }
+ }
+ });
if let Some(a) = &app.agent_chat.auth_status {
ui.label(RichText::new(a).color(t.text_dim).size(crate::theme::Tokens::get().font_small));
}
@@ -910,9 +1129,7 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
for (n, item) in app.agent_chat.items.iter().enumerate() {
match item {
Item::User { text, image, pictures, files } => {
- ui.add_space(6.0);
- egui::Frame::NONE.fill(t.accent_soft).corner_radius(6.0).inner_margin(egui::Margin::same(6)).show(ui, |ui| {
- ui.set_width(ui.available_width());
+ ui_kit::assistant_bubble(ui, |ui| {
if !text.is_empty() {
ui.add(egui::Label::new(RichText::new(text).color(t.text)).selectable(true).wrap());
}
@@ -931,11 +1148,21 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
if *thought {
ui.add(egui::Label::new(RichText::new(text).italics().color(t.text_dim)).selectable(true).wrap());
} else {
- super::markdown_view::show(ui, n, text);
+ ui_kit::assistant_prose(ui, |ui| super::markdown_view::show(ui, n, text));
}
}
- Item::Tool { title, kind, status, output, .. } => {
- tool_card(ui, n, title, kind, *status, output.as_deref());
+ Item::Tool { .. } => {
+ if n > 0 && matches!(app.agent_chat.items.get(n - 1), Some(Item::Tool { .. })) {
+ continue;
+ }
+ ui_kit::assistant_tool_frame(ui, false, |ui| {
+ ui.spacing_mut().item_spacing.y = Tokens::get().space_2;
+ for (offset, next) in app.agent_chat.items.iter().skip(n).take_while(|next| matches!(next, Item::Tool { .. })).enumerate() {
+ if let Item::Tool { title, kind, status, output, .. } = next {
+ tool_card(ui, n + offset, title, kind, *status, output.as_deref());
+ }
+ }
+ });
}
Item::Plan(entries) => {
for (c, s) in entries {
@@ -951,36 +1178,41 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
}
}
Item::Permission { title, options, answer: given, .. } => {
- egui::Frame::group(ui.style()).stroke(Stroke::new(1.0, t.accent)).show(ui, |ui| {
- ui.set_width(ui.available_width());
- ui.label(RichText::new(trf("ui.agent_chat_permission", &[("title", title)])).semibold().color(crate::theme::Tokens::get().text));
- match given {
- Some(a) => {
- ui.label(RichText::new(trf("ui.agent_chat_answered", &[("option", a)])).color(t.text_dim));
- }
- None => {
- ui.horizontal_wrapped(|ui| {
- for o in options {
- let r = if o.kind.starts_with("allow") {
- ui_kit::primary_button(ui, &o.name)
- } else {
- ui_kit::button(ui, &o.name, ui_kit::Button::Normal)
- };
+ ui_kit::assistant_approval(ui, &trf("ui.agent_chat_permission", &[("title", title)]), |ui| match given {
+ Some(a) => {
+ ui.label(RichText::new(trf("ui.agent_chat_answered", &[("option", a)])).color(t.text_dim));
+ }
+ None => {
+ ui_kit::assistant_actions(ui, |ui| {
+ for o in options.iter().filter(|o| o.kind == "allow_once").chain(options.iter().filter(|o| o.kind == "allow_always")) {
+ let r = if o.kind == "allow_once" {
+ ui_kit::primary_button(ui, &o.name)
+ } else {
+ ui_kit::button(ui, &o.name, ui_kit::Button::Normal)
+ };
+ crate::scenario::publish_handle(&format!("agent_chat:permission:{}", o.id), r.rect.center());
+ if r.clicked() {
+ answer = Some((n, Some(o.id.clone())));
+ }
+ }
+ ui.with_layout(Layout::left_to_right(Align::Center).with_main_wrap(true), |ui| {
+ for o in options.iter().filter(|o| !matches!(o.kind.as_str(), "allow_once" | "allow_always")) {
+ let r = ui_kit::button(ui, &o.name, ui_kit::Button::Normal);
crate::scenario::publish_handle(&format!("agent_chat:permission:{}", o.id), r.rect.center());
if r.clicked() {
answer = Some((n, Some(o.id.clone())));
}
}
});
- }
+ });
}
});
}
Item::Approval { id, title, tool, answer: given } => {
- egui::Frame::group(ui.style()).stroke(Stroke::new(1.5, t.warning)).show(ui, |ui| {
- ui.set_width(ui.available_width());
- ui.label(RichText::new(tr("ui.agent_chat_approval")).semibold().color(crate::theme::Tokens::get().text));
- ui.add(egui::Label::new(RichText::new(title).monospace().size(crate::theme::Tokens::get().font_caption)).selectable(true).wrap());
+ ui_kit::assistant_approval(ui, tr("ui.agent_chat_approval"), |ui| {
+ ui_kit::assistant_tool_detail(ui, |ui| {
+ ui.add(egui::Label::new(RichText::new(title).monospace().size(t.font_caption)).selectable(true).wrap());
+ });
match given {
Some(true) => {
ui.label(RichText::new(tr("ui.agent_chat_allowed")).color(t.text_dim));
@@ -989,11 +1221,15 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
ui.label(RichText::new(tr("ui.agent_chat_denied")).color(t.text_dim));
}
None => {
- ui.horizontal(|ui| {
- let allow = ui_kit::primary_button(ui, tr("ui.agent_chat_allow"));
+ ui_kit::assistant_actions(ui, |ui| {
+ let allow = ui_kit::primary_button(ui, tr("ui.agent_chat_allow_once"));
let always = ui_kit::button(ui, tr("ui.ai_always_allow"), ui_kit::Button::Normal)
.on_hover_text(trf("ui.ai_always_allow_tip", &[("tool", tool)]));
- let deny = ui_kit::button(ui, tr("ui.agent_chat_deny"), ui_kit::Button::Normal);
+ let deny = ui
+ .with_layout(Layout::left_to_right(Align::Center), |ui| {
+ ui_kit::button(ui, tr("ui.agent_chat_deny"), ui_kit::Button::Normal)
+ })
+ .inner;
crate::scenario::publish_handle("agent_chat:allow", allow.rect.center());
crate::scenario::publish_handle("agent_chat:always", always.rect.center());
crate::scenario::publish_handle("agent_chat:deny", deny.rect.center());
@@ -1027,10 +1263,11 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
});
}
Item::Notice { text, error } => {
- ui.label(RichText::new(text).color(if *error { t.error } else { t.text_dim }));
+ ui_kit::assistant_banner(ui, if *error { ui_kit::AssistantTone::Error } else { ui_kit::AssistantTone::Neutral }, |ui| {
+ ui.label(RichText::new(text).color(if *error { t.error } else { t.text_dim }));
+ });
}
}
- ui.add_space(2.0);
}
let (mut send_now_clicked, mut send_queue_clicked) = (false, false);
let mut remove: Option = None;
@@ -1042,50 +1279,55 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
let mut edit_buf = editing.as_ref().map(|(_, b)| b.clone());
for (n, p) in app.agent_chat.pending.iter().enumerate() {
ui.add_space(6.0);
- egui::Frame::NONE.fill(t.panel).stroke(Stroke::new(1.0, t.accent)).corner_radius(6.0).inner_margin(egui::Margin::same(6)).show(ui, |ui| {
- ui.set_width(ui.available_width());
- ui.horizontal(|ui| {
- let tag = if stopped && !busy { "ui.agent_chat_queued_stopped" } else { "ui.agent_chat_queued" };
- ui.label(RichText::new(tr(tag)).color(t.accent).semibold().size(crate::theme::Tokens::get().font_small));
- ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
- let x = ui_kit::button(ui, "×", ui_kit::Button::Small).on_hover_text(tr("ui.agent_chat_remove"));
- crate::scenario::publish_handle(&format!("agent_chat:pending_remove:{n}"), x.rect.center());
- if x.clicked() {
- remove = Some(n);
- }
- if editing.as_ref().is_none_or(|(i, _)| *i != n) {
- let e = ui_kit::button(ui, tr("ui.agent_chat_edit"), ui_kit::Button::Small);
- crate::scenario::publish_handle(&format!("agent_chat:pending_edit:{n}"), e.rect.center());
- if e.clicked() {
- start_edit = Some((n, p.text.clone()));
+ Container::new(ui.ctx(), Surface::Panel)
+ .edge_frame(t.panel)
+ .stroke(Stroke::new(1.0, t.accent))
+ .corner_radius(6.0)
+ .inner_margin(egui::Margin::same(6))
+ .show(ui, |ui| {
+ ui.set_width(ui.available_width());
+ ui.horizontal(|ui| {
+ let tag = if stopped && !busy { "ui.agent_chat_queued_stopped" } else { "ui.agent_chat_queued" };
+ ui.label(RichText::new(tr(tag)).color(t.accent).semibold().size(crate::theme::Tokens::get().font_small));
+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
+ let x = ui_kit::button(ui, "×", ui_kit::Button::Small).on_hover_text(tr("ui.agent_chat_remove"));
+ crate::scenario::publish_handle(&format!("agent_chat:pending_remove:{n}"), x.rect.center());
+ if x.clicked() {
+ remove = Some(n);
}
- }
- });
- });
- match (&editing, edit_buf.as_mut()) {
- (Some((i, _)), Some(buf)) if *i == n => {
- let te = ui_kit::message_field(ui, Id::new(("sc_agent_pending_input", n)), buf, "");
- crate::scenario::publish_rect("agent_chat:pending_input", te.rect);
- ui.horizontal(|ui| {
- if ui_kit::button(ui, tr("ui.agent_chat_save"), ui_kit::Button::Normal).clicked() {
- edit_done = Some((n, Some(buf.clone())));
- }
- if ui_kit::button(ui, tr("ui.agent_chat_cancel"), ui_kit::Button::Normal).clicked() {
- edit_done = Some((n, None));
+ if editing.as_ref().is_none_or(|(i, _)| *i != n) {
+ let e = ui_kit::button(ui, tr("ui.agent_chat_edit"), ui_kit::Button::Small);
+ crate::scenario::publish_handle(&format!("agent_chat:pending_edit:{n}"), e.rect.center());
+ if e.clicked() {
+ start_edit = Some((n, p.text.clone()));
+ }
}
});
- }
- _ => {
- if !p.text.is_empty() {
- ui.add(egui::Label::new(RichText::new(&p.text).color(t.text)).selectable(true).wrap());
+ });
+ match (&editing, edit_buf.as_mut()) {
+ (Some((i, _)), Some(buf)) if *i == n => {
+ let te = ui_kit::message_field(ui, Id::new(("sc_agent_pending_input", n)), buf, "");
+ crate::scenario::publish_rect("agent_chat:pending_input", te.rect);
+ ui.horizontal(|ui| {
+ if ui_kit::button(ui, tr("ui.agent_chat_save"), ui_kit::Button::Normal).clicked() {
+ edit_done = Some((n, Some(buf.clone())));
+ }
+ if ui_kit::button(ui, tr("ui.agent_chat_cancel"), ui_kit::Button::Normal).clicked() {
+ edit_done = Some((n, None));
+ }
+ });
}
- if p.image {
- ui.label(RichText::new(tr("ui.agent_chat_view_attached")).color(t.text_dim).size(crate::theme::Tokens::get().font_small));
+ _ => {
+ if !p.text.is_empty() {
+ ui.add(egui::Label::new(RichText::new(&p.text).color(t.text)).selectable(true).wrap());
+ }
+ if p.image {
+ ui.label(RichText::new(tr("ui.agent_chat_view_attached")).color(t.text_dim).size(crate::theme::Tokens::get().font_small));
+ }
+ files_line(ui, p.files.iter().map(|f| f.name.as_str()));
}
- files_line(ui, p.files.iter().map(|f| f.name.as_str()));
}
- }
- });
+ });
}
if !app.agent_chat.pending.is_empty() && editing.is_none() {
ui.horizontal(|ui| {
@@ -1106,10 +1348,18 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
slot.1 = buf;
}
if app.agent_chat.items.is_empty() && app.agent_chat.pending.is_empty() {
- ui.add_space(12.0);
- ui.label(RichText::new(tr("ui.agent_chat_intro")).color(t.text_dim));
- ui.add_space(6.0);
- ui.label(RichText::new(tr("ui.agent_chat_privacy")).color(t.text_dim).size(crate::theme::Tokens::get().font_small));
+ if agents::entries(app).is_empty() && app.agent_chat.detecting.is_none() {
+ ui_kit::assistant_empty(ui, tr("ui.agent_chat_setup_title"), tr("ui.agent_chat_setup_body"), |ui| {
+ if ui_kit::primary_button(ui, tr("ui.agent_chat_open_settings")).clicked() {
+ crate::prefs::open_at(app, crate::prefs::PAGE_AI);
+ }
+ });
+ } else {
+ ui_kit::assistant_prose(ui, |ui| {
+ ui.label(RichText::new(tr("ui.agent_chat_intro")).color(t.text_dim));
+ ui.label(RichText::new(tr("ui.agent_chat_privacy")).color(t.text_dim).size(t.font_small));
+ });
+ }
}
if let Some((n, text)) = edit_done {
if let (Some(text), Some(p)) = (text.filter(|t| !t.trim().is_empty()), app.agent_chat.pending.get_mut(n)) {
@@ -1340,57 +1590,53 @@ fn add_menu(app: &mut SolveApp, ui: &mut egui::Ui) {
#[cfg(not(target_arch = "wasm32"))]
fn tool_card(ui: &mut egui::Ui, n: usize, title: &str, kind: &str, status: Option, output: Option<&str>) {
let t = Tokens::get();
- let (color, filled, state) = match status {
- Some(ToolStatus::Completed) => (t.accent, true, "ui.ai_tool_done"),
- Some(ToolStatus::Failed) => (t.error, true, "ui.ai_tool_failed"),
- Some(ToolStatus::InProgress) => (t.warning, true, "ui.ai_tool_running"),
- _ => (t.text_dim, false, "ui.ai_tool_waiting"),
+ let (color, mark, state) = match status {
+ Some(ToolStatus::Completed) => (t.form_success, ui_kit::AssistantToolState::Done, "ui.ai_tool_done"),
+ Some(ToolStatus::Failed) => (t.error, ui_kit::AssistantToolState::Failed, "ui.ai_tool_failed"),
+ Some(ToolStatus::InProgress) => (t.accent, ui_kit::AssistantToolState::Running, "ui.ai_tool_running"),
+ _ => (t.text_dim, ui_kit::AssistantToolState::Pending, "ui.ai_tool_waiting"),
};
- egui::Frame::NONE.fill(t.toolbar).stroke(Stroke::new(1.0, t.border)).corner_radius(6.0).inner_margin(egui::Margin::symmetric(6, 3)).show(
- ui,
- |ui| {
- ui.set_width(ui.available_width());
- let id = ui.make_persistent_id(("sc_agent_tool", n));
- let mut state_ = egui::collapsing_header::CollapsingState::load_with_default_open(ui.ctx(), id, false);
- let head = ui.horizontal(|ui| {
+ ui_kit::assistant_tool_row(ui, status == Some(ToolStatus::Failed), |ui| {
+ ui.set_width(ui.available_width());
+ let id = ui.make_persistent_id(("sc_agent_tool", n));
+ let mut state_ = egui::collapsing_header::CollapsingState::load_with_default_open(ui.ctx(), id, false);
+ let head = ui.allocate_ui_with_layout(vec2(ui.available_width(), t.control_height + t.space_2), Layout::left_to_right(Align::Center), |ui| {
+ ui.spacing_mut().item_spacing.x = t.space_8;
+ ui_kit::assistant_tool_status(ui, mark);
+ ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
if output.is_some() {
- let (rect, _) = ui.allocate_exact_size(vec2(t.form_section_icon_size, t.form_section_icon_size), Sense::hover());
+ let (rect, _) = ui.allocate_exact_size(vec2(t.space_14, t.space_14), Sense::hover());
ui_kit::disclosure(ui.painter(), rect.center(), state_.is_open(), t.text_dim);
}
- status_dot(ui, color, filled);
- // The state and kind keep their room at the right; the title is cut short before them.
- ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
- ui.label(RichText::new(tr(state)).size(crate::theme::Tokens::get().font_panel).color(color));
- if !kind.is_empty() && kind != "other" {
- ui.label(RichText::new(kind).size(crate::theme::Tokens::get().font_panel).color(t.text_dim));
- }
- ui.with_layout(Layout::left_to_right(Align::Center), |ui| {
- ui.add(
- egui::Label::new(RichText::new(title).monospace().size(crate::theme::Tokens::get().font_caption).color(t.text))
- .truncate(),
- )
- .on_hover_text(title);
- });
+ ui.label(RichText::new(tr(state)).size(t.font_small).color(color));
+ if !kind.is_empty() && kind != "other" {
+ ui.label(RichText::new(kind).size(t.font_small).color(t.text_dim));
+ }
+ ui.with_layout(Layout::left_to_right(Align::Center), |ui| {
+ ui.add(egui::Label::new(RichText::new(title).monospace().size(t.font_caption).color(t.text)).truncate()).on_hover_text(title);
});
});
- let click = ui.interact(head.response.rect, id.with("head"), Sense::click());
- crate::scenario::publish_handle(&format!("agent_chat:tool:{n}"), head.response.rect.center());
- if output.is_some() && click.clicked() {
- state_.toggle(ui);
- }
- if output.is_some() {
- click.on_hover_text(tr("ui.ai_tool_unfold"));
- }
- state_.show_body_unindented(ui, |ui| {
- if let Some(o) = output {
- ui.separator();
- egui::ScrollArea::vertical().id_salt(("sc_agent_tool_out", n)).max_height(180.0).show(ui, |ui| {
- ui.add(egui::Label::new(RichText::new(o).monospace().size(crate::theme::Tokens::get().font_small)).selectable(true).wrap());
+ });
+ let click = ui.interact(head.response.rect, id.with("head"), Sense::click());
+ crate::scenario::publish_handle(&format!("agent_chat:tool:{n}"), head.response.rect.center());
+ if output.is_some() && click.clicked() {
+ state_.toggle(ui);
+ }
+ if output.is_some() {
+ click.on_hover_text(tr("ui.ai_tool_unfold"));
+ }
+ state_.show_body_unindented(ui, |ui| {
+ if let Some(o) = output {
+ ui.indent(id.with("detail"), |ui| {
+ ui_kit::assistant_tool_detail(ui, |ui| {
+ egui::ScrollArea::vertical().id_salt(("sc_agent_tool_out", n)).max_height(180.0).show(ui, |ui| {
+ ui.add(egui::Label::new(RichText::new(o).monospace().size(t.font_small)).selectable(true).wrap());
+ });
});
- }
- });
- },
- );
+ });
+ }
+ });
+ });
}
/// A small status mark drawn as a shape (no glyph a system font might lack): filled when the
@@ -1442,4 +1688,121 @@ mod tests {
toggle(&mut app);
assert!(!app.agent_chat.open);
}
+
+ #[test]
+ fn assistant_header_and_composer_keep_actions_inside_each_panel_width() {
+ for dark in [false, true] {
+ crate::theme::set_dark(dark);
+ for width in [280.0, 440.0, 760.0] {
+ let ctx = crate::fonts::test_context();
+ crate::theme::apply(&ctx);
+ let mut app = SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
+ app.agent_chat.detection = Some(discover::Detection::default());
+ app.agent_chat.picking = Some(false);
+ app.agent_chat.state = Some(State::Ready);
+ app.agent_chat.input = "Make a plate".to_string();
+ let input =
+ egui::RawInput { screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(width + 16.0, 720.0))), ..Default::default() };
+ for _ in 0..2 {
+ crate::scenario::clear_handles();
+ let mut output = ctx.run_ui(input.clone(), |ui| {
+ ui.set_width(width);
+ ui_kit::scope(ui, |ui| {
+ header(&mut app, ui, false);
+ desktop_body(&mut app, ui);
+ });
+ });
+ output.textures_delta.clear();
+ }
+ let controls: Vec<_> = ["close", "minimize", "newchat", "pop_out", "permissions", "send"]
+ .into_iter()
+ .map(|name| {
+ let key = format!("agent_chat:{name}");
+ let rect = crate::scenario::rect_of(&key).unwrap_or_else(|| panic!("missing {key}"));
+ assert!(rect.left() >= 0.0 && rect.right() <= width + 16.0, "{key} outside {width}: {rect:?}");
+ rect
+ })
+ .collect();
+ for (i, a) in controls.iter().enumerate() {
+ for b in controls.iter().skip(i + 1) {
+ assert!(!a.shrink(0.5).intersects(b.shrink(0.5)), "overlapping Assistant controls at {width}: {a:?} {b:?}");
+ }
+ }
+ }
+ }
+ }
+
+ #[test]
+ fn assistant_permissions_keep_provider_choices_and_responsive_approval_actions() {
+ for width in [280.0, 440.0, 760.0] {
+ let ctx = crate::fonts::test_context();
+ let mut app = SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
+ app.agent_chat.items.push(Item::Permission {
+ key: 4,
+ title: "Run solid.fillet".into(),
+ answer: None,
+ options: vec![
+ PermissionOption { id: "reject".into(), name: "Deny".into(), kind: "reject_once".into() },
+ PermissionOption { id: "remember".into(), name: "Always allow".into(), kind: "allow_always".into() },
+ PermissionOption { id: "once".into(), name: "Allow once".into(), kind: "allow_once".into() },
+ PermissionOption { id: "custom".into(), name: "Review details".into(), kind: "provider_specific".into() },
+ ],
+ });
+ let input = egui::RawInput { screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(width + 16.0, 720.0))), ..Default::default() };
+ crate::scenario::clear_handles();
+ let mut output = ctx.run_ui(input, |ui| {
+ ui.set_width(width);
+ ui_kit::scope(ui, |ui| conversation(&mut app, ui));
+ });
+ output.textures_delta.clear();
+ for id in ["reject", "remember", "once", "custom"] {
+ let at = crate::scenario::handle_at(&format!("agent_chat:permission:{id}")).expect("provider option retained");
+ assert!(at.x > 0.0 && at.x < width + 16.0, "choice outside {width}: {id} {at:?}");
+ }
+ let once = crate::scenario::handle_at("agent_chat:permission:once").expect("once");
+ let always = crate::scenario::handle_at("agent_chat:permission:remember").expect("always");
+ assert!(once.x > always.x, "primary once choice remains on the right");
+ assert_eq!(app.agent_chat.waiting(), 1, "drawing never answers an approval");
+ }
+ }
+
+ #[test]
+ fn assistant_agent_mode_and_model_wrap_without_escaping_narrow_width() {
+ let ctx = crate::fonts::test_context();
+ let mut app = SolveApp::new(solidcraft_engine::Session::default(), crate::Services::default());
+ app.agent_chat.state = Some(State::Ready);
+ app.agent_chat.detection = Some(discover::Detection::default());
+ app.agent_chat.agent_id = Some("fixture".into());
+ app.preferences.agents.push(agents::AgentConfig {
+ id: "fixture".into(),
+ name: "A coding agent with a long descriptive name".into(),
+ command: "fixture".into(),
+ ..Default::default()
+ });
+ app.agent_chat.modes = vec![("edit".into(), "A provider mode with a long descriptive label".into())];
+ app.agent_chat.mode = "edit".into();
+ app.agent_chat.models =
+ vec![acp::ModelInfo { id: "model".into(), name: "A model with a long descriptive label".into(), description: String::new() }];
+ app.agent_chat.model = "model".into();
+ let input = egui::RawInput { screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(296.0, 720.0))), ..Default::default() };
+ crate::scenario::clear_handles();
+ let mut output = ctx.run_ui(input, |ui| {
+ ui.set_width(280.0);
+ ui_kit::scope(ui, |ui| switcher(&mut app, ui));
+ });
+ output.textures_delta.clear();
+ let rects: Vec<_> = ["switcher", "mode", "model"]
+ .into_iter()
+ .map(|name| {
+ let rect = crate::scenario::rect_of(&format!("agent_chat:{name}")).expect("picker retained");
+ assert!(rect.left() >= 0.0 && rect.right() <= 296.0, "{name} outside narrow panel: {rect:?}");
+ rect
+ })
+ .collect();
+ for (n, a) in rects.iter().enumerate() {
+ for b in rects.iter().skip(n + 1) {
+ assert!(!a.shrink(0.5).intersects(b.shrink(0.5)), "picker overlap: {a:?} {b:?}");
+ }
+ }
+ }
}
diff --git a/crates/ui-egui/src/agent_chat/tests.rs b/crates/ui-egui/src/agent_chat/tests.rs
index d4ea32c87..04c215735 100644
--- a/crates/ui-egui/src/agent_chat/tests.rs
+++ b/crates/ui-egui/src/agent_chat/tests.rs
@@ -1468,12 +1468,17 @@ fn a_long_message_keeps_the_buttons_in_the_window() {
}
h.frames(4);
let bottom = |h: &crate::scenario::Harness| f64::from(h.app.agent_chat.panel_rect.map(|r| r.bottom()).expect("the panel is drawn"));
- let [_, rest] = h.widget("Send").expect("the Send button is drawn");
- let rest = bottom(&h) - rest;
+ let resting: Vec<_> = ["Send", "Attach view"]
+ .into_iter()
+ .map(|name| {
+ let [_, y] = h.widget(name).unwrap_or_else(|| panic!("{name} is drawn"));
+ (name, bottom(&h) - y)
+ })
+ .collect();
h.app.agent_chat.input = "Please make the plate thicker and then add a fillet on every outside edge.\n".repeat(60);
h.frames(8);
let window = 1000.0;
- for name in ["Send", "Attach view"] {
+ for (name, rest) in resting {
let [_, y] = h.widget(name).unwrap_or_else(|| panic!("{name} is drawn"));
assert!(y < window, "{name} is at {y}, below the window's bottom at {window}");
// The box is pinned to the bottom and grows upwards: the buttons stay where they were
diff --git a/crates/ui-egui/src/bom_panel.rs b/crates/ui-egui/src/bom_panel.rs
index d57c05522..a7cab4b1f 100644
--- a/crates/ui-egui/src/bom_panel.rs
+++ b/crates/ui-egui/src/bom_panel.rs
@@ -85,93 +85,93 @@ fn apply(app: &mut SolveApp, d: &mut BomPanel, row: &Value) {
pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let Some(mut d) = app.bom.take() else { return };
let t = Tokens::get();
- let mut open = true;
let bom = d.rows(app);
let rows: Vec = bom["rows"].as_array().cloned().unwrap_or_default();
let (mut export, mut apply_row) = (None, None);
- let title = RichText::new(crate::i18n::tr_label("Bill of Materials")).strong().size(t.font_button);
- crate::frame::window(ctx, title, crate::frame::Width::Wide).id(egui::Id::new("sc_bom")).open(&mut open).resizable(true).show(ctx, |ui| {
- ui.horizontal_wrapped(|ui| {
- let was = (d.top, d.by_definition, d.group_children);
- let mut levels = usize::from(d.top);
- let levels_width = crate::ui_kit::ContentWidth::button(ui, "Parts only").max(crate::ui_kit::ContentWidth::button(ui, "Top level")) * 2.0;
- ui.allocate_ui(egui::vec2(levels_width, crate::ui_kit::row_height()), |ui| {
- crate::ui_kit::segmented(ui, &mut levels, &["Parts only", "Top level"], Default::default());
- });
- d.top = levels == 1;
- ui.separator();
- let mut grouping = usize::from(d.by_definition);
- let grouping_width =
- crate::ui_kit::ContentWidth::button(ui, "By part number").max(crate::ui_kit::ContentWidth::button(ui, "By definition")) * 2.0;
- ui.allocate_ui(egui::vec2(grouping_width, crate::ui_kit::row_height()), |ui| {
- crate::ui_kit::segmented(ui, &mut grouping, &["By part number", "By definition"], Default::default());
- });
- d.by_definition = grouping == 1;
- ui.separator();
- crate::ui_kit::checkbox(ui, "Sub-parts in their part's row", &mut d.group_children);
- if was != (d.top, d.by_definition, d.group_children) {
- d.picked = None;
- }
- });
- ui.separator();
- egui::ScrollArea::vertical().max_height(320.0).show(ui, |ui| {
- egui::Grid::new("sc_bom_grid").num_columns(6).striped(true).spacing([14.0, 4.0]).show(ui, |ui| {
- for h in ["Item", "Part number", "Description", "Rev", "Qty", "Definition"] {
- ui.label(RichText::new(h).strong().color(t.text_dim));
+ let closed =
+ crate::ui_kit::Window::new(egui::Id::new("sc_bom"), "bom", crate::i18n::tr_label("Bill of Materials")).cards(3.0).show_body(ctx, |ui| {
+ ui.horizontal_wrapped(|ui| {
+ let was = (d.top, d.by_definition, d.group_children);
+ let mut levels = usize::from(d.top);
+ let levels_width =
+ crate::ui_kit::ContentWidth::button(ui, "Parts only").max(crate::ui_kit::ContentWidth::button(ui, "Top level")) * 2.0;
+ ui.allocate_ui(egui::vec2(levels_width, crate::ui_kit::row_height()), |ui| {
+ crate::ui_kit::segmented(ui, &mut levels, &["Parts only", "Top level"], Default::default());
+ });
+ d.top = levels == 1;
+ ui.separator();
+ let mut grouping = usize::from(d.by_definition);
+ let grouping_width =
+ crate::ui_kit::ContentWidth::button(ui, "By part number").max(crate::ui_kit::ContentWidth::button(ui, "By definition")) * 2.0;
+ ui.allocate_ui(egui::vec2(grouping_width, crate::ui_kit::row_height()), |ui| {
+ crate::ui_kit::segmented(ui, &mut grouping, &["By part number", "By definition"], Default::default());
+ });
+ d.by_definition = grouping == 1;
+ ui.separator();
+ crate::ui_kit::checkbox(ui, "Sub-parts in their part's row", &mut d.group_children);
+ if was != (d.top, d.by_definition, d.group_children) {
+ d.picked = None;
}
- ui.end_row();
- for (i, row) in rows.iter().enumerate() {
- let picked = d.picked == Some(i);
- if crate::ui_kit::list_picker(ui, &i.to_string(), &text(row, "item"), picked).clicked() {
- d.picked = if picked { None } else { Some(i) };
- d.fields = [text(row, "part_number"), text(row, "description"), text(row, "revision")];
+ });
+ ui.separator();
+ egui::ScrollArea::vertical().max_height(320.0).show(ui, |ui| {
+ egui::Grid::new("sc_bom_grid").num_columns(6).striped(true).spacing([14.0, 4.0]).show(ui, |ui| {
+ for h in ["Item", "Part number", "Description", "Rev", "Qty", "Definition"] {
+ ui.label(RichText::new(h).strong().color(t.text_dim));
}
- ui.label(text(row, "part_number"));
- ui.label(text(row, "description"));
- ui.label(text(row, "revision"));
- ui.label(text(row, "count"));
- ui.label(RichText::new(text(row, "definition")).color(t.text_dim));
ui.end_row();
- for c in row["children"].as_array().into_iter().flatten() {
- ui.label(RichText::new(text(c, "item")).color(t.text_dim));
- ui.label(text(c, "part_number"));
- ui.label(text(c, "description"));
- ui.label(text(c, "revision"));
- ui.label(text(c, "count"));
- ui.label(RichText::new(text(c, "definition")).color(t.text_dim));
+ for (i, row) in rows.iter().enumerate() {
+ let picked = d.picked == Some(i);
+ if crate::ui_kit::list_picker(ui, &i.to_string(), &text(row, "item"), picked).clicked() {
+ d.picked = if picked { None } else { Some(i) };
+ d.fields = [text(row, "part_number"), text(row, "description"), text(row, "revision")];
+ }
+ ui.label(text(row, "part_number"));
+ ui.label(text(row, "description"));
+ ui.label(text(row, "revision"));
+ ui.label(text(row, "count"));
+ ui.label(RichText::new(text(row, "definition")).color(t.text_dim));
+ ui.end_row();
+ for c in row["children"].as_array().into_iter().flatten() {
+ ui.label(RichText::new(text(c, "item")).color(t.text_dim));
+ ui.label(text(c, "part_number"));
+ ui.label(text(c, "description"));
+ ui.label(text(c, "revision"));
+ ui.label(text(c, "count"));
+ ui.label(RichText::new(text(c, "definition")).color(t.text_dim));
+ ui.end_row();
+ }
+ }
+ });
+ });
+ ui.label(RichText::new(format!("{} rows, {} placed", rows.len(), text(&bom, "total_occurrences"))).small().color(t.text_dim));
+ if let Some(row) = d.picked.and_then(|i| rows.get(i)) {
+ ui.separator();
+ egui::Grid::new("sc_bom_edit").num_columns(2).spacing([12.0, 6.0]).show(ui, |ui| {
+ for (label, field) in ["Part number", "Description", "Revision"].into_iter().zip(d.fields.iter_mut()) {
+ ui.label(label);
+ ui.allocate_ui(egui::vec2(280.0, crate::ui_kit::row_height()), |ui| {
+ crate::ui_kit::cell_editor(ui, ui.make_persistent_id(label), field, label, false);
+ });
ui.end_row();
}
+ });
+ if crate::ui_kit::button(ui, "Apply", crate::ui_kit::Button::Normal).clicked() {
+ apply_row = Some(row.clone());
}
- });
- });
- ui.label(RichText::new(format!("{} rows, {} placed", rows.len(), text(&bom, "total_occurrences"))).small().color(t.text_dim));
- if let Some(row) = d.picked.and_then(|i| rows.get(i)) {
+ }
+ if let Some(e) = &d.error {
+ ui.label(RichText::new(e).color(t.error));
+ }
ui.separator();
- egui::Grid::new("sc_bom_edit").num_columns(2).spacing([12.0, 6.0]).show(ui, |ui| {
- for (label, field) in ["Part number", "Description", "Revision"].into_iter().zip(d.fields.iter_mut()) {
- ui.label(label);
- ui.allocate_ui(egui::vec2(280.0, crate::ui_kit::row_height()), |ui| {
- crate::ui_kit::cell_editor(ui, ui.make_persistent_id(label), field, label, false);
- });
- ui.end_row();
+ ui.horizontal(|ui| {
+ for (label, ext) in [("Export CSV…", "csv"), ("Export JSON…", "json")] {
+ if crate::ui_kit::button(ui, label, crate::ui_kit::Button::Normal).clicked() {
+ export = Some(ext);
+ }
}
});
- if crate::ui_kit::button(ui, "Apply", crate::ui_kit::Button::Normal).clicked() {
- apply_row = Some(row.clone());
- }
- }
- if let Some(e) = &d.error {
- ui.label(RichText::new(e).color(t.error));
- }
- ui.separator();
- ui.horizontal(|ui| {
- for (label, ext) in [("Export CSV…", "csv"), ("Export JSON…", "json")] {
- if crate::ui_kit::button(ui, label, crate::ui_kit::Button::Normal).clicked() {
- export = Some(ext);
- }
- }
});
- });
if let Some(row) = apply_row {
apply(app, &mut d, &row);
}
@@ -180,7 +180,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
params["format"] = json!(ext);
app.pick_save_command(&format!("bill-of-materials.{ext}"), &[ext], "assembly.bom", params);
}
- if open {
+ if !closed {
app.bom = Some(d);
}
}
diff --git a/crates/ui-egui/src/browser.rs b/crates/ui-egui/src/browser.rs
index a2c9791fc..1cbb00d07 100644
--- a/crates/ui-egui/src/browser.rs
+++ b/crates/ui-egui/src/browser.rs
@@ -6,6 +6,7 @@
//! viewport, a double-click on a sketch edits it, and a right-click opens the item's menu
//! ([`crate::context_menu`]).
+use crate::ui_kit::{Container, Surface};
#[cfg(test)]
#[path = "occurrence_ui_tests.rs"]
mod occurrence_ui_tests;
@@ -662,10 +663,6 @@ fn lit_row((selected, hovered): (bool, bool)) -> (bool, Mark) {
(selected, if selected || hovered { Mark::Here } else { Mark::None })
}
-pub fn browser(app: &mut SolveApp, ui: &mut egui::Ui) {
- browser_panel(app, ui);
-}
-
/// How narrow the browser sidebar may be dragged, and how wide (the viewport keeps the rest).
const MIN_BROWSER_WIDTH: f32 = 170.0;
const MAX_BROWSER_WIDTH: f32 = 620.0;
@@ -674,24 +671,6 @@ const BROWSER_RAIL: f32 = 6.0;
/// How opaque the floating browser's card is; the workspace shows through the rest.
const BROWSER_FLOAT_ALPHA: f32 = 0.4;
-fn browser_panel(app: &mut SolveApp, ui: &mut egui::Ui) {
- let t = Tokens::get();
- app.tree.order.clear();
- DRAWN.with(|d| d.borrow_mut().clear());
- OCCURRENCES.with(|d| d.borrow_mut().clear());
- let mut acts = Actions::default();
- let width = browser_width(app.preferences.browser_width);
- let panel = egui::Panel::left("sc_browser")
- .exact_size(width)
- .resizable(false)
- .frame(egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(t.space_6 as i8, t.space_6 as i8)))
- .show(ui, |ui| {
- browser_contents(app, ui, &mut acts, false);
- });
- resize_column(app, ui, panel.response.rect, width, "left-browser-rail");
- finish_browser(app, ui, acts);
-}
-
pub(crate) fn browser_width(remembered: f32) -> f32 {
if remembered.is_finite() { remembered.clamp(MIN_BROWSER_WIDTH, MAX_BROWSER_WIDTH) } else { crate::prefs::DEFAULT_BROWSER_WIDTH }
}
@@ -710,20 +689,24 @@ pub(crate) fn resize_column(app: &mut SolveApp, ui: &egui::Ui, rect: Rect, width
crate::scenario::publish_handle(handle, pos2(rect.right() - BROWSER_RAIL / 2.0, rect.center().y));
}
-/// One browser card for the floating shell and the docked shell's optional overlay.
-/// The preference keeps its translucent overlay semantics; the floating shell always has a card.
-pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {
+/// One content-hugging browser; the shared container supplies floating or flush compact chrome.
+pub fn browser(app: &mut SolveApp, ui: &mut egui::Ui) {
+ let available = ui.available_rect_before_wrap();
let t = Tokens::get();
app.tree.order.clear();
DRAWN.with(|d| d.borrow_mut().clear());
OCCURRENCES.with(|d| d.borrow_mut().clear());
let mut acts = Actions::default();
- let gap = crate::shell::SHELL_GAP;
- let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };
+ let stacked = crate::timeline_left::stacked(app);
+ let container =
+ Container::new(ui.ctx(), Surface::Panel).joined(crate::ui_kit::DockEdges { left: true, top: true, bottom: stacked, ..Default::default() });
+ let gap = container.gap();
let width = browser_width(app.preferences.browser_width);
let vertical = app.ui.show_timeline && app.preferences.timeline_left;
let mut available = available;
- let stacked = crate::timeline_left::stacked(app);
+ if !stacked {
+ available.min.x += crate::agent_chat::left_inset(app, available);
+ }
if vertical
&& !stacked
&& let Some(history) = app.shell.history
@@ -734,33 +717,38 @@ pub fn floating(app: &mut SolveApp, ui: &mut egui::Ui, available: Rect) {
let bounds = if stacked {
crate::timeline_left::stacked_rects(app, available).0
} else {
- floating_bounds(available, if vertical { None } else { app.shell.history }, if collapsed { t.space_24 + t.space_10 } else { width }, top_gap)
+ panel_bounds(available, if vertical { None } else { app.shell.history }, if collapsed { t.space_24 + t.space_10 } else { width }, gap)
};
app.shell.browser = None;
let min_height = HEADER_H + 2.0 * (CARD_INSET + 1.0);
if bounds.is_positive() && bounds.height() >= min_height {
- let fill = if app.preferences.browser_float { t.panel.gamma_multiply(BROWSER_FLOAT_ALPHA) } else { t.panel };
- let frame = crate::frame::shell_card(fill).inner_margin(CARD_INSET as i8);
+ let fill = if container.floating() && app.preferences.browser_float { t.panel.gamma_multiply(BROWSER_FLOAT_ALPHA) } else { t.panel };
+ let frame = container.frame(ui.ctx(), fill, crate::frame::Side::Left).inner_margin(CARD_INSET as i8);
let inner_width = (bounds.width() - frame.total_margin().sum().x).max(0.0);
let inner_height = (bounds.height() - frame.total_margin().sum().y).max(0.0);
- let card = crate::frame::area(egui::Id::new("sc_browser_card")).fixed_pos(bounds.min).order(egui::Order::Middle).show(ui.ctx(), |ui| {
- let response = frame.show(ui, |ui| {
- ui.set_width(inner_width);
- ui.set_max_height(inner_height);
- if stacked {
- ui.set_min_height(inner_height);
- ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, vec2(inner_width, inner_height))));
- }
- if collapsed {
- browser_collapsed_rail(app, ui);
- } else {
- browser_contents(app, ui, &mut acts, true);
+ let card = Container::new(ui.ctx(), Surface::Panel)
+ .area(egui::Id::new("sc_browser_card"))
+ .fixed_pos(bounds.min)
+ .order(egui::Order::Middle)
+ .show(ui.ctx(), |ui| {
+ let limits = Rect::from_min_max(available.min, pos2(available.right(), bounds.bottom()));
+ let response = container.show_frame(ui, frame, limits, |ui| {
+ ui.set_width(inner_width);
+ ui.set_max_height(inner_height);
+ if stacked {
+ ui.set_min_height(inner_height);
+ ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, vec2(inner_width, inner_height))));
+ }
+ if collapsed {
+ browser_collapsed_rail(app, ui);
+ } else {
+ browser_contents(app, ui, &mut acts, true);
+ }
+ });
+ if !collapsed {
+ resize_column(app, ui, response.response.rect, width, "left-browser-rail");
}
});
- if !collapsed {
- resize_column(app, ui, response.response.rect, width, "left-browser-rail");
- }
- });
let rect = card.response.rect;
app.shell.browser = Some(rect);
crate::scenario::publish_rect("browser:card", rect);
@@ -799,9 +787,8 @@ fn browser_collapsed_rail(app: &mut SolveApp, ui: &mut egui::Ui) {
);
}
-pub(crate) fn floating_bounds(available: Rect, history: Option, width: f32, top_gap: f32) -> Rect {
- let gap = crate::shell::SHELL_GAP;
- let min = available.min + vec2(gap, top_gap);
+pub(crate) fn panel_bounds(available: Rect, history: Option, width: f32, gap: f32) -> Rect {
+ let min = available.min + vec2(gap, 0.0);
let right = (available.right() - gap).max(min.x);
let bottom = history.map_or(available.bottom() - gap, |r| r.top() - gap).max(min.y);
Rect::from_min_max(min, pos2((min.x + width).min(right), bottom))
diff --git a/crates/ui-egui/src/browser_card_tests.rs b/crates/ui-egui/src/browser_card_tests.rs
index 263a40b02..7a208131f 100644
--- a/crates/ui-egui/src/browser_card_tests.rs
+++ b/crates/ui-egui/src/browser_card_tests.rs
@@ -34,8 +34,8 @@ fn browser_card_shrinks_and_scrolls_without_covering_history() {
h.call("ui.set", json!({"layout":"docked"}));
h.settle();
- assert!(rect_of("browser:card").is_none());
- assert_eq!(h.app.viewport.rect.unwrap().left(), 250.0);
+ assert_eq!(rect_of("browser:card").unwrap().left(), 0.0);
+ assert_eq!(h.app.viewport.rect.unwrap().left(), 0.0);
assert!(drawn_rows().iter().all(|(_, rect, _, _)| rect.height() == 26.0));
h.call("ui.set", json!({"layout":"floating"}));
h.app.tree.collapsed.insert("c0".into());
@@ -138,8 +138,8 @@ fn tiny_floating_windows_never_panic() {
}
}
-/// Both shell layouts share one tree and one saved width. Docked can switch its card
-/// back into a column; Floating keeps its card when the overlay preference is cleared.
+/// Both shell layouts share one content-hugging tree and one saved width.
+/// The translucency preference never creates a second browser renderer.
#[test]
fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences() {
let mut h = Harness::new();
@@ -150,15 +150,11 @@ fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences()
h.app.preferences.browser_float = overlay;
h.app.preferences.browser_width = 310.0;
h.settle();
- let card = mode == LayoutMode::Floating || overlay;
- assert_eq!(rect_of("browser:card").is_some(), card);
+ assert!(rect_of("browser:card").is_some());
assert_eq!(crate::scenario::handles("browser:header").len(), 1, "only one browser header");
assert_eq!(drawn_rows().iter().filter(|(name, ..)| name == "Untitled").count(), 1, "only one tree");
- if card {
- assert!((rect_of("browser:card").unwrap().width() - 310.0).abs() < 1.0);
- } else {
- assert_eq!(h.app.viewport.rect.unwrap().left(), 310.0);
- }
+ assert!((rect_of("browser:card").unwrap().width() - 310.0).abs() < 1.0);
+ assert_eq!(h.app.viewport.rect.unwrap().left(), 0.0);
let rail = handle_at("left-browser-rail").unwrap();
h.call("ui.drag", json!({"x0":rail.x,"y0":rail.y,"x1":rail.x+60.0,"y1":rail.y,"steps":6}));
h.settle();
@@ -167,7 +163,7 @@ fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences()
h.app.ui.layout = LayoutMode::Docked;
h.app.preferences.browser_float = false;
h.settle();
- assert!((h.app.viewport.rect.unwrap().left() - width).abs() < 1.0, "the column uses the card's saved width");
+ assert!((rect_of("browser:card").unwrap().width() - width).abs() < 1.0, "compact keeps the saved width");
}
}
}
@@ -213,12 +209,8 @@ fn resizing_browser_card_and_column_persists_width_including_floating_preference
h.settle();
let width = h.app.preferences.browser_width;
assert!(width > crate::prefs::DEFAULT_BROWSER_WIDTH + 40.0, "{mode:?}, float={float}, width={width}");
- if mode == LayoutMode::Floating || float {
- assert!((rect_of("browser:card").unwrap().width() - width).abs() < 1.0);
- assert_eq!(h.app.viewport.rect.unwrap(), before, "the card leaves the projection intact");
- } else {
- assert!((h.app.viewport.rect.unwrap().left() - width).abs() < 1.0);
- }
+ assert!((rect_of("browser:card").unwrap().width() - width).abs() < 1.0);
+ assert_eq!(h.app.viewport.rect.unwrap(), before, "browser resizing leaves the projection intact");
let mut restored = SolveApp::new(Default::default(), Default::default());
restored.load_prefs(&h.app.prefs());
assert_eq!(restored.preferences.browser_width, width);
@@ -235,7 +227,7 @@ fn browser_width_rejects_hostile_preferences_and_tiny_windows_still_fit() {
assert_eq!(browser_width(f32::MAX), MAX_BROWSER_WIDTH);
let available = Rect::from_min_size(Pos2::ZERO, vec2(100.0, 300.0));
for top_gap in [0.0, crate::shell::SHELL_GAP] {
- let bounds = floating_bounds(available, None, MAX_BROWSER_WIDTH, top_gap);
+ let bounds = panel_bounds(available, None, MAX_BROWSER_WIDTH, top_gap);
assert!(available.contains_rect(bounds));
}
}
@@ -269,7 +261,7 @@ fn collapsed_rail_shares_header_hover_inset_and_expands_from_its_whole_card() {
let bounds = Rect::from_min_size(Pos2::ZERO, vec2(600.0, 700.0));
let draw = |app: &mut SolveApp, events| {
crate::test_support::frame(&ctx, egui::RawInput { screen_rect: Some(bounds), events, ..Default::default() }, |ui| {
- floating(app, ui, bounds);
+ browser(app, ui);
})
};
for _ in 0..3 {
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 2203d74b4..e338c8541 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -5,6 +5,7 @@
//! command has its geometry, so typing a number sets the value at once; Enter applies, Tab
//! moves on, Esc cancels.
+use crate::ui_kit::{Container, Surface};
use egui::{Color32, Pos2, Stroke, vec2};
use solidcraft_engine::Sel;
use solidcraft_engine::doc::expr::Kind as ValueKind;
@@ -568,22 +569,26 @@ fn draw(app: &SolveApp, ui: &mut egui::Ui, painter: &egui::Painter, proj: &Proj,
fn value_box(ui: &mut egui::Ui, label: &str, value: &mut String, at: Pos2, select_all: bool) {
let t = Tokens::get();
let id = egui::Id::new("sc_canvas_value");
- crate::frame::area(egui::Id::new("sc_canvas_area")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
- egui::Frame::popup(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {
- ui.horizontal(|ui| {
- ui.label(egui::RichText::new(crate::i18n::tr_label(label)).color(t.text_dim).size(crate::theme::Tokens::get().font_caption));
- let r = ui.add(egui::TextEdit::singleline(value).id(id).desired_width(72.0));
- crate::params_dialog::complete(ui, &r, value);
- if select_all {
- r.request_focus();
- let n = value.chars().count();
- let mut st = egui::text_edit::TextEditState::load(ui.ctx(), id).unwrap_or_default();
- st.cursor.set_char_range(Some(egui::text_selection::CCursorRange::two(egui::text::CCursor::new(0), egui::text::CCursor::new(n))));
- st.store(ui.ctx(), id);
- }
+ Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new("sc_canvas_area")).fixed_pos(at).order(egui::Order::Foreground).show(
+ ui.ctx(),
+ |ui| {
+ Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {
+ ui.horizontal(|ui| {
+ ui.label(egui::RichText::new(crate::i18n::tr_label(label)).color(t.text_dim).size(crate::theme::Tokens::get().font_caption));
+ let r = crate::ui_kit::canvas_value_field(ui, id, value);
+ crate::params_dialog::complete(ui, &r, value);
+ if select_all {
+ r.request_focus();
+ let n = value.chars().count();
+ let mut st = egui::text_edit::TextEditState::load(ui.ctx(), id).unwrap_or_default();
+ st.cursor
+ .set_char_range(Some(egui::text_selection::CCursorRange::two(egui::text::CCursor::new(0), egui::text::CCursor::new(n))));
+ st.store(ui.ctx(), id);
+ }
+ });
});
- });
- });
+ },
+ );
}
/// How far (logical points) from an arrow's stem a press still takes the arrow.
@@ -1178,9 +1183,13 @@ fn draw_revolve(
if to_mode {
// This badge is read-only. Its placement follows the model and can overlap the
// command dialog, whose buttons must keep receiving clicks.
- let area = crate::frame::area(egui::Id::new("sc_canvas_area")).fixed_pos(box_at).order(egui::Order::Foreground).interactable(false);
+ let area = Container::new(ui.ctx(), Surface::Canvas)
+ .area(egui::Id::new("sc_canvas_area"))
+ .fixed_pos(box_at)
+ .order(egui::Order::Foreground)
+ .interactable(false);
area.show(ui.ctx(), |ui| {
- egui::Frame::popup(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {
+ Container::popup_frame(ui.style()).inner_margin(egui::Margin::symmetric(6, 3)).show(ui, |ui| {
let text = if extent.curved_to {
"To surface".into()
} else if extent.sweep.is_finite() {
diff --git a/crates/ui-egui/src/colour_tokens_tests.rs b/crates/ui-egui/src/colour_tokens_tests.rs
index 8239e2330..700cd7371 100644
--- a/crates/ui-egui/src/colour_tokens_tests.rs
+++ b/crates/ui-egui/src/colour_tokens_tests.rs
@@ -29,9 +29,7 @@ fn moved_colours_keep_the_values_they_were_drawn_with() {
assert_eq!(t.analysis.access, [[0.20, 0.75, 0.30], [0.85, 0.22, 0.20]]);
assert_eq!(t.analysis.curvature, [[0.15, 0.35, 0.95], [0.10, 0.80, 0.25], [0.90, 0.15, 0.10]]);
assert!(!t.analysis.hatch);
- assert_eq!(t.app_bar_icon, [Color32::from_rgb(225, 230, 238), Color32::from_rgb(120, 140, 170), Color32::from_rgb(120, 190, 255)]);
assert_eq!(t.logo, [Color32::from_rgb(96, 158, 236), Color32::from_rgb(58, 136, 238), Color32::from_rgb(55, 108, 197), Color32::WHITE]);
- assert_eq!(t.icons.glint, Color32::from_white_alpha(160));
assert_eq!(t.icons.marker_halo, Color32::from_black_alpha(150));
assert_eq!(t.icons.agent, Color32::from_rgb(168, 85, 247));
}
@@ -59,7 +57,7 @@ fn analysis_colours_reach_the_shader_in_its_order() {
// Icons no longer take their colours from the caller or from `IconColors`: the SVG masters name
// palette roles (`assets/icons/ui/design/palette.toml`, light and dark, plus accents) that
// `icon_svg` resolves. `icon_svg`'s own tests hold that every master parses and that only the
-// palette's colours exist; the colour vision modes do not reach them yet.
+// palette's colours exist, including its colour-vision variants.
/// The most colour literals each UI file may hold, and why. None of them carries a meaning that a
/// colour vision mode must change. A file with more fails here: make the new colour a token in
@@ -75,7 +73,6 @@ const ALLOWED_LITERALS: &[(&str, usize, &str)] = &[
("dialogs_library.rs", 1, "a library appearance's swatch: the colour is the fact"),
("dialogs_assembly.rs", 1, "the interference fill, shaded from its token"),
("dialogs_motion.rs", 1, "a white outline"),
- ("frame.rs", 1, "the window shadow"),
("gizmo.rs", 2, "the gizmo's neutral grey ball"),
("icons.rs", 1, "the white tint that carries an icon image's opacity"),
("home.rs", 2, "thumbnail tints"),
diff --git a/crates/ui-egui/src/colour_vision_tests.rs b/crates/ui-egui/src/colour_vision_tests.rs
index dc63b066c..e2b1e3b9a 100644
--- a/crates/ui-egui/src/colour_vision_tests.rs
+++ b/crates/ui-egui/src/colour_vision_tests.rs
@@ -251,7 +251,6 @@ fn groups(t: &Tokens) -> Vec {
let lift = |c: Color32| {
Color32::from_rgb(c.r().saturating_add(t.hover_face_lift), c.g().saturating_add(t.hover_face_lift), c.b().saturating_add(t.hover_face_lift))
};
- let ic = &t.icons;
let a = &t.analysis;
let mut out = vec![
group(
@@ -337,37 +336,6 @@ fn groups(t: &Tokens) -> Vec {
&[("glyph_text", t.glyph_text), ("sketch_accent", t.sketch_accent), ("construction_geom", t.construction_geom)],
&[("toolbar", t.toolbar)],
),
- group(
- "origin icon",
- &[("icons.axes[0]", ic.axes[0]), ("icons.axes[1]", ic.axes[1]), ("icons.axes[2]", ic.axes[2])],
- &[("toolbar", t.toolbar)],
- ),
- group(
- "accessibility icon",
- &[("icons.access[0]", ic.access[0]), ("icons.access[1]", ic.access[1]), ("icon_fill", t.icon_fill), ("icon", t.icon)],
- &[],
- ),
- group("draft icon", &[("icons.draft[0]", ic.draft[0]), ("icons.draft[1]", ic.draft[1]), ("icon", t.icon)], &[]),
- group(
- "curvature icon",
- &[("icons.curvature[0]", ic.curvature[0]), ("icons.curvature[1]", ic.curvature[1]), ("icons.curvature[2]", ic.curvature[2])],
- &[],
- ),
- group(
- "appearance icon",
- &[("icons.paint[0]", ic.paint[0]), ("icons.paint[1]", ic.paint[1]), ("icons.paint[2]", ic.paint[2]), ("icon_fill", t.icon_fill)],
- &[],
- ),
- group("environment icon", &[("icons.sky", ic.sky), ("icons.floor", ic.floor), ("icons.highlight", ic.highlight)], &[]),
- group("warning icon", &[("icons.warning", ic.warning), ("icon", t.icon)], &[("toolbar", t.toolbar)]),
- group("interference icon", &[("icons.interference", ic.interference), ("icon", t.icon)], &[("toolbar", t.toolbar)]),
- group("folder icons", &[("icons.folder", ic.folder), ("icons.plane", ic.plane), ("icons.fold", ic.fold), ("icon", t.icon)], &[]),
- group("sheet icons", &[("icons.sheet", ic.sheet), ("icons.sheet_2", ic.sheet_2), ("icon", t.icon)], &[]),
- group(
- "app bar buttons",
- &[("app_bar_icon[0]", t.app_bar_icon[0]), ("app_bar_icon[1]", t.app_bar_icon[1]), ("app_bar_icon[2]", t.app_bar_icon[2])],
- &[("app_bar", t.app_bar)],
- ),
// Tab names and icons identify the tabs; each accent must read against the toolbar.
group("surface tab", &[("surface_accent", t.surface_accent)], &[("toolbar", t.toolbar)]),
group("mesh tab", &[("mesh_accent", t.mesh_accent)], &[("toolbar", t.toolbar)]),
@@ -478,6 +446,7 @@ const NO_MEANING: &[(&str, &str)] = &[
("render_accent", "the Render workspace's identity colour"),
// The window's chrome: grounds, text and borders (measured as grounds where meaning sits on them).
("panel_header", "chrome"),
+ ("icon", "neutral control ink; command artwork uses the SVG palette"),
("border", "chrome"),
("text_dim", "secondary text"),
("accent", "the one interface accent"),
@@ -485,8 +454,6 @@ const NO_MEANING: &[(&str, &str)] = &[
("dialog_bg", "chrome"),
("dialog_border", "chrome"),
("chip", "a label's ground"),
- ("heading_bg", "chrome"),
- ("subheading_bg", "chrome"),
("overlay", "a chip's ground over the view"),
("app_bar_text", "text"),
("app_bar_separator", "neutral chrome divider"),
@@ -528,10 +495,7 @@ const NO_MEANING: &[(&str, &str)] = &[
("analysis.hatch", "a flag: stripes on the failing faces"),
("logo[3]", "the mark's white edge"),
// Icon colours that are a shade of a measured one, or one mark alone.
- ("icons.sheet_light", "a lighter shade of a sheet"),
- ("icons.sheet_line", "lines on a sheet"),
- ("icons.glint", "a highlight"),
- ("icons.stripe", "zebra stripes, grey"),
+ ("icons.highlight", "white ink on viewport markers and the agent pointer"),
("icons.agent", "the agent's pointer, alone"),
("icons.marker_halo", "a dark halo under a marker"),
];
@@ -736,9 +700,6 @@ fn each_mode_changes_only_its_table() {
"analysis.draft",
"analysis.access",
"analysis.hatch",
- "icons.axes",
- "icons.access",
- "icons.draft",
"bend_up",
"bend_down",
"surface_accent",
diff --git a/crates/ui-egui/src/context_menu.rs b/crates/ui-egui/src/context_menu.rs
index 03fc3390f..1987e2b9c 100644
--- a/crates/ui-egui/src/context_menu.rs
+++ b/crates/ui-egui/src/context_menu.rs
@@ -11,6 +11,7 @@
//! state; [`items`] lists them and [`run_item`] runs one, so the control channel (`ui.menu`,
//! `ui.menuPick`) and tests reach everything a click does.
+use crate::ui_kit::{Container, Surface};
use egui::{Color32, Pos2, Rect, Sense, Vec2, pos2, vec2};
use serde::Serialize;
use serde_json::{Value, json};
@@ -1719,10 +1720,14 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let area = Rect::from_center_size(c, vec2(2.0 * (RX + 4.0), 2.0 * (RY + 4.0)));
inside |= pointer.is_some_and(|p| area.contains(p));
let hot = pointer.and_then(|p| sector(p - c));
- let resp = crate::frame::area(egui::Id::new("sc_marking_menu")).fixed_pos(area.min).order(egui::Order::Foreground).show(ctx, |ui| {
- let _ = ui.allocate_exact_size(area.size(), Sense::hover());
- picked = crate::ui_kit::radial_menu(ui, c, &radial, hot).or(picked.take());
- });
+ let resp = Container::new(ctx, Surface::Popup)
+ .area(egui::Id::new("sc_marking_menu"))
+ .fixed_pos(area.min)
+ .order(egui::Order::Foreground)
+ .show(ctx, |ui| {
+ let _ = ui.allocate_exact_size(area.size(), Sense::hover());
+ picked = crate::ui_kit::radial_menu(ui, c, &radial, hot).or(picked.take());
+ });
inside |= resp.response.contains_pointer();
list_place(c, list_height(&list), screen)
} else {
@@ -1750,8 +1755,12 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
}
let mut submenu_row = None;
let key_row = app.menu.key_row;
- let resp =
- crate::frame::area(egui::Id::new("sc_context_menu")).fixed_pos(list_at).constrain(true).order(egui::Order::Foreground).show(ctx, |ui| {
+ let resp = Container::new(ctx, Surface::Popup)
+ .area(egui::Id::new("sc_context_menu"))
+ .fixed_pos(list_at)
+ .constrain(true)
+ .order(egui::Order::Foreground)
+ .show(ctx, |ui| {
if target == Target::Workspace {
picked = crate::ui_kit::workspace_menu(ui, &list, key_row, (screen.bottom() - list_at.y).max(160.0)).or(picked.take());
} else {
@@ -1888,9 +1897,13 @@ fn show_rename(app: &mut SolveApp, ctx: &egui::Context) {
}
let Some(mut r) = app.menu.rename.take() else { return };
let mut done: Option = None;
- let resp = crate::frame::area(egui::Id::new("sc_rename")).fixed_pos(r.at).constrain(true).order(egui::Order::Foreground).show(ctx, |ui| {
- done = crate::ui_kit::rename_menu(ui, &mut r.text, &mut r.focused);
- });
+ let resp =
+ Container::new(ctx, Surface::Popup).area(egui::Id::new("sc_rename")).fixed_pos(r.at).constrain(true).order(egui::Order::Foreground).show(
+ ctx,
+ |ui| {
+ done = crate::ui_kit::rename_menu(ui, &mut r.text, &mut r.focused);
+ },
+ );
if ctx.input(|i| i.pointer.any_pressed()) && !resp.response.contains_pointer() && r.focused {
done = Some(true);
}
diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs
index 3826e9484..058815d7f 100644
--- a/crates/ui-egui/src/control.rs
+++ b/crates/ui-egui/src/control.rs
@@ -101,7 +101,7 @@ fn key_from(name: &str) -> Option {
fn execute(app: &mut SolveApp, id: &str, params: Value) -> Result {
let r = app.run(id, params);
if r.is_ok()
- && !matches!(id, "view.navigate" | "view.ambient_occlusion" | "view.graphics_preset" | "view.history_layout")
+ && !matches!(id, "view.layout" | "view.navigate" | "view.ambient_occlusion" | "view.graphics_preset" | "view.history_layout")
&& app.session.active_sketch.is_none()
&& app.session.world_state().bodies.len() == 1
&& app.session.undo.len() <= 2
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index db7bbbc28..b35585a01 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -987,12 +987,6 @@ impl Dialog {
})
}
- /// Dialogs holding a table get the wide limit.
- pub fn is_wide(&self) -> bool {
- (matches!(self.kind, Kind::PatternRect { .. }) && self.inputs.first().is_some_and(|i| i.accept == selection::FEATURES))
- || matches!(&self.kind, Kind::Motion(k) if k.wide())
- }
-
pub fn wants_picks(&self) -> bool {
!self.inputs.is_empty()
}
@@ -2260,7 +2254,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
}
// Physical materials: the library's, then the design's own (material.create).
let t = Tokens::get();
- let vp = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));
+ let vp = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));
// The Sketch Palette owns the right edge for as long as a sketch is being edited. A dialog
// started there docks at the left instead, so neither panel hides the other.
let side = if crate::sketch_palette::editing(app) && crate::sketch_palette::fits_beside_a_dialog(app, ctx) {
@@ -2278,7 +2272,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
// is open (#1335), kept inside the viewport.
let moved = crate::frame::dock_offset(ctx, title(&d.kind));
let docked = egui::pos2(side.anchor_x(vp), top);
- let anchor = crate::frame::offset_anchor(docked, moved, vp, side);
+ let drag_bounds = crate::shell::tool_drag_rect(app, vp);
+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);
let mut keep = true;
let mut ok = false;
let mut applied = false;
@@ -2310,8 +2305,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
Kind::ViewDxf { .. } => ("Export DXF…", "Cancel"),
_ => ("OK", "Cancel"),
};
- let panel =
- crate::ui_kit::Panel::new(&heading, egui::Id::new(("sc_dialog", title(&d.kind))), anchor, vp, side, frame).actions(ok_label, close_label);
+ let panel = crate::ui_kit::Panel::new(&heading, egui::Id::new(("sc_dialog", title(&d.kind))), anchor, drag_bounds, side, frame)
+ .actions(ok_label, close_label);
let panel = if matches!(d.kind, Kind::Appearance(_)) {
panel.width(t.form_card_width + t.form_label_width + t.space_6)
} else if wide {
@@ -2328,7 +2323,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let reset_scroll = d.reset_scroll;
let panel =
panel.reset_scroll(reset_scroll && matches!(d.kind, Kind::Appearance(_) | Kind::Motion(crate::dialogs_motion::Mo::Configurations { .. })));
- let window = panel.window();
+ let window = panel.window(ctx);
let repeatable =
matches!(&d.kind, Kind::SketchModify(k) if crate::sketch_modify_ui::repeatable(k)) && d.editing.is_none() && !d.extra.contains_key("pattern");
if let Kind::ConfirmDelete { with, fail, .. } = &d.kind {
@@ -2349,7 +2344,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
cancel = closed || action == crate::ui_kit::Action::Cancel;
app.viewport.dialog_rect = crate::scenario::rect_of("dialog:window");
} else {
- let response = window.frame(frame).open(&mut keep).show(ctx, |ui| {
+ let response = window.open(&mut keep).show(ctx, |ui| {
let spec = dense::command(&d.kind).and_then(solidcraft_engine::find_command);
let icon = spec.as_ref().map_or("", |s| s.icon);
let label = spec.as_ref().map_or(heading.as_str(), |s| tr(s.label));
diff --git a/crates/ui-egui/src/dialogs_assembly.rs b/crates/ui-egui/src/dialogs_assembly.rs
index 73780d802..350bae091 100644
--- a/crates/ui-egui/src/dialogs_assembly.rs
+++ b/crates/ui-egui/src/dialogs_assembly.rs
@@ -1225,7 +1225,7 @@ pub fn timeline_joints(app: &mut SolveApp, ui: &mut egui::Ui, p: &egui::Painter,
t.timeline_item
};
p.rect(br, 3.0, bg, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
- crate::icons::paint(p, br.shrink(4.0), "joint", if suppressed { t.border } else { t.icon }, t.icon_fill, t.accent);
+ crate::icons::paint_icon(p, br.shrink(4.0), "joint", f32::from((if suppressed { t.border } else { t.icon }).a()) / 255.0);
if suppressed {
p.line_segment([br.left_bottom() + vec2(4.0, -4.0), br.right_top() + vec2(-4.0, 4.0)], Stroke::new(1.5, t.text_dim));
}
@@ -1238,7 +1238,7 @@ pub fn timeline_joints(app: &mut SolveApp, ui: &mut egui::Ui, p: &egui::Painter,
if resp.secondary_clicked() && !app.tree.picked_joints.contains(&id) {
pick_joint(app, id, false);
}
- resp.context_menu(|ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));
+ crate::ui_kit::Menu::context(&resp, |ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));
x += 32.0;
}
if let Some((c, prm)) = run {
@@ -1276,7 +1276,7 @@ pub fn timeline_joints_vertical(app: &mut SolveApp, ui: &mut egui::Ui) {
ui.painter().rect_filled(rect, 3.0, t.hover);
}
let icon = egui::Rect::from_min_size(egui::pos2(rect.left() + 4.0, rect.top() + 4.0), vec2(22.0, 22.0));
- crate::icons::paint(ui.painter(), icon, "joint", if suppressed { t.border } else { t.icon }, t.icon_fill, t.accent);
+ crate::icons::paint_icon(ui.painter(), icon, "joint", f32::from((if suppressed { t.border } else { t.icon }).a()) / 255.0);
if suppressed {
ui.painter().line_segment([icon.left_bottom(), icon.right_top()], Stroke::new(1.5, t.text_dim));
}
@@ -1296,7 +1296,7 @@ pub fn timeline_joints_vertical(app: &mut SolveApp, ui: &mut egui::Ui) {
if response.secondary_clicked() && !app.tree.picked_joints.contains(&id) {
pick_joint(app, id, false);
}
- response.context_menu(|ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));
+ crate::ui_kit::Menu::context(&response, |ui| joint_menu(app, ui, (id, kind, suppressed), &mut open, &mut run));
}
if let Some((command, params)) = run {
if command == "selection.delete" {
diff --git a/crates/ui-egui/src/dialogs_sheet_tests.rs b/crates/ui-egui/src/dialogs_sheet_tests.rs
index 20811737a..2f6bdd898 100644
--- a/crates/ui-egui/src/dialogs_sheet_tests.rs
+++ b/crates/ui-egui/src/dialogs_sheet_tests.rs
@@ -206,7 +206,7 @@ fn flat_pattern_islands_fit_before_the_actual_command_panel() {
ctx.run_ui(egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 900.0))), ..Default::default() }, |ui| {
crate::ui_kit::Panel::new("FLAT PATTERN", id, pos2(1400.0, 294.0), viewport, crate::frame::Side::Right, egui::Frame::NONE)
.width(360.0)
- .window()
+ .window(&ctx)
.show(ui.ctx(), |ui| {
ui.label("Flat size: 50 × 10 × 2.5 mm");
});
diff --git a/crates/ui-egui/src/dim_view.rs b/crates/ui-egui/src/dim_view.rs
index e0af566cc..7b4dd61b5 100644
--- a/crates/ui-egui/src/dim_view.rs
+++ b/crates/ui-egui/src/dim_view.rs
@@ -9,6 +9,7 @@
//! Everything acts through commands: `sketch.dimension_text`, `sketch.delete`,
//! `parameters.change`.
+use crate::ui_kit::{Container, Surface};
use std::cell::RefCell;
use std::sync::Arc;
@@ -720,8 +721,8 @@ fn edit_box(app: &mut SolveApp, ctx: &egui::Context) {
anchor.x = anchor.x.clamp(rect.left(), (rect.right() - popup_width - 6.0).max(rect.left()));
anchor.y = anchor.y.clamp(rect.top(), (rect.bottom() - 80.0).max(rect.top()));
}
- crate::frame::area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Foreground).show(ctx, |ui| {
- egui::Frame::popup(ui.style()).fill(Tokens::get().dialog_body).inner_margin(Tokens::get().space_4).show(ui, |ui| {
+ Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_dim_edit_area")).fixed_pos(anchor).order(egui::Order::Foreground).show(ctx, |ui| {
+ Container::popup_frame(ui.style()).fill(Tokens::get().dialog_body).inner_margin(Tokens::get().space_4).show(ui, |ui| {
crate::ui_kit::scope(ui, |ui| {
ui.set_max_width(popup_width);
crate::ui_kit::text(ui, &crate::i18n::format("dialog.dimension_name", &[("name", &e.param)]), crate::ui_kit::Text::Inline)
diff --git a/crates/ui-egui/src/documents.rs b/crates/ui-egui/src/documents.rs
index 06f1ca299..31b004942 100644
--- a/crates/ui-egui/src/documents.rs
+++ b/crates/ui-egui/src/documents.rs
@@ -4,6 +4,7 @@
//! Closing a design with unsaved changes asks first, and so does quitting: one "save changes?"
//! per design with unsaved changes ([`request_quit`]).
+use crate::ui_kit::{Container, Surface};
use egui::{FontId, Rect, Sense, pos2, vec2};
use serde_json::{Value, json};
use solidcraft_engine::Session;
@@ -529,8 +530,11 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {
ui.ctx().data_mut(|d| d.insert_temp(id, !d.get_temp::(id).unwrap_or(false)));
}
if ui.ctx().data(|d| d.get_temp::(id).unwrap_or(false)) {
- let resp =
- crate::frame::area(id.with("area")).fixed_pos(pos2(mr.left(), r.bottom())).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
+ let resp = Container::new(ui.ctx(), Surface::Popup)
+ .area(id.with("area"))
+ .fixed_pos(pos2(mr.left(), r.bottom()))
+ .order(egui::Order::Foreground)
+ .show(ui.ctx(), |ui| {
crate::context_menu::menu_frame(ui, |ui| {
for (i, (name, dirty)) in info.iter().enumerate() {
let label = format!("{name}{}", if *dirty { " •" } else { "" });
@@ -551,23 +555,24 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {
let mut many: Option> = None;
if let Some((i, at)) = menu.filter(|(i, _)| *i < n) {
let items = [("ui.closeTab", "Close"), ("ui.closeOtherTabs", "Close Other Tabs"), ("ui.closeAllTabs", "Close All Tabs")];
- let resp = crate::frame::area(menu_id.with("area")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
- crate::context_menu::menu_frame(ui, |ui| {
- let mut chosen = None;
- for (id, label) in items {
- let mut item = crate::context_menu::Item::action(id, label, "");
- item.enabled = id != "ui.closeOtherTabs" || n > 1;
- let top = ui.cursor().top();
- let row = crate::context_menu::list_row(ui, &item);
- let rect = Rect::from_min_max(pos2(ui.min_rect().left(), top), pos2(ui.min_rect().right(), ui.cursor().top()));
- crate::scenario::publish_handle(&format!("tab_menu:{id}"), rect.center());
- if row.is_some() {
- chosen = Some(id);
+ let resp =
+ Container::new(ui.ctx(), Surface::Popup).area(menu_id.with("area")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
+ crate::context_menu::menu_frame(ui, |ui| {
+ let mut chosen = None;
+ for (id, label) in items {
+ let mut item = crate::context_menu::Item::action(id, label, "");
+ item.enabled = id != "ui.closeOtherTabs" || n > 1;
+ let top = ui.cursor().top();
+ let row = crate::context_menu::list_row(ui, &item);
+ let rect = Rect::from_min_max(pos2(ui.min_rect().left(), top), pos2(ui.min_rect().right(), ui.cursor().top()));
+ crate::scenario::publish_handle(&format!("tab_menu:{id}"), rect.center());
+ if row.is_some() {
+ chosen = Some(id);
+ }
}
- }
- chosen
- })
- });
+ chosen
+ })
+ });
match resp.inner {
Some("ui.closeTab") => shut = Some(i),
Some("ui.closeOtherTabs") => many = Some((0..n).filter(|k| *k != i).collect()),
diff --git a/crates/ui-egui/src/edit_clipboard.rs b/crates/ui-egui/src/edit_clipboard.rs
index d5a41a820..17d422a00 100644
--- a/crates/ui-egui/src/edit_clipboard.rs
+++ b/crates/ui-egui/src/edit_clipboard.rs
@@ -40,15 +40,6 @@ fn sketch_selection(app: &SolveApp) -> Vec {
.collect()
}
-/// Is there something Copy would copy?
-pub fn can_copy(app: &SolveApp) -> bool {
- if app.session.active_sketch.is_some() {
- !sketch_selection(app).is_empty()
- } else {
- app.tree.picked_components == [0] || !crate::timeline::selected_feature_ids(app).is_empty()
- }
-}
-
/// Is there something Paste would paste here?
pub fn can_paste(app: &SolveApp) -> bool {
if app.session.active_sketch.is_some() {
diff --git a/crates/ui-egui/src/edit_clipboard_tests.rs b/crates/ui-egui/src/edit_clipboard_tests.rs
index a12d571a7..3fccda224 100644
--- a/crates/ui-egui/src/edit_clipboard_tests.rs
+++ b/crates/ui-egui/src/edit_clipboard_tests.rs
@@ -187,7 +187,6 @@ fn contribution_saved_part(file: &ContributionPart) -> crate::SolveApp {
fn contribution_linked_design_clipboard_crosses_tabs_reuses_links_and_undoes_once() {
let file = ContributionPart::new();
let mut app = contribution_saved_part(&file);
- assert!(super::can_copy(&app));
assert!(super::copy(&mut app));
crate::documents::open_tab(&mut app, solidcraft_engine::Session::default()).unwrap();
assert!(super::can_paste(&app));
diff --git a/crates/ui-egui/src/file_load.rs b/crates/ui-egui/src/file_load.rs
index a987ffef2..6b20a1c3f 100644
--- a/crates/ui-egui/src/file_load.rs
+++ b/crates/ui-egui/src/file_load.rs
@@ -7,6 +7,7 @@
//! control-channel commands that change the design are held until the file is in. A control
//! (MCP) `doc.open` or import is answered when its file finishes loading.
+use crate::ui_kit::{Container, Surface};
use std::collections::VecDeque;
use std::sync::{
Arc,
@@ -906,7 +907,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
// Above the dialogs over the design; menus, tooltips and the resize edges stay above it.
ctx.move_to_top(egui::LayerId::new(egui::Order::Middle, id));
ctx.move_to_top(egui::LayerId::new(egui::Order::Middle, card_id));
- egui::Area::new(id).order(egui::Order::Middle).fixed_pos(cover.min).interactable(true).show(ctx, |ui| {
+ Container::new(ctx, Surface::InputShield).area(id).order(egui::Order::Middle).fixed_pos(cover.min).interactable(true).show(ctx, |ui| {
ui.set_min_size(cover.size());
ui.interact(cover, egui::Id::new("file_loading_block"), egui::Sense::click_and_drag());
ui.painter().rect_filled(cover, 0.0, egui::Color32::from_black_alpha(70));
diff --git a/crates/ui-egui/src/fonts.rs b/crates/ui-egui/src/fonts.rs
index afc032bd4..ddb733095 100644
--- a/crates/ui-egui/src/fonts.rs
+++ b/crates/ui-egui/src/fonts.rs
@@ -236,12 +236,6 @@ fn promote_font_to_front(fonts: &mut FontDefinitions, name: &str) {
}
}
-/// Install font bytes as fallback for every interface family, retaining its bundled weights.
-/// Returns true if the font was parsed and installed successfully.
-pub fn install_cjk_font(ctx: &egui::Context, bytes: Vec) -> bool {
- install_cjk_font_for(ctx, bytes, "ja")
-}
-
/// Install the downloaded font with the CJK UI's shared mixed-script baseline.
pub fn install_cjk_font_for(ctx: &egui::Context, bytes: Vec, language: &str) -> bool {
let fonts = ctx.data(|d| d.get_temp::(installed_fonts_id())).unwrap_or_else(base_font_definitions);
@@ -1009,9 +1003,10 @@ mod tests {
let chosen = solidcraft_engine::sketch::DEFAULT_FONT_FAMILY;
install(&ctx, web_font_definitions(chosen, None));
// Both installations happen before the first frame, like a fast cached web fetch.
- assert!(install_cjk_font(
+ assert!(install_cjk_font_for(
&ctx,
- include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/fonts/biz-udp-gothic/BIZUDPGothic-Regular.ttf")).to_vec()
+ include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/fonts/biz-udp-gothic/BIZUDPGothic-Regular.ttf")).to_vec(),
+ "ja",
));
let installed = ctx.data(|d| d.get_temp::(installed_fonts_id())).unwrap();
for family in sans_families() {
diff --git a/crates/ui-egui/src/frame.rs b/crates/ui-egui/src/frame.rs
index ba636db31..289f8f28f 100644
--- a/crates/ui-egui/src/frame.rs
+++ b/crates/ui-egui/src/frame.rs
@@ -1,23 +1,10 @@
-//! Shared dock dragging, bounded anchors and tokenised surfaces for `ui_kit::Panel`,
-//! plus bounded floating windows for BOM, Messages and 3D mouse calibration.
+//! Dock dragging and bounded anchors. Outer hosts and surfaces live in `ui_kit::Container`.
-use egui::{Align2, Pos2, Ui, WidgetText, vec2};
+use egui::{Pos2, Ui};
/// Width limits of a docked command dialog.
pub const DIALOG_MIN_W: f32 = 260.0;
pub const DIALOG_MAX_W: f32 = 380.0;
-/// Floating windows: prompts and panels, and those holding a table (Parameters, Keyboard
-/// Shortcuts).
-pub const WINDOW_MAX_W: f32 = 460.0;
-pub const WINDOW_WIDE_MAX_W: f32 = 760.0;
-
-/// How wide a window may get.
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum Width {
- Normal,
- Wide,
-}
-
/// Which edge of the viewport a docked panel sits against. The Sketch Palette holds the right
/// edge while a sketch is open, so a dialog started there takes the left.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -36,21 +23,6 @@ impl Side {
}
}
-/// The window frame of a docked panel: the two corners away from its edge are rounded, and the
-/// shadow falls the same way, so a left dock mirrors a right one.
-pub fn dock_frame(ctx: &egui::Context, side: Side) -> egui::Frame {
- let t = crate::theme::Tokens::get();
- let (corner_radius, shadow_x) = match side {
- Side::Right => (egui::CornerRadius { nw: t.radius_sm, sw: t.radius_sm, ne: 0, se: 0 }, -2),
- Side::Left => (egui::CornerRadius { nw: 0, sw: 0, ne: t.radius_sm, se: t.radius_sm }, 2),
- };
- egui::Frame::window(&ctx.global_style())
- .fill(t.dialog_bg)
- .stroke(egui::Stroke::new(1.0, t.dialog_border))
- .corner_radius(corner_radius)
- .shadow(egui::Shadow { offset: [shadow_x, 2], blur: 8, spread: 0, color: egui::Color32::from_black_alpha(40) })
-}
-
/// How far the open docked dialog titled `title` was dragged from its docked place (#1335);
/// zero for a dialog that was not dragged, or once another dialog opens.
pub fn dock_offset(ctx: &egui::Context, title: &str) -> egui::Vec2 {
@@ -82,8 +54,8 @@ pub fn offset_anchor(docked: Pos2, offset: egui::Vec2, vp: egui::Rect, side: Sid
/// `moved` (as last frame left it; `applied` of it is where the dialog is now, after keeping
/// it on screen). Called before the band's buttons are added, so they keep their clicks.
pub fn drag_dock(ui: &Ui, band: egui::Rect, title: &str, moved: egui::Vec2, applied: egui::Vec2) {
- let response = ui.interact(band, ui.id().with("sc_dock_drag"), egui::Sense::drag());
crate::scenario::publish_handle("dialog:title", band.center());
+ let response = ui.interact(band, ui.id().with("sc_dock_drag"), egui::Sense::drag());
// The drag runs from where the press started, so no movement is lost while egui decides
// it is a drag, nor on the frame it ends.
let base = egui::Id::new("sc_dock_drag_base");
@@ -108,33 +80,6 @@ pub fn drag_dock(ui: &Ui, band: egui::Rect, title: &str, moved: egui::Vec2, appl
}
}
-/// A floating window, centred on the screen unless the caller places it, shrink-wrapped to its
-/// content up to its width limit.
-pub fn window<'a>(ctx: &egui::Context, title: impl Into, width: Width) -> egui::Window<'a> {
- let max = match width {
- Width::Normal => WINDOW_MAX_W,
- Width::Wide => WINDOW_WIDE_MAX_W,
- };
- let c = ctx.content_rect().center();
- egui::Window::new(title)
- .enabled(!crate::issue_report::cad_input_blocked())
- .collapsible(false)
- .pivot(Align2::CENTER_CENTER)
- .default_pos(c - vec2(0.0, 60.0))
- .max_width(max)
-}
-
-/// Floating model controls share the report's read-only drawing boundary with windows.
-pub fn area(id: egui::Id) -> egui::Area {
- egui::Area::new(id).enabled(!crate::issue_report::cad_input_blocked())
-}
-
-/// Shared rounded surface for floating shell cards.
-pub(crate) fn shell_card(fill: egui::Color32) -> egui::Frame {
- let t = crate::theme::Tokens::get();
- egui::Frame::NONE.fill(fill).stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow())
-}
-
#[cfg(test)]
mod tests {
#[test]
@@ -236,21 +181,4 @@ mod tests {
assert!((h.app.viewport.dialog_rect.unwrap().min - rest.min).length() < 0.01, "a new dialog opens docked");
}
}
-
- /// Windows are made in this file only, so none can skip the width limits.
- #[test]
- fn windows_come_from_ui_kit_panel() {
- let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
- let mut bad = Vec::new();
- for e in std::fs::read_dir(&dir).unwrap() {
- let p = e.unwrap().path();
- if p.extension().is_some_and(|x| x == "rs") && p.file_name().is_some_and(|n| n != "frame.rs") {
- let text = std::fs::read_to_string(&p).unwrap();
- if text.contains("egui::Window::new(") {
- bad.push(p.display().to_string());
- }
- }
- }
- assert!(bad.is_empty(), "use ui_kit::Panel instead of egui::Window::new in {bad:?}");
- }
}
diff --git a/crates/ui-egui/src/help.rs b/crates/ui-egui/src/help.rs
index 3b2522966..3e832fb02 100644
--- a/crates/ui-egui/src/help.rs
+++ b/crates/ui-egui/src/help.rs
@@ -5,6 +5,7 @@
use crate::SolveApp;
use crate::ui_kit;
+use crate::ui_kit::{Container, Surface};
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const COMMIT: &str = env!("SOLIDCRAFT_COMMIT");
@@ -62,8 +63,12 @@ pub fn run(app: &mut SolveApp, ctx: &egui::Context, item: &str) {
pub fn show(app: &mut SolveApp, ctx: &egui::Context, anchor: egui::Pos2) {
if app.help.menu {
let mut pick: Option<&str> = None;
- let resp =
- crate::frame::area(egui::Id::new("sc_help_menu")).fixed_pos(anchor).constrain(true).order(egui::Order::Foreground).show(ctx, |ui| {
+ let resp = Container::new(ctx, Surface::Popup)
+ .area(egui::Id::new("sc_help_menu"))
+ .fixed_pos(anchor)
+ .constrain(true)
+ .order(egui::Order::Foreground)
+ .show(ctx, |ui| {
crate::context_menu::menu_frame(ui, |ui| {
for (id, label, icon) in [
("docs", "Documentation", "library"),
diff --git a/crates/ui-egui/src/home.rs b/crates/ui-egui/src/home.rs
index a5bdc6eac..16b33b246 100644
--- a/crates/ui-egui/src/home.rs
+++ b/crates/ui-egui/src/home.rs
@@ -3,6 +3,7 @@
//! button or the first document tab; selecting a design returns to its view.
use crate::fonts::RichTextExt as _;
+use crate::ui_kit::{Container, Surface};
use std::collections::HashMap;
use egui::{Color32, CornerRadius, RichText, Sense, Stroke, vec2};
@@ -530,7 +531,8 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
}
}
let mut action: Option> = None;
- egui::CentralPanel::default().frame(egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin::symmetric(36, 24))).show(ui, |ui| {
+ let page = Container::new(ui.ctx(), Surface::Viewport).central();
+ page.frame(Container::new(ui.ctx(), Surface::Viewport).edge_frame(t.panel).inner_margin(egui::Margin::symmetric(36, 24))).show(ui, |ui| {
egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {
ui.horizontal(|ui| {
ui.label(RichText::new("SolidCraft").size(crate::theme::Tokens::get().font_display).semibold().color(t.text));
@@ -559,13 +561,11 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
};
ui.painter().rect(r, t.radius_md, fill, Stroke::new(1.0, if primary { t.accent } else { t.border }), egui::StrokeKind::Inside);
let ink = if primary { t.on_accent } else { t.icon };
- crate::icons::paint(
+ crate::icons::paint_icon(
ui.painter(),
egui::Rect::from_center_size(r.left_center() + vec2(30.0, 0.0), vec2(30.0, 30.0)),
icon,
- ink,
- t.icon_fill,
- ink,
+ f32::from(ink.a()) / 255.0,
);
ui.painter().galley(r.left_center() + vec2(56.0, -galley.size().y / 2.0), galley, ink_text);
resp.clicked()
@@ -637,7 +637,7 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
let response = card(ui, Pic::Ready(app.home.thumbs.get(p.as_str()).and_then(Option::as_ref)), &name, &sub, missing)
.on_hover_text(p.as_str());
crate::scenario::publish_handle(&format!("home:recent:{i}"), response.rect.center());
- response.context_menu(|ui| {
+ crate::ui_kit::Menu::context(&response, |ui| {
if crate::context_menu::button(ui, crate::i18n::tr_label("Remove from list"), "delete").clicked() {
app.home.recent.retain(|x| x != p);
app.home.opened_at.remove(p);
@@ -727,7 +727,7 @@ fn card(ui: &mut egui::Ui, pic: Pic, name: &str, sub: &str, dim: bool) -> egui::
match pic {
Pic::Icon(icon) => {
ui.painter().rect_filled(img, CornerRadius::same(t.radius_sm), t.panel_header);
- crate::icons::paint(ui.painter(), egui::Rect::from_center_size(img.center(), vec2(56.0, 56.0)), icon, t.icon, t.icon_fill, t.icon);
+ crate::icons::paint_icon(ui.painter(), egui::Rect::from_center_size(img.center(), vec2(56.0, 56.0)), icon, f32::from(t.icon.a()) / 255.0);
}
Pic::Ready(Some(tx)) => {
let tint = if dim { Color32::from_white_alpha(90) } else { Color32::WHITE };
diff --git a/crates/ui-egui/src/icons.rs b/crates/ui-egui/src/icons.rs
index 796e2eb95..c42c96c76 100644
--- a/crates/ui-egui/src/icons.rs
+++ b/crates/ui-egui/src/icons.rs
@@ -31,14 +31,7 @@ enum Finish {
#[derive(Clone, Default)]
struct Cache(Arc>>);
-/// Draw the icon `name` in `r`. The ink, fill and accent colours the callers pass are no longer
-/// used: the palette decides. Only the ink's opacity is kept, so a dimmed (disabled) button dims
-/// its icon.
-pub fn paint(p: &Painter, r: Rect, name: &str, ink: Color32, _fill: Color32, _accent: Color32) {
- paint_icon(p, r, name, f32::from(ink.a()) / 255.0);
-}
-
-/// [`paint`] with an explicit opacity (0 to 1).
+/// Draw palette-owned icon artwork with an explicit opacity (0 to 1).
pub fn paint_icon(p: &Painter, r: Rect, name: &str, opacity: f32) {
paint_on(p, r, name, None, opacity);
}
diff --git a/crates/ui-egui/src/issue_report.rs b/crates/ui-egui/src/issue_report.rs
index ee15ab23b..9fefbe76c 100644
--- a/crates/ui-egui/src/issue_report.rs
+++ b/crates/ui-egui/src/issue_report.rs
@@ -1,5 +1,7 @@
//! Reviewed issue drafts with local evidence; never publishes or uploads a report.
+#[cfg(test)]
+use crate::ui_kit::{Container, Surface};
use std::fmt::Write as _;
use std::hash::{Hash, Hasher};
use std::sync::Arc;
@@ -1046,7 +1048,7 @@ mod tests {
ui.disable();
assert_eq!(ui.opacity(), 1.0, "capture must retain normal drawing opacity");
assert!(!ui.is_enabled());
- crate::frame::area(egui::Id::new("cad-boundary-proof")).fade_in(false).show(&ctx, |ui| {
+ Container::new(&ctx, Surface::Popup).area(egui::Id::new("cad-boundary-proof")).fade_in(false).show(&ctx, |ui| {
assert!(!ui.is_enabled());
assert_eq!(ui.opacity(), 1.0);
ui.ctx().data_mut(|d| d.insert_temp(state, 42_u32));
@@ -1055,7 +1057,7 @@ mod tests {
drop(barrier);
assert_eq!(ctx.memory(|m| m.focused()), Some(focus));
assert_eq!(ctx.data(|d| d.get_temp::(state)), Some(42));
- assert!(crate::frame::area(egui::Id::new("report-boundary-proof")).is_enabled());
+ assert!(Container::new(&ctx, Surface::Popup).area(egui::Id::new("report-boundary-proof")).is_enabled());
});
output.textures_delta.clear();
app.issue_report.draft = None;
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 84e065204..3a007eff7 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -7,6 +7,7 @@
//! right of the viewport, the command palette and a bottom or left-sidebar feature timeline.
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
#![forbid(unsafe_code)]
+use crate::ui_kit::{Container, Surface};
pub mod access;
pub mod agent_chat;
@@ -256,7 +257,7 @@ pub use control::{ControlRequest, ControlResponse};
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct UiState {
- /// Automation-only shell mode; never persisted in preferences.
+ /// Effective shell mode; automation can override the saved preference for this session.
pub layout: shell::LayoutMode,
/// Ribbon tab; SHEET METAL and the contextual SKETCH join the seven design tabs.
pub tab: String,
@@ -728,6 +729,7 @@ impl SolveApp {
if !prefs::MSAA.contains(&p.msaa) {
p.msaa = prefs::Prefs::default().msaa;
}
+ self.ui.layout = p.layout;
self.preferences = p;
}
// Saved before the theme was a preference: the Dark/Light flag says which.
@@ -756,6 +758,12 @@ impl SolveApp {
let r = self.session.execute(id, ¶ms).map_err(|e| e.to_string());
self.big_operation |= now_ms() - t0 >= recovery_ui::BIG_OPERATION_MS;
if let Ok(v) = &r {
+ if id == "view.layout" {
+ let layout =
+ if v.get("mode").and_then(Value::as_str) == Some("compact") { shell::LayoutMode::Docked } else { shell::LayoutMode::Floating };
+ self.preferences.layout = layout;
+ self.ui.layout = layout;
+ }
if id == "view.history_layout" {
if let Some(width) = v.get("width").and_then(Value::as_f64) {
self.preferences.timeline_left_width = ui_kit::history_snap_width(width as f32);
@@ -906,6 +914,11 @@ impl SolveApp {
return;
}
// A display toggle leaves the current modelling tool and camera in place.
+ if id == "view.layout" {
+ let mode = if self.ui.layout == shell::LayoutMode::Floating { "compact" } else { "floating" };
+ let _ = self.run(id, json!({"mode":mode}));
+ return;
+ }
if id == "view.history_layout" {
let _ = self.run(id, json!({}));
return;
@@ -1576,6 +1589,7 @@ impl SolveApp {
}
fn cad_ui(&mut self, ui: &mut egui::Ui, report_input: &mut Option) {
+ self.ui.layout.publish(ui.ctx());
scenario::clear_handles();
self.poll_deferred(ui.ctx());
self.poll_delete_check(ui.ctx());
@@ -1598,7 +1612,7 @@ impl SolveApp {
return;
}
}
- let floating = self.ui.layout == shell::LayoutMode::Floating;
+ let floating = ui_kit::Container::new(ui.ctx(), ui_kit::Surface::Panel).floating();
let show_timeline = self.ui.show_timeline && !render_workspace::active(self);
let left_timeline = show_timeline && self.preferences.timeline_left;
timeline_left::animate_folds(self, ui.ctx());
@@ -1606,12 +1620,14 @@ impl SolveApp {
toolbar::toolbar(self, ui);
}
theme::TabAccent::publish(self, ui.ctx());
+ if !floating {
+ agent_chat::show(self, ui);
+ }
if !floating && show_timeline && !left_timeline {
timeline::timeline(self, ui);
}
- // A floating browser keeps the workspace the whole width and covers viewport input.
- let browser_float = self.ui.show_browser && (self.preferences.browser_float || floating || left_timeline);
- if !browser_float {
+ // Browser hugs its contents in either layout; it never becomes a full-height blank column.
+ if !self.ui.show_browser {
self.shell.browser = None;
}
if floating || left_timeline || !show_timeline {
@@ -1619,7 +1635,7 @@ impl SolveApp {
}
let full = ui.available_rect_before_wrap();
if floating {
- let cards = shell::Cards::new(full, self.ui.layout);
+ let cards = shell::Cards::new(full, self.ui.layout, toolbar::ribbon_height(self.preferences.ribbon_labels));
self.shell.cards = vec![cards.workspace, cards.ribbon];
self.shell.history = if left_timeline {
let below_ribbon = egui::Rect::from_min_max(egui::pos2(full.left(), cards.bottom), full.max);
@@ -1655,49 +1671,35 @@ impl SolveApp {
if left_timeline {
timeline_left::left_panel(self, ui);
}
- if self.ui.show_browser && !browser_float {
- browser::browser(self, ui);
- }
if render_workspace::active(self) {
render_workspace::panel(self, ui);
}
- agent_chat::show(self, ui);
- if browser_float {
- // The remaining content starts below the ribbon in either shell layout.
- let viewport = ui.available_rect_before_wrap();
- browser::floating(self, ui, viewport);
+ if self.ui.show_browser {
+ browser::browser(self, ui);
}
- if !floating && timeline_left::stacked(self) {
- let width = browser::browser_width(self.preferences.browser_width) + shell::SHELL_GAP * 2.0;
- egui::Panel::left("sc_history_browser_column").exact_size(width).resizable(false).frame(egui::Frame::NONE).show(ui, |_| {});
+ if floating {
+ agent_chat::show(self, ui);
}
- egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| {
- if floating {
+ Container::new(ui.ctx(), Surface::Viewport)
+ .central()
+ .frame(Container::new(ui.ctx(), Surface::Viewport).edge_frame(egui::Color32::TRANSPARENT))
+ .show(ui, |ui| {
let panel_content = ui.max_rect();
- let mut content = panel_content;
- if let Some(history) = self.shell.history.filter(|_| !left_timeline) {
- content.max.y = (history.top() - shell::SHELL_GAP).max(content.top());
+ self.shell.content = Some(shell::workspace_content(self, panel_content));
+ if floating {
+ self.shell.panels = [
+ egui::Rect::from_min_max(egui::pos2(full.left(), panel_content.top()), egui::pos2(panel_content.left(), full.bottom())),
+ egui::Rect::from_min_max(egui::pos2(panel_content.right(), panel_content.top()), full.max),
+ ]
+ .into_iter()
+ .filter(|r| r.is_positive())
+ .collect();
+ viewport::refresh_layout(self, ui.ctx().pixels_per_point());
+ } else {
+ preview::update(self, ui.ctx());
+ self.show_workspace(ui);
}
- if left_timeline && let Some(history) = self.shell.history {
- content.min.x = (history.right() + shell::SHELL_GAP).min(content.right());
- }
- if let Some(browser) = self.shell.browser {
- content.min.x = (browser.right() + shell::SHELL_GAP).min(content.right());
- }
- self.shell.content = Some(content);
- self.shell.panels = [
- egui::Rect::from_min_max(egui::pos2(full.left(), panel_content.top()), egui::pos2(panel_content.left(), full.bottom())),
- egui::Rect::from_min_max(egui::pos2(panel_content.right(), panel_content.top()), full.max),
- ]
- .into_iter()
- .filter(|r| r.is_positive())
- .collect();
- viewport::refresh_layout(self, ui.ctx().pixels_per_point());
- } else {
- preview::update(self, ui.ctx());
- self.show_workspace(ui);
- }
- });
+ });
dialogs::show(self, ui.ctx());
issue_report::CadInput::block(self, ui, report_input);
sketch_palette::show(self, ui.ctx());
diff --git a/crates/ui-egui/src/manage_dialogs_tests.rs b/crates/ui-egui/src/manage_dialogs_tests.rs
index 47eecd921..7b6db3f81 100644
--- a/crates/ui-egui/src/manage_dialogs_tests.rs
+++ b/crates/ui-egui/src/manage_dialogs_tests.rs
@@ -537,7 +537,7 @@ fn parameters_header_drag_retains_offset_and_bounds_the_card() {
h.call("ui.drag", json!({"x0":title.x,"y0":title.y,"x1":title.x+delta.x,"y1":title.y+delta.y,"steps":8}));
h.frames(6);
let card = scenario::rect_of("dialog:header").unwrap().union(scenario::rect_of("dialog:footer").unwrap());
- let viewport = crate::shell::content_rect(&h.app, h.app.viewport.rect.unwrap());
+ let viewport = crate::shell::tool_drag_rect(&h.app, crate::shell::content_rect(&h.app, h.app.viewport.rect.unwrap()));
assert!(viewport.expand(2.0).contains_rect(card), "{layout:?}: {card:?} outside {viewport:?}");
assert!(h.app.params.is_some());
}
diff --git a/crates/ui-egui/src/material_card_review.rs b/crates/ui-egui/src/material_card_review.rs
index 1416c6a24..03df3ca69 100644
--- a/crates/ui-egui/src/material_card_review.rs
+++ b/crates/ui-egui/src/material_card_review.rs
@@ -49,7 +49,7 @@ impl ReviewWindow {
/// Open only through ui.start; executing the validator never opens a window.
pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let Some(mut window) = app.material_card_review.take() else { return };
- let viewport = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));
+ let viewport = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));
if !viewport.is_finite() || !viewport.is_positive() {
app.material_card_review = Some(window);
return;
@@ -61,12 +61,13 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let docked = egui::pos2(side.anchor_x(viewport), top);
let title = tr("ui.material_review.title");
let moved = crate::frame::dock_offset(ctx, "material_card_review");
- let anchor = crate::frame::offset_anchor(docked, moved, viewport, side);
+ let drag_bounds = crate::shell::tool_drag_rect(app, viewport);
+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);
let panel = ui_kit::Panel::new(
title,
egui::Id::new("sc_material_card_review"),
anchor,
- viewport,
+ drag_bounds,
side,
ui_kit::Panel::feature_frame(ctx, app.ui.layout, side),
)
@@ -78,7 +79,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
panel
};
let mut close = false;
- panel.window().show(ctx, |ui| {
+ panel.window(ctx).show(ctx, |ui| {
let (closed, action) = panel.feature(
ui,
ui_kit::FeatureOptions {
diff --git a/crates/ui-egui/src/messages.rs b/crates/ui-egui/src/messages.rs
index 9447ae5a8..48285e076 100644
--- a/crates/ui-egui/src/messages.rs
+++ b/crates/ui-egui/src/messages.rs
@@ -109,19 +109,15 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
}
let t = Tokens::get();
let now = crate::now_ms();
- let mut open = true;
- crate::frame::window(ctx, tr("messages.title"), crate::frame::Width::Normal)
- .id(egui::Id::new("sc_messages"))
- .open(&mut open)
- .default_size(vec2(460.0, 360.0))
- .show(ctx, |ui| {
+ let (closed, _) =
+ crate::ui_kit::Window::new(egui::Id::new("sc_messages"), "list", tr("messages.title")).fields().actions("", "", None).show(ctx, true, |ui| {
ui.horizontal(|ui| {
- let copy = ui.add_enabled(app.messages.iter().len() > 0, egui::Button::new(tr("messages.copy_all")));
+ let copy = crate::ui_kit::button(ui, tr("messages.copy_all"), crate::ui_kit::Button::Enabled(app.messages.iter().len() > 0));
crate::scenario::publish_handle("messages:copy", copy.rect.center());
if copy.clicked() {
ctx.copy_text(app.messages.as_text(now));
}
- let clear = ui.add_enabled(app.messages.iter().len() > 0, egui::Button::new(tr("messages.clear")));
+ let clear = crate::ui_kit::button(ui, tr("messages.clear"), crate::ui_kit::Button::Enabled(app.messages.iter().len() > 0));
crate::scenario::publish_handle("messages:clear", clear.rect.center());
if clear.clicked() {
app.messages.clear();
@@ -132,7 +128,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
ui.label(RichText::new(tr("messages.none")).color(t.text_dim));
return;
}
- egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {
+ egui::ScrollArea::vertical().max_height(crate::theme::Tokens::get().form_card_width).auto_shrink([false, true]).show(ui, |ui| {
for m in app.messages.iter().rev() {
ui.horizontal_top(|ui| {
ui.add_sized(vec2(70.0, 14.0), egui::Label::new(RichText::new(ago(now, m.at)).small().color(t.text_dim)));
@@ -142,7 +138,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
}
});
});
- if !open {
+ if closed {
app.messages.open = false;
}
// The ages tick on while it is open.
diff --git a/crates/ui-egui/src/mouse_gesture.rs b/crates/ui-egui/src/mouse_gesture.rs
index f85a8ba86..c8f09a831 100644
--- a/crates/ui-egui/src/mouse_gesture.rs
+++ b/crates/ui-egui/src/mouse_gesture.rs
@@ -20,6 +20,7 @@
//! [`Config`] (kept with the preferences, edited in [`editor`]) holds the person's own list for
//! any of them: how many tools and in which place, clockwise from the top.
+use crate::ui_kit::{Container, Surface};
use std::collections::BTreeMap;
use egui::{Align2, Color32, FontId, Mesh, Painter, Pos2, Rect, Sense, Shape, Stroke, Vec2, pos2, vec2};
@@ -340,7 +341,7 @@ pub(crate) fn paint(painter: &Painter, c: Pos2, scale: f32, studio: Studio, item
let at = c + vec2(a.sin(), -a.cos()) * (hub + ring) / 2.0;
let ink = if item.enabled { t.icon } else { t.border };
let side = (24.0 * scale).max(12.0);
- crate::icons::paint(painter, Rect::from_center_size(at, vec2(side, side)), &item.icon, ink, t.icon_fill, t.accent);
+ crate::icons::paint_icon(painter, Rect::from_center_size(at, vec2(side, side)), &item.icon, f32::from(ink.a()) / 255.0);
}
}
match hot.and_then(|k| items.get(k)).filter(|i| i.enabled) {
@@ -500,7 +501,7 @@ fn paint_open(app: &SolveApp, ctx: &egui::Context) {
let t = Tokens::get();
let pointer = ctx.input(|i| i.pointer.latest_pos());
let area = Rect::from_center_size(wheel.centre, vec2(2.0 * (RING + 6.0), 2.0 * (RING + 6.0)));
- crate::frame::area(egui::Id::new("sc_mouse_gesture")).fixed_pos(area.min).order(egui::Order::Foreground).show(ctx, |ui| {
+ Container::new(ctx, Surface::Canvas).area(egui::Id::new("sc_mouse_gesture")).fixed_pos(area.min).order(egui::Order::Foreground).show(ctx, |ui| {
let (r, _) = ui.allocate_exact_size(area.size(), Sense::hover());
paint(&ui.painter_at(r.expand(4.0)), wheel.centre, 1.0, wheel.studio, &list, pointer, t);
});
@@ -579,7 +580,9 @@ pub(crate) fn nav_rows(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
ui.label(crate::i18n::tr_label("Mouse gestures"));
ui.horizontal(|ui| {
crate::ui_kit::checkbox(ui, crate::i18n::tr_label("Ring of tools on the right button"), &mut app.preferences.mouse_gestures.enabled);
- if crate::ui_kit::button(ui, crate::i18n::tr_label("Customize…"), crate::ui_kit::Button::Normal).clicked() {
+ let customize = crate::ui_kit::button(ui, crate::i18n::tr_label("Customize…"), crate::ui_kit::Button::Normal);
+ crate::scenario::publish_handle("gestures:customize", customize.rect.center());
+ if customize.clicked() {
app.gesture.editor.open = true;
app.gesture.editor.studio = Studio::of(app);
}
@@ -613,13 +616,11 @@ fn editor(app: &mut SolveApp, ctx: &egui::Context) {
return;
}
let t = Tokens::get();
- let mut open = true;
let mut studio = app.gesture.editor.studio;
let mut config = app.preferences.mouse_gestures.clone();
- crate::frame::window(ctx, crate::i18n::tr_label("Mouse gestures"), crate::frame::Width::Wide)
- .id(egui::Id::new("sc_gesture_editor"))
- .open(&mut open)
- .show(ctx, |ui| {
+ let closed = crate::ui_kit::Window::new(egui::Id::new("sc_gesture_editor"), "settings", crate::i18n::tr_label("Mouse gestures"))
+ .cards(3.0)
+ .show_body(ctx, |ui| {
crate::ui_kit::checkbox(ui, crate::i18n::tr_label("Ring of tools on the right button"), &mut config.enabled);
if app.preferences.nav != MOUSE_MODE {
ui.colored_label(
@@ -729,7 +730,7 @@ fn editor(app: &mut SolveApp, ctx: &egui::Context) {
});
app.gesture.editor.studio = studio;
app.preferences.mouse_gestures = config;
- app.gesture.editor.open = open;
+ app.gesture.editor.open = !closed;
}
#[cfg(test)]
@@ -947,6 +948,45 @@ mod tests {
);
}
+ #[test]
+ fn customization_uses_the_shared_header_keeps_edits_and_has_no_resize_edges() {
+ use crate::scenario::{Harness, handle_at, rect_of};
+ use serde_json::json;
+ for dark in [false, true] {
+ let mut h = Harness::new();
+ h.app.home.open = false;
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ h.call("ui.set", json!({"dark":dark}));
+ h.app.preferences.mouse_gestures.set_tools(Studio::Part, vec!["undo".into(), "solid.extrude".into()]);
+ h.app.gesture.editor.open = true;
+ h.app.gesture.editor.studio = Studio::Part;
+ h.frames(6);
+ let header = rect_of("dialog:header").unwrap();
+ assert_eq!(header.height(), Tokens::get().form_header_height);
+ assert_eq!(h.app.preferences.mouse_gestures.tools(Studio::Part).len(), 2);
+ h.step(&json!({"widget":"Add a tool"})).unwrap();
+ h.frames(4);
+ assert_eq!(h.app.preferences.mouse_gestures.tools(Studio::Part).len(), 3);
+ let window = rect_of("dialog:window").unwrap();
+ for at in [window.left_center(), window.right_center(), window.right_bottom()] {
+ h.call("ui.move", json!({"x":at.x,"y":at.y}));
+ h.frames(2);
+ assert!(!matches!(
+ h.output.cursor_icon,
+ egui::CursorIcon::ResizeHorizontal
+ | egui::CursorIcon::ResizeVertical
+ | egui::CursorIcon::ResizeNwSe
+ | egui::CursorIcon::ResizeNeSw
+ ));
+ }
+ let close = handle_at("dialog:close").unwrap();
+ h.call("ui.click", json!({"x":close.x,"y":close.y}));
+ h.frames(2);
+ assert!(!h.app.gesture.editor.open);
+ assert_eq!(h.app.preferences.mouse_gestures.tools(Studio::Part).len(), 3, "closing retains edits");
+ }
+ }
+
#[test]
fn the_editor_changes_how_many_tools_and_where_they_sit() {
let mut list: Vec = ["solid.extrude", "undo", "solid.hole"].iter().map(|s| s.to_string()).collect();
diff --git a/crates/ui-egui/src/navigation_cube.rs b/crates/ui-egui/src/navigation_cube.rs
index f0974003e..ed1cc4459 100644
--- a/crates/ui-egui/src/navigation_cube.rs
+++ b/crates/ui-egui/src/navigation_cube.rs
@@ -217,7 +217,7 @@ pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {
crate::scenario::publish_target("axis_view:home", home);
let home_hover = control(app, ui, home, "home", "Home: isometric view and fit model");
if active {
- icons::paint(&painter, home.shrink(4.0 * scale), "home", if home_hover { t.accent } else { t.cube_face }, t.cube_face, t.accent);
+ icons::paint_icon(&painter, home.shrink(4.0 * scale), "home", f32::from((if home_hover { t.accent } else { t.cube_face }).a()) / 255.0);
}
let fit = Rect::from_center_size(c + vec2(67.0, 67.0) * scale, vec2(22.0, 22.0) * scale);
let fit_hover = control(app, ui, fit, "fit", "Fit model in view");
diff --git a/crates/ui-egui/src/open_meshing.rs b/crates/ui-egui/src/open_meshing.rs
index 7843ceef8..088929e9f 100644
--- a/crates/ui-egui/src/open_meshing.rs
+++ b/crates/ui-egui/src/open_meshing.rs
@@ -15,6 +15,7 @@
//!
//! Display only: commands, picking of what is drawn and exports read the session's world as ever.
+use crate::ui_kit::{Container, Surface};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
@@ -137,13 +138,14 @@ pub(crate) fn show(app: &SolveApp, ctx: &egui::Context) {
let (Some((done, total)), Some(view)) = (progress(app), app.viewport.rect) else { return };
let t = crate::theme::Tokens::get();
let at = egui::pos2(view.left() + 12.0, view.bottom() - 12.0);
- egui::Area::new(egui::Id::new("open_meshing"))
+ Container::new(ctx, Surface::Toast)
+ .area(egui::Id::new("open_meshing"))
.order(egui::Order::Foreground)
.pivot(egui::Align2::LEFT_BOTTOM)
.fixed_pos(at)
.interactable(false)
.show(ctx, |ui| {
- egui::Frame::popup(ui.style()).fill(t.panel).show(ui, |ui| {
+ Container::popup_frame(ui.style()).fill(t.panel).show(ui, |ui| {
ui.horizontal(|ui| {
ui.spinner();
ui.label(egui::RichText::new(format!("Loading parts {done}/{total}")).color(t.text));
diff --git a/crates/ui-egui/src/params_dialog.rs b/crates/ui-egui/src/params_dialog.rs
index 8241b8bca..604ed9b2d 100644
--- a/crates/ui-egui/src/params_dialog.rs
+++ b/crates/ui-egui/src/params_dialog.rs
@@ -140,7 +140,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
}
let Some(mut d) = app.params.take() else { return };
ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Enter));
- let viewport = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));
+ let viewport = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));
if !viewport.is_finite() || !viewport.is_positive() {
app.params = Some(d);
return;
@@ -151,12 +151,19 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let top = crate::shell::panel_top(app, viewport, viewport.bottom(), side);
let docked = egui::pos2(side.anchor_x(viewport), top);
let moved = crate::frame::dock_offset(ctx, "PARAMETERS");
- let anchor = crate::frame::offset_anchor(docked, moved, viewport, side);
+ let drag_bounds = crate::shell::tool_drag_rect(app, viewport);
+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);
let title = crate::i18n::tr_label("Parameters");
- let panel =
- ui_kit::Panel::new(title, egui::Id::new("sc_params_dialog"), anchor, viewport, side, ui_kit::Panel::feature_frame(ctx, app.ui.layout, side))
- .wide()
- .reset_scroll(d.reset_scroll);
+ let panel = ui_kit::Panel::new(
+ title,
+ egui::Id::new("sc_params_dialog"),
+ anchor,
+ drag_bounds,
+ side,
+ ui_kit::Panel::feature_frame(ctx, app.ui.layout, side),
+ )
+ .wide()
+ .reset_scroll(d.reset_scroll);
let panel = if side == crate::frame::Side::Left {
let available = palette.map_or(viewport.width(), |r| (r.left() - viewport.left() - crate::theme::Tokens::get().space_8).max(0.0));
panel.width((crate::theme::Tokens::get().form_card_width * 3.0).min(available))
@@ -172,7 +179,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
rows
};
let mut close = false;
- panel.window().show(ctx, |ui| {
+ panel.window(ctx).show(ctx, |ui| {
let (closed, action) = panel.feature(
ui,
ui_kit::FeatureOptions {
diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rs
index eba5d7c2c..9f2fcd5d6 100644
--- a/crates/ui-egui/src/prefs.rs
+++ b/crates/ui-egui/src/prefs.rs
@@ -442,6 +442,10 @@ preference_settings! {
custom_themes: Vec = Vec::new();
/// Interface language (a registered locale ID).
language: String = "en".into(), 0;
+ /// Shared workspace composition; system windows and popups retain their purpose.
+ layout: crate::shell::LayoutMode = Default::default(), 0;
+ /// Show command names beneath ribbon icons, independently of workspace layout.
+ ribbon_labels: bool = true, 0 => check_tr("ui.ribbon_labels");
/// Interface scale (1 = 100 %).
ui_scale: f32 = 1.0, 0, accept(0.5..=2.5) => slider("ui.ui_scale", 0.5..=2.5, 0.05, |v| format!("{:.0} %", v * 100.0), "prefs:scale");
/// Interface font: an installed font family (or a font file), or empty for the built-in one
@@ -455,8 +459,6 @@ preference_settings! {
timeline_under_browser: bool = false, 0;
/// Fold the shared-column history to its header.
timeline_collapsed: bool = false, 0;
- /// Legacy shared-column height, retained for preference compatibility.
- timeline_left_height: f32 = 360.0, 0;
/// Whether the browser beside the vertical history is collapsed to its rail.
timeline_left_browser_collapsed: bool = false, 0;
/// Width of the browser sidebar, which
@@ -600,6 +602,7 @@ pub fn open_at(app: &mut SolveApp, page: usize) {
struct Snapshot {
prefs: Prefs,
dark: bool,
+ layout: crate::shell::LayoutMode,
grid: bool,
shadow: bool,
perspective: bool,
@@ -616,6 +619,7 @@ impl Snapshot {
Snapshot {
prefs: app.preferences.clone(),
dark: app.ui.dark,
+ layout: app.ui.layout,
grid: app.ui.show_grid,
shadow: app.ui.ground_shadow,
perspective: app.ui.perspective,
@@ -634,6 +638,7 @@ impl Snapshot {
app.preferences = self.prefs;
app.preferences.update = update;
app.ui.dark = self.dark;
+ app.ui.layout = self.layout;
app.ui.show_grid = self.grid;
app.ui.ground_shadow = self.shadow;
app.ui.perspective = self.perspective;
@@ -767,6 +772,7 @@ fn defaults(app: &mut SolveApp, page: usize) {
match page {
0 => {
app.ui.dark = true;
+ app.ui.layout = app.preferences.layout;
app.ui.agent_cursor = Default::default();
app.autosave_minutes = 5.0;
set_autosave(app);
@@ -1144,6 +1150,18 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
});
});
theme_row(app, ui);
+ ui_kit::row(ui, app.tr("ui.workspace_layout"), |ui| {
+ let mut selected = usize::from(app.ui.layout == crate::shell::LayoutMode::Docked);
+ if ui_kit::segmented(
+ ui,
+ &mut selected,
+ &[crate::i18n::tr("ui.layout_floating"), crate::i18n::tr("ui.layout_compact")],
+ Default::default(),
+ ) {
+ let _ = app.run("view.layout", json!({"mode": if selected == 1 { "compact" } else { "floating" }}));
+ }
+ });
+ setting::ribbon_labels(app, ui);
setting::ui_scale(app, ui);
if !cfg!(target_arch = "wasm32") {
ui_kit::row(ui, app.tr_label("Interface font"), |ui| ui_font_row(app, ui));
@@ -1165,7 +1183,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
});
ui_kit::text(ui, app.tr("ui.timeline_left_note"), ui_kit::Text::Note("timeline"));
ui_kit::row(ui, app.tr_label("Parts browser"), |ui| {
- setting::browser_float(app, ui);
+ ui.add_enabled_ui(app.ui.layout == crate::shell::LayoutMode::Floating, |ui| setting::browser_float(app, ui));
});
ui_kit::text(
ui,
@@ -1883,6 +1901,9 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result bool {
- self.active && !self.rolled_back
- }
-
/// Stop drawing the preview scene and give the bodies it stood in for back to the model.
fn hide_scene(&mut self) {
if self.active || !self.replaced.is_empty() {
diff --git a/crates/ui-egui/src/render_workspace.rs b/crates/ui-egui/src/render_workspace.rs
index f654379d6..400089bd7 100644
--- a/crates/ui-egui/src/render_workspace.rs
+++ b/crates/ui-egui/src/render_workspace.rs
@@ -1,5 +1,6 @@
//! Integrated product preview. Shares the installed device/pipelines, not Design's scene policy.
+use crate::ui_kit::{Container, Edge, Surface};
use std::hash::{Hash, Hasher};
use std::sync::{Arc, Mutex};
@@ -173,10 +174,11 @@ pub fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {
app.render_workspace.view.draft = app.session.doc.render.setups.get(&app.render_workspace.view.name).cloned().unwrap_or_default();
app.render_workspace.revision = app.session.revision;
}
- egui::Panel::right("sc_render_settings")
+ Container::new(ui.ctx(), Surface::Panel)
+ .edge("sc_render_settings", Edge::Right)
.exact_size(285.0)
.resizable(false)
- .frame(egui::Frame::NONE.fill(Tokens::get().panel).inner_margin(10))
+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(Tokens::get().panel).inner_margin(10))
.show(ui, |ui| {
crate::ui_kit::scope(ui, |ui| {
egui::ScrollArea::vertical().show(ui, |ui| {
diff --git a/crates/ui-egui/src/select_other.rs b/crates/ui-egui/src/select_other.rs
index bc34d9376..070418267 100644
--- a/crates/ui-egui/src/select_other.rs
+++ b/crates/ui-egui/src/select_other.rs
@@ -17,6 +17,7 @@
//!
//! The control channel's `ui.selectOther` opens, describes and picks from the list.
+use crate::ui_kit::{Container, Surface};
use egui::{Align2, FontId, Pos2, Rect, Sense, pos2, vec2};
use serde_json::{Value, json};
use solidcraft_engine::Sel;
@@ -515,7 +516,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let w = crate::context_menu::LIST_W - 10.0;
// Title, rows up to the scroll height, margins and border.
let size = vec2(w + 10.0, 30.0 + (p.rows.len() as f32 * 24.0).min(360.0));
- let resp = crate::frame::area(egui::Id::new("sc_select_other"))
+ let resp = Container::new(ctx, Surface::Popup)
+ .area(egui::Id::new("sc_select_other"))
.fixed_pos(crate::context_menu::place(p.at, vec2(12.0, 12.0), size, ctx.content_rect()))
.constrain(true)
.order(egui::Order::Foreground)
@@ -539,13 +541,11 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
hovered = Some(i);
ui.painter().rect_filled(r.shrink2(vec2(2.0, 1.0)), 4.0, t.hover);
}
- crate::icons::paint(
+ crate::icons::paint_icon(
ui.painter(),
Rect::from_center_size(pos2(r.left() + 16.0, r.center().y), vec2(16.0, 16.0)),
row.icon,
- t.icon,
- t.icon_fill,
- t.accent,
+ f32::from(t.icon.a()) / 255.0,
);
ui.painter().text(
pos2(r.left() + 32.0, r.center().y),
diff --git a/crates/ui-egui/src/shell.rs b/crates/ui-egui/src/shell.rs
index 48f6d34eb..a424611eb 100644
--- a/crates/ui-egui/src/shell.rs
+++ b/crates/ui-egui/src/shell.rs
@@ -1,18 +1,30 @@
//! Transient shell geometry shared by automation, drawing and viewport occlusion.
+use crate::ui_kit::{Container, Surface};
use egui::{Rect, pos2, vec2};
use serde::{Deserialize, Serialize};
use crate::{SolveApp, theme::Tokens, toolbar};
-/// Shell frame selected by automation for this session.
+/// Saved workspace layout; automation may override it for a session.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum LayoutMode {
#[default]
Floating,
+ #[serde(rename = "compact", alias = "docked")]
Docked,
}
+impl LayoutMode {
+ pub(crate) fn publish(self, ctx: &egui::Context) {
+ ctx.data_mut(|data| data.insert_temp(egui::Id::new("sc_container_layout"), self));
+ }
+
+ pub(crate) fn current(ctx: &egui::Context) -> Self {
+ ctx.data(|data| data.get_temp(egui::Id::new("sc_container_layout"))).unwrap_or_default()
+ }
+}
+
/// The gap from the viewport edge to the floating cards and between the cards.
pub(crate) const SHELL_GAP: f32 = 7.0;
@@ -58,17 +70,20 @@ pub(crate) struct Cards {
}
impl Cards {
- pub fn new(available: Rect, mode: LayoutMode) -> Self {
- let margin = if mode == LayoutMode::Floating { SHELL_GAP } else { 0.0 };
- let gap = if mode == LayoutMode::Floating { SHELL_GAP } else { 1.0 };
+ pub fn new(available: Rect, mode: LayoutMode, ribbon_height: f32) -> Self {
+ let margin = Container::for_layout(mode, Surface::Chrome).gap();
+ let gap = margin;
let left = available.left() + margin;
let top = available.top() + margin;
let right = (available.right() - margin).max(left);
let workspace = Rect::from_min_size(
pos2(left, top),
- vec2(toolbar::WORKSPACE_WIDTH.min((right - left).max(0.0)), toolbar::RIBBON_HEIGHT - if mode == LayoutMode::Docked { 1.0 } else { 0.0 }),
+ vec2(
+ toolbar::WORKSPACE_WIDTH.min((right - left).max(0.0)),
+ ribbon_height - if !Container::for_layout(mode, Surface::Chrome).floating() { 1.0 } else { 0.0 },
+ ),
);
- let ribbon = Rect::from_min_max(pos2((workspace.right() + gap).min(right), top), pos2(right, top + toolbar::RIBBON_HEIGHT));
+ let ribbon = Rect::from_min_max(pos2((workspace.right() + gap).min(right), top), pos2(right, top + ribbon_height));
Self { workspace, ribbon, bottom: ribbon.bottom() + margin }
}
}
@@ -93,11 +108,14 @@ pub(crate) struct State {
/// One source of occlusion for navigation, picking, overlays and fit.
pub(crate) fn covered_rects(app: &SolveApp) -> Vec {
let mut rects = Vec::new();
- if app.ui.layout == LayoutMode::Floating {
+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {
rects.extend(app.shell.cards.iter().copied());
rects.extend(app.shell.panels.iter().copied());
- rects.extend(app.shell.history);
+ if crate::agent_chat::shown(app) && app.agent_chat.open && !app.preferences.agent_chat_popped {
+ rects.extend(app.agent_chat.panel_rect);
+ }
}
+ rects.extend(app.shell.history.filter(|_| app.ui.show_timeline));
if app.ui.show_timeline && app.preferences.timeline_left {
rects.extend(app.shell.history.map(|card| crate::ui_kit::HistorySeam::new(card).pill));
}
@@ -114,14 +132,42 @@ pub(crate) fn covered(app: &SolveApp, p: egui::Pos2) -> bool {
/// The former central panel remains the anchor for controls and docked panels.
pub(crate) fn content_rect(app: &SolveApp, viewport: Rect) -> Rect {
- if app.ui.layout == LayoutMode::Floating { app.shell.content.unwrap_or(viewport).intersect(viewport) } else { viewport }
+ app.shell.content.unwrap_or(viewport).intersect(viewport)
+}
+
+/// Free anchor space shared by both layouts. Compact edge hosts have already consumed
+/// their allocation; content-hugging Browser and floating overlays reserve their measured span.
+pub(crate) fn workspace_content(app: &SolveApp, mut content: Rect) -> Rect {
+ let gap = Container::for_layout(app.ui.layout, Surface::Panel).gap();
+ if let Some(history) = app.shell.history {
+ if app.preferences.timeline_left {
+ content.min.x = (history.right() + gap).clamp(content.left(), content.right());
+ } else {
+ content.max.y = (history.top() - gap).clamp(content.top(), content.bottom());
+ }
+ }
+ if let Some(browser) = app.shell.browser {
+ content.min.x = (browser.right() + gap).clamp(content.left(), content.right());
+ }
+ content
+}
+
+/// Tool sheets may cover Browser and History, while shell chrome and Assistant stay clear.
+/// Assistant's outside-rail exception stays in its owner.
+pub(crate) fn tool_drag_rect(app: &SolveApp, placement: Rect) -> Rect {
+ let gap = Container::for_layout(app.ui.layout, Surface::Feature).gap();
+ let mut bounds = crate::agent_chat::tool_space(app, app.viewport.rect.unwrap_or(placement));
+ for card in app.shell.cards.iter().filter(|r| r.is_finite() && r.is_positive()) {
+ bounds.min.y = (card.bottom() + gap).clamp(bounds.top(), bounds.bottom());
+ }
+ bounds
}
pub(crate) fn panel_top(app: &SolveApp, viewport: Rect, bottom: f32, side: crate::frame::Side) -> f32 {
let content = content_rect(app, viewport);
- if app.ui.layout == LayoutMode::Floating && side == crate::frame::Side::Right {
- // Preserve measured compass clearance when there is room; reclaim it on short
- // views with the same 360 px panel budget as Docked.
+ if side == crate::frame::Side::Right {
+ // Both layouts use the measured compass, rather than a legacy fixed-height gap.
+ // Reclaim that space on short views while keeping the panel usable.
app.viewport
.layout
.as_ref()
diff --git a/crates/ui-egui/src/shell_tests.rs b/crates/ui-egui/src/shell_tests.rs
index 238eaf800..e11dc3dfd 100644
--- a/crates/ui-egui/src/shell_tests.rs
+++ b/crates/ui-egui/src/shell_tests.rs
@@ -46,7 +46,7 @@ fn both_modes_keep_their_geometry_and_fit_clear_of_covered_rects() {
assert_eq!(viewport.top(), toolbar.bottom());
assert_eq!(toolbar.height(), toolbar::RIBBON_HEIGHT);
assert_eq!(workspace.left(), 0.0);
- assert!(covered_rects(&h.app).is_empty());
+ assert_eq!(covered_rects(&h.app), vec![h.app.shell.history.unwrap(), rect_of("browser:card").unwrap()]);
}
h.app.fit_view();
h.settle();
@@ -230,9 +230,9 @@ fn floating_browser_clears_cards_shields_input_and_can_dock_again() {
assert!(crate::browser::drawn_rows().iter().any(|(name, _, _, open)| name == "Origin" && *open == Some(true)));
h.app.preferences.browser_float = false;
h.settle();
- assert_eq!(h.app.shell.browser.is_some(), mode == LayoutMode::Floating || timeline_left);
+ assert!(h.app.shell.browser.is_some());
assert!(rect_of("browser:float").is_none());
- assert_eq!(rect_of("browser:card").is_some(), mode == LayoutMode::Floating || timeline_left);
+ assert!(rect_of("browser:card").is_some());
// The saved width follows both the floating card and the docked column.
let rail = crate::scenario::handle_at("left-browser-rail").unwrap();
let width = h.app.preferences.browser_width;
@@ -294,12 +294,12 @@ fn left_history_and_browser_share_the_left_edge_without_moving_right_controls()
assert!(rect_of("history:card").is_none());
let history = rect_of("history:vertical").unwrap();
let browser = rect_of("browser:card").unwrap();
- assert!(history.right() < browser.left());
+ assert!((browser.left() - history.right() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0);
assert!(crate::scenario::handle_at("timeline:First").is_some());
let viewport = h.app.viewport.rect.unwrap();
let content = content_rect(&h.app, viewport);
assert_eq!(viewport.left(), if mode == LayoutMode::Floating { 0.0 } else { crate::ui_kit::history_width(true) });
- assert_eq!(content.left(), if mode == LayoutMode::Floating { browser.right() + SHELL_GAP } else { viewport.left() });
+ assert_eq!(content.left(), browser.right() + Container::for_layout(mode, Surface::Panel).gap());
assert_eq!(content.bottom(), viewport.bottom());
if mode == LayoutMode::Floating {
assert!(covered(&h.app, history.center()));
@@ -310,3 +310,354 @@ fn left_history_and_browser_share_the_left_edge_without_moving_right_controls()
}
}
}
+
+#[test]
+fn assistant_floats_without_changing_projection_and_shields_the_model() {
+ for dark in [false, true] {
+ for side in ["left", "right"] {
+ let mut h = crate::scenario::Harness::new();
+ h.app.home.open = false;
+ h.call("ui.resize", serde_json::json!({"width":1400,"height":1000}));
+ h.call("ui.set", serde_json::json!({"dark":dark,"layout":"floating"}));
+ h.frames(4);
+ let projection = h.app.viewport.rect.expect("viewport");
+ let original_controls = h.app.viewport.layout.clone().expect("layout");
+ h.call("ui.agent_chat", serde_json::json!({"open":true,"picker":false,"side":side,"width":440}));
+ h.frames(6);
+ let card = crate::scenario::rect_of("agent_chat:panel").expect("floating Assistant");
+ assert_eq!(h.app.viewport.rect, Some(projection), "opening the card preserves projection");
+ assert!(card.left() > projection.left() && card.right() < projection.right());
+ assert!(card.bottom() < projection.bottom());
+ let content = h.app.shell.content.expect("content");
+ assert!((card.top() - content.top()).abs() < 1.0, "full-height top: {card:?} {content:?}");
+ assert!((card.bottom() - content.bottom()).abs() < 1.0, "full-height bottom: {card:?} {content:?}");
+ assert!(covered(&h.app, card.center()), "chat shields viewport input");
+ if side == "right" {
+ let layout = h.app.viewport.layout.as_ref().expect("layout");
+ assert!(!card.intersect(layout.axis_view).is_positive(), "card clears compass");
+ assert!(!card.intersect(layout.navigation).is_positive(), "card clears navigation");
+ assert!(layout.axis_view.right() < original_controls.axis_view.right(), "compass moves left");
+ assert!(layout.navigation.center().x < original_controls.navigation.center().x, "navigation moves left");
+ } else {
+ let browser = h.app.shell.browser.expect("browser card");
+ assert!(card.right() < browser.left(), "left Assistant precedes browser");
+ assert!((card.top() - browser.top()).abs() < 1.0, "Assistant and browser share the top margin");
+ }
+ let camera = h.app.cam;
+ let at = card.center();
+ h.call("ui.move", json!({"x":at.x,"y":at.y}));
+ h.call("ui.scroll", json!({"x":at.x,"y":at.y,"delta":120}));
+ h.call("ui.drag", json!({"x0":at.x,"y0":at.y,"x1":at.x-30.0,"y1":at.y+15.0,"button":"middle","steps":6}));
+ assert_eq!(h.app.cam, camera, "chat consumes wheel and orbit input");
+ assert!(h.app.viewport.boxsel.is_none());
+ h.app.start("solid.extrude");
+ h.frames(5);
+ let feature = h.app.viewport.dialog_rect.expect("feature panel");
+ let beside = crate::scenario::rect_of("agent_chat:panel").expect("Assistant beside feature");
+ assert!(!beside.intersect(feature).is_positive(), "feature and Assistant coexist: {beside:?} {feature:?}");
+ assert!(
+ (beside.min - card.min).length() < 1.0 && (beside.max - card.max).length() < 1.0,
+ "opening a tool must not move Assistant: {card:?} -> {beside:?}"
+ );
+ if side == "right" {
+ assert!(feature.right() + SHELL_GAP <= beside.left() + 1.0, "tool stays inside Assistant's rail");
+ }
+ h.app.dialog = None;
+ h.app.tool = None;
+ h.frames(3);
+ h.call("ui.agent_chat", serde_json::json!({"minimized":true}));
+ h.frames(4);
+ let folded = crate::scenario::rect_of("agent_chat:panel").expect("floating folded card");
+ assert!(folded.width() < 60.0 && folded.height() < 120.0);
+ assert!(covered(&h.app, folded.center()));
+ assert_eq!(h.app.viewport.rect, Some(projection));
+ let folded_controls = h.app.viewport.layout.as_ref().expect("layout");
+ assert_eq!(folded_controls.axis_view, original_controls.axis_view);
+ if side == "right" {
+ assert_eq!(folded_controls.navigation, original_controls.navigation);
+ } else {
+ let shift = (folded.width() + SHELL_GAP) / 2.0;
+ assert!((folded_controls.navigation.center().x - original_controls.navigation.center().x - shift).abs() < 1.0);
+ }
+ h.call("ui.agent_chat", serde_json::json!({"open":false}));
+ h.frames(3);
+ assert!(!covered(&h.app, card.center()), "closed chat leaves no stale obstruction");
+ }
+ }
+}
+
+#[test]
+fn assistant_left_dock_precedes_history_and_drag_hints_match_the_result() {
+ for layout in ["floating", "docked"] {
+ for (names, stacked) in [(false, false), (true, false), (true, true)] {
+ let mut h = Harness::new();
+ h.app.home.open = false;
+ h.app.preferences.timeline_left = true;
+ h.app.preferences.timeline_under_browser = stacked;
+ h.app.preferences.timeline_left_width = crate::ui_kit::history_width(names);
+ h.call("ui.resize", json!({"width":1600,"height":1000}));
+ h.call("ui.set", json!({"layout":layout}));
+ h.call("ui.agent_chat", json!({"open":true,"side":"right","width":440,"picker":false}));
+ h.frames(6);
+ let projection = h.app.viewport.rect;
+ for left in [true, false] {
+ let grip = crate::scenario::handle_at("agent_chat:grip").expect("drag grip");
+ let target = pos2(if left { 100.0 } else { 1500.0 }, grip.y);
+ h.app.synthetic.push(egui::Event::PointerMoved(grip));
+ h.frame();
+ h.app.synthetic.push(egui::Event::PointerButton {
+ pos: grip,
+ button: egui::PointerButton::Primary,
+ pressed: true,
+ modifiers: egui::Modifiers::NONE,
+ });
+ h.frame();
+ h.app.synthetic.push(egui::Event::PointerMoved(target));
+ h.frames(2);
+ let hint = rect_of("agent_chat:dock_hint").expect("visible dock target");
+ h.app.synthetic.push(egui::Event::PointerButton {
+ pos: target,
+ button: egui::PointerButton::Primary,
+ pressed: false,
+ modifiers: egui::Modifiers::NONE,
+ });
+ h.frames(6);
+ let card = h.app.agent_chat.panel_rect.expect("docked Assistant");
+ assert_eq!(h.app.preferences.agent_chat_side, if left { "left" } else { "right" });
+ assert!((hint.min - card.min).length() < 1.0 && (hint.max - card.max).length() < 1.0, "{layout} preview {hint:?} matches {card:?}");
+ if layout == "floating" {
+ assert_eq!(h.app.viewport.rect, projection, "docking keeps model projection");
+ }
+ if left {
+ let history = h.app.shell.history.expect("vertical history");
+ let browser = h.app.shell.browser.expect("browser");
+ assert!(card.right() <= history.left(), "Assistant precedes history: {card:?} {history:?}");
+ if stacked {
+ assert!((history.left() - browser.left()).abs() < 1.0);
+ assert!((history.width() - browser.width()).abs() < 1.0);
+ assert!(browser.bottom() <= history.top(), "History stays below Browser");
+ } else {
+ assert!(history.right() <= browser.left(), "history precedes browser");
+ }
+ }
+ }
+ h.call("ui.agent_chat", json!({"side":"left","minimized":true}));
+ h.frames(6);
+ let strip = h.app.agent_chat.drop_rect.expect("minimized Assistant");
+ assert!(strip.right() <= h.app.shell.history.expect("history").left());
+ h.call("ui.agent_chat", json!({"open":false}));
+ h.frames(6);
+ assert!(h.app.shell.history.expect("history returns to outer edge").left() < strip.right());
+ }
+ }
+}
+
+#[test]
+fn assistant_right_edge_survives_palette_tool_resize_and_minimize() {
+ for layout in ["floating", "docked"] {
+ let mut h = Harness::new();
+ h.app.home.open = false;
+ h.call("ui.resize", json!({"width":1800,"height":1000}));
+ h.call("ui.set", json!({"layout":layout}));
+ h.call("ui.agent_chat", json!({"open":true,"side":"right","width":380,"picker":false}));
+ h.frames(5);
+ let right = h.app.agent_chat.panel_rect.unwrap().right();
+ h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();
+ h.frames(6);
+ for width in [380.0, 480.0] {
+ h.call("ui.agent_chat", json!({"width":width}));
+ h.frames(6);
+ let chat = h.app.agent_chat.panel_rect.unwrap();
+ let palette = h.app.viewport.palette_rect.unwrap();
+ assert!((chat.right() - right).abs() < 1.0, "{layout}: Assistant stays outside the palette");
+ assert!(
+ palette.right() + Container::for_layout(h.app.ui.layout, Surface::Panel).gap() <= chat.left() + 1.0,
+ "{layout}: {palette:?}, {chat:?}"
+ );
+ }
+ h.call("ui.agent_chat", json!({"minimized":true}));
+ h.frames(5);
+ let strip = h.app.agent_chat.drop_rect.unwrap();
+ let palette = h.app.viewport.palette_rect.unwrap();
+ assert!((strip.right() - right).abs() < 1.0);
+ assert!(palette.right() <= strip.left(), "palette clears the minimized Assistant too");
+ h.call("ui.agent_chat", json!({"open":false}));
+ h.frames(5);
+ assert!(h.app.viewport.palette_rect.unwrap().right() > palette.right(), "closing Assistant reclaims its rail");
+ }
+}
+
+#[test]
+fn tool_sheets_drag_over_browser_and_history_but_clear_protected_panels() {
+ for side in ["left", "right"] {
+ let mut h = Harness::new();
+ h.app.home.open = false;
+ h.call("ui.resize", json!({"width":1800,"height":1000}));
+ h.call("ui.set", json!({"layout":"floating"}));
+ h.call("ui.agent_chat", json!({"open":true,"side":side,"width":380,"picker":false}));
+ h.frames(5);
+ h.app.start("sketch.create");
+ h.frames(5);
+ let chat = h.app.agent_chat.panel_rect.unwrap();
+ let browser = h.app.shell.browser.unwrap();
+ let history = h.app.shell.history.unwrap();
+ let ribbon = h.app.shell.cards[1];
+ let workspace = h.app.shell.cards[0];
+ for target in [browser.center(), history.center(), ribbon.center(), workspace.center(), egui::pos2(-1000.0, 400.0), egui::pos2(3000.0, 400.0)]
+ {
+ let title = crate::scenario::handle_at("dialog:title").unwrap();
+ h.call("ui.drag", json!({"x0":title.x,"y0":title.y,"x1":target.x,"y1":target.y,"steps":10}));
+ h.frames(4);
+ let sheet = h.app.viewport.dialog_rect.unwrap();
+ assert!(!sheet.intersect(chat).is_positive(), "{side}: {sheet:?} overlaps Assistant {chat:?}");
+ assert!(!sheet.intersect(ribbon).is_positive(), "sheet clears ribbon");
+ assert!(!sheet.intersect(workspace).is_positive(), "sheet clears workspace selector");
+ if target == browser.center() {
+ assert!(sheet.intersect(browser).is_positive(), "sheet can cover Browser");
+ let layer = h.ctx.layer_id_at(sheet.intersect(browser).center()).unwrap();
+ assert_eq!(layer.id, egui::Id::new(("sc_dialog", "CREATE SKETCH")), "sheet receives input above Browser");
+ } else if target == history.center() {
+ assert!(sheet.intersect(history).is_positive(), "sheet can cover History");
+ }
+ }
+ h.step(&json!({"widget":"Cancel"})).unwrap();
+ assert!(h.app.dialog.is_none(), "dragged sheet remains interactive");
+ }
+}
+
+#[test]
+fn compact_layout_is_saved_and_survives_cancel_apply_defaults_and_bad_input() {
+ let mut h = Harness::new();
+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();
+ h.app.start("solid.extrude");
+ h.settle();
+ let design = h.app.session.doc.to_json();
+ let undo = h.app.session.undo.len();
+ let camera = h.app.cam;
+ h.call("ui.prefs", json!({"open":"General"}));
+ h.step(&json!({"click":{"handle":"dialog:Workspace layout:Compact"}})).unwrap();
+ h.call("ui.prefs", json!({"button":"ok"}));
+ h.settle();
+ assert!(h.app.dialog.is_some(), "changing layout keeps the active tool");
+ assert_eq!(h.app.preferences.layout, LayoutMode::Docked);
+ assert_eq!(h.app.ui.layout, LayoutMode::Docked);
+ assert_eq!(h.app.cam, camera);
+ h.call("engine.execute", json!({"command":"view.layout", "params":{"mode":"compact"}}));
+ assert_eq!(h.app.cam, camera, "programmatic layout changes never auto-fit");
+ assert_eq!(h.app.session.doc.to_json(), design);
+ assert_eq!(h.app.session.undo.len(), undo);
+ let mut restored = crate::SolveApp::new(Default::default(), Default::default());
+ restored.load_prefs(&h.app.prefs());
+ assert_eq!(restored.ui.layout, LayoutMode::Docked);
+ assert_eq!(restored.preferences.layout, LayoutMode::Docked);
+ h.call("ui.prefs", json!({"open":"General","layout":"floating"}));
+ h.call("ui.prefs", json!({"button":"cancel"}));
+ assert_eq!(h.app.ui.layout, LayoutMode::Docked);
+ h.call("ui.prefs", json!({"open":"General","layout":"floating"}));
+ h.call("ui.prefs", json!({"button":"apply"}));
+ h.call("ui.prefs", json!({"layout":"compact"}));
+ h.call("ui.prefs", json!({"button":"cancel"}));
+ assert_eq!(h.app.ui.layout, LayoutMode::Floating);
+ h.call("ui.prefs", json!({"open":"General","layout":"compact"}));
+ h.call("ui.prefs", json!({"button":"defaults"}));
+ assert_eq!(h.app.ui.layout, LayoutMode::Floating);
+ assert_eq!(h.app.preferences.layout, LayoutMode::Floating);
+ h.call("ui.prefs", json!({"button":"ok"}));
+ assert!(crate::prefs::set(&mut h.app, &json!({"layout":"invalid"})).is_err());
+ assert_eq!(h.app.ui.layout, LayoutMode::Floating);
+ restored.load_prefs(r#"{"preferences":{"layout":"invalid","default_units":"in"}}"#);
+ assert_eq!(restored.ui.layout, LayoutMode::Floating);
+ assert_eq!(restored.preferences.default_units, "in");
+ assert_eq!(crate::prefs::lenient(&json!({})).layout, LayoutMode::Floating);
+}
+
+#[test]
+fn compact_chrome_is_flush_and_browser_hugs_content_in_both_themes() {
+ for dark in [false, true] {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ h.call("ui.prefs", json!({"layout":"compact"}));
+ h.call("ui.set", json!({"dark":dark}));
+ h.settle();
+ let bar = rect_of("toolbar").unwrap();
+ let browser = rect_of("browser:card").unwrap();
+ let workspace = rect_of("ribbon:workspace").unwrap();
+ assert_eq!(workspace.left(), bar.left());
+ assert_eq!(workspace.top(), bar.top());
+ assert_eq!(h.app.shell.cards.get(1).unwrap().left(), workspace.right(), "one joined top bar");
+ assert_eq!(browser.left(), 0.0);
+ assert_eq!(browser.top(), bar.bottom(), "square, flush Browser/ribbon join");
+ assert!(browser.height() < h.app.viewport.rect.unwrap().height() / 2.0, "Browser hugs its contents");
+ let compact = crate::ui_kit::Container::new(&h.ctx, crate::ui_kit::Surface::Panel);
+ assert_eq!(compact.gap(), 0.0);
+ let frame = compact.frame(&h.ctx, crate::theme::Tokens::get().panel, crate::frame::Side::Left);
+ assert_eq!(frame.shadow, egui::Shadow::NONE);
+ assert_eq!(frame.corner_radius, egui::CornerRadius::ZERO);
+ h.app.start("solid.extrude");
+ h.settle();
+ let dialog = h.app.viewport.dialog_rect.unwrap();
+ assert!((dialog.right() - h.app.viewport.rect.unwrap().right()).abs() < 1.0, "{dialog:?}");
+ let before = dialog;
+ h.step(&json!({"drag":[{"handle":"dialog:title"},[700,300]],"steps":6})).unwrap();
+ h.settle();
+ let moved = h.app.viewport.dialog_rect.unwrap();
+ assert!(moved.right() < before.right() - 100.0, "compact tool sheets detach from the right edge");
+ let feature = crate::ui_kit::Container::new(&h.ctx, crate::ui_kit::Surface::Feature);
+ assert_eq!(feature.frame(&h.ctx, crate::theme::Tokens::get().dialog_body, crate::frame::Side::Right).shadow, egui::Shadow::NONE);
+ h.app.run("view.layout", json!({"mode":"floating"})).unwrap();
+ h.settle();
+ assert_eq!(rect_of("browser:card").unwrap().left(), SHELL_GAP);
+ assert!(h.app.dialog.is_some());
+ }
+}
+
+#[test]
+fn two_collapsed_compact_headers_leave_live_viewport_below_their_column() {
+ for dark in [false, true] {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ h.call("ui.prefs", json!({"layout":"compact"}));
+ h.call("ui.set", json!({"dark":dark}));
+ h.app.run("view.history_layout", json!({"dock":"under_browser"})).unwrap();
+ h.app.preferences.timeline_left_browser_collapsed = true;
+ h.app.preferences.timeline_collapsed = true;
+ h.frames(12);
+ let browser = h.app.shell.browser.unwrap();
+ let history = h.app.shell.history.unwrap();
+ let below = egui::pos2(browser.center().x, history.bottom() + 40.0);
+ assert!(h.app.viewport.rect.unwrap().contains(below));
+ assert!(!covered(&h.app, below));
+ assert!(covered(&h.app, browser.center()));
+ assert!(covered(&h.app, history.center()));
+ h.call("ui.move", json!({"x":below.x,"y":below.y}));
+ assert_eq!(h.app.viewport.mouse, Some(below), "the vacated column remains live viewport");
+ }
+}
+
+#[test]
+fn ribbon_labels_are_saved_independently_and_icon_only_commands_remain_reachable() {
+ for mode in [LayoutMode::Floating, LayoutMode::Docked] {
+ let mut h = Harness::new();
+ h.call("ui.resize", json!({"width":1400,"height":900}));
+ h.call("ui.prefs", json!({"layout":mode}));
+ h.settle();
+ let labelled = rect_of("toolbar").unwrap();
+ h.call("ui.prefs", json!({"ribbon_labels":false}));
+ h.settle();
+ let icons = rect_of("toolbar").unwrap();
+ assert!(icons.height() < labelled.height());
+ assert_eq!(h.app.ui.layout, mode);
+ let command = rect_of("button:sketch.create").unwrap();
+ assert!(icons.contains_rect(command));
+ h.step(&json!({"click":{"handle":"button:sketch.create"}})).unwrap();
+ assert!(h.app.dialog.is_some(), "the icon still starts Create Sketch");
+ let mut restored = crate::SolveApp::new(Default::default(), Default::default());
+ restored.load_prefs(&h.app.prefs());
+ assert!(!restored.preferences.ribbon_labels);
+ assert_eq!(restored.ui.layout, mode);
+ h.call("ui.prefs", json!({"open":"General","ribbon_labels":true}));
+ h.call("ui.prefs", json!({"button":"cancel"}));
+ assert!(!h.app.preferences.ribbon_labels);
+ }
+ assert!(crate::prefs::lenient(&json!({})).ribbon_labels);
+}
diff --git a/crates/ui-egui/src/shortcut_box.rs b/crates/ui-egui/src/shortcut_box.rs
index 2c7903aee..7f672672b 100644
--- a/crates/ui-egui/src/shortcut_box.rs
+++ b/crates/ui-egui/src/shortcut_box.rs
@@ -1,6 +1,7 @@
//! Ribbon-anchored command search. Ranking comes from the registry; document results use
//! existing feature-edit and parameter commands. JSON mode never starts an interactive tool.
+use crate::ui_kit::{Container, Surface};
use egui::{Pos2, Rect, pos2, vec2};
use serde_json::{Value, json};
use solidcraft_engine::command_specs;
@@ -355,8 +356,13 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let mut rows = Vec::new();
let mut design = Vec::new();
let mut mode = None;
- let response =
- crate::frame::area(egui::Id::new("sc_sbox")).fixed_pos(pos).order(egui::Order::Foreground).fade_in(false).constrain(false).show(ctx, |ui| {
+ let response = Container::new(ctx, Surface::Popup)
+ .area(egui::Id::new("sc_sbox"))
+ .fixed_pos(pos)
+ .order(egui::Order::Foreground)
+ .fade_in(false)
+ .constrain(false)
+ .show(ctx, |ui| {
// Area rounds its origin; place the child at the exact interpolated bounds
// so the field's right edge does not drift during expansion.
ui.scope_builder(egui::UiBuilder::new().max_rect(Rect::from_min_size(pos, vec2(field_size.x, height + field_size.y))), |ui| {
@@ -374,7 +380,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
ui_kit::SearchFieldGeometry {
height: field_size.y,
progress,
- radius: ui_kit::CommandSearch::field_radius(progress, app.ui.layout == crate::shell::LayoutMode::Floating),
+ radius: ui_kit::CommandSearch::field_radius(progress, ui_kit::Container::new(ctx, ui_kit::Surface::Chrome).floating()),
},
MAX_QUERY,
);
diff --git a/crates/ui-egui/src/sketch_attachment_ui.rs b/crates/ui-egui/src/sketch_attachment_ui.rs
index 19217a57a..101d5f88b 100644
--- a/crates/ui-egui/src/sketch_attachment_ui.rs
+++ b/crates/ui-egui/src/sketch_attachment_ui.rs
@@ -136,7 +136,7 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
let mut apply = false;
let mut cancel = false;
let t = Tokens::get();
- let viewport = crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()));
+ let viewport = crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())));
if !viewport.is_finite() || !viewport.is_positive() {
app.tree.redefine_draft = Some(draft);
return;
@@ -149,13 +149,14 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
let top = crate::shell::panel_top(app, viewport, viewport.bottom(), side);
let docked = egui::pos2(side.anchor_x(viewport), top);
let moved = crate::frame::dock_offset(ctx, "sc_redefine");
- let anchor = crate::frame::offset_anchor(docked, moved, viewport, side);
+ let drag_bounds = crate::shell::tool_drag_rect(app, viewport);
+ let anchor = crate::frame::offset_anchor(docked, moved, drag_bounds, side);
let frame = ui_kit::Panel::feature_frame(ctx, app.ui.layout, side);
let spec = solidcraft_engine::find_command("sketch.redefine");
let command = spec.as_ref().map_or("", |s| crate::i18n::tr_label(s.label));
let title = crate::i18n::format("sketch_panel.redefine_title", &[("command", command), ("name", name)]);
- let panel = ui_kit::Panel::new(&title, egui::Id::new("sc_redefine"), anchor, viewport, side, frame);
- let response = panel.window().show(ctx, |ui| {
+ let panel = ui_kit::Panel::new(&title, egui::Id::new("sc_redefine"), anchor, drag_bounds, side, frame);
+ let response = panel.window(ctx).show(ctx, |ui| {
let (closed, action) = panel.feature(
ui,
ui_kit::FeatureOptions {
diff --git a/crates/ui-egui/src/sketch_dims.rs b/crates/ui-egui/src/sketch_dims.rs
index b79ba23c1..c172d6aac 100644
--- a/crates/ui-egui/src/sketch_dims.rs
+++ b/crates/ui-egui/src/sketch_dims.rs
@@ -4,6 +4,7 @@
//! locks that value; Tab moves to the next box; Enter places the shape with the typed values,
//! which become dimension constraints. Values are expressions ("25", "1 in", "d1 * 2").
+use crate::ui_kit::{Container, Surface};
use egui::{Pos2, vec2};
use serde_json::{Value, json};
use solidcraft_engine::doc::expr::Kind as ValueKind;
@@ -423,23 +424,27 @@ fn boxes(app: &SolveApp, ui: &mut egui::Ui, proj: &Proj, t: &mut Tool) -> Option
s.store(ui.ctx(), id);
}
let pos = in_view(sp + vec2(-34.0, -11.0), view, ui.ctx().pointer_latest_pos());
- crate::frame::area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
- let fill = if b.locked { tk.accent_soft } else { tk.panel };
- egui::Frame::popup(ui.style()).fill(fill).inner_margin(egui::Margin::symmetric(tk.space_3 as i8, 1)).show(ui, |ui| {
- let r = crate::ui_kit::placement_field(ui, id, &mut b.value, b.label);
- // A completion gets first use of forward Tab. Shift+Tab always moves back;
- // the box reached by egui's generic traversal must not complete its text.
- let changed = (source.is_none() || (source == Some(i) && tab != Some(true))) && crate::params_dialog::complete(ui, &r, &mut b.value);
- completed |= changed && source == Some(i);
- if r.changed() || changed {
- b.locked = true;
- }
- if focus && i == 0 {
- r.request_focus();
- }
- any_focused |= r.has_focus() || r.lost_focus();
- });
- });
+ Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new(("sc_dim_area", i))).fixed_pos(pos).order(egui::Order::Foreground).show(
+ ui.ctx(),
+ |ui| {
+ let fill = if b.locked { tk.accent_soft } else { tk.panel };
+ Container::popup_frame(ui.style()).fill(fill).inner_margin(egui::Margin::symmetric(tk.space_3 as i8, 1)).show(ui, |ui| {
+ let r = crate::ui_kit::placement_field(ui, id, &mut b.value, b.label);
+ // A completion gets first use of forward Tab. Shift+Tab always moves back;
+ // the box reached by egui's generic traversal must not complete its text.
+ let changed =
+ (source.is_none() || (source == Some(i) && tab != Some(true))) && crate::params_dialog::complete(ui, &r, &mut b.value);
+ completed |= changed && source == Some(i);
+ if r.changed() || changed {
+ b.locked = true;
+ }
+ if focus && i == 0 {
+ r.request_focus();
+ }
+ any_focused |= r.has_focus() || r.lost_focus();
+ });
+ },
+ );
}
if let Some(source) = source
&& !completed
diff --git a/crates/ui-egui/src/sketch_palette.rs b/crates/ui-egui/src/sketch_palette.rs
index 0b27f3813..95f241549 100644
--- a/crates/ui-egui/src/sketch_palette.rs
+++ b/crates/ui-egui/src/sketch_palette.rs
@@ -237,7 +237,7 @@ fn width(vp: egui::Rect) -> f32 {
/// The viewport the palette docks into.
fn viewport(app: &SolveApp, ctx: &egui::Context) -> egui::Rect {
- crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect()))
+ crate::agent_chat::tool_space(app, crate::shell::content_rect(app, app.viewport.rect.unwrap_or_else(|| ctx.content_rect())))
}
/// Is a sketch being edited? That is the palette's own condition.
@@ -334,10 +334,11 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
if !vp.is_finite() || !vp.is_positive() {
return;
}
- let bottom = vp.bottom().min(ctx.content_rect().bottom()) - crate::shell::SHELL_GAP;
+ let gap = crate::ui_kit::Container::new(ctx, crate::ui_kit::Surface::Palette).gap();
+ let bottom = vp.bottom().min(ctx.content_rect().bottom()) - gap;
let top = crate::shell::panel_top(app, vp, bottom, crate::frame::Side::Right);
let frame = crate::ui_kit::Panel::palette_frame(ctx, app.ui.layout);
- let anchor = egui::pos2(vp.right() - crate::shell::SHELL_GAP - frame.stroke.width, top + frame.stroke.width);
+ let anchor = egui::pos2(vp.right() - gap - frame.stroke.width, top + frame.stroke.width);
let shown = |key: &str| match key {
"grid" => !opts.hide_grid,
"snap" => !opts.no_snap,
@@ -370,7 +371,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
frame,
)
.width(width(vp));
- let response = panel.window().show(ctx, |ui| {
+ let response = panel.window(ctx).show(ctx, |ui| {
panel.palette(ui, bottom, top, |ui, part| match part {
crate::ui_kit::Part::Header => {
let status = if !solved || !geometry || remaining == 0 {
diff --git a/crates/ui-egui/src/sketch_tools.rs b/crates/ui-egui/src/sketch_tools.rs
index c3f162241..a0fc473cf 100644
--- a/crates/ui-egui/src/sketch_tools.rs
+++ b/crates/ui-egui/src/sketch_tools.rs
@@ -521,20 +521,6 @@ pub fn glyph_positions() -> Vec<(String, Pos2)> {
GLYPHS.with(|g| g.borrow().clone())
}
-/// A click on a constraint glyph selects it (true: the click was used).
-pub fn click_glyph(app: &mut SolveApp, _proj: &Proj, pos: Pos2) -> bool {
- if app.session.active_sketch.is_none() {
- return false;
- }
- let hit = GLYPHS.with(|g| g.borrow().iter().find(|(_, c)| c.distance(pos) <= GLYPH * 0.6).map(|(id, _)| id.clone()));
- let used = hit.is_some();
- PICKED.with(|p| *p.borrow_mut() = hit.clone());
- if let Some(id) = hit {
- app.set_status(format!("Constraint {id} selected: Delete removes it"), false);
- }
- used
-}
-
/// Delete the selected constraint glyph (true when one was selected).
pub fn delete_glyph(app: &mut SolveApp) -> bool {
let Some(id) = PICKED.with(|p| p.borrow_mut().take()) else { return false };
@@ -1328,7 +1314,7 @@ fn glyphs(app: &SolveApp, painter: &egui::Painter, proj: &Proj, hover: Option crate::icons::paint(painter, r.shrink(2.0), icon, col, tk.glyph_bg, col),
+ Some(icon) => crate::icons::paint_icon(painter, r.shrink(2.0), icon, f32::from(col.a()) / 255.0),
None => {
painter.text(
*sp,
diff --git a/crates/ui-egui/src/space_mouse_calibration.rs b/crates/ui-egui/src/space_mouse_calibration.rs
index 06e2b0b3e..848cdf47e 100644
--- a/crates/ui-egui/src/space_mouse_calibration.rs
+++ b/crates/ui-egui/src/space_mouse_calibration.rs
@@ -109,11 +109,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
Stage::Done => format!("{0} / {0}", STEP_PROMPTS.len()),
};
let (mut back, mut over, mut cancel, mut save) = (false, false, false, false);
- crate::frame::window(ctx, app.tr("ui.space_mouse_calibrate_title"), crate::frame::Width::Normal)
- .id(egui::Id::new("sc_space_mouse_calibration"))
- .collapsible(false)
- .resizable(false)
- .show(ctx, |ui| {
+ let closed = crate::ui_kit::Window::new(egui::Id::new("sc_space_mouse_calibration"), "settings", app.tr("ui.space_mouse_calibrate_title"))
+ .show_body(ctx, |ui| {
ui.label(app.tr(prompt));
if let Some(axis) = weak {
ui.label(egui::RichText::new(app.tr(axis)).strong());
@@ -147,7 +144,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
save = matches!(result, Some(Ok(_))) && crate::ui_kit::button(ui, app.tr("ui.save"), crate::ui_kit::Button::Normal).clicked();
});
});
- if cancel {
+ if cancel || closed {
app.space_mouse.calibrating = None;
} else if let Some((device, wizard)) = &mut app.space_mouse.calibrating {
wizard.set_dead_zone_share(dead_zone);
diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs
index eae1eb4f8..1edd0455b 100644
--- a/crates/ui-egui/src/theme.rs
+++ b/crates/ui-egui/src/theme.rs
@@ -215,39 +215,11 @@ pub fn srgb(c: [f32; 3]) -> Color32 {
/// the same as when they were literals in the WGSL). The light theme's are the headless default.
pub use solidcraft_engine::render::AnalysisColors;
-/// The colours icons draw of their own (`icons::paint` takes ink, fill and accent from its
-/// caller). Every icon colour is a token so a colour vision mode can reach it.
+/// Colours for native viewport markers and the agent pointer. Command artwork uses the SVG palette.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IconColors {
- /// Surface sheets: a sheet, a second sheet beside it, a lighter sheet, iso lines and teeth.
- pub sheet: Color32,
- pub sheet_2: Color32,
- pub sheet_light: Color32,
- pub sheet_line: Color32,
- /// Highlights (and the white ink of markers and the agent pointer), and the sphere's glint.
pub highlight: Color32,
- pub glint: Color32,
- pub folder: Color32,
- pub plane: Color32,
- pub fold: Color32,
- /// Zebra stripes, and the environment map's sky and floor.
- pub stripe: Color32,
- pub sky: Color32,
- pub floor: Color32,
- /// Appearance: red, blue and yellow paint dabs.
- pub paint: [Color32; 3],
- /// Origin: X, Y and Z arrows.
- pub axes: [Color32; 3],
- /// Accessibility: reachable, blocked. Draft: positive, between. Curvature: flat, middle,
- /// tight.
- pub access: [Color32; 2],
- pub draft: [Color32; 2],
- pub curvature: [Color32; 3],
- pub interference: Color32,
- pub warning: Color32,
- /// The pointer an AI agent moves.
pub agent: Color32,
- /// The dark halo under viewport markers (snap points).
pub marker_halo: Color32,
}
@@ -386,7 +358,6 @@ pub struct Tokens {
pub error: Color32,
pub warning: Color32,
pub icon: Color32,
- pub icon_fill: Color32,
pub timeline: Color32,
pub hover: Color32,
// ---- viewport selection feedback ----
@@ -462,10 +433,6 @@ pub struct Tokens {
pub dialog_bg: Color32,
pub dialog_border: Color32,
pub chip: Color32,
- /// Band behind a panel's heading and, lighter, behind its section headings (both set off
- /// from `dialog_bg`).
- pub heading_bg: Color32,
- pub subheading_bg: Color32,
/// Inside of bodies cut by a section.
pub section_cap: Color32,
/// Closed sketch profiles (translucent fill).
@@ -528,8 +495,6 @@ pub struct Tokens {
pub continuity: [Color32; 4],
pub analysis: AnalysisColors,
pub icons: IconColors,
- /// The application bar's buttons: ink, fill and accent of their icons.
- pub app_bar_icon: [Color32; 3],
/// The SolidCraft mark on the application bar: light, mid and dark faces, and its edge.
pub logo: [Color32; 4],
}
@@ -736,14 +701,4 @@ mod tests {
}
});
}
-
- /// Title and section bands stand out from a dialog, the title more than its sections.
- #[test]
- fn heading_bands_are_darker_than_the_dialog_in_order() {
- let luma = |c: egui::Color32| u32::from(c.r()) * 3 + u32::from(c.g()) * 6 + u32::from(c.b());
- for t in [super::Tokens::light(), super::Tokens::dark()] {
- assert!(luma(t.heading_bg) < luma(t.subheading_bg), "{t:?}");
- assert!(luma(t.subheading_bg) < luma(t.dialog_bg), "{t:?}");
- }
- }
}
diff --git a/crates/ui-egui/src/theme_files.rs b/crates/ui-egui/src/theme_files.rs
index 09c4733aa..f102930e9 100644
--- a/crates/ui-egui/src/theme_files.rs
+++ b/crates/ui-egui/src/theme_files.rs
@@ -26,6 +26,33 @@ pub const MAX_COLORS: usize = 512;
const MAX_NAME: usize = 80;
pub const MAX_CUSTOM: usize = 64;
+// Older exports contain colours for retired window bands and procedural icons.
+// Discard them at import; they have no token, renderer, or exported setting now.
+const RETIRED_COLORS: &[&str] = &[
+ "icon_fill",
+ "heading_bg",
+ "subheading_bg",
+ "app_bar_icon",
+ "icons.sheet",
+ "icons.sheet_2",
+ "icons.sheet_light",
+ "icons.sheet_line",
+ "icons.glint",
+ "icons.folder",
+ "icons.plane",
+ "icons.fold",
+ "icons.stripe",
+ "icons.sky",
+ "icons.floor",
+ "icons.paint",
+ "icons.axes",
+ "icons.access",
+ "icons.draft",
+ "icons.curvature",
+ "icons.interference",
+ "icons.warning",
+];
+
/// The palette a theme starts from.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
@@ -53,15 +80,15 @@ pub struct ThemeFile {
/// The settable colours: a key, and where it lives in [`Tokens`]. `one` keys take a colour,
/// `many` keys a list of exactly as many colours as the token has; `icons.*` are the colours
-/// icons draw of their own. The destructuring below fails to build when a token is added
+/// viewport glyphs draw of their own. The destructuring below fails to build when a token is added
/// without a key here, so every colour stays themeable.
macro_rules! theme_keys {
(one: [$($one:ident),* $(,)?], many: [$($many:ident),* $(,)?],
- icons_one: [$($ione:ident),* $(,)?], icons_many: [$($imany:ident),* $(,)?] $(,)?) => {
+ icons: [$($ione:ident),* $(,)?] $(,)?) => {
/// Every key a theme file may set, in the order an export writes them.
pub fn keys() -> Vec<&'static str> {
let mut k = vec![$(stringify!($one),)* $(stringify!($many),)*];
- k.extend([$(concat!("icons.", stringify!($ione)),)* $(concat!("icons.", stringify!($imany)),)*]);
+ k.extend([$(concat!("icons.", stringify!($ione)),)*]);
k
}
@@ -70,7 +97,6 @@ macro_rules! theme_keys {
$(stringify!($one) => Some(std::slice::from_mut(&mut t.$one)),)*
$(stringify!($many) => Some(&mut t.$many[..]),)*
$(concat!("icons.", stringify!($ione)) => Some(std::slice::from_mut(&mut t.icons.$ione)),)*
- $(concat!("icons.", stringify!($imany)) => Some(&mut t.icons.$imany[..]),)*
_ => None,
}
}
@@ -91,7 +117,7 @@ macro_rules! theme_keys {
form_checkbox_height: _, form_button_height: _, sketch_palette_width: _, sketch_mode_size: _, sketch_mode_radius: _, sketch_mode_border: _,
sketch_palette_alpha: _, sketch_mode_tint: _, sketch_footer_icon_size: _, font_section_tracking: _,
} = t;
- let IconColors { $($ione: _,)* $($imany: _,)* } = &t.icons;
+ let IconColors { $($ione: _,)* } = &t.icons;
}
};
}
@@ -99,12 +125,12 @@ macro_rules! theme_keys {
theme_keys! {
one: [
app_bar, toolbar, panel, panel_header, border, text, text_dim, accent, accent_soft, sketch_accent, error, warning,
- icon, icon_fill, timeline, hover, sel_face, sel_edge, sel_edge_rim, hover_edge, hover_edge_halo, sel_profile,
+ icon, timeline, hover, sel_face, sel_edge, sel_edge_rim, hover_edge, hover_edge_halo, sel_profile,
sel_profile_edge, hover_profile, hover_profile_edge, sel_vertex, origin_plane, origin_plane_edge, origin_plane_hover,
origin_point, axis_x, axis_y, axis_z, construction_plane, construction_geom, body, body_edge, manipulator,
preview_add, preview_new, preview_sketch, preview_cut, cube_face, cube_border, cube_text, cube_hover, viewport_top,
viewport_bottom, grid, grid_major, body_selected, sketch, sketch_fixed, sketch_locked, dimension, dimension_driven,
- sketch_point, sketch_point_free, dialog_bg, dialog_border, chip, heading_bg, subheading_bg, section_cap,
+ sketch_point, sketch_point_free, dialog_bg, dialog_border, chip, section_cap,
profile_fill, glyph_bg, glyph_edge, glyph_text, overlay, rubber_band, app_bar_text, app_bar_hover, timeline_item,
timeline_item_error, timeline_marker, field, box_window, box_crossing, sketch_projected, sketch_lost,
sketch_construction, sketch_centerline, bend_up, bend_down, interference,
@@ -113,12 +139,8 @@ theme_keys! {
app_bar_hover_button, app_bar_hover_strong, app_bar_tab_active,
form_ink, form_dim, form_primary, form_error, form_error_fill, form_success, form_success_fill, dialog_body, dialog_footer, dialog_rule, control_fill, control_border, dialog_label, selected_ink, selected_bg,
],
- many: [triad, gizmo, continuity, app_bar_icon, logo],
- icons_one: [
- sheet, sheet_2, sheet_light, sheet_line, highlight, glint, folder, plane, fold, stripe, sky, floor, interference,
- warning, agent, marker_halo,
- ],
- icons_many: [paint, axes, access, draft, curvature],
+ many: [triad, gizmo, continuity, logo],
+ icons: [highlight, agent, marker_halo],
}
/// `#rrggbb` or `#rrggbbaa` (alpha not premultiplied).
@@ -172,7 +194,7 @@ pub fn from_value(v: &Value) -> Result {
Some("light") => Base::Light,
_ => return Err("`base` must be \"dark\" or \"light\"".into()),
};
- let src = match v.get("colors") {
+ let mut src = match v.get("colors") {
None => serde_json::Map::new(),
Some(Value::Object(o)) => o.clone(),
Some(_) => return Err("`colors` must be an object of colour names and values".into()),
@@ -180,6 +202,7 @@ pub fn from_value(v: &Value) -> Result {
if src.len() > MAX_COLORS {
return Err(format!("`colors` has more than {MAX_COLORS} entries"));
}
+ src.retain(|key, _| !RETIRED_COLORS.contains(&key.as_str()));
let mut probe = Tokens::light();
let mut bad = Vec::new();
for (k, c) in &src {
@@ -307,16 +330,6 @@ mod tests {
}
}
- /// Title and section bands stand out from a dialog in every built-in theme, as in Dark and
- /// Light (`heading_bands_are_darker_than_the_dialog_in_order`).
- #[test]
- fn built_in_themes_keep_heading_bands_in_order() {
- let luma = |c: Color32| u32::from(c.r()) * 3 + u32::from(c.g()) * 6 + u32::from(c.b());
- for t in builtin().iter().map(resolve) {
- assert!(luma(t.heading_bg) < luma(t.subheading_bg) && luma(t.subheading_bg) < luma(t.dialog_bg), "{t:?}");
- }
- }
-
#[test]
fn a_short_file_sets_only_its_colours() {
let t = parse(r##"{"format":"solidcraft-theme/1","name":"My Theme!","base":"light","colors":{"panel":"#102030","triad":["#ff0000","#00ff00","#0000ff80"]}}"##).unwrap();
@@ -327,6 +340,20 @@ mod tests {
assert_eq!(p.text, Tokens::light().text);
}
+ #[test]
+ fn older_exports_keep_active_overrides_without_retired_ui_settings() {
+ let mut file = export("Older theme", Base::Dark, &Tokens::dark());
+ let colors = file.get_mut("colors").and_then(Value::as_object_mut).unwrap();
+ colors.insert("panel".into(), json!("#102030"));
+ for key in RETIRED_COLORS {
+ colors.insert((*key).into(), json!("#abcdef"));
+ }
+ let imported = from_value(&file).unwrap();
+ assert_eq!(resolve(&imported).panel, Color32::from_rgb(0x10, 0x20, 0x30));
+ assert_eq!(imported.colors.len(), keys().len());
+ assert!(RETIRED_COLORS.iter().all(|key| !imported.colors.contains_key(*key)));
+ }
+
#[test]
fn bad_files_are_refused_naming_every_bad_key() {
let ok = r#""format":"solidcraft-theme/1","name":"x","base":"dark""#;
diff --git a/crates/ui-egui/src/timeline.rs b/crates/ui-egui/src/timeline.rs
index 03f82296f..9002faa9c 100644
--- a/crates/ui-egui/src/timeline.rs
+++ b/crates/ui-egui/src/timeline.rs
@@ -1,6 +1,7 @@
//! The timeline (bottom): features in order, the rollback marker, errors and warnings.
-use egui::{Rect, Sense, Stroke, UiBuilder, pos2, vec2};
+use crate::ui_kit::{Container, Edge, Surface};
+use egui::{Rect, Sense, UiBuilder, pos2, vec2};
use serde_json::{Value, json};
use solidcraft_engine::doc::{
FeatureKind, PlaneRef, SketchId,
@@ -270,7 +271,7 @@ fn toggle_feature(app: &mut SolveApp, id: u64) {
pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
let t = Tokens::get();
app.shell.history_dock_space = Some(ui.available_rect_before_wrap());
- if app.ui.layout == crate::shell::LayoutMode::Floating {
+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {
let rect = floating_rect(ui.available_rect_before_wrap());
// A window too short for the card (the ribbon already fills it) leaves the history out
// rather than drawing into a negative-size rectangle.
@@ -281,13 +282,17 @@ pub fn timeline(app: &mut SolveApp, ui: &mut egui::Ui) {
app.shell.history = Some(rect);
crate::scenario::publish_rect("history:card", rect);
let mut child = ui.new_child(UiBuilder::new().id_salt("sc_timeline").max_rect(rect));
- ui.painter().add(crate::frame::shell_card(t.timeline).paint(rect));
+ ui.painter().add(Container::new(ui.ctx(), Surface::Panel).frame(ui.ctx(), t.timeline, crate::frame::Side::Left).paint(rect));
child.set_clip_rect(rect);
timeline_contents(app, &mut child, true);
} else {
- let response = egui::Panel::bottom("sc_timeline").exact_size(40.0).frame(egui::Frame::NONE.fill(t.timeline)).show(ui, |ui| {
- timeline_contents(app, ui, false);
- });
+ let response = Container::new(ui.ctx(), Surface::Panel)
+ .edge("sc_timeline", Edge::Bottom)
+ .exact_size(40.0)
+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.timeline))
+ .show(ui, |ui| {
+ timeline_contents(app, ui, false);
+ });
app.shell.history = Some(response.response.rect);
crate::scenario::publish_rect("history:strip", response.response.rect);
}
@@ -304,9 +309,7 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
let accent = crate::theme::TabAccent::for_tab(&t, &app.ui.tab);
let r = ui.max_rect();
let p = ui.painter().clone();
- if !floating {
- p.line_segment([r.left_top(), r.right_top()], Stroke::new(1.0, t.border));
- }
+
let n = app.session.doc.features.len();
let marker = app.session.doc.marker.unwrap_or(n);
// Playback controls.
diff --git a/crates/ui-egui/src/timeline_left.rs b/crates/ui-egui/src/timeline_left.rs
index 50f0232e9..3c5cd080d 100644
--- a/crates/ui-egui/src/timeline_left.rs
+++ b/crates/ui-egui/src/timeline_left.rs
@@ -1,5 +1,6 @@
//! The left feature-history panel: named rows, folders, rollback and drag-and-drop.
+use crate::ui_kit::{Container, Edge, Surface};
use egui::{Rect, Sense, Stroke, pos2, vec2};
use serde_json::json;
@@ -133,9 +134,10 @@ fn column_rects(app: &SolveApp, available: Rect, browser_collapsed: bool, histor
}
fn column_rects_at(app: &SolveApp, available: Rect, browser_fold: f32, history_fold: f32) -> (Rect, Rect) {
- let gap = crate::shell::SHELL_GAP;
- let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };
- let column = crate::browser::floating_bounds(available, None, crate::browser::browser_width(app.preferences.browser_width), top_gap);
+ let mut available = available;
+ available.min.x += crate::agent_chat::left_inset(app, available);
+ let gap = Container::for_layout(app.ui.layout, Surface::Panel).gap();
+ let column = crate::browser::panel_bounds(available, None, crate::browser::browser_width(app.preferences.browser_width), gap);
if !app.ui.show_browser {
let height = egui::lerp(column.height()..=header_outer_height().min(column.height()), history_fold);
let history = Rect::from_min_size(column.min, vec2(column.width(), height));
@@ -156,9 +158,8 @@ pub(crate) fn floating_rect(app: &SolveApp, available: Rect) -> Rect {
if stacked(app) {
return stacked_rects(app, available).1;
}
- let gap = crate::shell::SHELL_GAP;
- let top_gap = if app.ui.layout == crate::shell::LayoutMode::Docked { gap } else { 0.0 };
- let min = pos2((available.left() + gap).min(available.right()), (available.top() + top_gap).min(available.bottom()));
+ let gap = Container::for_layout(app.ui.layout, Surface::Panel).gap();
+ let min = pos2((available.left() + crate::agent_chat::left_inset(app, available) + gap).min(available.right()), available.top());
Rect::from_min_max(min, pos2((min.x + strip_width(app)).min((available.right() - gap).max(min.x)), (available.bottom() - gap).max(min.y)))
}
@@ -167,26 +168,31 @@ pub fn left_panel(app: &mut SolveApp, ui: &mut egui::Ui) {
let t = Tokens::get();
let available = ui.available_rect_before_wrap();
app.shell.history_dock_space = Some(available);
- if app.ui.layout == crate::shell::LayoutMode::Floating || stacked(app) {
+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() || stacked(app) {
let bounds = floating_rect(app, available);
app.shell.history = None;
if !bounds.is_finite() || bounds.width() < crate::ui_kit::history_width(false) || bounds.height() < t.control_height {
return;
}
- let frame = crate::frame::shell_card(t.panel).inner_margin(t.space_4);
+ let container = Container::new(ui.ctx(), Surface::Panel).joined(crate::ui_kit::DockEdges { left: true, top: true, ..Default::default() });
+ let frame = container.frame(ui.ctx(), t.panel, crate::frame::Side::Left).inner_margin(t.space_4);
let inner = (bounds.size() - frame.total_margin().sum()).max(egui::Vec2::ZERO);
- let card = crate::frame::area(egui::Id::new("sc_timeline_left_card")).fixed_pos(bounds.min).order(egui::Order::Middle).show(ui.ctx(), |ui| {
- let response = frame.show(ui, |ui| {
- ui.set_min_size(inner);
- ui.set_max_size(inner);
- ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, inner)));
- left_timeline(app, ui);
+ let card = Container::new(ui.ctx(), Surface::Panel)
+ .area(egui::Id::new("sc_timeline_left_card"))
+ .fixed_pos(bounds.min)
+ .order(egui::Order::Middle)
+ .show(ui.ctx(), |ui| {
+ let response = container.show_frame(ui, frame, available, |ui| {
+ ui.set_min_size(inner);
+ ui.set_max_size(inner);
+ ui.set_clip_rect(ui.clip_rect().intersect(Rect::from_min_size(ui.max_rect().min, inner)));
+ left_timeline(app, ui);
+ });
+ if stacked(app) {
+ let width = crate::browser::browser_width(app.preferences.browser_width);
+ crate::browser::resize_column(app, ui, response.response.rect, width, "left-history-rail");
+ }
});
- if stacked(app) {
- let width = crate::browser::browser_width(app.preferences.browser_width);
- crate::browser::resize_column(app, ui, response.response.rect, width, "left-history-rail");
- }
- });
app.shell.history = Some(card.response.rect);
crate::scenario::publish_rect("history:vertical", card.response.rect);
if !stacked(app) {
@@ -197,10 +203,11 @@ pub fn left_panel(app: &mut SolveApp, ui: &mut egui::Ui) {
if width < crate::ui_kit::history_width(false) {
return;
}
- let response = egui::Panel::left("sc_timeline_left")
+ let response = Container::new(ui.ctx(), Surface::Panel)
+ .edge("sc_timeline_left", Edge::Left)
.exact_size(width)
.resizable(false)
- .frame(egui::Frame::NONE.fill(t.panel).inner_margin(t.space_4))
+ .frame(Container::new(ui.ctx(), Surface::Panel).edge_frame(t.panel).inner_margin(t.space_4))
.show(ui, |ui| left_timeline(app, ui));
crate::scenario::publish_rect("history:vertical", response.response.rect);
app.shell.history = Some(response.response.rect);
@@ -216,23 +223,26 @@ fn names_fit(width: f32) -> bool {
fn seam_handle(app: &mut SolveApp, ui: &mut egui::Ui, card: Rect) {
let seam = crate::ui_kit::HistorySeam::new(card);
let bounds = seam.edge.union(seam.pill);
- crate::frame::area(egui::Id::new("history_seam_overlay")).order(egui::Order::Foreground).fixed_pos(bounds.min).show(ui.ctx(), |ui| {
- ui.set_min_size(bounds.size());
- ui.set_clip_rect(ui.ctx().content_rect());
- let result = crate::ui_kit::history_seam(ui, card, card.width() >= crate::ui_kit::history_width(true));
- if let Some(width) = result.width {
- app.shell.history_drag_width = Some(width);
- ui.ctx().request_repaint();
- if result.released {
- let _ = app.run("view.history_layout", json!({"width": width}));
- app.shell.history_drag_width = None;
+ Container::new(ui.ctx(), Surface::Canvas).area(egui::Id::new("history_seam_overlay")).order(egui::Order::Foreground).fixed_pos(bounds.min).show(
+ ui.ctx(),
+ |ui| {
+ ui.set_min_size(bounds.size());
+ ui.set_clip_rect(ui.ctx().content_rect());
+ let result = crate::ui_kit::history_seam(ui, card, card.width() >= crate::ui_kit::history_width(true));
+ if let Some(width) = result.width {
+ app.shell.history_drag_width = Some(width);
+ ui.ctx().request_repaint();
+ if result.released {
+ let _ = app.run("view.history_layout", json!({"width": width}));
+ app.shell.history_drag_width = None;
+ }
+ } else if result.toggle {
+ let width = crate::ui_kit::history_width(card.width() < crate::ui_kit::history_width(true));
+ let _ = app.run("view.history_layout", json!({"width":width}));
+ ui.ctx().request_repaint();
}
- } else if result.toggle {
- let width = crate::ui_kit::history_width(card.width() < crate::ui_kit::history_width(true));
- let _ = app.run("view.history_layout", json!({"width":width}));
- ui.ctx().request_repaint();
- }
- });
+ },
+ );
}
/// Width alone chooses icons, names, horizontal transport and the optional title.
@@ -363,7 +373,7 @@ pub(crate) fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Response
if let Some(target) = target {
let zone = match target {
Dock::Bottom => {
- if app.ui.layout == crate::shell::LayoutMode::Floating {
+ if Container::for_layout(app.ui.layout, Surface::Panel).floating() {
crate::timeline::floating_rect(available)
} else {
Rect::from_min_max(pos2(available.left(), (available.bottom() - 40.0).max(available.top())), available.max)
@@ -371,7 +381,7 @@ pub(crate) fn dock_drag(app: &mut SolveApp, ui: &egui::Ui, drag: &egui::Response
}
Dock::Left => {
let mut rect = available;
- let gap = if app.ui.layout == crate::shell::LayoutMode::Floating { crate::shell::SHELL_GAP } else { 0.0 };
+ let gap = if Container::for_layout(app.ui.layout, Surface::Panel).floating() { crate::shell::SHELL_GAP } else { 0.0 };
rect.min.x += gap;
rect.max.x = (rect.left() + strip_width(app)).min(available.right() - gap);
rect.max.y -= gap;
@@ -845,7 +855,7 @@ fn vertical_group_row(
let centre = pos2(rect.left() + 9.0 + offset, rect.center().y);
crate::ui_kit::disclosure(ui.painter(), centre, open, t.text_dim);
let icon = Rect::from_center_size(pos2(rect.left() + 27.5 + offset, rect.center().y), vec2(17.0, 17.0));
- icons::paint(ui.painter(), icon, "folder", t.icon, t.icon_fill, t.accent);
+ icons::paint_icon(ui.painter(), icon, "folder", f32::from(t.icon.a()) / 255.0);
let renaming = timeline_group_name(app, ui, group, rect, offset, names, &t);
crate::scenario::publish_handle(&format!("timeline-folder:{}", group.name), rect.center());
let fold_rect = Rect::from_min_max(pos2(rect.left() + offset, rect.top()), pos2(rect.left() + offset + 18.0, rect.bottom()));
@@ -1235,7 +1245,7 @@ mod tests {
let history = h.app.shell.history.unwrap();
assert!((browser.width() - history.width()).abs() < 1.0);
assert!((browser.height() - history.height()).abs() < 1.0);
- assert!(browser.bottom() < history.top());
+ assert!((history.top() - browser.bottom() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0);
let at = handle_at("history:collapse").unwrap();
h.call("ui.click", json!({"x":at.x,"y":at.y}));
h.frames(5);
@@ -1250,7 +1260,7 @@ mod tests {
let folded_history = h.app.shell.history.unwrap();
assert!(folded_browser.height() <= header_outer_height() + 1.0);
assert!(folded_history.height() <= header_outer_height() + 1.0);
- assert!((folded_history.top() - folded_browser.bottom() - crate::shell::SHELL_GAP).abs() < 1.0);
+ assert!((folded_history.top() - folded_browser.bottom() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0);
let at = handle_at("history:collapse").unwrap();
h.call("ui.click", json!({"x":at.x,"y":at.y}));
h.frames(5);
@@ -1532,7 +1542,10 @@ mod tests {
h.settle();
let history = crate::scenario::rect_of("history:vertical").unwrap();
let browser = crate::scenario::rect_of("browser:card").unwrap();
- assert!(history.right() < browser.left(), "{mode:?}, names={names}, collapsed={collapsed}: {history:?}, {browser:?}");
+ assert!(
+ (browser.left() - history.right() - Container::for_layout(mode, Surface::Panel).gap()).abs() < 1.0,
+ "{mode:?}, names={names}, collapsed={collapsed}: {history:?}, {browser:?}"
+ );
assert_eq!(history.width(), crate::ui_kit::history_width(names));
assert_eq!(handle_at("row:Untitled").is_none(), collapsed);
let folder = handle_at("timeline-folder:Housing").unwrap();
@@ -1608,11 +1621,8 @@ mod tests {
harness.app.preferences.browser_float = false;
harness.frames(4);
assert!(crate::scenario::rect_of("browser:float").is_none(), "the explicit overlay is off");
- assert_eq!(crate::scenario::rect_of("browser:card").is_some(), mode == crate::shell::LayoutMode::Floating);
- assert_eq!(
- harness.app.viewport.rect.unwrap().left(),
- if mode == crate::shell::LayoutMode::Docked { harness.app.preferences.browser_width } else { 0.0 }
- );
+ assert!(crate::scenario::rect_of("browser:card").is_some());
+ assert_eq!(harness.app.viewport.rect.unwrap().left(), 0.0);
assert!(handle_at("left-browser-rail").is_some(), "both card and sidebar resize");
}
}
diff --git a/crates/ui-egui/src/tool_modifiers.rs b/crates/ui-egui/src/tool_modifiers.rs
index 10f0e3cba..c91662f1e 100644
--- a/crates/ui-egui/src/tool_modifiers.rs
+++ b/crates/ui-egui/src/tool_modifiers.rs
@@ -7,7 +7,7 @@
//! so that neither gizmo nor canvas needs access to application state.
//!
//! Strategy: bindings name a chord; call sites ask whether the chord matches the
-//! held keys (`held` / `matches_exact`) instead of reading `Modifiers` fields
+//! held keys (`held` / `matches`) instead of reading `Modifiers` fields
//! directly. Platform primary is Ctrl on Windows/Linux and Cmd on macOS; the
//! physical Ctrl key on macOS is never treated as primary.
@@ -104,11 +104,6 @@ impl ModifierCombo {
}
}
- /// True if **exactly** these modifiers (and no others) are held.
- pub fn matches_exact(self, m: Modifiers) -> bool {
- self.matches(Held::from_modifiers(m), Match::Exact)
- }
-
/// True if **at least** these modifiers are held (subset / "held" match).
pub fn held(self, m: Modifiers) -> bool {
self.matches(Held::from_modifiers(m), Match::AtLeast)
@@ -143,16 +138,9 @@ impl ModifierCombo {
/// Combos offered by the sketch snap-suppress picker (classic OR first).
pub const SNAP_SUPPRESS_CHOICES: [Self; 4] = [Self::CTRL_ALT, Self::CTRL, Self::ALT, Self::SHIFT];
-
- /// All single-key combos, in display order (for a picker widget).
- pub const SINGLE_KEYS: [Self; 3] = [Self::CTRL, Self::ALT, Self::SHIFT];
}
/// "Ctrl/Cmd" on Windows/Linux, "Cmd" on macOS.
-pub fn ctrl_name() -> &'static str {
- ctrl_name_for(Platform::host())
-}
-
pub fn ctrl_name_for(platform: Platform) -> &'static str {
match platform {
Platform::Mac => "Cmd",
@@ -161,10 +149,6 @@ pub fn ctrl_name_for(platform: Platform) -> &'static str {
}
/// "Alt" on Windows/Linux, "Option" on macOS.
-pub fn alt_name() -> &'static str {
- alt_name_for(Platform::host())
-}
-
pub fn alt_name_for(platform: Platform) -> &'static str {
match platform {
Platform::Mac => "Option",
@@ -500,9 +484,9 @@ mod tests {
#[test]
fn exact_match_requires_no_extra_keys() {
let ctrl = ModifierCombo::CTRL;
- assert!(ctrl.matches_exact(mods(false, true, false)));
- assert!(!ctrl.matches_exact(mods(true, true, false)), "extra shift must fail");
- assert!(!ctrl.matches_exact(mods(false, false, false)));
+ assert!(ctrl.matches(Held::from_modifiers(mods(false, true, false)), Match::Exact));
+ assert!(!ctrl.matches(Held::from_modifiers(mods(true, true, false)), Match::Exact), "extra shift must fail");
+ assert!(!ctrl.matches(Held::from_modifiers(mods(false, false, false)), Match::Exact));
}
#[test]
@@ -526,7 +510,7 @@ mod tests {
let ctrl = ModifierCombo::CTRL;
let cmd_mods = Modifiers { command: true, ..Default::default() };
assert!(ctrl.held(cmd_mods), "Cmd on macOS should match a ctrl binding");
- assert!(ctrl.matches_exact(cmd_mods), "exact match also normalises command");
+ assert!(ctrl.matches(Held::from_modifiers(cmd_mods), Match::Exact), "exact match also normalises command");
}
#[test]
diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs
index dd985f75b..e9f0ec749 100644
--- a/crates/ui-egui/src/toolbar.rs
+++ b/crates/ui-egui/src/toolbar.rs
@@ -2,6 +2,7 @@
use crate::fonts::RichTextExt as _;
use crate::icons::glyphs::pin_icon;
+use crate::ui_kit::{Container, Edge, Surface};
use egui::{Align2, Color32, FontId, Rect, Sense, Stroke, pos2, vec2};
use serde_json::json;
@@ -99,6 +100,13 @@ pub const GROUP_HEIGHT: f32 = 86.0;
pub const RIBBON_HEIGHT: f32 = TAB_ROW_HEIGHT + GROUP_HEIGHT + 1.0;
pub(crate) const WORKSPACE_WIDTH: f32 = 88.0;
const BUTTON_HEIGHT: f32 = 60.0;
+const ICON_BUTTON_HEIGHT: f32 = 36.0;
+const ICON_GROUP_HEIGHT: f32 = 62.0;
+
+/// The same height drives shell reservations and ribbon painting in either layout.
+pub(crate) fn ribbon_height(labels: bool) -> f32 {
+ if labels { RIBBON_HEIGHT } else { TAB_ROW_HEIGHT + ICON_GROUP_HEIGHT + 1.0 }
+}
const BUTTON_GAP: f32 = 3.0;
const BUTTON_MIN_WIDTH: f32 = 54.0;
const BUTTON_MAX_WIDTH: f32 = 76.0;
@@ -271,7 +279,9 @@ pub const APP_BAR_HEIGHT: f32 = 34.0;
pub fn app_bar(app: &mut SolveApp, ui: &mut egui::Ui) {
let t = Tokens::get();
- egui::Panel::top("sc_appbar").exact_size(APP_BAR_HEIGHT).show_separator_line(false).frame(egui::Frame::NONE.fill(t.app_bar)).show(ui, |ui| {
+ let app_bar = Container::new(ui.ctx(), Surface::ApplicationBar).edge("sc_appbar", Edge::Top);
+ let frame = Container::new(ui.ctx(), Surface::ApplicationBar).edge_frame(t.app_bar);
+ app_bar.exact_size(APP_BAR_HEIGHT).show_separator_line(false).frame(frame).show(ui, |ui| {
let r = ui.max_rect();
// The bar is the window's title bar: its empty space moves the window.
if app.custom_titlebar || app.integrated_titlebar {
@@ -474,7 +484,8 @@ fn file_menu(app: &mut SolveApp, ctx: &egui::Context) {
return;
}
let mut close = false;
- let resp = crate::frame::area(egui::Id::new("sc_file_area"))
+ let resp = Container::new(ctx, Surface::Popup)
+ .area(egui::Id::new("sc_file_area"))
.fixed_pos(pos2(ctx.data(|d| d.get_temp::(egui::Id::new("sc_file_menu_x"))).unwrap_or(100.0), APP_BAR_HEIGHT))
.order(egui::Order::Foreground)
.show(ctx, |ui| {
@@ -797,7 +808,7 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {
let search_width = crate::ui_kit::CommandSearch::closed_width(ui.ctx());
// The first tab and the search field sit the same distance from the card's top, left and right
// edges, so their outer corners are concentric with the card's corners.
- let floating = app.ui.layout == crate::shell::LayoutMode::Floating;
+ let floating = Container::for_layout(app.ui.layout, Surface::Panel).floating();
let inset = RIBBON_TAB_INSET;
let corner = if floating { t.radius_lg.saturating_sub(inset as u8).max(2) } else { 5 };
let search = Rect::from_min_size(pos2(row.right() - search_width - inset, row.top() + inset), vec2(search_width, TAB_ROW_HEIGHT - 2.0 * inset));
@@ -900,23 +911,31 @@ fn dropdown_arrow(painter: &egui::Painter, at: egui::Pos2, ink: Color32) {
pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let t = Tokens::get();
crate::workspace::sync_context(app);
- let floating = app.ui.layout == crate::shell::LayoutMode::Floating;
- let cards = crate::shell::Cards::new(ui.available_rect_before_wrap(), app.ui.layout);
- let height = if floating { cards.bottom - ui.available_rect_before_wrap().top() } else { RIBBON_HEIGHT };
+ let floating = Container::for_layout(app.ui.layout, Surface::Panel).floating();
+ let labels = app.preferences.ribbon_labels;
+ let button_height = if labels { BUTTON_HEIGHT } else { ICON_BUTTON_HEIGHT };
+ let group_height = if labels { GROUP_HEIGHT } else { ICON_GROUP_HEIGHT };
+ let ribbon_height = ribbon_height(labels);
+ let gallery_width = if labels { CONSTRAINT_GRID_WIDTH } else { 6.0 * 27.0 };
+ let cards = crate::shell::Cards::new(ui.available_rect_before_wrap(), app.ui.layout, ribbon_height);
+ let height = if floating { cards.bottom - ui.available_rect_before_wrap().top() } else { ribbon_height };
let fill = if floating { Color32::TRANSPARENT } else { t.toolbar };
- egui::Panel::top("sc_toolbar").exact_size(height).show_separator_line(false).frame(egui::Frame::NONE.fill(fill)).show(ui, |ui| {
- let r = if floating { Rect::from_min_max(cards.workspace.min, cards.ribbon.max) } else { ui.max_rect() };
- let ws = if floating { cards.workspace } else { Rect::from_min_size(r.left_top(), vec2(WORKSPACE_WIDTH, RIBBON_HEIGHT - 1.0)) };
- let ribbon_left = if floating { cards.ribbon.left() } else { ws.right() + 1.0 };
+ let ribbon = Container::new(ui.ctx(), Surface::Chrome).edge("sc_toolbar", Edge::Top);
+ let frame = Container::new(ui.ctx(), Surface::Chrome).edge_frame(fill);
+ ribbon.exact_size(height).show_separator_line(false).frame(frame).show(ui, |ui| {
+ let r = if floating { Rect::from_min_max(cards.workspace.min, cards.ribbon.max) } else { frame.outer_rect(ui.max_rect()) };
+ let ws = if floating { cards.workspace } else { Rect::from_min_size(r.left_top(), vec2(WORKSPACE_WIDTH, ribbon_height - 1.0)) };
+ let ribbon_left = if floating { cards.ribbon.left() } else { ws.right() };
if floating {
for card in [ws, cards.ribbon] {
- let frame = egui::Frame::NONE.fill(t.toolbar).stroke(Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow());
+ let frame = Container::new(ui.ctx(), Surface::Chrome).frame(ui.ctx(), t.toolbar, crate::frame::Side::Left);
ui.painter().add(frame.paint(card));
// Blank card space owns clicks as well as its buttons.
ui.interact(card, ui.id().with(("shell_card", card.left().to_bits())), Sense::click_and_drag());
}
crate::scenario::publish_rect("ribbon:card", cards.ribbon);
}
+ app.shell.cards = vec![ws, Rect::from_min_max(pos2(ribbon_left, r.top()), r.max)];
let painter = ui.painter().clone();
let bg = ui.interact(if floating { cards.ribbon } else { r }, ui.id().with("toolbar_bg"), Sense::click());
if bg.secondary_clicked() {
@@ -939,13 +958,25 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
}
let render = crate::render_workspace::active(app);
let workspace_icon = if render { "ws_render" } else { "ws_design" };
- icons::paint_icon(&painter, Rect::from_center_size(pos2(ws.center().x, ws.top() + 39.0), vec2(30.0, 30.0)), workspace_icon, 1.0);
- ribbon_text(ui, pos2(ws.center().x, ws.top() + 69.0), app.tr(if render { "ui.render" } else { "ui.design" }), t.font_button, t.text, true);
+ icons::paint_icon(
+ &painter,
+ Rect::from_center_size(pos2(ws.center().x, ws.top() + if labels { 39.0 } else { 25.0 }), vec2(30.0, 30.0)),
+ workspace_icon,
+ 1.0,
+ );
+ ribbon_text(
+ ui,
+ pos2(ws.center().x, ws.top() + if labels { 69.0 } else { 50.0 }),
+ app.tr(if render { "ui.render" } else { "ui.design" }),
+ t.font_button,
+ t.text,
+ true,
+ );
let label = app.tr("ui.ribbon_workspace");
let label_width =
painter.layout_no_wrap(label.to_string(), FontId::proportional(crate::theme::Tokens::get().font_small), t.text_dim).size().x;
- ribbon_text(ui, pos2(ws.center().x - 6.0, ws.top() + 89.0), label, t.font_small, t.text_dim, false);
- dropdown_arrow(&painter, pos2(ws.center().x - 6.0 + label_width / 2.0 + 7.0, ws.top() + 89.5), t.text_dim);
+ ribbon_text(ui, pos2(ws.center().x - 6.0, ws.top() + if labels { 89.0 } else { 70.0 }), label, t.font_small, t.text_dim, false);
+ dropdown_arrow(&painter, pos2(ws.center().x - 6.0 + label_width / 2.0 + 7.0, ws.top() + if labels { 89.5 } else { 70.5 }), t.text_dim);
if wresp.on_hover_text(app.tr("ui.change_workspace")).clicked() {
crate::context_menu::toggle_for(app, ws, ws.left_bottom(), crate::context_menu::Target::Workspace);
}
@@ -995,11 +1026,16 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let family = crate::sketch_families::family(c.id)
.filter(|f| tab == "SKETCH" && *panel == "CREATE" && f.commands.first().copied() == Some(c.id));
let label = family.map_or_else(|| crate::workspace::ribbon_button_label(c), |f| f.label);
- ButtonSize { width: ribbon_button_width(&painter, app.tr_label(label)), min_width: BUTTON_MIN_WIDTH }
+ if labels {
+ ButtonSize { width: ribbon_button_width(&painter, app.tr_label(label)), min_width: BUTTON_MIN_WIDTH }
+ } else {
+ let width = if family.is_some() { 50.0 } else { 40.0 };
+ ButtonSize { width, min_width: width }
+ }
})
.collect();
if tab == "SKETCH" && *panel == "CONSTRAIN" && shown.iter().any(|c| crate::workspace::CONSTRAINT_GALLERY.contains(&c.id)) {
- widths.push(ButtonSize { width: CONSTRAINT_GRID_WIDTH, min_width: CONSTRAINT_GRID_WIDTH });
+ widths.push(ButtonSize { width: gallery_width, min_width: gallery_width });
}
PanelSize { buttons: widths }
})
@@ -1053,20 +1089,24 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let inset = if drawn == 0 { 0.0 } else { ((width - 8.0 - buttons_width) / 2.0).max(0.0).floor() };
let bx = px + 4.0 + inset;
let free_x = bx + buttons_width + BUTTON_GAP;
- let free = Rect::from_min_size(pos2(free_x, top + 2.0), vec2((px + width - 4.0 - free_x).max(0.0), BUTTON_HEIGHT));
+ let free = Rect::from_min_size(pos2(free_x, top + 2.0), vec2((px + width - 4.0 - free_x).max(0.0), button_height));
let fresp = ui.interact(free, ui.id().with(("panel_free", panel)), if collapsed { Sense::click() } else { Sense::hover() });
let mut opened = false;
if collapsed {
// One button: the panel's first command's icon over a caret; it opens the
// drop-down, which lists every command of the panel.
- let br = Rect::from_center_size(free.center(), vec2((width - 8.0).max(0.0), BUTTON_HEIGHT));
+ let br = Rect::from_center_size(free.center(), vec2((width - 8.0).max(0.0), button_height));
crate::scenario::publish_handle(&format!("collapsed:{tab}:{panel}"), br.center());
if fresp.hovered() && enabled_panel {
painter.rect_filled(br, t.radius_sm, t.hover);
}
if let Some(c) = shown.first().or(cmds.first()) {
- let acc = command_accent(c.icon);
- icons::paint(&painter, Rect::from_center_size(br.center() - vec2(0.0, 3.0), vec2(26.0, 26.0)), c.icon, t.icon, t.icon_fill, acc);
+ icons::paint_icon(
+ &painter,
+ Rect::from_center_size(br.center() - vec2(0.0, 3.0), vec2(26.0, 26.0)),
+ c.icon,
+ f32::from(t.icon.a()) / 255.0,
+ );
}
dropdown_arrow(&painter, pos2(br.center().x, br.bottom() - 3.0), t.text_dim);
let tip = format!("{} ({})", app.tr_label(panel), shown.len().max(cmds.len()));
@@ -1081,11 +1121,15 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
// variants remain exact commands, including in customised toolbars.
let family = crate::sketch_families::family(c.id).filter(|f| sketch_create && f.commands.first().copied() == Some(c.id));
let selected = family.and_then(|f| app.preferences.sketch_variants.selected(f)).unwrap_or(c);
- let whole = Rect::from_min_size(pos2(button_x, top + 2.0), vec2(button_width, BUTTON_HEIGHT));
+ let whole = Rect::from_min_size(pos2(button_x, top + 2.0), vec2(button_width, button_height));
button_x += button_width + BUTTON_GAP;
let mut br = whole;
if family.is_some() {
- br.max.y = whole.top() + 32.0;
+ if labels {
+ br.max.y = whole.top() + 32.0;
+ } else {
+ br.max.x -= 14.0;
+ }
}
let info = selected.info(&app.session);
let resp = ui.interact(br, ui.id().with(("cmd", c.id)), Sense::click_and_drag());
@@ -1122,7 +1166,8 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
}
let icon = if selected.id == "sketch.finish" { "finish" } else { selected.icon };
let side = if finish { 30.0 } else { 26.0 };
- let icon_rect = Rect::from_center_size(pos2(br.center().x, whole.top() + 16.0), vec2(side, side));
+ let icon_rect =
+ Rect::from_center_size(pos2(br.center().x, whole.top() + if labels { 16.0 } else { button_height / 2.0 }), vec2(side, side));
icons::paint_icon(&painter, icon_rect, icon, if info.enabled { 1.0 } else { 0.35 });
let tr_label = app.tr_label(selected.label).to_string();
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled() && info.enabled, &tr_label));
@@ -1131,24 +1176,32 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
app.start(id);
}
if let Some(f) = family {
- let ar = Rect::from_min_max(pos2(whole.left(), whole.top() + 30.0), pos2(whole.right(), whole.top() + 48.0));
+ let ar = if labels {
+ Rect::from_min_max(pos2(whole.left(), whole.top() + 30.0), pos2(whole.right(), whole.top() + 48.0))
+ } else {
+ Rect::from_min_max(pos2(br.right(), whole.top()), whole.right_bottom())
+ };
let arrow = ui.interact(ar, ui.id().with(("family", f.label)), Sense::click());
crate::scenario::publish_handle(&format!("family:{}", f.label), ar.center());
if arrow.hovered() {
painter.rect_filled(ar, t.radius_sm, t.hover);
}
// The title sits on the same line as the other buttons' labels.
- let title_y = whole.top() + 39.0;
- let galley = ribbon_button_galley(&painter, app.tr_label(f.label), ar.width() - 16.0, t.text);
- painter.galley(pos2(ar.center().x - 4.0, title_y - galley.size().y / 2.0), galley, t.text);
- dropdown_arrow(&painter, pos2(ar.right() - 6.0, title_y + 0.5), t.text_dim);
+ if labels {
+ let title_y = whole.top() + 39.0;
+ let galley = ribbon_button_galley(&painter, app.tr_label(f.label), ar.width() - 16.0, t.text);
+ painter.galley(pos2(ar.center().x - 4.0, title_y - galley.size().y / 2.0), galley, t.text);
+ dropdown_arrow(&painter, pos2(ar.right() - 6.0, title_y + 0.5), t.text_dim);
+ } else {
+ dropdown_arrow(&painter, ar.center(), t.text_dim);
+ }
arrow.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, app.tr_label(f.label)));
- egui::Popup::menu(&arrow).show(|ui| {
+ Container::new(ui.ctx(), Surface::Popup).menu(&arrow).show(|ui| {
let variants: Vec<_> = f.commands.iter().filter_map(|id| solidcraft_engine::find_command(id)).collect();
dropdown_keys(app, ui, &variants);
sketch_menu_rows(app, ui, &variants, &mut menu, &mut toggle);
});
- } else {
+ } else if labels {
let label = app.tr_label(crate::workspace::ribbon_button_label(selected));
let color = if info.enabled { t.text } else { t.text_dim };
let galley = ribbon_button_galley(&painter, label, whole.width() - BUTTON_LABEL_PADDING, color);
@@ -1159,14 +1212,17 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
if !gallery.is_empty() {
// A quiet rule sets the grid apart from the large button before it.
painter.line_segment(
- [pos2(button_x - 1.5, top + 8.0), pos2(button_x - 1.5, top + 46.0)],
+ [pos2(button_x - 1.5, top + 8.0), pos2(button_x - 1.5, top + button_height.min(46.0))],
Stroke::new(1.0, t.toolbar.lerp_to_gamma(t.border, 0.5)),
);
}
for c in &gallery {
let index = crate::workspace::CONSTRAINT_GALLERY.iter().position(|id| *id == c.id).unwrap_or(0);
- let cell =
- Rect::from_min_size(pos2(button_x + (index % 3) as f32 * 27.0, top + 6.0 + (index / 3) as f32 * 23.0), vec2(24.0, 20.0));
+ let columns = if labels { 3 } else { 6 };
+ let cell = Rect::from_min_size(
+ pos2(button_x + (index % columns) as f32 * 27.0, top + 6.0 + (index / columns) as f32 * 23.0),
+ vec2(24.0, 20.0),
+ );
let info = c.info(&app.session);
let resp = ui.interact(cell, ui.id().with(("cmd", c.id)), Sense::click_and_drag());
let active = running.as_deref() == Some(c.id);
@@ -1218,7 +1274,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
// RIBBON_TAB_INSET from the card's bottom edge (and from its left edge in the first
// section): its corner is concentric with the card's.
let lr = Rect::from_min_size(
- pos2(px + RIBBON_TAB_INSET, top + GROUP_HEIGHT - SECTION_HEIGHT - (RIBBON_TAB_INSET - 1.0)),
+ pos2(px + RIBBON_TAB_INSET, top + group_height - SECTION_HEIGHT - (RIBBON_TAB_INSET - 1.0)),
vec2((width - 2.0 * RIBBON_TAB_INSET).max(0.0), SECTION_HEIGHT),
);
let lresp = ui.interact(lr, ui.id().with(("panel", panel)), Sense::click());
@@ -1259,7 +1315,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let over_button = ui.input(|input| input.pointer.hover_pos()).is_some_and(|p| {
let mut x = bx;
button_widths.iter().take(drawn).any(|width| {
- let rect = Rect::from_min_size(pos2(x, top + 2.0), vec2(*width, BUTTON_HEIGHT));
+ let rect = Rect::from_min_size(pos2(x, top + 2.0), vec2(*width, button_height));
x += width + BUTTON_GAP;
rect.contains(p)
})
@@ -1275,69 +1331,72 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
let open = ui.ctx().data(|d| d.get_temp::(egui::Id::new("sc_panel_open"))) == Some(popup_id);
if open {
let cmds = if collapsed || trimmed { menu_commands(&cmds, &shown) } else { cmds.clone() };
- let area = crate::frame::area(popup_id).fixed_pos(lr.left_bottom()).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
- section_frame(ui).show(ui, |ui| {
- ui.spacing_mut().item_spacing.y = 0.0;
- ui.set_min_width(200.0);
- if *panel == "SELECT" {
- selection_filter(app, ui);
- } else if cmds.is_empty() {
- ui.label(egui::RichText::new(crate::i18n::tr_label("Not available yet")).color(t.text_dim));
- }
- if sketch_create {
- sketch_create_menu(app, ui, &cmds, &mut menu, &mut toggle);
- section_footer(ui);
- return;
- }
- let grouped = crate::workspace::grouped_commands(&tab, panel, &cmds);
- let cmds: Vec<_> = grouped.iter().map(|(_, c)| *c).collect();
- let row_w = dropdown_width(app, ui, &cmds);
- ui.set_width(row_w);
- // Up and Down move the keyboard focus through the enabled rows (from none
- // focused: the first or the last), instead of egui's own spatial move.
- let (down, up) = ui.input(|i| (i.key_pressed(egui::Key::ArrowDown), i.key_pressed(egui::Key::ArrowUp)));
- if down || up {
- let enabled: Vec<&str> = cmds.iter().filter(|c| c.info(&app.session).enabled).map(|c| c.id).collect();
- let focused = ui.ctx().memory(|m| m.focused());
- let at = enabled.iter().position(|id| focused == Some(dropdown_row_id(id)));
- let n = enabled.len();
- let next = match (at, down) {
- (None, true) => Some(0),
- (None, false) => n.checked_sub(1),
- (Some(i), true) => Some((i + 1) % n.max(1)),
- (Some(i), false) => Some((i + n.max(1) - 1) % n.max(1)),
- };
- if let Some(id) = next.and_then(|i| enabled.get(i)) {
- ui.ctx().memory_mut(|m| {
- m.request_focus(dropdown_row_id(id));
- m.move_focus(egui::FocusDirection::None);
- });
+ let area = Container::new(ui.ctx(), Surface::Popup).area(popup_id).fixed_pos(lr.left_bottom()).order(egui::Order::Foreground).show(
+ ui.ctx(),
+ |ui| {
+ section_frame(ui).show(ui, |ui| {
+ ui.spacing_mut().item_spacing.y = 0.0;
+ ui.set_min_width(200.0);
+ if *panel == "SELECT" {
+ selection_filter(app, ui);
+ } else if cmds.is_empty() {
+ ui.label(egui::RichText::new(crate::i18n::tr_label("Not available yet")).color(t.text_dim));
}
- }
- // The rows scroll when the drop-down would run past the window's bottom.
- // `min_scrolled_height` lets the rows grow past the size the area kept from
- // an earlier, shorter list (#874); they still shrink to fit their content.
- let room = (ui.ctx().content_rect().bottom() - ui.cursor().top() - 64.0).max(ROW_H * 3.0);
- egui::ScrollArea::vertical().id_salt("panel_menu_rows").max_height(room).min_scrolled_height(room).show(ui, |ui| {
- for (heading, c) in &grouped {
- if let Some(heading) = heading {
- section_heading(ui, heading, row_w);
+ if sketch_create {
+ sketch_create_menu(app, ui, &cmds, &mut menu, &mut toggle);
+ section_footer(ui);
+ return;
+ }
+ let grouped = crate::workspace::grouped_commands(&tab, panel, &cmds);
+ let cmds: Vec<_> = grouped.iter().map(|(_, c)| *c).collect();
+ let row_w = dropdown_width(app, ui, &cmds);
+ ui.set_width(row_w);
+ // Up and Down move the keyboard focus through the enabled rows (from none
+ // focused: the first or the last), instead of egui's own spatial move.
+ let (down, up) = ui.input(|i| (i.key_pressed(egui::Key::ArrowDown), i.key_pressed(egui::Key::ArrowUp)));
+ if down || up {
+ let enabled: Vec<&str> = cmds.iter().filter(|c| c.info(&app.session).enabled).map(|c| c.id).collect();
+ let focused = ui.ctx().memory(|m| m.focused());
+ let at = enabled.iter().position(|id| focused == Some(dropdown_row_id(id)));
+ let n = enabled.len();
+ let next = match (at, down) {
+ (None, true) => Some(0),
+ (None, false) => n.checked_sub(1),
+ (Some(i), true) => Some((i + 1) % n.max(1)),
+ (Some(i), false) => Some((i + n.max(1) - 1) % n.max(1)),
+ };
+ if let Some(id) = next.and_then(|i| enabled.get(i)) {
+ ui.ctx().memory_mut(|m| {
+ m.request_focus(dropdown_row_id(id));
+ m.move_focus(egui::FocusDirection::None);
+ });
}
- let pinned = crate::toolbar_custom::pinned_on(app, &tab, c.id).is_some();
- match dropdown_row(app, ui, c, row_w, pinned) {
- RowAction::None => {}
- RowAction::Menu(at) => menu = Some((at, c.id)),
- RowAction::TogglePin => toggle = Some(c.id),
- RowAction::Start => {
- app.start(c.id);
- ui.ctx().data_mut(|d| d.remove::(egui::Id::new("sc_panel_open")));
+ }
+ // The rows scroll when the drop-down would run past the window's bottom.
+ // `min_scrolled_height` lets the rows grow past the size the area kept from
+ // an earlier, shorter list (#874); they still shrink to fit their content.
+ let room = (ui.ctx().content_rect().bottom() - ui.cursor().top() - 64.0).max(ROW_H * 3.0);
+ egui::ScrollArea::vertical().id_salt("panel_menu_rows").max_height(room).min_scrolled_height(room).show(ui, |ui| {
+ for (heading, c) in &grouped {
+ if let Some(heading) = heading {
+ section_heading(ui, heading, row_w);
+ }
+ let pinned = crate::toolbar_custom::pinned_on(app, &tab, c.id).is_some();
+ match dropdown_row(app, ui, c, row_w, pinned) {
+ RowAction::None => {}
+ RowAction::Menu(at) => menu = Some((at, c.id)),
+ RowAction::TogglePin => toggle = Some(c.id),
+ RowAction::Start => {
+ app.start(c.id);
+ ui.ctx().data_mut(|d| d.remove::(egui::Id::new("sc_panel_open")));
+ }
}
}
- }
+ });
+ section_footer(ui);
});
- section_footer(ui);
- });
- });
+ },
+ );
popup_rect = Some(area.response.rect);
crate::scenario::publish_rect("toolbar_dropdown", area.response.rect);
// A drag out of the drop-down ends with a release elsewhere: not a click elsewhere.
@@ -1347,11 +1406,11 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
}
}
px += width;
- painter.line_segment([pos2(px, top + 4.0), pos2(px, top + GROUP_HEIGHT - 3.0)], Stroke::new(1.0, t.border));
+ painter.line_segment([pos2(px, top + 4.0), pos2(px, top + group_height - 3.0)], Stroke::new(1.0, t.border));
px += PANEL_GAP;
}
if !overflow.is_empty() {
- let at = Rect::from_min_size(pos2(px.min(right - finish_width - 40.0), top + 4.0), vec2(38.0, BUTTON_HEIGHT));
+ let at = Rect::from_min_size(pos2(px.min(right - finish_width - 40.0), top + 4.0), vec2(38.0, button_height));
ui.scope_builder(egui::UiBuilder::new().max_rect(at), |ui| {
let response = crate::ui_kit::Menu::button(ui, "»", |ui| {
for (panel, cmds) in &overflow {
@@ -1379,9 +1438,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
response.response.on_hover_text(crate::i18n::tr_label("More toolbar panels"));
});
}
- if !floating {
- painter.line_segment([pos2(r.left(), r.bottom() - 0.5), pos2(r.right(), r.bottom() - 0.5)], Stroke::new(1.0, t.border));
- }
+
// Dragging a command: its icon follows the pointer; a toolbar button dragged off the
// toolbar (or into the open drop-down) shows it will be removed.
let pointer = ui.input(|i| i.pointer.latest_pos());
@@ -1423,58 +1480,20 @@ fn app_bar_separator(ui: &egui::Ui, bar: Rect, x: f32, group: &str) {
/// The chat panel's compact entry point. State stays in agent_chat; the bar only paints it.
fn assistant_button(app: &mut SolveApp, ui: &mut egui::Ui, at: Rect) {
use crate::agent_chat::AssistantMark;
- let t = Tokens::get();
let resp = ui.interact(at, ui.id().with("assistant_button"), Sense::click());
crate::scenario::publish_target("titlebar:assistant", at);
let mark = crate::agent_chat::assistant_mark(app);
let tip = crate::agent_chat::assistant_tip(mark);
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), &tip));
- // The highlight is a 26 px square, like the other icon buttons; the mark sits on the bubble's corner.
- let mut ring = t.app_bar;
- if app.agent_chat.open || resp.hovered() || resp.has_focus() {
- let fill = if app.agent_chat.open { t.app_bar_hover_strong } else { t.app_bar_hover_button };
- ui.painter().rect_filled(at.shrink(3.0), t.radius_sm, fill);
- ring = t.app_bar.blend(fill);
- }
- icons::paint_app_bar(ui.painter(), at.shrink(7.0), "assistant", 1.0);
- let c = at.min + vec2(23.5, 9.5);
- match mark {
- AssistantMark::Quiet => {}
- AssistantMark::Ready | AssistantMark::NeedsAuth | AssistantMark::Stopped => {
- let color = match mark {
- AssistantMark::Ready => t.agent_ok,
- AssistantMark::NeedsAuth => t.warning,
- _ => t.error,
- };
- ui.painter().circle_filled(c, 5.5, ring);
- ui.painter().circle_filled(c, 4.0, color);
- }
- AssistantMark::Busy => {
- let phase = if app.preferences.look_at_anim {
- ui.ctx().request_repaint();
- ui.input(|i| i.time) as f32 * 3.0
- } else {
- 0.0
- };
- ui.painter().circle_filled(c, 6.0, ring);
- let points = (0..=24)
- .map(|i| {
- let angle = phase + i as f32 / 24.0 * std::f32::consts::TAU * 0.75;
- c + vec2(angle.cos(), angle.sin()) * 4.0
- })
- .collect();
- ui.painter().add(egui::Shape::line(points, Stroke::new(1.8, t.agent_busy)));
- }
- AssistantMark::Waiting(count) => {
- let text = count.to_string();
- let font = FontId::proportional(t.font_badge);
- let galley = ui.painter().layout_no_wrap(text, font, t.app_bar);
- let badge = Rect::from_center_size(c, vec2((galley.size().x + 6.0).max(14.0), 14.0));
- ui.painter().rect_filled(badge.expand(1.5), 8.5, ring);
- ui.painter().rect_filled(badge, 7.0, t.warning);
- ui.painter().galley(badge.center() - galley.size() / 2.0, galley, t.app_bar);
- }
- }
+ let state = match mark {
+ AssistantMark::Quiet => crate::ui_kit::AssistantEntryState::Quiet,
+ AssistantMark::Ready => crate::ui_kit::AssistantEntryState::Ready,
+ AssistantMark::Busy => crate::ui_kit::AssistantEntryState::Busy,
+ AssistantMark::NeedsAuth => crate::ui_kit::AssistantEntryState::NeedsAuth,
+ AssistantMark::Stopped => crate::ui_kit::AssistantEntryState::Stopped,
+ AssistantMark::Waiting(count) => crate::ui_kit::AssistantEntryState::Waiting(count),
+ };
+ crate::ui_kit::assistant_entry(ui, &resp, state, app.agent_chat.open, ui.ctx().global_style().animation_time > 0.0);
if resp.on_hover_text(tip).clicked() {
crate::agent_chat::toggle(app);
}
@@ -1512,7 +1531,7 @@ fn ribbon_tooltip(app: &SolveApp, response: egui::Response, command: &solidcraft
ribbon_text(ui, rect.center(), name, t.font_heading, t.text, true);
if let Some(key) = command.shortcut {
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- egui::Frame::new()
+ egui::Frame::NONE
.fill(t.panel_header)
.stroke(Stroke::new(1.0, t.border))
.corner_radius(3.0)
@@ -1750,7 +1769,7 @@ fn drag_ghost(ctx: &egui::Context, id: &str, at: egui::Pos2, removing: bool) {
let p = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("sc_toolbar_drag")));
let r = Rect::from_center_size(at + vec2(14.0, 16.0), vec2(30.0, 30.0));
p.rect(r, t.radius_sm, t.toolbar.gamma_multiply(0.92), Stroke::new(1.0, if removing { t.error } else { t.accent }), egui::StrokeKind::Inside);
- icons::paint(&p, r.shrink(5.0), c.icon, t.icon, t.icon_fill, command_accent(c.icon));
+ icons::paint_icon(&p, r.shrink(5.0), c.icon, f32::from(t.icon.a()) / 255.0);
if removing {
let s = Stroke::new(2.0, t.error);
let x = Rect::from_center_size(r.right_top(), vec2(9.0, 9.0));
diff --git a/crates/ui-egui/src/ui_kit/actions.rs b/crates/ui-egui/src/ui_kit/actions.rs
index 444fe9704..c9bcb6027 100644
--- a/crates/ui-egui/src/ui_kit/actions.rs
+++ b/crates/ui-egui/src/ui_kit/actions.rs
@@ -68,6 +68,8 @@ pub(crate) struct Footer<'a> {
pub selected: Option,
pub danger: bool,
pub confirm: bool,
+ /// Parent surface corners; the footer inherits only its two bottom corners.
+ pub corners: Option,
}
pub(crate) fn footer(ui: &mut Ui, ok_label: &str, cancel_label: &str, ok_enabled: bool, options: Footer<'_>) -> Action {
@@ -82,7 +84,7 @@ pub(super) fn footer_with_left(
options: Footer<'_>,
left: impl FnOnce(&mut Ui),
) -> Action {
- let Footer { apply: apply_label, status, selected, danger, confirm } = options;
+ let Footer { apply: apply_label, status, selected, danger, confirm, corners } = options;
let t = Tokens::get();
let ok_enabled = ok_enabled && !ok_label.is_empty();
// The footer is a full-width band (the card has no margin of its own): its own fill, a rule
@@ -91,8 +93,12 @@ pub(super) fn footer_with_left(
vec2(dimension(ui.available_width()), t.form_footer_height + if confirm { t.space_4 } else { 0.0 }),
egui::Sense::hover(),
);
- let corner = t.radius_xl.saturating_sub(1);
- ui.painter().rect_filled(band, egui::CornerRadius { nw: 0, ne: 0, sw: corner, se: corner }, t.dialog_footer);
+ let corners = corners.unwrap_or(egui::CornerRadius::same(t.radius_xl));
+ ui.painter().rect_filled(
+ band,
+ egui::CornerRadius { nw: 0, ne: 0, sw: corners.sw.saturating_sub(1), se: corners.se.saturating_sub(1) },
+ t.dialog_footer,
+ );
ui.painter().hline(band.x_range(), band.top(), egui::Stroke::new(1.0, t.dialog_rule));
scenario::publish_rect("dialog:footer", band);
scenario::publish_count("dialog:ok:enabled", f64::from(ok_enabled && ui.is_enabled()));
@@ -220,16 +226,14 @@ pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], butto
let left = rect.center().x - (galley.size().x + icon_width) / 2.0;
let painter = ui.painter().with_clip_rect(ui.clip_rect().intersect(rect));
if let Some(icon) = button.icon {
- crate::icons::paint(
+ crate::icons::paint_icon(
&painter,
egui::Rect::from_center_size(
egui::pos2(left + t.sketch_footer_icon_size / 2.0, rect.center().y),
vec2(t.sketch_footer_icon_size, t.sketch_footer_icon_size),
),
icon,
- t.icon,
- t.icon_fill,
- t.form_primary,
+ f32::from(t.icon.a()) / 255.0,
);
}
painter.galley(egui::pos2(left + icon_width, rect.center().y - galley.size().y / 2.0), galley, t.form_ink);
@@ -246,13 +250,13 @@ pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], butto
}
/// Secondary button variants preserve native sizing and enabled-button translation.
-pub(crate) enum Button {
+pub enum Button {
Normal,
Small,
Enabled(bool),
}
-pub(crate) fn button(ui: &mut Ui, label: impl Into, options: Button) -> Response {
+pub fn button(ui: &mut Ui, label: impl Into, options: Button) -> Response {
let label = label.into();
let key = label.text().to_owned();
let draw = |ui: &mut Ui, label| match options {
diff --git a/crates/ui-egui/src/ui_kit/assistant.rs b/crates/ui-egui/src/ui_kit/assistant.rs
new file mode 100644
index 000000000..f6e162d4e
--- /dev/null
+++ b/crates/ui-egui/src/ui_kit/assistant.rs
@@ -0,0 +1,408 @@
+//! Assistant presentation primitives; protocol state and action dispatch stay with callers.
+use crate::theme::Tokens;
+use egui::{InnerResponse, Response, Ui, vec2};
+
+#[derive(Clone, Copy)]
+pub(crate) enum AssistantTone {
+ Neutral,
+ Working,
+ Success,
+ Warning,
+ Error,
+}
+
+impl AssistantTone {
+ fn colors(self, t: &Tokens) -> (egui::Color32, egui::Color32) {
+ match self {
+ Self::Neutral => (t.form_dim, t.dialog_footer),
+ Self::Working => (t.selected_ink, t.accent_soft),
+ Self::Success => (t.form_success, t.form_success_fill),
+ Self::Warning => (t.warning, t.warning.gamma_multiply(0.12)),
+ Self::Error => (t.form_error, t.form_error_fill),
+ }
+ }
+}
+
+/// A compact state pill. Tokens: font_small, space_6/12, radius_xl and semantic state colours.
+pub(crate) fn assistant_badge(ui: &mut Ui, label: &str, tone: AssistantTone) -> Response {
+ let t = Tokens::get();
+ let (ink, fill) = tone.colors(&t);
+ let font = egui::FontId::proportional(t.font_caption);
+ let width = ui.painter().layout_no_wrap(label.to_owned(), font.clone(), ink).size().x + t.space_12;
+ let (rect, response) = ui.allocate_exact_size(vec2(width, t.form_close_size - t.space_4), egui::Sense::hover());
+ ui.painter().rect_filled(rect, t.radius_xl, fill);
+ ui.painter().text(rect.center(), egui::Align2::CENTER_CENTER, label, font, ink);
+ response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), label));
+ response
+}
+
+/// The shared 40 pt header band. The caller owns its title, state and icon actions.
+pub(crate) fn assistant_header(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ let output = egui::Frame::NONE
+ .inner_margin(egui::Margin {
+ left: t.space_12 as i8,
+ right: t.space_8 as i8,
+ top: (t.space_4 + t.space_3) as i8,
+ bottom: (t.space_4 + t.space_3) as i8,
+ })
+ .show(ui, |ui| {
+ ui.set_min_width(ui.available_width().max(0.0));
+ ui.set_min_height(t.form_close_size);
+ add(ui)
+ });
+ ui.painter().hline(output.response.rect.x_range(), output.response.rect.bottom(), egui::Stroke::new(1.0, t.dialog_rule));
+ output
+}
+
+/// Inset controls band beneath the header, aligned with the conversation body.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_controls(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ egui::Frame::NONE.inner_margin(egui::Margin::symmetric(t.space_12 as i8, t.space_8 as i8)).show(ui, |ui| {
+ ui.set_min_width(ui.available_width().max(0.0));
+ add(ui)
+ })
+}
+
+/// Right-aligned user message with a compact lower-right corner and 86% maximum width.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_bubble(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ let width = ui.available_width().max(0.0);
+ let bubble_width = width * 0.86;
+ ui.horizontal_top(|ui| {
+ ui.spacing_mut().item_spacing.x = 0.0;
+ ui.add_space(width - bubble_width);
+ egui::Frame::NONE
+ .fill(t.accent_soft)
+ .corner_radius(egui::CornerRadius { nw: t.radius_xl, ne: t.radius_xl, sw: t.radius_xl, se: t.space_3 as u8 })
+ .inner_margin(egui::Margin::symmetric((t.space_8 + t.space_3) as i8, t.space_8 as i8))
+ .show(ui, |ui| {
+ let content_width = (bubble_width - (t.space_8 + t.space_3) * 2.0).max(0.0);
+ ui.set_width(content_width);
+ ui.with_layout(egui::Layout::top_down(egui::Align::Min), |ui| {
+ ui.set_width(content_width);
+ ui.spacing_mut().item_spacing.y = t.space_6;
+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);
+ ui.visuals_mut().override_text_color = Some(t.form_ink);
+ add(ui)
+ })
+ .inner
+ })
+ })
+ .inner
+}
+
+/// Assistant prose remains unboxed and uses the shared readable body typography.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_prose(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R {
+ let t = Tokens::get();
+ ui.scope(|ui| {
+ ui.style_mut().text_styles.insert(egui::TextStyle::Body, egui::FontId::proportional(t.font_label));
+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);
+ ui.visuals_mut().override_text_color = Some(t.form_ink);
+ add(ui)
+ })
+ .inner
+}
+
+#[cfg(any(not(target_arch = "wasm32"), test))]
+#[derive(Clone, Copy)]
+pub(crate) enum AssistantToolState {
+ Pending,
+ Running,
+ Done,
+ Failed,
+}
+
+/// A 15 pt status mark with distinct shape and colour for every tool state.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_tool_status(ui: &mut Ui, state: AssistantToolState) -> Response {
+ let t = Tokens::get();
+ let size = t.space_12 + t.space_3;
+ let (rect, response) = ui.allocate_exact_size(vec2(size, size), egui::Sense::hover());
+ let radius = (size - t.space_4) / 2.0;
+ match state {
+ AssistantToolState::Pending => {
+ ui.painter().circle_stroke(rect.center(), radius, egui::Stroke::new(1.0, t.form_dim));
+ }
+ AssistantToolState::Running => {
+ let phase = ui.input(|i| i.time) as f32 * t.space_3;
+ let points = (0..=24)
+ .map(|step| {
+ let angle = phase + step as f32 / 24.0 * std::f32::consts::TAU * 0.75;
+ rect.center() + vec2(angle.cos(), angle.sin()) * radius
+ })
+ .collect();
+ ui.painter().add(egui::Shape::line(points, egui::Stroke::new(t.space_2, t.form_primary)));
+ ui.ctx().request_repaint();
+ }
+ AssistantToolState::Done => {
+ ui.painter().circle_filled(rect.center(), size / 2.0, t.form_success_fill);
+ super::checks::paint_check_glyph(ui.painter(), rect, false, t.form_success);
+ }
+ AssistantToolState::Failed => {
+ ui.painter().circle_filled(rect.center(), size / 2.0, t.form_error_fill);
+ crate::icons::paint_ink(ui.painter(), rect, "close", t.form_error);
+ }
+ }
+ response
+}
+
+/// Bordered tool group; the caller retains expansion, status and automation identities.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_tool_frame(ui: &mut Ui, failed: bool, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ egui::Frame::NONE
+ .fill(if failed { t.form_error_fill } else { t.dialog_body })
+ .stroke(egui::Stroke::new(1.0, t.dialog_rule))
+ .corner_radius(t.radius_lg)
+ .inner_margin(t.space_3)
+ .show(ui, |ui| {
+ ui.set_min_width(ui.available_width().max(0.0));
+ add(ui)
+ })
+}
+
+/// Individual tool-row surface, retaining a failed row's tint inside a shared group.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_tool_row(ui: &mut Ui, failed: bool, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ egui::Frame::NONE.fill(if failed { t.form_error_fill } else { t.dialog_body }).corner_radius(t.control_radius).show(ui, add)
+}
+
+/// Indented detail box using the same field surface as inline command parameters.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_tool_detail(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ egui::Frame::NONE
+ .fill(t.control_fill)
+ .stroke(egui::Stroke::new(1.0, t.dialog_rule))
+ .corner_radius(t.control_radius)
+ .inner_margin(egui::Margin::symmetric((t.space_6 + t.space_3) as i8, t.space_6 as i8))
+ .show(ui, add)
+}
+
+/// Approval frame with a tinted heading. Permission choices remain entirely caller-owned.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_approval(ui: &mut Ui, title: &str, body: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ let output = egui::Frame::NONE.fill(t.dialog_body).stroke(egui::Stroke::new(1.0, t.form_primary)).corner_radius(t.radius_xl).show(ui, |ui| {
+ ui.set_min_width(ui.available_width().max(0.0));
+ ui.spacing_mut().item_spacing.y = 0.0;
+ egui::Frame::NONE
+ .fill(t.accent_soft)
+ .corner_radius(egui::CornerRadius { nw: t.radius_xl.saturating_sub(1), ne: t.radius_xl.saturating_sub(1), sw: 0, se: 0 })
+ .inner_margin(egui::Margin::symmetric(t.space_10 as i8, t.space_8 as i8))
+ .show(ui, |ui| {
+ ui.set_min_width(ui.available_width().max(0.0));
+ ui.horizontal_top(|ui| {
+ ui.spacing_mut().item_spacing.x = t.space_6;
+ let (icon, _) = ui.allocate_exact_size(vec2(t.space_16, t.space_16), egui::Sense::hover());
+ crate::icons::paint_ink(ui.painter(), icon, "shield", t.selected_ink);
+ ui.add(egui::Label::new(egui::RichText::new(title).font(crate::fonts::semibold(t.font_label)).color(t.form_ink)).wrap());
+ });
+ });
+ egui::Frame::NONE
+ .inner_margin(t.space_10)
+ .show(ui, |ui| {
+ ui.spacing_mut().item_spacing.y = t.space_8;
+ body(ui)
+ })
+ .inner
+ });
+ crate::scenario::publish_rect("assistant:approval", output.response.rect);
+ output
+}
+
+/// Unframed growing editor inside the composer. The caller retains focus ID and Enter routing.
+/// Tokens: font_label, control_height, space_8 and shared text_input alignment.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_input(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
+ let t = Tokens::get();
+ ui.add(
+ super::fields::text_input(egui::TextEdit::multiline(value))
+ .id(id)
+ .frame(egui::Frame::NONE)
+ .background_color(egui::Color32::TRANSPARENT)
+ .hint_text(hint)
+ .desired_rows(2)
+ .desired_width(f32::INFINITY)
+ .min_size(vec2(0.0, t.control_height + t.space_8))
+ .font(egui::FontId::proportional(t.font_label)),
+ )
+}
+
+/// Compact right-aligned approval actions; wrapping grows by control rows, not the remaining card height.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_actions(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ ui.allocate_ui_with_layout(
+ vec2(ui.available_width(), t.control_height),
+ egui::Layout::right_to_left(egui::Align::Center).with_main_wrap(true),
+ add,
+ )
+}
+
+/// Composer's rounded field surface with an accent border only while focused.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_composer(ui: &mut Ui, focused: bool, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ egui::Frame::NONE
+ .fill(t.control_fill)
+ .stroke(egui::Stroke::new(1.0, if focused { t.form_primary } else { t.control_border }))
+ .corner_radius(t.radius_xl)
+ .inner_margin(egui::Margin::symmetric(t.space_10 as i8, t.space_8 as i8))
+ .show(ui, |ui| {
+ ui.set_min_width(ui.available_width().max(0.0));
+ ui.spacing_mut().item_spacing.y = t.space_6;
+ add(ui)
+ })
+}
+
+/// Circular primary send or stop action. The caller retains queue and cancellation dispatch.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_send(ui: &mut Ui, enabled: bool, busy: bool, label: &str) -> Response {
+ let t = Tokens::get();
+ ui.add_enabled_ui(enabled, |ui| {
+ let size = t.control_height + t.space_2;
+ let (rect, response) = ui.allocate_exact_size(vec2(size, size), egui::Sense::click());
+ let fill = if response.hovered() { t.form_primary.gamma_multiply(0.9) } else { t.form_primary };
+ ui.painter().circle_filled(rect.center(), size / 2.0, fill);
+ let ink = if crate::theme::contrast_ratio(t.on_accent, fill) >= 4.5 { t.on_accent } else { t.tab_on_fill_dark };
+ crate::icons::paint_ink(ui.painter(), rect.shrink(t.space_6), if busy { "stop" } else { "send" }, ink);
+ if response.has_focus() {
+ ui.painter().circle_stroke(rect.center(), size / 2.0 + t.space_2, egui::Stroke::new(1.0, t.form_primary));
+ }
+ if response.hovered() {
+ ui.ctx().set_cursor_icon(egui::CursorIcon::PointingHand);
+ }
+ response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), label));
+ response.on_hover_text(label)
+ })
+ .inner
+}
+
+/// Pinned composer footer. The enclosing shell retains ownership of scrolling and sizing.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_composer_footer(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ let output = egui::Frame::NONE
+ .fill(t.dialog_footer)
+ .corner_radius(egui::CornerRadius { nw: 0, ne: 0, sw: t.radius_xl.saturating_sub(1), se: t.radius_xl.saturating_sub(1) })
+ .inner_margin(t.space_10)
+ .show(ui, add);
+ ui.painter().hline(output.response.rect.x_range(), output.response.rect.top(), egui::Stroke::new(1.0, t.dialog_rule));
+ output
+}
+
+/// Centred setup copy and caller-supplied action, bounded to a readable 300 pt column.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_empty(ui: &mut Ui, title: &str, body: &str, add: impl FnOnce(&mut Ui) -> R) -> R {
+ let t = Tokens::get();
+ let width = ui.available_width().min(t.form_card_width + t.space_24 + t.space_12).max(0.0);
+ ui.vertical_centered(|ui| {
+ ui.set_max_width(width);
+ ui.spacing_mut().item_spacing.y = t.space_8;
+ let diameter = t.control_height + t.space_16;
+ let (disc, _) = ui.allocate_exact_size(vec2(diameter, diameter), egui::Sense::hover());
+ ui.painter().circle_filled(disc.center(), diameter / 2.0, t.accent_soft);
+ crate::icons::paint_ink(ui.painter(), disc.shrink(t.space_8), "assistant", t.selected_ink);
+ ui.add(egui::Label::new(egui::RichText::new(title).font(crate::fonts::semibold(t.font_body + t.space_2)).color(t.form_ink)).wrap());
+ ui.add(egui::Label::new(egui::RichText::new(body).size(t.font_label).color(t.form_dim)).wrap());
+ add(ui)
+ })
+ .inner
+}
+
+/// Semantic warning/error/information band with caller-owned text and actions.
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn assistant_banner(ui: &mut Ui, tone: AssistantTone, add: impl FnOnce(&mut Ui) -> R) -> InnerResponse {
+ let t = Tokens::get();
+ let (_, fill) = tone.colors(&t);
+ egui::Frame::NONE.fill(fill).stroke(egui::Stroke::new(1.0, t.dialog_rule)).corner_radius(t.radius_lg).inner_margin(t.space_10).show(ui, |ui| {
+ ui.set_min_width(ui.available_width().max(0.0));
+ ui.spacing_mut().item_spacing.y = t.space_8;
+ add(ui)
+ })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn assistant_bubble_stays_right_aligned_at_narrow_and_wide_widths() {
+ for width in [220.0, 280.0, 440.0, 740.0] {
+ let ctx = crate::fonts::test_context();
+ for _ in 0..2 {
+ super::super::test_support::frame(&ctx, vec![], |ui| {
+ ui.set_width(width);
+ let left = ui.cursor().left();
+ let available = ui.available_width();
+ let bubble = assistant_bubble(ui, |ui| {
+ ui.label("A message that wraps within its bubble.");
+ });
+ assert!((bubble.response.rect.right() - (left + available)).abs() < 1.0);
+ assert!(bubble.response.rect.width() <= available * 0.86 + 1.0);
+ });
+ }
+ }
+ }
+
+ #[test]
+ fn assistant_bubble_stacks_message_and_file_summary_without_squeezing_either() {
+ for width in [280.0, 440.0, 740.0] {
+ let ctx = crate::fonts::test_context();
+ for _ in 0..2 {
+ super::super::test_support::frame(&ctx, vec![], |ui| {
+ ui.set_width(width);
+ let bubble = assistant_bubble(ui, |ui| {
+ let message = ui.label("Make the plate thicker.").rect;
+ let files = ui.label("Files: plate-dimensions.txt").rect;
+ (message, files)
+ });
+ let (message, files) = bubble.inner;
+ assert!(files.top() >= message.bottom(), "file summary must follow message vertically");
+ assert!((message.left() - files.left()).abs() < 1.0, "both lines share the content inset");
+ assert!(files.width() > Tokens::get().control_height * 3.0, "file summary must retain readable width");
+ assert!(bubble.response.rect.height() < Tokens::get().control_height * 4.0, "two short lines remain compact");
+ });
+ }
+ }
+ }
+
+ #[test]
+ fn assistant_send_only_activates_when_enabled() {
+ for enabled in [false, true] {
+ let ctx = crate::fonts::test_context();
+ let mut position = egui::Pos2::ZERO;
+ let mut clicked = false;
+ super::super::test_support::frame(&ctx, vec![], |ui| {
+ position = assistant_send(ui, enabled, false, "Send").rect.center();
+ });
+ super::super::test_support::frame(&ctx, super::super::test_support::pointer(position, true), |ui| {
+ clicked |= assistant_send(ui, enabled, false, "Send").clicked();
+ });
+ super::super::test_support::frame(&ctx, super::super::test_support::pointer(position, false), |ui| {
+ clicked |= assistant_send(ui, enabled, false, "Send").clicked();
+ });
+ assert_eq!(clicked, enabled);
+ }
+ }
+
+ #[test]
+ fn assistant_header_and_badge_share_reference_control_heights() {
+ let ctx = crate::fonts::test_context();
+ super::super::test_support::frame(&ctx, vec![], |ui| {
+ let t = Tokens::get();
+ let header = assistant_header(ui, |ui| {
+ ui.allocate_exact_size(vec2(t.space_24, t.form_close_size), egui::Sense::hover());
+ });
+ assert!((header.response.rect.height() - t.form_header_height).abs() < 1.0);
+ let badge = assistant_badge(ui, "Ready", AssistantTone::Success);
+ assert!((badge.rect.height() - (t.form_close_size - t.space_4)).abs() < 1.0);
+ });
+ }
+}
diff --git a/crates/ui-egui/src/ui_kit/assistant_entry.rs b/crates/ui-egui/src/ui_kit/assistant_entry.rs
new file mode 100644
index 000000000..80e6f2fd2
--- /dev/null
+++ b/crates/ui-egui/src/ui_kit/assistant_entry.rs
@@ -0,0 +1,67 @@
+//! Assistant entry point and its status mark, shared by application chrome and previews.
+use crate::{icons, theme::Tokens};
+use egui::{FontId, Rect, Response, Stroke, vec2};
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub(crate) enum AssistantEntryState {
+ Quiet,
+ Ready,
+ Busy,
+ NeedsAuth,
+ Stopped,
+ Waiting(usize),
+}
+
+/// Paint the compact entry point in its caller-owned target. The caller owns state and actions.
+/// Tokens: app_bar, app_bar_hover_button/strong, agent_ok/busy, warning/error, radius_sm, font_badge.
+pub(crate) fn assistant_entry(ui: &egui::Ui, response: &Response, state: AssistantEntryState, open: bool, animate: bool) {
+ let t = Tokens::get();
+ let at = response.rect;
+ let mark = state;
+ // The highlight is a 26 px square, like the other icon buttons; the mark sits on the bubble's corner.
+ let mut ring = t.app_bar;
+ if open || response.hovered() || response.has_focus() {
+ let fill = if open { t.app_bar_hover_strong } else { t.app_bar_hover_button };
+ ui.painter().rect_filled(at.shrink(t.space_3), t.radius_sm, fill);
+ ring = t.app_bar.blend(fill);
+ }
+ icons::paint_app_bar(ui.painter(), at.shrink(t.space_6 + 1.0), "assistant", 1.0);
+ let c = egui::pos2(at.right() - t.space_8 - 0.5, at.top() + t.space_10 - 0.5);
+ match mark {
+ AssistantEntryState::Quiet => {}
+ AssistantEntryState::Ready | AssistantEntryState::NeedsAuth | AssistantEntryState::Stopped => {
+ let color = match mark {
+ AssistantEntryState::Ready => t.agent_ok,
+ AssistantEntryState::NeedsAuth => t.warning,
+ _ => t.error,
+ };
+ ui.painter().circle_filled(c, 5.5, ring);
+ ui.painter().circle_filled(c, 4.0, color);
+ }
+ AssistantEntryState::Busy => {
+ let phase = if animate {
+ ui.ctx().request_repaint();
+ ui.input(|i| i.time) as f32 * 3.0
+ } else {
+ 0.0
+ };
+ ui.painter().circle_filled(c, 6.0, ring);
+ let points = (0..=24)
+ .map(|i| {
+ let angle = phase + i as f32 / 24.0 * std::f32::consts::TAU * 0.75;
+ c + vec2(angle.cos(), angle.sin()) * 4.0
+ })
+ .collect();
+ ui.painter().add(egui::Shape::line(points, Stroke::new(1.8, t.agent_busy)));
+ }
+ AssistantEntryState::Waiting(count) => {
+ let text = count.to_string();
+ let font = FontId::proportional(t.font_badge);
+ let galley = ui.painter().layout_no_wrap(text, font, t.app_bar);
+ let badge = Rect::from_center_size(c, vec2((galley.size().x + t.space_6).max(t.space_14), t.space_14));
+ ui.painter().rect_filled(badge.expand(1.5), 8.5, ring);
+ ui.painter().rect_filled(badge, 7.0, t.warning);
+ ui.painter().galley(badge.center() - galley.size() / 2.0, galley, t.app_bar);
+ }
+ }
+}
diff --git a/crates/ui-egui/src/ui_kit/choice.rs b/crates/ui-egui/src/ui_kit/choice.rs
index bb518beb8..ef9036e3f 100644
--- a/crates/ui-egui/src/ui_kit/choice.rs
+++ b/crates/ui-egui/src/ui_kit/choice.rs
@@ -5,6 +5,7 @@ use super::{
metrics::*,
text::paint_text,
};
+use crate::ui_kit::{Container, Surface};
use crate::{scenario, theme::Tokens};
use egui::{Ui, vec2};
@@ -130,7 +131,7 @@ pub(crate) fn segmented_icons(ui: &mut Ui, selected: &mut usize, options: &[Icon
// A square icon area inside the segment: dash gaps and dots need the room to read apart.
let side = (segment.width().min(segment.height()) - t.space_4).max(t.space_12);
let icon_rect = egui::Rect::from_center_size(segment.center(), vec2(side, side));
- crate::icons::paint(ui.painter(), icon_rect, option.icon, t.icon, t.icon_fill, t.form_primary);
+ crate::icons::paint_icon(ui.painter(), icon_rect, option.icon, f32::from(t.icon.a()) / 255.0);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, ui.is_enabled(), on, option.key));
scenario::publish_handle(&format!("dialog:{}:{}", label(ui), option.key), segment.center());
let response = response.on_hover_text(&option.tip);
@@ -239,7 +240,7 @@ pub(crate) fn tool_choices<'a>(ui: &mut Ui, label: &str, current: &str, choices:
.corner_radius(t.sketch_mode_radius)
.min_size(vec2(t.sketch_mode_size, t.sketch_mode_size)),
);
- crate::icons::paint(ui.painter(), response.rect.shrink(t.space_6), choice.icon, t.icon, t.icon_fill, t.sketch_accent);
+ crate::icons::paint_icon(ui.painter(), response.rect.shrink(t.space_6), choice.icon, f32::from(t.icon.a()) / 255.0);
scenario::publish_target(&format!("sketch_palette:feature:{}", choice.key), response.rect);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, enabled, on, choice.label));
if response.on_hover_text(choice.label).clicked() && enabled {
@@ -257,7 +258,7 @@ pub(crate) fn toggle_icon(ui: &mut Ui, row: &str, label: &str, selected: &mut bo
let t = Tokens::get();
let response =
ui.add(egui::Button::new("").selected(*selected).min_size(vec2(t.space_24 + t.space_4, t.control_height)).sense(egui::Sense::CLICK));
- crate::icons::paint(ui.painter(), response.rect.shrink(t.space_3), icon, t.icon, t.icon_fill, t.form_primary);
+ crate::icons::paint_icon(ui.painter(), response.rect.shrink(t.space_3), icon, f32::from(t.icon.a()) / 255.0);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, true, *selected, crate::i18n::tr_label(label)));
crate::scenario::publish_handle(&format!("dialog:{row}:{label}"), response.rect.center());
if response.clone().on_hover_text(crate::i18n::tr_label(label)).clicked() {
@@ -363,8 +364,9 @@ pub(crate) fn popup_list(
let t = crate::theme::Tokens::get();
let mut chosen = None;
let mut rows = Vec::with_capacity(options.len());
- let area = crate::frame::area(id).order(egui::Order::Tooltip).fixed_pos(anchor.left_bottom() + egui::vec2(0.0, t.space_2)).show(ctx, |ui| {
- egui::Frame::popup(ui.style())
+ let popup = Container::new(ctx, Surface::Popup).area(id);
+ let area = popup.order(egui::Order::Tooltip).fixed_pos(anchor.left_bottom() + egui::vec2(0.0, t.space_2)).show(ctx, |ui| {
+ Container::popup_frame(ui.style())
.fill(t.control_fill)
.stroke(egui::Stroke::new(1.0, t.dialog_border))
.corner_radius(t.radius_lg)
diff --git a/crates/ui-egui/src/ui_kit/color.rs b/crates/ui-egui/src/ui_kit/color.rs
index 81434ee9d..8ac77c2ca 100644
--- a/crates/ui-egui/src/ui_kit/color.rs
+++ b/crates/ui-egui/src/ui_kit/color.rs
@@ -1,5 +1,6 @@
//! Opaque document RGB editing. Interface paint uses tokens; the gradients are colour data.
use super::{layout::label, metrics::dimension};
+use crate::ui_kit::{Container, Surface};
use crate::{i18n, scenario, theme::Tokens};
use egui::{Color32, Response, Sense, Ui, ecolor::HsvaGamma, pos2, vec2};
@@ -22,11 +23,12 @@ pub(crate) fn color_field(ui: &mut Ui, rgb: &mut [u8; 3]) -> Response {
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::ColorButton, ui.is_enabled(), i18n::tr("color.edit")));
publish(&format!("dialog:color:{}", label(ui)), &response);
let mut edited = false;
- egui::Popup::menu(&response)
+ Container::new(ui.ctx(), Surface::Popup)
+ .menu(&response)
.close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside)
.width(t.form_card_width + t.space_24 + t.space_12)
.frame(
- egui::Frame::popup(ui.style())
+ Container::popup_frame(ui.style())
.fill(t.control_fill)
.stroke(egui::Stroke::new(1.0, t.border))
.corner_radius(t.radius_xl)
diff --git a/crates/ui-egui/src/ui_kit/container.rs b/crates/ui-egui/src/ui_kit/container.rs
new file mode 100644
index 000000000..8432e90af
--- /dev/null
+++ b/crates/ui-egui/src/ui_kit/container.rs
@@ -0,0 +1,249 @@
+//! The only constructors for outer UI hosts. Content widgets belong to the other kit modules.
+//! A surface declares its purpose; the shell supplies the layout once per frame. Never infer
+//! floating/docked presentation from a panel name or keep a second layout preference here.
+use crate::frame::Side;
+use crate::{shell::LayoutMode, theme::Tokens};
+use egui::{Color32, Context, Frame, Id, Stroke, WidgetText};
+
+/// Persistent panels adapt to the layout; transient UI retains its anchoring and modality.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Surface {
+ /// Browser, History, Render settings and future workspace panels.
+ Panel,
+ /// Feature forms and the Assistant sheet.
+ Feature,
+ /// Sketch options, including their translucent background.
+ Palette,
+ /// Workspace switcher and ribbon cards.
+ Chrome,
+ /// Native application/title bar; its presentation is independent of workspace layout.
+ ApplicationBar,
+ /// Movable system windows and modal dialogs; never become workspace docks.
+ Window,
+ /// Anchored menus, completion lists and rename editors.
+ Popup,
+ /// Model-anchored editors and manipulation feedback.
+ Canvas,
+ /// Status/progress notifications, independent of the workspace layout.
+ Toast,
+ /// Viewport navigation controls (the compass itself is drawn geometry).
+ Navigation,
+ /// Full-page content, the model viewport and native pop-out content.
+ Viewport,
+ /// Deliberate input-blocking backdrops; must not inherit CAD input blocking.
+ InputShield,
+}
+
+#[derive(Clone, Copy, Debug)]
+pub enum Edge {
+ Left,
+ Right,
+ Top,
+ Bottom,
+}
+
+/// Edges that meet the window or another docked surface. Only exposed corners round.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+pub struct DockEdges {
+ pub left: bool,
+ pub right: bool,
+ pub top: bool,
+ pub bottom: bool,
+}
+
+impl DockEdges {
+ pub const ALL: Self = Self { left: true, right: true, top: true, bottom: true };
+}
+
+/// Universal outer host and surface policy. Both host geometry and frame construction must go
+/// through this API, including code in nested modules and platform apps.
+#[derive(Clone, Copy)]
+pub struct Container {
+ surface: Surface,
+ layout: LayoutMode,
+ joined: Option,
+}
+
+impl Container {
+ pub fn new(ctx: &Context, surface: Surface) -> Self {
+ Self::for_layout(LayoutMode::current(ctx), surface)
+ }
+
+ pub(crate) fn for_layout(layout: LayoutMode, surface: Surface) -> Self {
+ Self { surface, layout, joined: None }
+ }
+
+ /// Declare contacts from shell geometry; styling remains entirely in the container.
+ pub fn joined(mut self, edges: DockEdges) -> Self {
+ self.joined = Some(edges);
+ self
+ }
+
+ /// Shell-owned placement policy, shared by current and future adaptive panels.
+ pub fn floating(self) -> bool {
+ matches!(self.surface, Surface::Panel | Surface::Feature | Surface::Palette | Surface::Chrome) && self.layout == LayoutMode::Floating
+ }
+
+ /// Separation between adaptive workspace surfaces; compact surfaces meet their edge.
+ pub fn gap(self) -> f32 {
+ if self.floating() { crate::shell::SHELL_GAP } else { 0.0 }
+ }
+
+ /// Tokenised outer chrome. Callers may supply content padding, not another card surface.
+ pub fn frame(self, ctx: &Context, fill: Color32, side: crate::frame::Side) -> Frame {
+ let t = Tokens::get();
+ let flat = Frame::NONE.fill(fill);
+ match self.surface {
+ Surface::Feature | Surface::Palette if !self.floating() => {
+ let edges = self.joined.unwrap_or(DockEdges { left: side == Side::Left, right: side == Side::Right, ..Default::default() });
+ Self::compact_frame(fill, t.dialog_border, edges)
+ }
+ Surface::Panel | Surface::Chrome if !self.floating() => Self::compact_frame(fill, t.border, self.joined.unwrap_or(DockEdges::ALL)),
+ Surface::Feature | Surface::Window => {
+ flat.stroke(egui::Stroke::new(1.0, t.dialog_border)).corner_radius(t.radius_xl).shadow(t.shell_shadow())
+ }
+ Surface::Palette => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_xl).shadow(t.shell_shadow()),
+ Surface::Panel | Surface::Chrome => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_lg).shadow(t.shell_shadow()),
+ Surface::Navigation => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_md),
+ Surface::Toast => flat.stroke(egui::Stroke::new(1.0, t.border)).corner_radius(t.radius_md).shadow(t.shell_shadow()),
+ Surface::Popup => Self::popup_frame(&ctx.global_style()).fill(fill),
+ Surface::ApplicationBar | Surface::Canvas | Surface::Viewport | Surface::InputShield => flat,
+ }
+ }
+
+ /// Movable tool sheets round all exposed corners, joining only their right dock edge.
+ pub(crate) fn tool_frame(self, mut frame: Frame, right_docked: bool) -> Frame {
+ if self.surface == Surface::Feature && !self.floating() {
+ frame.corner_radius = Self::compact_rounding(DockEdges { right: right_docked, ..Default::default() });
+ }
+ frame
+ }
+
+ /// Surface of an allocated dock or internal pinned band. Floating card decoration is
+ /// supplied by `frame`; edge-hosted panes must not acquire outer shadows or card gaps.
+ pub fn edge_frame(self, fill: Color32) -> Frame {
+ if self.adaptive() && !self.floating() {
+ Self::compact_frame(fill, Tokens::get().border, self.joined.unwrap_or(DockEdges::ALL))
+ } else {
+ Frame::NONE.fill(fill)
+ }
+ }
+
+ fn adaptive(self) -> bool {
+ matches!(self.surface, Surface::Panel | Surface::Feature | Surface::Palette | Surface::Chrome)
+ }
+
+ fn compact_rounding(edges: DockEdges) -> egui::CornerRadius {
+ let radius = Tokens::get().radius_lg;
+ egui::CornerRadius {
+ nw: if edges.left || edges.top { 0 } else { radius },
+ ne: if edges.right || edges.top { 0 } else { radius },
+ sw: if edges.left || edges.bottom { 0 } else { radius },
+ se: if edges.right || edges.bottom { 0 } else { radius },
+ }
+ }
+
+ fn compact_frame(fill: Color32, border: Color32, edges: DockEdges) -> Frame {
+ // Collapse adjoining borders onto the same one-point strip. North/west outlines
+ // sit outside the allocation; south/east outlines sit inside it. Logical panel
+ // rectangles still touch exactly, with neither gaps nor doubled strokes.
+ Frame::NONE
+ .fill(fill)
+ .stroke(Stroke::new(1.0, border))
+ .outer_margin(egui::Margin { left: -1, top: -1, right: 0, bottom: 0 })
+ .corner_radius(Self::compact_rounding(edges))
+ }
+
+ /// Measure content before rounding a compact card. Reaching a dock boundary joins
+ /// that edge, so a content-hugging card and a full-height card share one composition.
+ pub(crate) fn show_frame(
+ self,
+ ui: &mut egui::Ui,
+ frame: Frame,
+ bounds: egui::Rect,
+ body: impl FnOnce(&mut egui::Ui) -> R,
+ ) -> egui::InnerResponse {
+ let mut prepared = frame.begin(ui);
+ let inner = body(&mut prepared.content_ui);
+ if self.adaptive() && !self.floating() {
+ let rect = prepared.frame.outer_rect(prepared.content_ui.min_rect());
+ let mut edges = self.joined.unwrap_or(DockEdges::ALL);
+ edges.left |= rect.left() <= bounds.left();
+ edges.right |= rect.right() >= bounds.right();
+ edges.top |= rect.top() <= bounds.top();
+ edges.bottom |= rect.bottom() >= bounds.bottom();
+ prepared.frame.corner_radius = Self::compact_rounding(edges);
+ }
+ egui::InnerResponse { inner, response: prepared.end(ui) }
+ }
+
+ pub fn area(self, id: Id) -> egui::Area {
+ egui::Area::new(id).enabled(self.input_enabled())
+ }
+
+ pub fn edge(self, id: impl Into, edge: Edge) -> egui::Panel {
+ let panel = match edge {
+ Edge::Left => egui::Panel::left(id),
+ Edge::Right => egui::Panel::right(id),
+ Edge::Top => egui::Panel::top(id),
+ Edge::Bottom => egui::Panel::bottom(id),
+ };
+ if self.adaptive() && !self.floating() { panel.show_separator_line(false) } else { panel }
+ }
+
+ pub(super) fn window<'a>(self, title: impl Into) -> egui::Window<'a> {
+ egui::Window::new(title).enabled(self.input_enabled())
+ }
+
+ /// Anchored editors inherit their containing widget's local style. Their host stays a
+ /// popup in both layouts; only the universal module constructs the egui popup frame.
+ pub fn popup_frame(style: &egui::Style) -> Frame {
+ Frame::popup(style)
+ }
+
+ pub(crate) fn menu_frame() -> Frame {
+ let t = Tokens::get();
+ egui::Frame::NONE
+ .fill(t.dialog_body)
+ .stroke(Stroke::new(1.0, t.dialog_border))
+ .corner_radius(t.radius_xl)
+ .inner_margin(egui::Margin::symmetric(t.space_6 as i8, t.space_6 as i8))
+ .shadow(egui::Shadow {
+ offset: [0, t.space_14 as i8],
+ blur: (t.space_24 + t.space_12) as u8,
+ spread: 0,
+ color: t.app_bar.gamma_multiply(0.18),
+ })
+ }
+
+ pub(crate) fn submenu(self) -> egui::menu::SubMenu {
+ egui::menu::SubMenu::new()
+ }
+
+ pub fn menu<'a>(self, response: &egui::Response) -> egui::Popup<'a> {
+ egui::Popup::menu(response)
+ }
+
+ pub fn context_menu<'a>(self, response: &egui::Response) -> egui::Popup<'a> {
+ egui::Popup::context_menu(response)
+ }
+
+ pub(crate) fn tooltip_frame(self, ctx: &Context) -> Frame {
+ let t = Tokens::get();
+ self.frame(ctx, t.dialog_body, crate::frame::Side::Right)
+ .stroke(egui::Stroke::new(1.0, t.dialog_border))
+ .inner_margin(egui::Margin::symmetric(t.space_8 as i8, t.space_4 as i8))
+ }
+
+ pub fn modal(self, id: Id) -> egui::Modal {
+ egui::Modal::new(id).area(egui::Modal::default_area(id).fade_in(false))
+ }
+
+ pub fn central(self) -> egui::CentralPanel {
+ egui::CentralPanel::default()
+ }
+
+ fn input_enabled(self) -> bool {
+ self.surface == Surface::InputShield || !crate::issue_report::cad_input_blocked()
+ }
+}
diff --git a/crates/ui-egui/src/ui_kit/disclosure_tests.rs b/crates/ui-egui/src/ui_kit/disclosure_tests.rs
index 2d3c15798..e08a14ed7 100644
--- a/crates/ui-egui/src/ui_kit/disclosure_tests.rs
+++ b/crates/ui-egui/src/ui_kit/disclosure_tests.rs
@@ -67,7 +67,7 @@ fn section_card_and_floating_window_folds_render_down_when_open_right_when_close
crate::frame::Side::Left,
egui::Frame::NONE,
)
- .window()
+ .window(&ctx)
.show(ui.ctx(), |ui| collapsible_header(ui, "fillet", "Fillet", &mut !open, || {}));
}
});
diff --git a/crates/ui-egui/src/ui_kit/fields.rs b/crates/ui-egui/src/ui_kit/fields.rs
index 2c4b832b6..760961c5a 100644
--- a/crates/ui-egui/src/ui_kit/fields.rs
+++ b/crates/ui-egui/src/ui_kit/fields.rs
@@ -4,6 +4,7 @@ use super::{
metrics::*,
text::paint_text,
};
+use crate::ui_kit::{Container, Surface};
use crate::{scenario, theme::Tokens};
use egui::{Response, RichText, Ui, vec2};
@@ -257,7 +258,7 @@ mod tests;
/// Stable-ID inline editor for tables. Completion is owned by the caller so Enter can commit
/// a cell without submitting its panel. Tokens: control_height/fill, form_inset, font_label, text/error.
-pub(crate) fn cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, invalid: bool) -> Response {
+pub fn cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, invalid: bool) -> Response {
bounded_cell_editor(ui, id, value, hint, invalid, usize::MAX)
}
@@ -485,6 +486,13 @@ fn length_drag<'a>(value: &'a mut f64, units: &str, decimals: u8) -> egui::DragV
.custom_parser(move |text| crate::prefs::parse_length_mm(text, scale))
}
+/// Small model-anchored value editor. Retains its focus ID and native hit height so it does
+/// not intercept nearby canvas picks; the owner keeps completion and selection handling.
+pub(crate) fn canvas_value_field(ui: &mut Ui, id: egui::Id, value: &mut String) -> Response {
+ let t = Tokens::get();
+ ui.add(egui::TextEdit::singleline(value).id(id).desired_width(t.space_24 * 3.0))
+}
+
/// Placement editor whose owner routes Enter and Tab (including rejected expressions).
/// Completion remains with the caller. Tokens: cell_editor tokens.
pub(crate) fn placement_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
@@ -534,7 +542,7 @@ pub(crate) fn library_cell(ui: &mut Ui, id: egui::Id, value: &mut String, hint:
let library = super::icon_button_at(ui, button, "chevron", "Library");
scenario::publish_handle("dialog:menu:Library", button.center());
scenario::publish_rect("dialog:menu:Library", button);
- let popup = egui::Popup::menu(&library);
+ let popup = Container::new(ui.ctx(), Surface::Popup).menu(&library);
let open = popup.is_open();
popup.show(|ui| super::scope(ui, menu));
if open {
diff --git a/crates/ui-egui/src/ui_kit/gallery.rs b/crates/ui-egui/src/ui_kit/gallery.rs
index 84808167a..787f036c9 100644
--- a/crates/ui-egui/src/ui_kit/gallery.rs
+++ b/crates/ui-egui/src/ui_kit/gallery.rs
@@ -1,5 +1,6 @@
//! Table-driven layout/paint references in both themes. No window or GPU required.
use super::*;
+use crate::ui_kit::{Container, Surface};
use crate::{scenario, theme::Tokens};
use egui::{Ui, vec2};
@@ -28,6 +29,121 @@ macro_rules! element {
// One entry per element/variant: names, rendering and geometry expectations stay together.
const ELEMENTS: &[Element] = &[
+ element!("assistant_entry", |ui, _| {
+ let t = Tokens::get();
+ egui::Frame::NONE.fill(t.app_bar).show(ui, |ui| {
+ ui.horizontal(|ui| {
+ for state in [
+ AssistantEntryState::Quiet,
+ AssistantEntryState::Ready,
+ AssistantEntryState::Busy,
+ AssistantEntryState::NeedsAuth,
+ AssistantEntryState::Stopped,
+ AssistantEntryState::Waiting(3),
+ ] {
+ let (_, response) = ui.allocate_exact_size(vec2(t.space_24 + t.space_8, t.space_24 + t.space_8), egui::Sense::click());
+ assistant_entry(ui, &response, state, false, false);
+ }
+ });
+ });
+ }),
+ element!("assistant_header", |ui, _| {
+ assistant_header(ui, |ui| {
+ ui.horizontal(|ui| {
+ ui.label("Assistant");
+ assistant_badge(ui, "Ready", AssistantTone::Success);
+ });
+ });
+ }),
+ element!("assistant_controls", |ui, _| {
+ assistant_controls(ui, |ui| {
+ button(ui, "Connect", Button::Normal);
+ });
+ }),
+ element!("assistant_badge", |ui, _| {
+ ui.horizontal(|ui| {
+ for (label, tone) in [
+ ("Ready", AssistantTone::Success),
+ ("Working", AssistantTone::Working),
+ ("Waiting", AssistantTone::Warning),
+ ("Error", AssistantTone::Error),
+ ("Offline", AssistantTone::Neutral),
+ ] {
+ assistant_badge(ui, label, tone);
+ }
+ });
+ }),
+ element!("assistant_bubble", |ui, _| {
+ assistant_bubble(ui, |ui| {
+ ui.label("Set the plate thickness to 8 mm.");
+ });
+ }),
+ element!("assistant_prose", |ui, _| {
+ assistant_prose(ui, |ui| {
+ ui.label("The thickness is now 8 mm. The design rebuilt successfully.");
+ });
+ }),
+ element!("assistant_tool_status", |ui, _| {
+ ui.horizontal(|ui| {
+ for state in [AssistantToolState::Pending, AssistantToolState::Running, AssistantToolState::Done, AssistantToolState::Failed] {
+ assistant_tool_status(ui, state);
+ }
+ });
+ }),
+ element!("assistant_tool", |ui, _| {
+ assistant_tool_frame(ui, false, |ui| {
+ ui.monospace("parameters.set");
+ assistant_tool_detail(ui, |ui| {
+ ui.monospace("thickness = 8 mm");
+ });
+ });
+ }),
+ element!("assistant_tool_failed", |ui, _| {
+ assistant_tool_frame(ui, false, |ui| {
+ assistant_tool_row(ui, true, |ui| {
+ ui.monospace("solid.fillet");
+ });
+ });
+ }),
+ element!("assistant_approval", |ui, _| {
+ assistant_approval(ui, "Allow the Assistant to run this?", |ui| {
+ ui.label("Change the design parameter.");
+ assistant_actions(ui, |ui| {
+ primary_button(ui, "Allow once");
+ button(ui, "Always allow", Button::Normal);
+ button(ui, "Deny", Button::Normal);
+ });
+ });
+ }),
+ element!("assistant_composer", |ui, s| {
+ assistant_composer_footer(ui, |ui| {
+ assistant_composer(ui, false, |ui| {
+ assistant_input(ui, ui.id().with("assistant_gallery"), &mut s.value, "Ask for a change…");
+ });
+ });
+ }),
+ element!("assistant_composer_focused", |ui, _| {
+ assistant_composer(ui, true, |ui| {
+ ui.label("Ask for a change…");
+ });
+ }),
+ element!("assistant_send", |ui, _| {
+ ui.horizontal(|ui| {
+ assistant_send(ui, true, false, "Send");
+ assistant_send(ui, true, true, "Stop");
+ assistant_send(ui, false, false, "Send");
+ });
+ }),
+ element!("assistant_empty", |ui, _| {
+ assistant_empty(ui, "Set up an assistant", "Choose an installed agent in Preferences.", |ui| {
+ button(ui, "Open Preferences", Button::Normal);
+ });
+ }),
+ element!("assistant_banner", |ui, _| {
+ assistant_banner(ui, AssistantTone::Warning, |ui| {
+ ui.label("Paused after the configured step limit.");
+ });
+ }),
element!("history_transport", |ui, _| {
ui.horizontal(|ui| {
let side = Tokens::get().space_24;
@@ -346,6 +462,9 @@ const ELEMENTS: &[Element] = &[
element!("slider_integer_without_editor", |ui, _| {
slider(ui, &mut 12.0, 0.0..=100.0, Slider { show_value: false, integer: true, ..Default::default() });
}),
+ element!("canvas_value_field", |ui, s| {
+ canvas_value_field(ui, ui.id().with("canvas_value"), &mut s.value);
+ }),
element!("placement_field", |ui, s| {
placement_field(ui, ui.id().with("placement"), &mut s.value, "Distance");
}),
@@ -1127,7 +1246,7 @@ fn history_example(ui: &mut Ui, names: bool) {
let width = crate::timeline_left::strip_width(&app);
let rect = ui.allocate_space(vec2(width, 650.0)).1;
ui.scope_builder(egui::UiBuilder::new().max_rect(rect.shrink(5.0)), |ui| {
- ui.painter().add(crate::frame::shell_card(Tokens::get().panel).paint(rect));
+ ui.painter().add(Container::new(ui.ctx(), Surface::Panel).frame(ui.ctx(), Tokens::get().panel, crate::frame::Side::Left).paint(rect));
crate::timeline_left::left_timeline(&mut app, ui);
});
}
@@ -1177,7 +1296,7 @@ fn history_board_in_both_themes_and_widths() {
|ui| {
ui.painter().rect_filled(bounds, 0.0, Tokens::get().viewport_top);
crate::timeline_left::left_panel(&mut app, ui);
- crate::browser::floating(&mut app, ui, bounds);
+ crate::browser::browser(&mut app, ui);
},
);
textures_update(&mut textures, &output.textures_delta);
diff --git a/crates/ui-egui/src/ui_kit/history.rs b/crates/ui-egui/src/ui_kit/history.rs
index 4272f89c0..bae10ccbb 100644
--- a/crates/ui-egui/src/ui_kit/history.rs
+++ b/crates/ui-egui/src/ui_kit/history.rs
@@ -322,13 +322,7 @@ pub(crate) fn history_seam(ui: &mut egui::Ui, card: Rect, names: bool) -> Histor
let response = button.clone().union(edge.clone());
if hovered && !dragging {
let mut tip = egui::Tooltip::for_widget(&response);
- let t = Tokens::get();
- let frame = egui::Frame::NONE
- .fill(t.dialog_body)
- .stroke(Stroke::new(1.0, t.dialog_border))
- .corner_radius(t.radius_md)
- .inner_margin(egui::Margin::symmetric(t.space_8 as i8, t.space_4 as i8))
- .shadow(t.shell_shadow());
+ let frame = super::Container::new(ui.ctx(), super::Surface::Toast).tooltip_frame(ui.ctx());
tip.popup = tip.popup.anchor(seam.pill).align(egui::RectAlign::RIGHT_START).frame(frame);
tip.show(|ui| {
let t = Tokens::get();
diff --git a/crates/ui-egui/src/ui_kit/menu.rs b/crates/ui-egui/src/ui_kit/menu.rs
index c8f534dd1..cd49e87d0 100644
--- a/crates/ui-egui/src/ui_kit/menu.rs
+++ b/crates/ui-egui/src/ui_kit/menu.rs
@@ -1,4 +1,5 @@
//! Menus share one popup surface and one row painter. Command dispatch stays with callers.
+use crate::ui_kit::{Container, Surface};
use crate::{context_menu::Item, fonts::RichTextExt as _, icons, theme::Tokens};
use egui::{Color32, FontId, Rect, Response, Sense, Stroke, Ui, pos2, vec2};
@@ -6,7 +7,7 @@ pub(crate) struct Menu;
impl Menu {
pub(crate) fn context(response: &Response, add: impl FnOnce(&mut Ui) -> R) -> Option> {
- egui::Popup::context_menu(response).frame(Self::frame()).show(add)
+ Container::new(&response.ctx, Surface::Popup).context_menu(response).frame(Self::frame()).show(add)
}
pub(crate) fn button(ui: &mut Ui, label: impl Into, add: impl FnOnce(&mut Ui) -> R) -> egui::InnerResponse