Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Cleanup after the popup move (step 7 of #2016, after the panels PR)

Nathan Danedad56187dfba
diff --git a/assets/locales/cs.json b/assets/locales/cs.json
index 3dc2fb97a5..463e080cd1 100644
--- a/assets/locales/cs.json
+++ b/assets/locales/cs.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Hlášení odešlete na GitHubu tlačítkem Submit new issue.",
"A new configuration, a copy of the active one": "Nová konfigurace, kopie aktivní",
- "AI": "AI",
"ARRANGE": "USPOŘÁDAT",
"About SolidCraft": "O aplikaci SolidCraft",
"Actions": "Akce",
@@ -68,7 +67,6 @@
"Component1": "Komponenta1",
"Configuration": "Konfigurace",
"Configuration rules": "Pravidla konfigurace",
- "Construction": "Konstrukční",
"Contact": "Kontakt",
"Continuity": "Spojitost",
"Copy Error Message": "Kopírovat chybovou zprávu",
@@ -93,7 +91,6 @@
"Delete rule": "Smazat pravidlo",
"Delete the row": "Smazat řádek",
"Delete the set": "Smazat sadu",
- "Delete this parameter": "Smazat tento parametr",
"Density": "Hustota",
"Designs you open or save appear here.": "Zde se zobrazí návrhy, které otevřete nebo uložíte.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Určeno volbou K objektu. Pro úpravu úhlového rozsahu zvolte Úhel.",
@@ -131,7 +128,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Soubory z mnoha CAD programů mají osu Y nahoru, proto se zde otevřou ležící na zádech (Z nahoru).",
"Filter": "Filtr",
"Find in Browser": "Najít v prohlížeči",
- "Flat": "Plochý",
"Flat size": "Rozměr rozvinu",
"Follow camera (Look At sketches)": "Sledovat kameru (náčrty natočené k pohledu)",
"Follow the camera (Look At sketches)": "Sledovat kameru (náčrty natočené k pohledu)",
@@ -201,7 +197,6 @@
"No matching appearances": "Žádné odpovídající vzhledy",
"No visible bodies to export.": "Žádná viditelná tělesa k exportu.",
"None": "Žádné",
- "Normal to sketch": "Kolmo ke skice",
"Not available yet": "Zatím není k dispozici",
"Notch": "Zářez",
"OUTPUT": "VÝSTUP",
@@ -215,7 +210,6 @@
"Outside": "Vně",
"Overall length": "Celková délka",
"Parameter": "Parametr",
- "Parameter values": "Hodnoty parametrů",
"Pass through": "Procházet skrz",
"Path": "Cesta",
"Per Edge": "Pro každou hranu",
@@ -230,7 +224,6 @@
"Preview Row": "Náhled řádku",
"Preview leaves the current design unchanged.": "Náhled aktuální návrh nemění.",
"Profiles/Curves": "Profily/křivky",
- "Projection": "Promítání",
"RECENT": "NEDÁVNÉ",
"REFERENCE": "REFERENCE",
"RULED SURFACE": "PŘÍMKOVÁ PLOCHA",
@@ -343,7 +336,6 @@
"Value": "Hodnota",
"Vertices": "Vrcholy",
"View navigator": "Navigátor pohledu",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Pouze viditelná tělesa. Křivky jsou nahrazeny úsečkami (tolerance 0,01 mm).",
"Volume": "Objem",
"Wall": "Stěna",
"Wall Location": "Umístění stěny",
@@ -691,7 +683,6 @@
"cmd.view_navigate": "Navigovat pohled",
"cmd.view_rename": "Přejmenovat pojmenovaný pohled",
"cmd.view_save": "Nový pojmenovaný pohled",
- "command name": "název příkazu",
"contact.components_count": "Počet komponent: {count}",
"contact.enabled_label": "povoleno",
"coupling.gear_1": "Kolo 1",
@@ -738,7 +729,6 @@
"dxf.progress.write": "Zápis DXF (5/5)",
"dxf.tolerance": "Tolerance křivek",
"dxf.tolerance_help": "Pouze viditelná tělesa. Křivky jsou nahrazeny úsečkami. Menší tolerance dává jemnější křivky, ale zabere více času a paměti.",
- "expression, e.g. 25 mm": "výraz, např. 25 mm",
"fits the face, e.g. M8": "odpovídá ploše, např. M8",
"from the rule": "z pravidla",
"help.apache": "Licence Apache 2.0",
@@ -815,7 +805,6 @@
"nav.touchpad.zoom": "Přiblížení (svislé posouvání nebo sevření prstů)",
"needs two joints": "vyžaduje dva klouby",
"new configuration": "nová konfigurace",
- "new name": "nový název",
"new parameter": "nový parametr",
"no interference": "bez kolize",
"no joint that moves yet": "zatím žádný pohyblivý kloub",
@@ -834,10 +823,8 @@
"properties.title": "Vlastnosti: {name}",
"render.background": "Pozadí scény",
"render.fit": "Přizpůsobit produktu",
- "render.image_cancel": "Zrušit render",
"render.image_cancelled": "Render zrušen",
"render.image_cancelling": "Rušení",
- "render.image_check": "Zkontrolovat požadavek na render",
"render.image_completed": "Obrázek připraven k exportu",
"render.image_encoding": "Kódování PNG",
"render.image_export": "Exportovat PNG",
@@ -916,7 +903,6 @@
"sketch_text.align_right": "Vpravo",
"sketch_text.bold": "Tučné",
"sketch_text.builtin_font": "{family} (vestavěné)",
- "sketch_text.font_search": "Hledat písma",
"sketch_text.italic": "Kurzíva",
"sketch_text.loading_fonts": "Hledání nainstalovaných písem…",
"sketch_text.on_path": "Text sleduje svou cestu: umístění určuje křivka",
@@ -940,9 +926,7 @@
"trace.stopped_by_loop": "Končí ve vzorku {sample}: smyčku přes {joint} už nelze dále uzavřít",
"ui.1_degree_of_freedom": "1 stupeň volnosti",
"ui.3d_mouse_speed": "Rychlost 3D myši",
- "ui.3d_mouse_windows": "3D myš",
"ui.3d_sketch": "3D náčrt",
- "ui.about": "O aplikaci",
"ui.activate": "Aktivovat",
"ui.active_component": "Aktivní komponenta",
"ui.agent_chat": "Chat s agentem",
@@ -984,7 +968,6 @@
"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.",
- "ui.agent_chat_new_yes": "Nový chat",
"ui.agent_chat_next_picture": "Další obrázek",
"ui.agent_chat_no_cli": "Vedle aplikace nebyl nalezen solidcraft-cli, takže agent nemá přístup k návrhu.",
"ui.agent_chat_no_control": "Endpoint chatu s agentem se nespustil, takže agent nemá přístup k návrhu.",
@@ -1118,7 +1101,6 @@
"ui.anti_aliasing": "Vyhlazování hran",
"ui.apply": "Použít",
"ui.arc": "Oblouk",
- "ui.assemble": "Sestavit",
"ui.autosave_every": "Automaticky ukládat každých",
"ui.axes": "Osy",
"ui.axis": "Osa",
@@ -1142,7 +1124,6 @@
"ui.chamfer": "Sražení",
"ui.chamfer_type": "Typ sražení",
"ui.change_workspace": "Změnit pracovní prostředí",
- "ui.chord_length": "Délka tětivy",
"ui.circle": "Kružnice",
"ui.circular_pattern": "Kruhové pole",
"ui.clear": "Vymazat",
@@ -1175,11 +1156,9 @@
"ui.command_done": "{command} hotovo",
"ui.command_palette_hint": "Zadejte příkaz, např. {example} — nebo stiskněte S pro hledání",
"ui.concentric": "Soustřednost",
- "ui.configurations": "Konfigurace",
"ui.conic_curve": "Kuželosečka",
"ui.constant": "Konstantní",
"ui.constraints_conflict": "Konflikt vazeb",
- "ui.construct": "Konstrukce",
"ui.construction": "Konstrukční",
"ui.context_menu": "Místní nabídka",
"ui.continuity_gap": "Mezera",
@@ -1202,7 +1181,6 @@
"ui.cylinder": "Válec",
"ui.dark": "Tmavý",
"ui.default_modelling_orientation": "Výchozí orientace modelování",
- "ui.degrees_of_freedom": "stupňů volnosti",
"ui.delete": "Smazat",
"ui.depth": "Hloubka",
"ui.design": "Návrh",
@@ -1244,7 +1222,6 @@
"ui.equivalent_radius": "Ekvivalentní poloměr",
"ui.expand": "Rozbalit",
"ui.exportDxf": "Exportovat DXF…",
- "ui.export_ellipsis": "Exportovat...",
"ui.export_ellipsis_keymap": "Exportovat…",
"ui.export_keymap_tip": "Klávesy, oblíbené z vyhledávání S a panel nástrojů jako soubor",
"ui.extend": "Prodloužit",
@@ -1326,7 +1303,6 @@
"ui.heading_sheet_metal": "PLECH",
"ui.heading_shell": "SKOŘEPINA",
"ui.heading_sketch": "NÁČRT",
- "ui.heading_sketch_palette": "PALETA NÁČRTU",
"ui.heading_sketch_scale": "MĚŘÍTKO NÁČRTU",
"ui.heading_solid": "TĚLESO",
"ui.heading_sphere": "KOULE",
@@ -1365,7 +1341,6 @@
"ui.length_decimals": "Desetinná místa délky",
"ui.light": "Světlý",
"ui.line": "Úsečka",
- "ui.linetype": "Typ čáry",
"ui.lock": "Zamknout",
"ui.loft": "Spojení profilů",
"ui.look_at": "Pohled kolmo",
@@ -1397,10 +1372,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF se značkami ploch",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Střed",
"ui.mirror": "Zrcadlit",
"ui.mirror_line": "Osa zrcadlení",
- "ui.modify": "Upravit",
"ui.move": "Posunout",
"ui.multiple": "Více",
"ui.named_views": "Pojmenované pohledy",
@@ -1420,7 +1393,6 @@
"ui.offset_plane": "Odsazená rovina",
"ui.one_side": "Jedna strana",
"ui.open": "Otevřít",
- "ui.open_ellipsis": "Otevřít...",
"ui.open_preferences": "Otevřít předvolby",
"ui.open_recent": "Otevřít nedávné",
"ui.operation": "Operace",
@@ -1431,8 +1403,6 @@
"ui.origin": "Počátek",
"ui.palette_construction_mode": "Konstrukční režim (X)",
"ui.palette_more": "Další",
- "ui.palette_points": "Body",
- "ui.palette_profile": "Profil",
"ui.palette_sketch_options": "Možnosti náčrtu",
"ui.pan": "Posun",
"ui.pan_zoom_orbit": "Posun, přiblížení, otáčení",
@@ -1467,7 +1437,6 @@
"ui.quit": "Ukončit",
"ui.radial_context_menu": "Kruhová místní nabídka",
"ui.radius": "Poloměr",
- "ui.radius_type": "Typ poloměru",
"ui.reachable": "Dosažitelné",
"ui.rectangle": "Obdélník",
"ui.rectangular_pattern": "Obdélníkové pole",
@@ -1490,7 +1459,6 @@
"ui.right": "Zprava",
"ui.save": "Uložit",
"ui.save_as": "Uložit jako",
- "ui.save_as_ellipsis": "Uložit jako...",
"ui.save_mesh_no_slicer": "Nebyl nalezen žádný slicer: zvolte Vlastní… a vyberte svůj slicer, nebo vypněte Odeslat do sliceru",
"ui.save_mesh_pick_bodies": "Vyberte tělesa k uložení",
"ui.save_mesh_temp_failed": "Nelze vytvořit {folder}: {error}",
@@ -1502,7 +1470,6 @@
"ui.select": "Vybrat",
"ui.selectOther": "Vybrat jiné…",
"ui.selectTangentChain": "Vybrat tečný řetězec",
- "ui.select_other_hint": "Vybrat jiné: podržte levé tlačítko na modelu (nebo pravé tlačítko › Vybrat jiné…) a zobrazí se vše pod kurzorem; dalším kliknutím na stejné místo vyberete další prvek.",
"ui.selection": "Výběr",
"ui.send": "Odeslat",
"ui.send_to_slicer": "Odeslat do sliceru",
@@ -1519,7 +1486,6 @@
"ui.show_constraints": "Vazby",
"ui.show_construction_geometries": "Konstrukční geometrie",
"ui.show_dimensions": "Kóty",
- "ui.show_points": "Zobrazit body",
"ui.show_profile": "Zobrazit profil",
"ui.show_projected_geometries": "Promítnuté geometrie",
"ui.simple": "Jednoduchý",
@@ -1529,7 +1495,6 @@
"ui.sketch_dimension": "Kóta náčrtu",
"ui.sketch_grid": "Mřížka náčrtu",
"ui.sketch_scale": "Měřítko náčrtu",
- "ui.sketch_status": "Stav náčrtu",
"ui.sketches": "Náčrty",
"ui.slice": "Řez",
"ui.slicer": "Slicer",
@@ -1575,7 +1540,6 @@
"ui.stand_up_tip": "Když se soubor STEP nebo IGES otevře s osou Z nahoru, nabídnout otočení o čtvrt otáčky kolem X",
"ui.start": "Start",
"ui.start_over": "Začít znovu",
- "ui.start_radius": "Počáteční poloměr",
"ui.supersampling": "Supersampling (SSAA)",
"ui.supersampling_adaptive": "Jen když je pohled v klidu",
"ui.supersampling_off": "Vypnuto (1×)",
@@ -1619,7 +1583,6 @@
"ui.untitled": "Bez názvu",
"ui.up_axis_note": "Která osa v pohledech míří nahoru (pohled podél osy, výchozí pohled, pohled kolmo). Návrhy se nemění.",
"ui.updateToCurrentView": "Aktualizovat na aktuální pohled",
- "ui.variable": "Proměnný",
"ui.view_centre": "Střed pohledu",
"ui.visual_shaded_hidden_edges": "Stínovaný se skrytými hranami",
"ui.visual_shaded_with_edges": "Stínovaný s hranami",
@@ -1635,7 +1598,6 @@
"ui.zoom_to_the_cursor": "Přibližovat ke kurzoru",
"update.available": "Je k dispozici SolidCraft {version}",
"update.button": "Aktualizovat",
- "update.button_tip": "Je k dispozici SolidCraft {version}",
"update.button_version": "Aktualizovat na {version}",
"update.check_automatically": "Automaticky kontrolovat aktualizace",
"update.check_now": "Zkontrolovat nyní",
diff --git a/assets/locales/da.json b/assets/locales/da.json
index 5ffc6bb2f9..152bf45442 100644
--- a/assets/locales/da.json
+++ b/assets/locales/da.json
@@ -5,7 +5,6 @@
"2. Attach your screenshot: copy and paste it, or save and upload the PNG.": "2. Vedhæft dit skærmbillede: Kopiér og indsæt det, eller gem og upload PNG-filen.",
"3. Click Submit new issue on GitHub to send your report.": "3. Klik på Submit new issue på GitHub for at sende rapporten.",
"A new configuration, a copy of the active one": "Opret en ny konfiguration som en kopi af den aktive",
- "AI": "AI",
"About SolidCraft": "Om SolidCraft",
"Acceleration": "Acceleration",
"Active": "Aktiv",
@@ -60,7 +59,6 @@
"Component1": "Komponent1",
"Configuration": "Konfiguration",
"Configuration rules": "Konfigurationsregler",
- "Construction": "Konstruktionsgeometri",
"Contact": "Kontakt",
"Contact sets": "Kontaktsæt",
"Continuity": "Kontinuitet",
@@ -86,7 +84,6 @@
"Delete rule": "Slet regel",
"Delete the row": "Slet rækken",
"Delete the set": "Slet sættet",
- "Delete this parameter": "Slet denne parameter",
"Density": "Densitet",
"Designs you open or save appear here.": "Designs, du åbner eller gemmer, vises her.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Bestemmes af Til objekt. Vælg Vinkel for at ændre vinkeludstrækningen.",
@@ -121,7 +118,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Filer fra mange CAD-programmer har Y opad og åbnes derfor liggende på ryggen her (Z opad).",
"Filter": "Filter",
"Find in Browser": "Find i modeltræ",
- "Flat": "Flad",
"Flat size": "Bredde mellem flader",
"Follow camera (Look At sketches)": "Følg kamera (Se på skitser)",
"Follow the camera (Look At sketches)": "Følg kameraet (Se på skitser)",
@@ -174,7 +170,6 @@
"No matching appearances": "Ingen matchende udseender",
"No visible bodies to export.": "Der er ingen synlige emner at eksportere.",
"None": "Ingen",
- "Normal to sketch": "Vinkelret på skitse",
"Not available yet": "Endnu ikke tilgængelig",
"Notch": "Udskæring",
"Opacity": "Opacitet",
@@ -184,7 +179,6 @@
"Other surface (mutual trim)": "Anden overflade (trim begge)",
"Outside": "Udvendigt",
"Overall length": "Samlet længde",
- "Parameter values": "Parameterværdier",
"Pass through": "Gå igennem",
"Path": "Bane",
"Per Edge": "Pr. kant",
@@ -202,7 +196,6 @@
"Preview Row": "Forhåndsvis række",
"Preview leaves the current design unchanged.": "Forhåndsvisning ændrer ikke det aktuelle design.",
"Profiles/Curves": "Profiler/kurver",
- "Projection": "Projektion",
"Quantity": "Antal",
"RECENT": "SENESTE",
"RULED SURFACE": "REGELFLADE",
@@ -311,7 +304,6 @@
"Velocity": "Hastighed",
"Vertices": "Hjørnepunkter",
"View navigator": "Visningsnavigator",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Kun synlige emner. Kurver består af linjestykker (tolerance: 0,01 mm).",
"Volume": "Volumen",
"Wall": "Væg",
"Wall Location": "Vægplacering",
@@ -663,7 +655,6 @@
"cmd.view_navigate": "Navigér i visning",
"cmd.view_rename": "Omdøb navngiven visning",
"cmd.view_save": "Ny navngiven visning",
- "command name": "kommandonavn",
"coupling.gear_1": "Tandhjul 1",
"coupling.gear_1_pick": "Tandhjul 1 (valgfrit)",
"coupling.gear_2": "Tandhjul 2",
@@ -710,7 +701,6 @@
"dxf.progress.write": "Skriver DXF (5/5)",
"dxf.tolerance": "Kurvetolerance",
"dxf.tolerance_help": "Kun synlige emner. Kurver består af rette linjestykker. En mindre tolerance giver finere kurver og kræver mere tid og hukommelse.",
- "expression, e.g. 25 mm": "udtryk, f.eks. 25 mm",
"fits the face, e.g. M8": "passer til fladen, f.eks. M8",
"from the rule": "fra reglen",
"home.documentation": "Dokumentation",
@@ -762,7 +752,6 @@
"nav.touchpad.zoom": "Zoom (lodret rulning eller knibebevægelse)",
"needs two joints": "kræver to led",
"new configuration": "ny konfiguration",
- "new name": "nyt navn",
"new parameter": "ny parameter",
"no hole": "intet hul",
"no interference": "intet overlap",
@@ -778,10 +767,8 @@
"pick one or two vertices, edges or faces": "vælg et eller to hjørnepunkter, kanter eller flader",
"render.background": "Scenebaggrund",
"render.fit": "Tilpas til produkt",
- "render.image_cancel": "Annullér rendering",
"render.image_cancelled": "Rendering annulleret",
"render.image_cancelling": "Annullerer",
- "render.image_check": "Kontrollér, om billedet kan renderes",
"render.image_completed": "Billedet er klar til eksport",
"render.image_encoding": "Gemmer som PNG",
"render.image_export": "Eksportér PNG",
@@ -848,7 +835,6 @@
"sketch_text.align_right": "Højre",
"sketch_text.bold": "Fed",
"sketch_text.builtin_font": "{family} (indbygget)",
- "sketch_text.font_search": "Søg efter skrifttyper",
"sketch_text.italic": "Kursiv",
"sketch_text.loading_fonts": "Søger efter installerede skrifttyper…",
"sketch_text.on_path": "Teksten følger sin bane: Kurven bestemmer placeringen",
@@ -877,9 +863,7 @@
"trace.stopped_by_loop": "Slutter ved prøve {sample}: Løkken gennem {joint} kan ikke lukkes yderligere",
"ui.1_degree_of_freedom": "1 frihedsgrad",
"ui.3d_mouse_speed": "3D-musens hastighed",
- "ui.3d_mouse_windows": "3D-mus",
"ui.3d_sketch": "3D-skitse",
- "ui.about": "Om",
"ui.activate": "Aktivér",
"ui.active_component": "Aktiv komponent",
"ui.agent_chat": "Agentchat",
@@ -945,7 +929,6 @@
"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.",
- "ui.agent_chat_new_yes": "Ny chat",
"ui.agent_chat_no_cli": "solidcraft-cli blev ikke fundet ved siden af appen, så agenten kan ikke få adgang til designet.",
"ui.agent_chat_no_control": "Agentchattens endepunkt startede ikke, så agenten kan ikke få adgang til designet.",
"ui.agent_chat_no_images": "Denne agent kan ikke modtage billeder",
@@ -1081,7 +1064,6 @@
"ui.anti_aliasing": "Kantudjævning",
"ui.apply": "Anvend",
"ui.arc": "Bue",
- "ui.assemble": "Samling",
"ui.autosave_every": "Gem automatisk hver",
"ui.axes": "Akser",
"ui.axis": "Akse",
@@ -1101,7 +1083,6 @@
"ui.chamfer": "Affasning",
"ui.chamfer_type": "Affasningstype",
"ui.change_workspace": "Skift arbejdsområde",
- "ui.chord_length": "Kordelængde",
"ui.circle": "Cirkel",
"ui.circular_pattern": "Cirkulært mønster",
"ui.clear": "Ryd",
@@ -1134,11 +1115,9 @@
"ui.command_done": "{command} udført",
"ui.command_palette_hint": "Skriv en kommando, f.eks. {example} — eller tryk S for at søge",
"ui.concentric": "Koncentrisk",
- "ui.configurations": "Konfigurationer",
"ui.conic_curve": "Keglesnitskurve",
"ui.constant": "Konstant",
"ui.constraints_conflict": "Bindinger er i konflikt",
- "ui.construct": "Konstruktion",
"ui.construction": "Konstruktionsgeometri",
"ui.context_menu": "Genvejsmenu",
"ui.continuity_g0": "G0-knæk",
@@ -1164,7 +1143,6 @@
"ui.cylinder": "Cylinder",
"ui.dark": "Mørk",
"ui.default_modelling_orientation": "Standardorientering for modellering",
- "ui.degrees_of_freedom": "frihedsgrader",
"ui.delete": "Slet",
"ui.depth": "Dybde",
"ui.design": "Design",
@@ -1206,7 +1184,6 @@
"ui.equivalent_radius": "Ækvivalent radius",
"ui.expand": "Fold ud",
"ui.exportDxf": "Eksportér DXF…",
- "ui.export_ellipsis": "Eksportér...",
"ui.export_ellipsis_keymap": "Eksportér…",
"ui.export_keymap_tip": "Gem tastaturgenveje, favoritter i S-menuen og værktøjslinjen i en fil",
"ui.extend": "Forlæng",
@@ -1296,7 +1273,6 @@
"ui.heading_sheet_metal": "PLADE",
"ui.heading_shell": "UDHULNING",
"ui.heading_sketch": "SKITSE",
- "ui.heading_sketch_palette": "SKITSEPALETTE",
"ui.heading_sketch_scale": "SKITSESKALERING",
"ui.heading_solid": "MASSIVT EMNE",
"ui.heading_sphere": "KUGLE",
@@ -1334,7 +1310,6 @@
"ui.length_decimals": "Længdedecimaler",
"ui.light": "Lys",
"ui.line": "Linje",
- "ui.linetype": "Linjetype",
"ui.lock": "Lås",
"ui.loft": "Loft",
"ui.look_at": "Se på",
@@ -1368,10 +1343,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF med flademærker",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Midtpunkt",
"ui.mirror": "Spejling",
"ui.mirror_line": "Spejlingslinje",
- "ui.modify": "Redigér",
"ui.move": "Flyt",
"ui.multiple": "Flere",
"ui.named_views": "Navngivne visninger",
@@ -1392,7 +1365,6 @@
"ui.offset_plane": "Forskudt plan",
"ui.one_side": "Én side",
"ui.open": "Åbn",
- "ui.open_ellipsis": "Åbn...",
"ui.open_ends_tip": "Berører intet",
"ui.open_preferences": "Åbn indstillinger",
"ui.open_recent": "Åbn seneste",
@@ -1402,8 +1374,6 @@
"ui.orbit_around": "Rotér omkring",
"ui.orientation": "Orientering",
"ui.origin": "Nulpunkt",
- "ui.palette_points": "Punkter",
- "ui.palette_profile": "Profil",
"ui.pan": "Panorér",
"ui.pan_zoom_orbit": "Panorér, zoom, rotér visning",
"ui.parallel": "Parallel",
@@ -1444,7 +1414,6 @@
"ui.quit": "Afslut",
"ui.radial_context_menu": "Radial genvejsmenu",
"ui.radius": "Radius",
- "ui.radius_type": "Radiustype",
"ui.rail": "Styrekurve",
"ui.rail_fit": "Tilpasning til styrekurve",
"ui.reachable": "Kan nås",
@@ -1474,7 +1443,6 @@
"ui.right": "Fra højre",
"ui.save": "Gem",
"ui.save_as": "Gem som",
- "ui.save_as_ellipsis": "Gem som...",
"ui.save_mesh_no_slicer": "Ingen slicer fundet: Vælg Brugerdefineret…, og vælg dit slicerprogram, eller slå Send til slicer fra",
"ui.save_mesh_pick_bodies": "Vælg de emner, der skal gemmes",
"ui.save_mesh_temp_failed": "Kunne ikke oprette {folder}: {error}",
@@ -1487,7 +1455,6 @@
"ui.select": "Vælg",
"ui.selectOther": "Vælg andet…",
"ui.selectTangentChain": "Vælg tangentkæde",
- "ui.select_other_hint": "Vælg andet: Hold venstre museknap nede uden at flytte markøren på modellen (eller højreklik › Vælg andet…) for at vise alt under markøren. Klik igen samme sted for at vælge næste objekt.",
"ui.selection": "Markering",
"ui.selection_modifiers": "Taster ved markering",
"ui.selection_shift_add_only": "Shift+klik tilføjer uden at fjerne",
@@ -1507,7 +1474,6 @@
"ui.show_constraints": "Bindinger",
"ui.show_construction_geometries": "Konstruktionsgeometri",
"ui.show_dimensions": "Mål",
- "ui.show_points": "Vis punkter",
"ui.show_profile": "Vis profil",
"ui.show_projected_geometries": "Projiceret geometri",
"ui.simple": "Enkel",
@@ -1518,7 +1484,6 @@
"ui.sketch_grid": "Skitsegitter",
"ui.sketch_modifiers": "Taster i skitser",
"ui.sketch_scale": "Skitseskalering",
- "ui.sketch_status": "Skitsestatus",
"ui.sketches": "Skitser",
"ui.slice": "Lagdeling",
"ui.slicer": "Slicer",
@@ -1614,7 +1579,6 @@
"ui.untitled": "Uden titel",
"ui.up_axis_note": "Hvilken akse der peger opad i visningerne (aksevisning, Hjem, Se på). Designs ændres ikke.",
"ui.updateToCurrentView": "Opdatér til aktuel visning",
- "ui.variable": "Variabel",
"ui.view_centre": "Visningens centrum",
"ui.visual_shaded_hidden_edges": "Skyggelagt med skjulte kanter",
"ui.visual_shaded_with_edges": "Skyggelagt med kanter",
@@ -1630,7 +1594,6 @@
"ui.zoom_to_the_cursor": "Zoom mod markøren",
"update.available": "SolidCraft {version} er tilgængelig",
"update.button": "Opdatér",
- "update.button_tip": "SolidCraft {version} er tilgængelig",
"update.button_version": "Opdatér til {version}",
"update.check_automatically": "Søg automatisk efter opdateringer",
"update.check_now": "Søg nu",
diff --git a/assets/locales/de.json b/assets/locales/de.json
index 7148159530..df9f15b15b 100644
--- a/assets/locales/de.json
+++ b/assets/locales/de.json
@@ -4,7 +4,6 @@
"2. Attach your screenshot: copy and paste it, or save and upload the PNG.": "2. Screenshot anhängen: kopieren und einfügen oder als PNG speichern und hochladen.",
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Auf GitHub auf Submit new issue klicken, um den Bericht zu senden.",
- "AI": "KI",
"ARRANGE": "ANORDNEN",
"Acceleration": "Beschleunigung",
"Actions": "Aktionen",
@@ -32,7 +31,6 @@
"Collisions": "Kollisionen",
"Comment": "Kommentar",
"Configuration rules": "Configuration rules",
- "Construction": "Konstruktionslinie",
"Contact sets": "Kontaktsätze",
"Continuity": "Stetigkeit",
"Copy Error Message": "Fehlermeldung kopieren",
@@ -71,7 +69,6 @@
"Feature": "Funktion",
"Filter": "Filter",
"Find in Browser": "Im Browser suchen",
- "Flat": "Flach",
"From edges": "Ausgangskanten",
"HISTORY": "VERLAUF",
"Hidden edges": "Verdeckte Kanten",
@@ -109,7 +106,6 @@
"No matching appearance presets.": "Keine passenden Erscheinungsbildvorlagen.",
"No visible bodies to export.": "Keine sichtbaren Körper zum Exportieren.",
"None": "Keine",
- "Normal to sketch": "Normal zur Skizze",
"Notch": "Ausklinkung",
"OUTPUT": "AUSGABE",
"Open local libraries in the desktop app. You can export this design's library here.": "Öffnen Sie lokale Bibliotheken in der Desktop-App. Die Bibliothek dieses Designs können Sie hier exportieren.",
@@ -127,7 +123,6 @@
"Position (G0)": "Position (G0)",
"Preferences › Design turns the offer back on": "Unter Einstellungen › Design lässt sich das Angebot wieder einschalten",
"Profiles/Curves": "Profile/Kurven",
- "Projection": "Projektion",
"Quantity": "Größe",
"REFERENCE": "REFERENZ",
"RULED SURFACE": "REGELFLÄCHE",
@@ -177,7 +172,6 @@
"Value": "Value",
"Velocity": "Geschwindigkeit",
"Vertices": "Scheitelpunkte",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Nur sichtbare Körper. Kurven werden durch Liniensegmente angenähert (Toleranz: 0,01 mm).",
"Wall Location": "Wandlage",
"Wall Thickness": "Wandstärke",
"When": "When",
@@ -655,10 +649,8 @@
"properties.title": "Eigenschaften: {name}",
"render.background": "Szenenhintergrund",
"render.fit": "Produkt einpassen",
- "render.image_cancel": "Rendering abbrechen",
"render.image_cancelled": "Rendering abgebrochen",
"render.image_cancelling": "Wird abgebrochen",
- "render.image_check": "Renderanfrage prüfen",
"render.image_completed": "Bild bereit zum Export",
"render.image_encoding": "PNG wird kodiert",
"render.image_export": "PNG exportieren",
@@ -737,7 +729,6 @@
"sketch_text.align_right": "Rechts",
"sketch_text.bold": "Fett",
"sketch_text.builtin_font": "{family} (integriert)",
- "sketch_text.font_search": "Schriftarten suchen",
"sketch_text.italic": "Kursiv",
"sketch_text.loading_fonts": "Installierte Schriftarten werden gesucht…",
"sketch_text.on_path": "Der Text folgt seiner Kurve: sie bestimmt seine Lage",
@@ -759,7 +750,6 @@
"trace.stopped_by_loop": "Endet bei Probe {sample}: die Schleife über {joint} lässt sich nicht weiter schließen",
"ui.1_degree_of_freedom": "1 Freiheitsgrad",
"ui.3d_sketch": "3D-Skizze",
- "ui.about": "Über",
"ui.activate": "Aktivieren",
"ui.active_component": "Aktive Komponente",
"ui.agent_chat": "Agenten-Chat",
@@ -922,7 +912,6 @@
"ui.anti_aliasing": "Kantenglättung",
"ui.apply": "Anwenden",
"ui.arc": "Kreisbogen",
- "ui.assemble": "Zusammenbau",
"ui.autosave_every": "Autospeichern alle",
"ui.axes": "Achsen",
"ui.axis": "Achse",
@@ -947,7 +936,6 @@
"ui.chamfer": "Abschrägung",
"ui.chamfer_type": "Fasentyp",
"ui.change_workspace": "Arbeitsbereich wechseln",
- "ui.chord_length": "Sehnenlänge",
"ui.circle": "Kreis",
"ui.circular_pattern": "Radiales Muster",
"ui.clear_recent": "Zuletzt verwendet leeren",
@@ -977,11 +965,9 @@
"ui.command_done": "{command} fertig",
"ui.command_palette_hint": "Befehl eingeben, z. B. {example} — oder S drücken, um zu suchen",
"ui.concentric": "Konzentrisch",
- "ui.configurations": "Konfigurationen",
"ui.conic_curve": "Kegelschnitt",
"ui.constant": "Konstant",
"ui.constraints_conflict": "Bedingungen konfliktreich",
- "ui.construct": "Konstruktion",
"ui.construction": "Konstruktionslinie",
"ui.continuity_g0": "G0 Knick",
"ui.continuity_g1": "G1 Tangente",
@@ -1006,7 +992,6 @@
"ui.cylinder": "Zylinder",
"ui.dark": "Dunkel",
"ui.default_modelling_orientation": "Standard-Modellierungsorientierung",
- "ui.degrees_of_freedom": "Freiheitsgrade",
"ui.delete": "Löschen",
"ui.depth": "Tiefe",
"ui.design": "Design",
@@ -1048,7 +1033,6 @@
"ui.equivalent_radius": "Äquivalenter Radius",
"ui.expand": "Aufklappen",
"ui.exportDxf": "Als DXF exportieren…",
- "ui.export_ellipsis": "Exportieren...",
"ui.export_ellipsis_keymap": "Exportieren…",
"ui.extend": "Verlängern",
"ui.extent_type": "Ausdehnungstyp",
@@ -1130,7 +1114,6 @@
"ui.heading_sheet_metal": "BLECH",
"ui.heading_shell": "HÜLLE",
"ui.heading_sketch": "SKIZZE",
- "ui.heading_sketch_palette": "SKIZZENPALETTE",
"ui.heading_sketch_scale": "SKIZZE SKALIEREN",
"ui.heading_solid": "KÖRPER",
"ui.heading_sphere": "SPHÄRE",
@@ -1167,7 +1150,6 @@
"ui.length_decimals": "Längen-Dezimalstellen",
"ui.light": "Hell",
"ui.line": "Linie",
- "ui.linetype": "Linientyp",
"ui.lock": "Sperren",
"ui.loft": "Loft",
"ui.look_at": "Ansehen",
@@ -1198,10 +1180,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF mit Flächenmarken",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Mittelpunkt",
"ui.mirror": "Spiegeln",
"ui.mirror_line": "Spiegelachse",
- "ui.modify": "Ändern",
"ui.move": "Verschieben",
"ui.multiple": "Mehrfach",
"ui.named_views": "Benannte Ansichten",
@@ -1221,7 +1201,6 @@
"ui.offset_plane": "Abstandsebene",
"ui.one_side": "Einseitig",
"ui.open": "Öffnen",
- "ui.open_ellipsis": "Öffnen...",
"ui.open_preferences": "Einstellungen öffnen",
"ui.open_recent": "Zuletzt verwendet",
"ui.operation": "Operation",
@@ -1232,8 +1211,6 @@
"ui.origin": "Ursprung",
"ui.palette_construction_mode": "Konstruktionsmodus (X)",
"ui.palette_more": "Mehr",
- "ui.palette_points": "Punkte",
- "ui.palette_profile": "Profil",
"ui.palette_sketch_options": "Skizzenoptionen",
"ui.pan": "Verschieben",
"ui.pan_zoom_orbit": "Verschieben, zoomen, umkreisen",
@@ -1264,7 +1241,6 @@
"ui.quantity_2": "Anzahl 2",
"ui.quit": "Beenden",
"ui.radius": "Radius",
- "ui.radius_type": "Radius-Typ",
"ui.rail": "Leitkurve",
"ui.rail_fit": "Anpassung an Leitkurve",
"ui.reachable": "Erreichbar",
@@ -1286,7 +1262,6 @@
"ui.right": "Rechts",
"ui.save": "Speichern",
"ui.save_as": "Speichern unter",
- "ui.save_as_ellipsis": "Speichern unter...",
"ui.save_mesh_no_slicer": "Kein Slicer gefunden: „Benutzerdefiniert…“ wählen und das Slicer-Programm angeben, oder „An Slicer senden“ ausschalten",
"ui.save_mesh_pick_bodies": "Wähle die Körper zum Speichern aus",
"ui.save_mesh_temp_failed": "{folder} konnte nicht angelegt werden: {error}",
@@ -1315,7 +1290,6 @@
"ui.show_constraints": "Bedingungen",
"ui.show_construction_geometries": "Konstruktionsgeometrien",
"ui.show_dimensions": "Maße",
- "ui.show_points": "Punkte anzeigen",
"ui.show_profile": "Profil anzeigen",
"ui.show_projected_geometries": "Projizierte Geometrien",
"ui.simple": "Einfach",
@@ -1325,7 +1299,6 @@
"ui.sketch_dimension": "Skizzenmaß",
"ui.sketch_grid": "Skizzenraster",
"ui.sketch_scale": "Skizzenskalierung",
- "ui.sketch_status": "Skizzenstatus",
"ui.sketches": "Skizzen",
"ui.slice": "Scheibe",
"ui.slicer": "Slicer",
@@ -1366,7 +1339,6 @@
"ui.split_body": "Körper trennen",
"ui.start": "Start",
"ui.start_over": "Von vorn beginnen",
- "ui.start_radius": "Startradius",
"ui.stretch": "Strecken",
"ui.supersampling": "Supersampling (SSAA)",
"ui.supersampling_adaptive": "Nur bei ruhender Ansicht",
@@ -1408,7 +1380,6 @@
"ui.unsuppress": "Unterdrückung aufheben",
"ui.untitled": "Ohne Titel",
"ui.updateToCurrentView": "Auf aktuelle Ansicht aktualisieren",
- "ui.variable": "Variabel",
"ui.view_centre": "Ansichtszentrum",
"ui.visual_style": "Ansichtsstil",
"ui.workspace": "Arbeitsbereich",
@@ -1418,7 +1389,6 @@
"ui.zoom_to_the_cursor": "Zum Cursor zoomen",
"update.available": "SolidCraft {version} ist verfügbar",
"update.button": "Update",
- "update.button_tip": "SolidCraft {version} ist verfügbar",
"update.button_version": "Auf {version} aktualisieren",
"update.check_automatically": "Automatisch nach Updates suchen",
"update.check_now": "Jetzt suchen",
diff --git a/assets/locales/en.json b/assets/locales/en.json
index 933fbcd17b..03d07f885b 100644
--- a/assets/locales/en.json
+++ b/assets/locales/en.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Click Submit new issue on GitHub to send your report.",
"A new configuration, a copy of the active one": "A new configuration, a copy of the active one",
- "AI": "AI",
"ARRANGE": "ARRANGE",
"About SolidCraft": "About SolidCraft",
"Acceleration": "Acceleration",
@@ -81,7 +80,6 @@
"Config Table": "Config Table",
"Configuration": "Configuration",
"Configuration rules": "Configuration rules",
- "Construction": "Construction",
"Contact": "Contact",
"Contact Sets": "Contact Sets",
"Contact sets": "Contact sets",
@@ -110,7 +108,6 @@
"Delete rule": "Delete rule",
"Delete the row": "Delete the row",
"Delete the set": "Delete the set",
- "Delete this parameter": "Delete this parameter",
"Density": "Density",
"Dependents": "Dependents",
"Designs you open or save appear here.": "Designs you open or save appear here.",
@@ -157,7 +154,6 @@
"Filter": "Filter",
"Find in Browser": "Find in Browser",
"Finish": "Finish",
- "Flat": "Flat",
"Flat Pattern": "Flat Pattern",
"Flat size": "Flat size",
"Follow camera (Look At sketches)": "Follow camera (Look At sketches)",
@@ -238,7 +234,6 @@
"No matching appearances": "No matching appearances",
"No visible bodies to export.": "No visible bodies to export.",
"None": "None",
- "Normal to sketch": "Normal to sketch",
"Not available yet": "Not available yet",
"Notch": "Notch",
"OUTPUT": "OUTPUT",
@@ -253,7 +248,6 @@
"Overall length": "Overall length",
"Param. Graph": "Param. Graph",
"Parameter": "Parameter",
- "Parameter values": "Parameter values",
"Parts": "Parts",
"Pass through": "Pass through",
"Path": "Path",
@@ -274,7 +268,6 @@
"Preview Row": "Preview Row",
"Preview leaves the current design unchanged.": "Preview leaves the current design unchanged.",
"Profiles/Curves": "Profiles/Curves",
- "Projection": "Projection",
"Quantity": "Quantity",
"RECENT": "RECENT",
"REFERENCE": "REFERENCE",
@@ -401,7 +394,6 @@
"Velocity": "Velocity",
"Vertices": "Vertices",
"View navigator": "View navigator",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Visible bodies only. Curves use line segments (0.01 mm tolerance).",
"Volume": "Volume",
"Wall": "Wall",
"Wall Location": "Wall Location",
@@ -768,7 +760,6 @@
"cmd.view_navigate": "Navigate View",
"cmd.view_rename": "Rename Named View",
"cmd.view_save": "New Named View",
- "command name": "command name",
"contact.components_count": "{count} components",
"contact.enabled_label": "enabled",
"coupling.gear_1": "Gear 1",
@@ -834,7 +825,6 @@
"dxf.progress.write": "Writing DXF (5/5)",
"dxf.tolerance": "Curve tolerance",
"dxf.tolerance_help": "Visible bodies only. Curves use straight segments. Smaller tolerance gives finer curves and uses more time and memory.",
- "expression, e.g. 25 mm": "expression, e.g. 25 mm",
"file_load.built": "Built so far: {built} of {total} features.",
"file_load.converting": "Converting solid {done} of {total}",
"file_load.inserting": "Inserting geometry",
@@ -937,7 +927,6 @@
"nav.touchpad.zoom": "Zoom (vertical scroll or pinch)",
"needs two joints": "needs two joints",
"new configuration": "new configuration",
- "new name": "new name",
"new parameter": "new parameter",
"no hole": "no hole",
"no interference": "no interference",
@@ -963,10 +952,8 @@
"recovery.never_saved": "never saved",
"render.background": "Scene background",
"render.fit": "Fit Product",
- "render.image_cancel": "Cancel Render",
"render.image_cancelled": "Render cancelled",
"render.image_cancelling": "Cancelling",
- "render.image_check": "Check Render Request",
"render.image_completed": "Image ready to export",
"render.image_encoding": "Encoding PNG",
"render.image_export": "Export PNG",
@@ -1047,7 +1034,6 @@
"sketch_text.align_right": "Right",
"sketch_text.bold": "Bold",
"sketch_text.builtin_font": "{family} (built-in)",
- "sketch_text.font_search": "Search fonts",
"sketch_text.italic": "Italic",
"sketch_text.loading_fonts": "Looking for installed fonts…",
"sketch_text.on_path": "The text follows its path: the curve places it",
@@ -1077,9 +1063,7 @@
"trace.stopped_by_loop": "Ends at sample {sample}: the loop through {joint} can't close any further",
"ui.1_degree_of_freedom": "1 degree of freedom",
"ui.3d_mouse_speed": "3D mouse speed",
- "ui.3d_mouse_windows": "3D mouse",
"ui.3d_sketch": "3D Sketch",
- "ui.about": "About",
"ui.activate": "Activate",
"ui.active_component": "Active component",
"ui.agent_chat": "Agent chat",
@@ -1146,7 +1130,6 @@
"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.",
- "ui.agent_chat_new_yes": "New chat",
"ui.agent_chat_next_picture": "Next picture",
"ui.agent_chat_no_cli": "solidcraft-cli was not found next to the app, so the agent can't reach the design.",
"ui.agent_chat_no_control": "The agent chat's endpoint did not start, so the agent can't reach the design.",
@@ -1288,7 +1271,6 @@
"ui.anti_aliasing": "Anti-aliasing",
"ui.apply": "Apply",
"ui.arc": "Arc",
- "ui.assemble": "Assemble",
"ui.assistant": "Assistant",
"ui.assistant_waiting": "{count} approvals waiting",
"ui.autosave_every": "Autosave every",
@@ -1315,7 +1297,6 @@
"ui.chamfer": "Chamfer",
"ui.chamfer_type": "Chamfer Type",
"ui.change_workspace": "Change workspace",
- "ui.chord_length": "Chord Length",
"ui.circle": "Circle",
"ui.circular_pattern": "Circular Pattern",
"ui.clear": "Clear",
@@ -1348,11 +1329,9 @@
"ui.command_done": "{command} done",
"ui.command_palette_hint": "Type a command, e.g. {example} — or press S to search",
"ui.concentric": "Concentric",
- "ui.configurations": "Configurations",
"ui.conic_curve": "Conic Curve",
"ui.constant": "Constant",
"ui.constraints_conflict": "Constraints conflict",
- "ui.construct": "Construct",
"ui.construction": "Construction",
"ui.context_menu": "Context menu",
"ui.continuity_g0": "G0 crease",
@@ -1378,7 +1357,6 @@
"ui.cylinder": "Cylinder",
"ui.dark": "Dark",
"ui.default_modelling_orientation": "Default modelling orientation",
- "ui.degrees_of_freedom": "degrees of freedom",
"ui.delete": "Delete",
"ui.depth": "Depth",
"ui.design": "Design",
@@ -1420,7 +1398,6 @@
"ui.equivalent_radius": "Equivalent Radius",
"ui.expand": "Expand",
"ui.exportDxf": "Export DXF…",
- "ui.export_ellipsis": "Export...",
"ui.export_ellipsis_keymap": "Export…",
"ui.export_keymap_tip": "Keys, S box favourites and the toolbar, as a file",
"ui.extend": "Extend",
@@ -1510,7 +1487,6 @@
"ui.heading_sheet_metal": "SHEET METAL",
"ui.heading_shell": "SHELL",
"ui.heading_sketch": "SKETCH",
- "ui.heading_sketch_palette": "SKETCH PALETTE",
"ui.heading_sketch_scale": "SKETCH SCALE",
"ui.heading_solid": "SOLID",
"ui.heading_sphere": "SPHERE",
@@ -1549,7 +1525,6 @@
"ui.length_decimals": "Length decimals",
"ui.light": "Light",
"ui.line": "Line",
- "ui.linetype": "Linetype",
"ui.lock": "Lock",
"ui.loft": "Loft",
"ui.look_at": "Look At",
@@ -1583,10 +1558,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF with face tags",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Midpoint",
"ui.mirror": "Mirror",
"ui.mirror_line": "Mirror line",
- "ui.modify": "Modify",
"ui.move": "Move",
"ui.multiple": "Multiple",
"ui.named_views": "Named Views",
@@ -1607,7 +1580,6 @@
"ui.offset_plane": "Offset Plane",
"ui.one_side": "One Side",
"ui.open": "Open",
- "ui.open_ellipsis": "Open...",
"ui.open_ends_tip": "Touches nothing",
"ui.open_preferences": "Open Preferences",
"ui.open_recent": "Open Recent",
@@ -1619,8 +1591,6 @@
"ui.origin": "Origin",
"ui.palette_construction_mode": "Construction mode (X)",
"ui.palette_more": "More",
- "ui.palette_points": "Points",
- "ui.palette_profile": "Profile",
"ui.palette_sketch_options": "Sketch options",
"ui.pan": "Pan",
"ui.pan_zoom_orbit": "Pan, zoom, orbit",
@@ -1662,7 +1632,6 @@
"ui.quit": "Quit",
"ui.radial_context_menu": "Radial context menu",
"ui.radius": "Radius",
- "ui.radius_type": "Radius Type",
"ui.rail": "Rail",
"ui.rail_fit": "Rail Fit",
"ui.reachable": "Reachable",
@@ -1695,7 +1664,6 @@
"ui.right": "Right",
"ui.save": "Save",
"ui.save_as": "Save As",
- "ui.save_as_ellipsis": "Save As...",
"ui.save_mesh_no_slicer": "No slicer found: choose Custom… and pick your slicer program, or turn off Send to slicer",
"ui.save_mesh_pick_bodies": "Select the bodies to save",
"ui.save_mesh_temp_failed": "Couldn't make {folder}: {error}",
@@ -1708,7 +1676,6 @@
"ui.select": "Select",
"ui.selectOther": "Select Other…",
"ui.selectTangentChain": "Select Tangent Chain",
- "ui.select_other_hint": "Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there.",
"ui.selection": "Selection",
"ui.selection_modifiers": "Selection modifiers",
"ui.selection_shift_add_only": "Shift+click adds without removing",
@@ -1728,7 +1695,6 @@
"ui.show_constraints": "Constraints",
"ui.show_construction_geometries": "Construction Geometries",
"ui.show_dimensions": "Dimensions",
- "ui.show_points": "Show Points",
"ui.show_profile": "Show Profile",
"ui.show_projected_geometries": "Projected Geometries",
"ui.simple": "Simple",
@@ -1739,7 +1705,6 @@
"ui.sketch_grid": "Sketch Grid",
"ui.sketch_modifiers": "Sketch modifiers",
"ui.sketch_scale": "Sketch Scale",
- "ui.sketch_status": "Sketch Status",
"ui.sketches": "Sketches",
"ui.slice": "Slice",
"ui.slicer": "Slicer",
@@ -1786,7 +1751,6 @@
"ui.start": "Start",
"ui.start_over": "Start over",
"ui.start_page": "Start page",
- "ui.start_radius": "Start Radius",
"ui.stretch": "Stretch",
"ui.supersampling": "Supersampling (SSAA)",
"ui.supersampling_adaptive": "Only when the view is still",
@@ -1836,7 +1800,6 @@
"ui.untitled": "Untitled",
"ui.up_axis_note": "Which axis points up in the views (axis view, Home, Look At). Designs are unchanged.",
"ui.updateToCurrentView": "Update to Current View",
- "ui.variable": "Variable",
"ui.view_centre": "View centre",
"ui.visual_shaded_hidden_edges": "Shaded with hidden edges",
"ui.visual_shaded_with_edges": "Shaded with edges",
@@ -1864,7 +1827,6 @@
"ui.zoom_to_the_cursor": "Zoom to the cursor",
"update.available": "SolidCraft {version} is available",
"update.button": "Update",
- "update.button_tip": "SolidCraft {version} is available",
"update.button_version": "Update to {version}",
"update.check_automatically": "Check for updates automatically",
"update.check_now": "Check now",
diff --git a/assets/locales/es.json b/assets/locales/es.json
index 321c059a9a..a729e80e7b 100644
--- a/assets/locales/es.json
+++ b/assets/locales/es.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Haz clic en «Submit new issue» en GitHub para enviar el informe.",
"A new configuration, a copy of the active one": "Una configuración nueva, copia de la activa",
- "AI": "AI",
"ARRANGE": "ORGANIZAR",
"About SolidCraft": "Acerca de SolidCraft",
"Acceleration": "Aceleración",
@@ -71,7 +70,6 @@
"Component1": "Componente1",
"Configuration": "Configuración",
"Configuration rules": "Reglas de configuración",
- "Construction": "Construcción",
"Contact": "Contacto",
"Contact sets": "Conjuntos de contacto",
"Continuity": "Continuidad",
@@ -97,7 +95,6 @@
"Delete rule": "Eliminar regla",
"Delete the row": "Eliminar la fila",
"Delete the set": "Eliminar el conjunto",
- "Delete this parameter": "Eliminar este parámetro",
"Density": "Densidad",
"Designs you open or save appear here.": "Aquí aparecen los diseños que abras o guardes.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Determinado por «Hasta objeto». Elige «Ángulo» para modificar la extensión angular.",
@@ -138,7 +135,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Los archivos de muchos programas CAD usan Y como eje vertical, por eso aquí se abren tumbados (con Z hacia arriba).",
"Filter": "Filtrar",
"Find in Browser": "Buscar en el explorador",
- "Flat": "Plano",
"Flat size": "Tamaño del desarrollo",
"Follow camera (Look At sketches)": "Seguir cámara (orientar hacia los bocetos)",
"Follow the camera (Look At sketches)": "Seguir la cámara (orientar hacia los bocetos)",
@@ -210,7 +206,6 @@
"No matching appearances": "No hay apariencias coincidentes",
"No visible bodies to export.": "No hay cuerpos visibles para exportar.",
"None": "Ninguno",
- "Normal to sketch": "Normal al boceto",
"Not available yet": "Todavía no disponible",
"Notch": "Muesca",
"OUTPUT": "SALIDA",
@@ -224,7 +219,6 @@
"Outside": "Exterior",
"Overall length": "Longitud total",
"Parameter": "Parámetro",
- "Parameter values": "Valores de parámetros",
"Pass through": "Pasante",
"Path": "Trayectoria",
"Per Edge": "Por arista",
@@ -242,7 +236,6 @@
"Preview Row": "Previsualizar fila",
"Preview leaves the current design unchanged.": "La vista previa no modifica el diseño actual.",
"Profiles/Curves": "Perfiles/curvas",
- "Projection": "Proyección",
"Quantity": "Cantidad",
"RECENT": "RECIENTES",
"REFERENCE": "REFERENCIA",
@@ -359,7 +352,6 @@
"Velocity": "Velocidad",
"Vertices": "Vértices",
"View navigator": "Navegador de vistas",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Solo cuerpos visibles. Las curvas utilizan segmentos rectos (tolerancia de 0,01 mm).",
"Volume": "Volumen",
"Wall": "Pared",
"Wall Location": "Posición de la pared",
@@ -711,7 +703,6 @@
"cmd.view_navigate": "Navegar por la vista",
"cmd.view_rename": "Cambiar nombre de vista guardada",
"cmd.view_save": "Nueva vista guardada",
- "command name": "nombre del comando",
"contact.components_count": "{count} componentes",
"contact.enabled_label": "activado",
"coupling.gear_1": "Engranaje 1",
@@ -758,7 +749,6 @@
"dxf.progress.write": "Escribiendo DXF (5/5)",
"dxf.tolerance": "Tolerancia de curva",
"dxf.tolerance_help": "Solo cuerpos visibles. Las curvas usan segmentos rectos. Una tolerancia menor da curvas más finas y consume más tiempo y memoria.",
- "expression, e.g. 25 mm": "expresión, p. ej., 25 mm",
"fits the face, e.g. M8": "se ajusta a la cara, p. ej., M8",
"from the rule": "de la regla",
"help.apache": "Licencia Apache 2.0",
@@ -830,7 +820,6 @@
"nav.touchpad.zoom": "Zoom (desplazamiento vertical o gesto de pellizco)",
"needs two joints": "necesita dos uniones",
"new configuration": "nueva configuración",
- "new name": "nuevo nombre",
"new parameter": "nuevo parámetro",
"no interference": "sin interferencias",
"no joint that moves yet": "todavía no hay ninguna unión móvil",
@@ -849,10 +838,8 @@
"properties.title": "Propiedades: {name}",
"render.background": "Fondo de la escena",
"render.fit": "Ajustar producto",
- "render.image_cancel": "Cancelar renderizado",
"render.image_cancelled": "Renderizado cancelado",
"render.image_cancelling": "Cancelando",
- "render.image_check": "Comprobar solicitud de renderizado",
"render.image_completed": "Imagen lista para exportar",
"render.image_encoding": "Codificando PNG",
"render.image_export": "Exportar PNG",
@@ -931,7 +918,6 @@
"sketch_text.align_right": "Alinear a la derecha",
"sketch_text.bold": "Negrita",
"sketch_text.builtin_font": "{family} (integrada)",
- "sketch_text.font_search": "Buscar fuentes",
"sketch_text.italic": "Cursiva",
"sketch_text.loading_fonts": "Buscando fuentes instaladas…",
"sketch_text.on_path": "El texto sigue su trayectoria: la curva determina su posición",
@@ -959,9 +945,7 @@
"trace.stopped_by_loop": "Termina en la muestra {sample}: el bucle que pasa por {joint} no puede cerrarse más",
"ui.1_degree_of_freedom": "1 grado de libertad",
"ui.3d_mouse_speed": "Velocidad del ratón 3D",
- "ui.3d_mouse_windows": "Ratón 3D",
"ui.3d_sketch": "Boceto 3D",
- "ui.about": "Acerca de",
"ui.activate": "Activar",
"ui.active_component": "Componente activo",
"ui.agent_chat": "Chat del agente",
@@ -1003,7 +987,6 @@
"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.",
- "ui.agent_chat_new_yes": "Nuevo chat",
"ui.agent_chat_next_picture": "Imagen siguiente",
"ui.agent_chat_no_cli": "No se ha encontrado solidcraft-cli junto a la aplicación, por lo que el agente no puede acceder al diseño.",
"ui.agent_chat_no_control": "No se ha iniciado el punto de conexión del chat del agente, por lo que no puede acceder al diseño.",
@@ -1137,7 +1120,6 @@
"ui.anti_aliasing": "Suavizado de bordes",
"ui.apply": "Aplicar",
"ui.arc": "Arco",
- "ui.assemble": "Ensamblar",
"ui.autosave_every": "Guardar automáticamente cada",
"ui.axes": "Ejes",
"ui.axis": "Eje",
@@ -1161,7 +1143,6 @@
"ui.chamfer": "Chaflán",
"ui.chamfer_type": "Tipo de chaflán",
"ui.change_workspace": "Cambiar espacio de trabajo",
- "ui.chord_length": "Longitud de cuerda",
"ui.circle": "Círculo",
"ui.circular_pattern": "Patrón circular",
"ui.clear": "Borrar",
@@ -1194,11 +1175,9 @@
"ui.command_done": "{command} completado",
"ui.command_palette_hint": "Escribe un comando, p. ej., {example}, o pulsa S para buscar",
"ui.concentric": "Concéntrico",
- "ui.configurations": "Configuraciones",
"ui.conic_curve": "Curva cónica",
"ui.constant": "Constante",
"ui.constraints_conflict": "Conflicto entre restricciones",
- "ui.construct": "Construir",
"ui.construction": "Construcción",
"ui.context_menu": "Menú contextual",
"ui.continuity_g0": "G0 arista",
@@ -1224,7 +1203,6 @@
"ui.cylinder": "Cilindro",
"ui.dark": "Oscuro",
"ui.default_modelling_orientation": "Orientación de modelado predeterminada",
- "ui.degrees_of_freedom": "grados de libertad",
"ui.delete": "Eliminar",
"ui.depth": "Profundidad",
"ui.design": "Diseño",
@@ -1266,7 +1244,6 @@
"ui.equivalent_radius": "Radio equivalente",
"ui.expand": "Expandir",
"ui.exportDxf": "Exportar DXF…",
- "ui.export_ellipsis": "Exportar…",
"ui.export_ellipsis_keymap": "Exportar…",
"ui.export_keymap_tip": "Exportar las teclas, los favoritos de la búsqueda S y la barra de herramientas como archivo",
"ui.extend": "Extender",
@@ -1350,7 +1327,6 @@
"ui.heading_sheet_metal": "CHAPA",
"ui.heading_shell": "VACIADO",
"ui.heading_sketch": "BOCETO",
- "ui.heading_sketch_palette": "PALETA DE BOCETOS",
"ui.heading_sketch_scale": "ESCALA DEL BOCETO",
"ui.heading_solid": "SÓLIDO",
"ui.heading_sphere": "ESFERA",
@@ -1389,7 +1365,6 @@
"ui.length_decimals": "Decimales de longitud",
"ui.light": "Claro",
"ui.line": "Línea",
- "ui.linetype": "Tipo de línea",
"ui.lock": "Bloquear",
"ui.loft": "Solevación",
"ui.look_at": "Mirar hacia",
@@ -1421,10 +1396,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF con etiquetas de cara",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Punto medio",
"ui.mirror": "Simetría",
"ui.mirror_line": "Línea de simetría",
- "ui.modify": "Modificar",
"ui.move": "Mover",
"ui.multiple": "Múltiple",
"ui.named_views": "Vistas guardadas",
@@ -1444,7 +1417,6 @@
"ui.offset_plane": "Plano desfasado",
"ui.one_side": "Un lado",
"ui.open": "Abrir",
- "ui.open_ellipsis": "Abrir…",
"ui.open_preferences": "Abrir preferencias",
"ui.open_recent": "Abrir reciente",
"ui.operation": "Operación",
@@ -1455,8 +1427,6 @@
"ui.origin": "Origen",
"ui.palette_construction_mode": "Modo de construcción (X)",
"ui.palette_more": "Más",
- "ui.palette_points": "Puntos",
- "ui.palette_profile": "Perfil",
"ui.palette_sketch_options": "Opciones de croquis",
"ui.pan": "Desplazar",
"ui.pan_zoom_orbit": "Desplazar, zoom y orbitar",
@@ -1491,7 +1461,6 @@
"ui.quit": "Salir",
"ui.radial_context_menu": "Menú contextual radial",
"ui.radius": "Radio",
- "ui.radius_type": "Tipo de radio",
"ui.rail": "Línea guía",
"ui.rail_fit": "Ajuste a la guía",
"ui.reachable": "Alcanzable",
@@ -1516,7 +1485,6 @@
"ui.right": "Derecha",
"ui.save": "Guardar",
"ui.save_as": "Guardar como",
- "ui.save_as_ellipsis": "Guardar como…",
"ui.save_mesh_no_slicer": "No se ha encontrado ningún laminador: elige Personalizado… y selecciona tu laminador, o desactiva Enviar al laminador",
"ui.save_mesh_pick_bodies": "Selecciona los cuerpos que se van a guardar",
"ui.save_mesh_temp_failed": "No se ha podido crear {folder}: {error}",
@@ -1529,7 +1497,6 @@
"ui.select": "Seleccionar",
"ui.selectOther": "Seleccionar otro…",
"ui.selectTangentChain": "Seleccionar cadena tangente",
- "ui.select_other_hint": "Seleccionar otro: mantén pulsado el botón izquierdo sobre el modelo (o haz clic derecho › Seleccionar otro…) para ver todos los elementos bajo el cursor; vuelve a pulsar en el mismo punto para seleccionar el siguiente.",
"ui.selection": "Selección",
"ui.send": "Enviar",
"ui.send_to_slicer": "Enviar al laminador",
@@ -1546,7 +1513,6 @@
"ui.show_constraints": "Restricciones",
"ui.show_construction_geometries": "Geometrías de construcción",
"ui.show_dimensions": "Cotas",
- "ui.show_points": "Mostrar puntos",
"ui.show_profile": "Mostrar perfil",
"ui.show_projected_geometries": "Geometrías proyectadas",
"ui.simple": "Sencillo",
@@ -1556,7 +1522,6 @@
"ui.sketch_dimension": "Cota de boceto",
"ui.sketch_grid": "Cuadrícula de boceto",
"ui.sketch_scale": "Escala del boceto",
- "ui.sketch_status": "Estado del boceto",
"ui.sketches": "Bocetos",
"ui.slice": "Laminar",
"ui.slicer": "Laminador",
@@ -1602,7 +1567,6 @@
"ui.stand_up_tip": "Tras abrir un archivo STEP o IGES con Z hacia arriba, ofrecer un cuarto de vuelta alrededor de X",
"ui.start": "Iniciar",
"ui.start_over": "Volver a empezar",
- "ui.start_radius": "Radio inicial",
"ui.stretch": "Estirar",
"ui.supersampling": "Supermuestreo (SSAA)",
"ui.supersampling_adaptive": "Solo cuando la vista está inmóvil",
@@ -1647,7 +1611,6 @@
"ui.untitled": "Sin título",
"ui.up_axis_note": "Eje que apunta hacia arriba en las vistas (vista de eje, Inicio, Mirar hacia). Los diseños no cambian.",
"ui.updateToCurrentView": "Actualizar a vista actual",
- "ui.variable": "Variable",
"ui.view_centre": "Centro de la vista",
"ui.visual_shaded_hidden_edges": "Sombreado con aristas ocultas",
"ui.visual_shaded_with_edges": "Sombreado con aristas",
@@ -1663,7 +1626,6 @@
"ui.zoom_to_the_cursor": "Zoom hacia el cursor",
"update.available": "SolidCraft {version} está disponible",
"update.button": "Actualizar",
- "update.button_tip": "SolidCraft {version} está disponible",
"update.button_version": "Actualizar a {version}",
"update.check_automatically": "Buscar actualizaciones automáticamente",
"update.check_now": "Comprobar ahora",
diff --git a/assets/locales/fr.json b/assets/locales/fr.json
index dcdf0a314e..36c3af0ce5 100644
--- a/assets/locales/fr.json
+++ b/assets/locales/fr.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Cliquer sur Submit new issue sur GitHub pour envoyer votre rapport.",
"A new configuration, a copy of the active one": "Nouvelle configuration, copie de la configuration active",
- "AI": "IA",
"ARRANGE": "DISPOSER",
"About SolidCraft": "À propos de SolidCraft",
"Acceleration": "Accélération",
@@ -72,7 +71,6 @@
"Component1": "Composant1",
"Configuration": "Configuration",
"Configuration rules": "Règles de configuration",
- "Construction": "Construction",
"Contact": "Contact",
"Contact sets": "Jeux de contact",
"Continuity": "Continuité",
@@ -99,7 +97,6 @@
"Delete rule": "Supprimer la règle",
"Delete the row": "Supprimer la ligne",
"Delete the set": "Supprimer le jeu",
- "Delete this parameter": "Supprimer ce paramètre",
"Density": "Masse volumique",
"Designs you open or save appear here.": "Les conceptions que vous ouvrez ou enregistrez apparaissent ici.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Déterminé par Jusqu'à l'objet. Choisir Angle pour modifier l'étendue angulaire.",
@@ -140,7 +137,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Les fichiers de nombreux logiciels de CAO ont Y vers le haut : ils s'ouvrent donc couchés ici (Z vers le haut).",
"Filter": "Filtrer",
"Find in Browser": "Trouver dans le navigateur",
- "Flat": "Plat",
"Flat size": "Dimensions à plat",
"Follow camera (Look At sketches)": "Suivre la caméra (vue normale aux esquisses)",
"Follow the camera (Look At sketches)": "Suivre la caméra (vue normale aux esquisses)",
@@ -212,7 +208,6 @@
"No matching appearances": "Aucune apparence correspondante",
"No visible bodies to export.": "Aucun corps visible à exporter.",
"None": "Aucun",
- "Normal to sketch": "Normale à l'esquisse",
"Not available yet": "Pas encore disponible",
"Notch": "Encoche",
"OUTPUT": "SORTIE",
@@ -226,7 +221,6 @@
"Outside": "Extérieur",
"Overall length": "Longueur hors tout",
"Parameter": "Paramètre",
- "Parameter values": "Valeurs des paramètres",
"Pass through": "Passer par",
"Path": "Trajectoire",
"Per Edge": "Par arête",
@@ -244,7 +238,6 @@
"Preview Row": "Aperçu de la ligne",
"Preview leaves the current design unchanged.": "L'aperçu ne modifie pas la conception actuelle.",
"Profiles/Curves": "Profils/Courbes",
- "Projection": "Projection",
"Quantity": "Grandeur",
"RECENT": "RÉCENTS",
"REFERENCE": "RÉFÉRENCE",
@@ -361,7 +354,6 @@
"Velocity": "Vitesse",
"Vertices": "Sommets",
"View navigator": "Repère de navigation",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Corps visibles uniquement. Les courbes sont approchées par des segments de droite (tolérance de 0,01 mm).",
"Volume": "Volume",
"Wall": "Paroi",
"Wall Location": "Position de la paroi",
@@ -718,7 +710,6 @@
"cmd.view_navigate": "Naviguer dans la vue",
"cmd.view_rename": "Renommer la vue nommée",
"cmd.view_save": "Nouvelle vue nommée",
- "command name": "nom de la commande",
"contact.components_count": "{count} composants",
"contact.enabled_label": "activé",
"coupling.gear_1": "Engrenage 1",
@@ -770,7 +761,6 @@
"dxf.progress.write": "Écriture du DXF (5/5)",
"dxf.tolerance": "Tolérance des courbes",
"dxf.tolerance_help": "Corps visibles uniquement. Les courbes sont approchées par des segments de droite. Une tolérance plus faible donne des courbes plus fines, au prix de plus de temps et de mémoire.",
- "expression, e.g. 25 mm": "expression, par ex. 25 mm",
"fits the face, e.g. M8": "adapté à la face, par ex. M8",
"from the rule": "selon la règle",
"help.apache": "Licence Apache 2.0",
@@ -842,7 +832,6 @@
"nav.touchpad.zoom": "Zoom (défilement vertical ou pincement)",
"needs two joints": "nécessite deux liaisons",
"new configuration": "nouvelle configuration",
- "new name": "nouveau nom",
"new parameter": "nouveau paramètre",
"no hole": "sans perçage",
"no interference": "aucune interférence",
@@ -862,10 +851,8 @@
"properties.title": "Propriétés : {name}",
"render.background": "Arrière-plan de la scène",
"render.fit": "Cadrer le produit",
- "render.image_cancel": "Annuler le rendu",
"render.image_cancelled": "Rendu annulé",
"render.image_cancelling": "Annulation",
- "render.image_check": "Vérifier la demande de rendu",
"render.image_completed": "Image prête à exporter",
"render.image_encoding": "Encodage du PNG",
"render.image_export": "Exporter en PNG",
@@ -946,7 +933,6 @@
"sketch_text.align_right": "Droite",
"sketch_text.bold": "Gras",
"sketch_text.builtin_font": "{family} (intégrée)",
- "sketch_text.font_search": "Rechercher des polices",
"sketch_text.italic": "Italique",
"sketch_text.loading_fonts": "Recherche des polices installées…",
"sketch_text.on_path": "Le texte suit sa trajectoire : la courbe le positionne",
@@ -976,9 +962,7 @@
"trace.stopped_by_loop": "Se termine à l'échantillon {sample} : la boucle passant par {joint} ne peut plus se fermer",
"ui.1_degree_of_freedom": "1 degré de liberté",
"ui.3d_mouse_speed": "Vitesse de la souris 3D",
- "ui.3d_mouse_windows": "Souris 3D",
"ui.3d_sketch": "Esquisse 3D",
- "ui.about": "À propos",
"ui.activate": "Activer",
"ui.active_component": "Composant actif",
"ui.agent_chat": "Chat de l'agent",
@@ -1044,7 +1028,6 @@
"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é.",
- "ui.agent_chat_new_yes": "Nouveau chat",
"ui.agent_chat_next_picture": "Image suivante",
"ui.agent_chat_no_cli": "solidcraft-cli est introuvable à côté de l'application : l'agent ne peut donc pas accéder à la conception.",
"ui.agent_chat_no_control": "Le point d'accès du chat de l'agent n'a pas démarré : l'agent ne peut donc pas accéder à la conception.",
@@ -1186,7 +1169,6 @@
"ui.anti_aliasing": "Anticrénelage",
"ui.apply": "Appliquer",
"ui.arc": "Arc",
- "ui.assemble": "Assembler",
"ui.autosave_every": "Enregistrement automatique toutes les",
"ui.axes": "Axes",
"ui.axis": "Axe",
@@ -1211,7 +1193,6 @@
"ui.chamfer": "Chanfrein",
"ui.chamfer_type": "Type de chanfrein",
"ui.change_workspace": "Changer d'espace de travail",
- "ui.chord_length": "Longueur de corde",
"ui.circle": "Cercle",
"ui.circular_pattern": "Réseau circulaire",
"ui.clear": "Effacer",
@@ -1244,11 +1225,9 @@
"ui.command_done": "{command} terminé",
"ui.command_palette_hint": "Tapez une commande, ex. {example} — ou S pour chercher",
"ui.concentric": "Concentricité",
- "ui.configurations": "Configurations",
"ui.conic_curve": "Courbe conique",
"ui.constant": "Constant",
"ui.constraints_conflict": "Contraintes en conflit",
- "ui.construct": "Construire",
"ui.construction": "Construction",
"ui.context_menu": "Menu contextuel",
"ui.continuity_g0": "G0 angle vif",
@@ -1274,7 +1253,6 @@
"ui.cylinder": "Cylindre",
"ui.dark": "Sombre",
"ui.default_modelling_orientation": "Orientation de modélisation par défaut",
- "ui.degrees_of_freedom": "degrés de liberté",
"ui.delete": "Supprimer",
"ui.depth": "Profondeur",
"ui.design": "Conception",
@@ -1316,7 +1294,6 @@
"ui.equivalent_radius": "Rayon équivalent",
"ui.expand": "Développer",
"ui.exportDxf": "Exporter en DXF…",
- "ui.export_ellipsis": "Exporter...",
"ui.export_ellipsis_keymap": "Exporter…",
"ui.export_keymap_tip": "Raccourcis, favoris de la boîte S et barre d'outils, dans un fichier",
"ui.extend": "Prolonger",
@@ -1406,7 +1383,6 @@
"ui.heading_sheet_metal": "TÔLERIE",
"ui.heading_shell": "COQUE",
"ui.heading_sketch": "ESQUISSE",
- "ui.heading_sketch_palette": "PALETTE D'ESQUISSE",
"ui.heading_sketch_scale": "ÉCHELLE D'ESQUISSE",
"ui.heading_solid": "SOLIDE",
"ui.heading_sphere": "SPHÈRE",
@@ -1445,7 +1421,6 @@
"ui.length_decimals": "Décimales des longueurs",
"ui.light": "Clair",
"ui.line": "Ligne",
- "ui.linetype": "Type de ligne",
"ui.lock": "Verrouiller",
"ui.loft": "Lissage",
"ui.look_at": "Vue normale",
@@ -1477,10 +1452,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF avec étiquettes de faces",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Point milieu",
"ui.mirror": "Symétrie",
"ui.mirror_line": "Ligne de symétrie",
- "ui.modify": "Modifier",
"ui.move": "Déplacer",
"ui.multiple": "Multiple",
"ui.named_views": "Vues nommées",
@@ -1501,7 +1474,6 @@
"ui.offset_plane": "Plan décalé",
"ui.one_side": "Un côté",
"ui.open": "Ouvrir",
- "ui.open_ellipsis": "Ouvrir...",
"ui.open_ends_tip": "Ne touche rien",
"ui.open_preferences": "Ouvrir les préférences",
"ui.open_recent": "Ouvrir un fichier récent",
@@ -1513,8 +1485,6 @@
"ui.origin": "Origine",
"ui.palette_construction_mode": "Mode construction (X)",
"ui.palette_more": "Plus",
- "ui.palette_points": "Points",
- "ui.palette_profile": "Profil",
"ui.palette_sketch_options": "Options d’esquisse",
"ui.pan": "Panoramique",
"ui.pan_zoom_orbit": "Panoramique, zoom, orbite",
@@ -1549,7 +1519,6 @@
"ui.quit": "Quitter",
"ui.radial_context_menu": "Menu contextuel radial",
"ui.radius": "Rayon",
- "ui.radius_type": "Type de rayon",
"ui.rail": "Rail",
"ui.rail_fit": "Ajustement au rail",
"ui.reachable": "Accessible",
@@ -1576,7 +1545,6 @@
"ui.right": "Droite",
"ui.save": "Enregistrer",
"ui.save_as": "Enregistrer sous",
- "ui.save_as_ellipsis": "Enregistrer sous...",
"ui.save_mesh_no_slicer": "Aucun slicer trouvé : choisissez Personnalisé… et sélectionnez votre slicer, ou désactivez Envoyer au slicer",
"ui.save_mesh_pick_bodies": "Sélectionner les corps à enregistrer",
"ui.save_mesh_temp_failed": "Impossible de créer {folder} : {error}",
@@ -1589,7 +1557,6 @@
"ui.select": "Sélectionner",
"ui.selectOther": "Sélectionner un autre…",
"ui.selectTangentChain": "Sélectionner la chaîne tangente",
- "ui.select_other_hint": "Sélectionner un autre élément : maintenir le bouton gauche immobile sur le modèle (ou clic droit › Sélectionner un autre…) pour lister tout ce qui se trouve sous le curseur ; cliquer de nouveau au même endroit pour sélectionner l'élément suivant.",
"ui.selection": "Sélection",
"ui.send": "Envoyer",
"ui.send_to_slicer": "Envoyer au slicer",
@@ -1606,7 +1573,6 @@
"ui.show_constraints": "Contraintes",
"ui.show_construction_geometries": "Géométries de construction",
"ui.show_dimensions": "Cotes",
- "ui.show_points": "Afficher les points",
"ui.show_profile": "Afficher le profil",
"ui.show_projected_geometries": "Géométries projetées",
"ui.simple": "Simple",
@@ -1616,7 +1582,6 @@
"ui.sketch_dimension": "Cote d'esquisse",
"ui.sketch_grid": "Grille d'esquisse",
"ui.sketch_scale": "Échelle d'esquisse",
- "ui.sketch_status": "État de l'esquisse",
"ui.sketches": "Esquisses",
"ui.slice": "Trancher",
"ui.slicer": "Slicer",
@@ -1662,7 +1627,6 @@
"ui.stand_up_tip": "Après l'ouverture d'un fichier STEP ou IGES avec Z vers le haut, proposer un quart de tour autour de X",
"ui.start": "Début",
"ui.start_over": "Recommencer",
- "ui.start_radius": "Rayon initial",
"ui.stretch": "Étirer",
"ui.supersampling": "Suréchantillonnage (SSAA)",
"ui.supersampling_adaptive": "Seulement quand la vue est immobile",
@@ -1710,7 +1674,6 @@
"ui.untitled": "Sans titre",
"ui.up_axis_note": "Axe orienté vers le haut dans les vues (vue d'axe, Accueil, Vue normale). Les conceptions ne sont pas modifiées.",
"ui.updateToCurrentView": "Mettre à jour avec la vue actuelle",
- "ui.variable": "Variable",
"ui.view_centre": "Centre de la vue",
"ui.visual_shaded_hidden_edges": "Ombré avec arêtes cachées",
"ui.visual_shaded_with_edges": "Ombré avec arêtes",
@@ -1726,7 +1689,6 @@
"ui.zoom_to_the_cursor": "Zoom vers le curseur",
"update.available": "SolidCraft {version} est disponible",
"update.button": "Mettre à jour",
- "update.button_tip": "SolidCraft {version} est disponible",
"update.button_version": "Mettre à jour vers {version}",
"update.check_automatically": "Rechercher automatiquement les mises à jour",
"update.check_now": "Vérifier maintenant",
diff --git a/assets/locales/gl.json b/assets/locales/gl.json
index a240a0d0ce..7bafe6e065 100644
--- a/assets/locales/gl.json
+++ b/assets/locales/gl.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Preme Submit new issue en GitHub para enviar o informe.",
"A new configuration, a copy of the active one": "Unha configuración nova, copia da activa",
- "AI": "IA",
"ARRANGE": "ORGANIZAR",
"About SolidCraft": "Acerca de SolidCraft",
"Actions": "Accións",
@@ -68,7 +67,6 @@
"Component1": "Compoñente1",
"Configuration": "Configuración",
"Configuration rules": "Regras de configuración",
- "Construction": "Construción",
"Contact": "Contacto",
"Continuity": "Continuidade",
"Copy Error Message": "Copiar a mensaxe de erro",
@@ -93,7 +91,6 @@
"Delete rule": "Eliminar a regra",
"Delete the row": "Eliminar a fila",
"Delete the set": "Eliminar o conxunto",
- "Delete this parameter": "Eliminar este parámetro",
"Density": "Densidade",
"Designs you open or save appear here.": "Os deseños que abras ou gardes aparecen aquí.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Determinado por Ata o obxecto. Escolle Ángulo para editar a extensión angular.",
@@ -131,7 +128,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Os ficheiros de moitos programas CAD teñen o Y cara arriba, así que aquí ábrense deitados (Z cara arriba).",
"Filter": "Filtro",
"Find in Browser": "Buscar no navegador",
- "Flat": "Plano",
"Flat size": "Tamaño desenvolvido",
"Follow camera (Look At sketches)": "Seguir a cámara (Mirar cara aos bosquexos)",
"Follow the camera (Look At sketches)": "Seguir a cámara (Mirar cara aos bosquexos)",
@@ -201,7 +197,6 @@
"No matching appearances": "Non hai aparencias coincidentes",
"No visible bodies to export.": "Non hai corpos visibles para exportar.",
"None": "Ningún",
- "Normal to sketch": "Normal ao bosquexo",
"Not available yet": "Aínda non dispoñible",
"Notch": "Entalle",
"OUTPUT": "SAÍDA",
@@ -215,7 +210,6 @@
"Outside": "Fóra",
"Overall length": "Lonxitude total",
"Parameter": "Parámetro",
- "Parameter values": "Valores dos parámetros",
"Pass through": "Atravesar",
"Path": "Traxectoria",
"Per Edge": "Por aresta",
@@ -230,7 +224,6 @@
"Preview Row": "Previsualizar a fila",
"Preview leaves the current design unchanged.": "A previsualización non cambia o deseño actual.",
"Profiles/Curves": "Perfís/curvas",
- "Projection": "Proxección",
"RECENT": "RECENTES",
"REFERENCE": "REFERENCIA",
"RULED SURFACE": "SUPERFICIE REGRADA",
@@ -343,7 +336,6 @@
"Value": "Valor",
"Vertices": "Vértices",
"View navigator": "Navegador de vistas",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Só os corpos visibles. As curvas usan segmentos de liña (tolerancia de 0,01 mm).",
"Volume": "Volume",
"Wall": "Parede",
"Wall Location": "Situación da parede",
@@ -691,7 +683,6 @@
"cmd.view_navigate": "Navegar pola vista",
"cmd.view_rename": "Renomear a vista con nome",
"cmd.view_save": "Vista con nome nova",
- "command name": "nome da orde",
"contact.components_count": "{count} compoñentes",
"contact.enabled_label": "activado",
"coupling.gear_1": "Engrenaxe 1",
@@ -738,7 +729,6 @@
"dxf.progress.write": "Escribindo o DXF (5/5)",
"dxf.tolerance": "Tolerancia da curva",
"dxf.tolerance_help": "Só os corpos visibles. As curvas usan segmentos rectos. Unha tolerancia menor dá curvas máis finas e usa máis tempo e memoria.",
- "expression, e.g. 25 mm": "expresión, p. ex. 25 mm",
"fits the face, e.g. M8": "encaixa na cara, p. ex. M8",
"from the rule": "da regra",
"help.apache": "Licenza Apache 2.0",
@@ -806,7 +796,6 @@
"nav.touchpad.zoom": "Zoom (desprazamento vertical ou pinza)",
"needs two joints": "precisa dúas unións",
"new configuration": "configuración nova",
- "new name": "nome novo",
"new parameter": "parámetro novo",
"no interference": "sen interferencias",
"no joint that moves yet": "aínda non hai ningunha unión que se mova",
@@ -825,10 +814,8 @@
"properties.title": "Propiedades: {name}",
"render.background": "Fondo da escena",
"render.fit": "Encadrar o produto",
- "render.image_cancel": "Cancelar o render",
"render.image_cancelled": "Render cancelado",
"render.image_cancelling": "Cancelando",
- "render.image_check": "Comprobar a solicitude de render",
"render.image_completed": "Imaxe lista para exportar",
"render.image_encoding": "Codificando o PNG",
"render.image_export": "Exportar PNG",
@@ -907,7 +894,6 @@
"sketch_text.align_right": "Dereita",
"sketch_text.bold": "Negra",
"sketch_text.builtin_font": "{family} (integrado)",
- "sketch_text.font_search": "Buscar tipos de letra",
"sketch_text.italic": "Cursiva",
"sketch_text.loading_fonts": "Buscando os tipos de letra instalados…",
"sketch_text.on_path": "O texto segue a súa traxectoria: a curva colócao",
@@ -931,9 +917,7 @@
"trace.stopped_by_loop": "Remata na mostra {sample}: o bucle a través de {joint} non pode pecharse máis",
"ui.1_degree_of_freedom": "1 grao de liberdade",
"ui.3d_mouse_speed": "Velocidade do rato 3D",
- "ui.3d_mouse_windows": "Rato 3D",
"ui.3d_sketch": "Bosquexo 3D",
- "ui.about": "Acerca de",
"ui.activate": "Activar",
"ui.active_component": "Compoñente activo",
"ui.agent_chat": "Chat co axente",
@@ -975,7 +959,6 @@
"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.",
- "ui.agent_chat_new_yes": "Chat novo",
"ui.agent_chat_next_picture": "Imaxe seguinte",
"ui.agent_chat_no_cli": "Non se atopou solidcraft-cli xunto á aplicación, así que o axente non pode chegar ao deseño.",
"ui.agent_chat_no_control": "O punto de acceso do chat co axente non se iniciou, así que o axente non pode chegar ao deseño.",
@@ -1109,7 +1092,6 @@
"ui.anti_aliasing": "Antialiasing",
"ui.apply": "Aplicar",
"ui.arc": "Arco",
- "ui.assemble": "Ensamblar",
"ui.autosave_every": "Gardar automaticamente cada",
"ui.axes": "Eixes",
"ui.axis": "Eixe",
@@ -1133,7 +1115,6 @@
"ui.chamfer": "Chafrán",
"ui.chamfer_type": "Tipo de chafrán",
"ui.change_workspace": "Cambiar de espazo de traballo",
- "ui.chord_length": "Lonxitude da corda",
"ui.circle": "Círculo",
"ui.circular_pattern": "Patrón circular",
"ui.clear": "Borrar",
@@ -1166,11 +1147,9 @@
"ui.command_done": "{command} feito",
"ui.command_palette_hint": "Escribe unha orde, p. ex. {example} — ou preme S para buscar",
"ui.concentric": "Concéntrica",
- "ui.configurations": "Configuracións",
"ui.conic_curve": "Curva cónica",
"ui.constant": "Constante",
"ui.constraints_conflict": "Conflito de restricións",
- "ui.construct": "Construír",
"ui.construction": "Construción",
"ui.context_menu": "Menú contextual",
"ui.continuity_gap": "Separación",
@@ -1193,7 +1172,6 @@
"ui.cylinder": "Cilindro",
"ui.dark": "Escuro",
"ui.default_modelling_orientation": "Orientación de modelado predeterminada",
- "ui.degrees_of_freedom": "graos de liberdade",
"ui.delete": "Eliminar",
"ui.depth": "Profundidade",
"ui.design": "Deseño",
@@ -1235,7 +1213,6 @@
"ui.equivalent_radius": "Raio equivalente",
"ui.expand": "Expandir",
"ui.exportDxf": "Exportar DXF…",
- "ui.export_ellipsis": "Exportar...",
"ui.export_ellipsis_keymap": "Exportar…",
"ui.export_keymap_tip": "Teclas, favoritos da caixa S e a barra de ferramentas, como un ficheiro",
"ui.extend": "Estender",
@@ -1317,7 +1294,6 @@
"ui.heading_sheet_metal": "CHAPA",
"ui.heading_shell": "BALEIRADO",
"ui.heading_sketch": "BOSQUEXO",
- "ui.heading_sketch_palette": "PALETA DO BOSQUEXO",
"ui.heading_sketch_scale": "ESCALA DO BOSQUEXO",
"ui.heading_solid": "SÓLIDO",
"ui.heading_sphere": "ESFERA",
@@ -1356,7 +1332,6 @@
"ui.length_decimals": "Decimais das lonxitudes",
"ui.light": "Claro",
"ui.line": "Liña",
- "ui.linetype": "Tipo de liña",
"ui.lock": "Bloquear",
"ui.loft": "Transición",
"ui.look_at": "Mirar cara a",
@@ -1388,10 +1363,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF con etiquetas de cara",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Punto medio",
"ui.mirror": "Simetría",
"ui.mirror_line": "Liña de simetría",
- "ui.modify": "Modificar",
"ui.move": "Mover",
"ui.multiple": "Múltiple",
"ui.named_views": "Vistas con nome",
@@ -1411,7 +1384,6 @@
"ui.offset_plane": "Plano desprazado",
"ui.one_side": "Un lado",
"ui.open": "Abrir",
- "ui.open_ellipsis": "Abrir...",
"ui.open_preferences": "Abrir as preferencias",
"ui.open_recent": "Abrir recentes",
"ui.operation": "Operación",
@@ -1422,8 +1394,6 @@
"ui.origin": "Orixe",
"ui.palette_construction_mode": "Modo de construción (X)",
"ui.palette_more": "Máis",
- "ui.palette_points": "Puntos",
- "ui.palette_profile": "Perfil",
"ui.palette_sketch_options": "Opcións do esbozo",
"ui.pan": "Desprazar",
"ui.pan_zoom_orbit": "Desprazar, zoom, orbitar",
@@ -1458,7 +1428,6 @@
"ui.quit": "Saír",
"ui.radial_context_menu": "Menú contextual radial",
"ui.radius": "Raio",
- "ui.radius_type": "Tipo de raio",
"ui.reachable": "Alcanzable",
"ui.rectangle": "Rectángulo",
"ui.rectangular_pattern": "Patrón rectangular",
@@ -1481,7 +1450,6 @@
"ui.right": "Dereita",
"ui.save": "Gardar",
"ui.save_as": "Gardar como",
- "ui.save_as_ellipsis": "Gardar como...",
"ui.save_mesh_no_slicer": "Non se atopou ningún laminador: escolle Personalizado… e selecciona o teu programa laminador, ou desactiva Enviar ao laminador",
"ui.save_mesh_pick_bodies": "Selecciona os corpos que queres gardar",
"ui.save_mesh_temp_failed": "Non se puido crear {folder}: {error}",
@@ -1493,7 +1461,6 @@
"ui.select": "Seleccionar",
"ui.selectOther": "Seleccionar outro…",
"ui.selectTangentChain": "Seleccionar cadea tanxente",
- "ui.select_other_hint": "Seleccionar outro: mantén o botón esquerdo quieto sobre o modelo (ou clic dereito › Seleccionar outro…) para listar todo o que hai baixo o cursor; fai clic de novo no mesmo punto para seleccionar o seguinte.",
"ui.selection": "Selección",
"ui.send": "Enviar",
"ui.send_to_slicer": "Enviar ao laminador",
@@ -1510,7 +1477,6 @@
"ui.show_constraints": "Restricións",
"ui.show_construction_geometries": "Xeometrías de construción",
"ui.show_dimensions": "Cotas",
- "ui.show_points": "Mostrar os puntos",
"ui.show_profile": "Mostrar o perfil",
"ui.show_projected_geometries": "Xeometrías proxectadas",
"ui.simple": "Simple",
@@ -1520,7 +1486,6 @@
"ui.sketch_dimension": "Cota do bosquexo",
"ui.sketch_grid": "Grella do bosquexo",
"ui.sketch_scale": "Escala do bosquexo",
- "ui.sketch_status": "Estado do bosquexo",
"ui.sketches": "Bosquexos",
"ui.slice": "Laminar",
"ui.slicer": "Laminador",
@@ -1566,7 +1531,6 @@
"ui.stand_up_tip": "Despois de abrir un ficheiro STEP ou IGES con Z cara arriba, ofrecer un cuarto de volta arredor de X",
"ui.start": "Inicio",
"ui.start_over": "Volver comezar",
- "ui.start_radius": "Raio inicial",
"ui.supersampling": "Supermostraxe (SSAA)",
"ui.supersampling_adaptive": "Só cando a vista está quieta",
"ui.supersampling_off": "Desactivado (1×)",
@@ -1610,7 +1574,6 @@
"ui.untitled": "Sen título",
"ui.up_axis_note": "Que eixe apunta cara arriba nas vistas (vista de eixe, Inicio, Mirar cara a). Os deseños non cambian.",
"ui.updateToCurrentView": "Actualizar á vista actual",
- "ui.variable": "Variable",
"ui.view_centre": "Centro da vista",
"ui.visual_shaded_hidden_edges": "Sombreado con arestas ocultas",
"ui.visual_shaded_with_edges": "Sombreado con arestas",
@@ -1626,7 +1589,6 @@
"ui.zoom_to_the_cursor": "Zoom cara ao cursor",
"update.available": "Está dispoñible SolidCraft {version}",
"update.button": "Actualizar",
- "update.button_tip": "Está dispoñible SolidCraft {version}",
"update.button_version": "Actualizar a {version}",
"update.check_automatically": "Buscar actualizacións automaticamente",
"update.check_now": "Comprobar agora",
diff --git a/assets/locales/it.json b/assets/locales/it.json
index e8326dbec1..b15f550f30 100644
--- a/assets/locales/it.json
+++ b/assets/locales/it.json
@@ -5,7 +5,6 @@
"2. Attach your screenshot: copy and paste it, or save and upload the PNG.": "2. Allega la schermata: copiala e incollala, oppure salva e carica il PNG.",
"3. Click Submit new issue on GitHub to send your report.": "3. Fai clic su Submit new issue su GitHub per inviare la segnalazione.",
"A new configuration, a copy of the active one": "Una nuova configurazione, copia di quella attiva",
- "AI": "IA",
"About SolidCraft": "Informazioni su SolidCraft",
"Acceleration": "Accelerazione",
"Actions": "Azioni",
@@ -64,7 +63,6 @@
"Component1": "Componente1",
"Configuration": "Configurazione",
"Configuration rules": "Regole di configurazione",
- "Construction": "Costruzione",
"Contact": "Contatto",
"Contact sets": "Gruppi di contatto",
"Continuity": "Continuità",
@@ -91,7 +89,6 @@
"Delete rule": "Elimina regola",
"Delete the row": "Elimina la riga",
"Delete the set": "Elimina il gruppo",
- "Delete this parameter": "Elimina questo parametro",
"Density": "Densità",
"Designs you open or save appear here.": "I progetti aperti o salvati vengono visualizzati qui.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Determinato da Fino all'oggetto. Scegli Angolo per modificare l'estensione angolare.",
@@ -129,7 +126,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Molti programmi CAD usano Y come asse verticale: qui, dove l'asse verticale è Z, i loro file si aprono coricati.",
"Filter": "Filtro",
"Find in Browser": "Trova nella struttura",
- "Flat": "Piatto",
"Flat size": "Dimensioni dello sviluppo",
"Follow camera (Look At sketches)": "Segui la camera (Vista normale agli schizzi)",
"Follow the camera (Look At sketches)": "Segui la camera (Vista normale agli schizzi)",
@@ -201,7 +197,6 @@
"Outside": "Esterno",
"Overall length": "Lunghezza complessiva",
"Parameter": "Parametro",
- "Parameter values": "Valori dei parametri",
"Pass through": "Passante",
"Path": "Percorso",
"Per Edge": "Per spigolo",
@@ -219,7 +214,6 @@
"Preview Row": "Anteprima della riga",
"Preview leaves the current design unchanged.": "L'anteprima lascia invariato il progetto corrente.",
"Profiles/Curves": "Profili/Curve",
- "Projection": "Proiezione",
"Quantity": "Quantità",
"RECENT": "RECENTI",
"RULED SURFACE": "SUPERFICIE RIGATA",
@@ -327,7 +321,6 @@
"Velocity": "Velocità",
"Vertices": "Vertici",
"View navigator": "Navigatore della vista",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Solo corpi visibili. Le curve usano segmenti di retta (tolleranza 0.01 mm).",
"Volume": "Volume",
"Wall": "Parete",
"Wall Location": "Posizione della parete",
@@ -682,7 +675,6 @@
"cmd.view_navigate": "Naviga nella vista",
"cmd.view_rename": "Rinomina vista con nome",
"cmd.view_save": "Nuova vista con nome",
- "command name": "nome del comando",
"contact.components_count": "{count} componenti",
"contact.enabled_label": "abilitato",
"coupling.gear_1": "Ruota dentata 1",
@@ -729,7 +721,6 @@
"dxf.progress.write": "Scrittura DXF (5/5)",
"dxf.tolerance": "Tolleranza delle curve",
"dxf.tolerance_help": "Solo corpi visibili. Le curve usano segmenti rettilinei. Una tolleranza minore produce curve più precise e richiede più tempo e memoria.",
- "expression, e.g. 25 mm": "espressione, ad es. 25 mm",
"fits the face, e.g. M8": "adatta alla faccia, ad es. M8",
"from the rule": "dalla regola",
"help.apache": "Licenza Apache 2.0",
@@ -810,7 +801,6 @@
"nav.touchpad.zoom": "Zoom (scorrimento verticale o gesto di pizzicamento)",
"needs two joints": "richiede due giunti",
"new configuration": "nuova configurazione",
- "new name": "nuovo nome",
"new parameter": "nuovo parametro",
"no interference": "nessuna interferenza",
"no joint that moves yet": "nessun giunto mobile ancora presente",
@@ -829,10 +819,8 @@
"properties.title": "Proprietà: {name}",
"render.background": "Sfondo della scena",
"render.fit": "Inquadra prodotto",
- "render.image_cancel": "Annulla rendering",
"render.image_cancelled": "Rendering annullato",
"render.image_cancelling": "Annullamento",
- "render.image_check": "Verifica richiesta di rendering",
"render.image_completed": "Immagine pronta per l'esportazione",
"render.image_encoding": "Codifica PNG",
"render.image_export": "Esporta PNG",
@@ -913,7 +901,6 @@
"sketch_text.align_right": "Destra",
"sketch_text.bold": "Grassetto",
"sketch_text.builtin_font": "{family} (integrato)",
- "sketch_text.font_search": "Cerca caratteri",
"sketch_text.italic": "Corsivo",
"sketch_text.loading_fonts": "Ricerca dei caratteri installati…",
"sketch_text.on_path": "Il testo segue il percorso: la curva ne determina la posizione",
@@ -941,9 +928,7 @@
"trace.stopped_by_loop": "Termina al campione {sample}: la catena chiusa che passa per {joint} non può chiudersi ulteriormente",
"ui.1_degree_of_freedom": "1 grado di libertà",
"ui.3d_mouse_speed": "Velocità del mouse 3D",
- "ui.3d_mouse_windows": "Mouse 3D",
"ui.3d_sketch": "Schizzo 3D",
- "ui.about": "Informazioni",
"ui.activate": "Attiva",
"ui.active_component": "Componente attivo",
"ui.agent_chat": "Chat con l'agente",
@@ -985,7 +970,6 @@
"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.",
- "ui.agent_chat_new_yes": "Nuova chat",
"ui.agent_chat_next_picture": "Immagine successiva",
"ui.agent_chat_no_cli": "solidcraft-cli non è stato trovato accanto all'applicazione, quindi l'agente non può accedere al progetto.",
"ui.agent_chat_no_control": "L'endpoint della chat con l'agente non si è avviato, quindi l'agente non può accedere al progetto.",
@@ -1119,7 +1103,6 @@
"ui.anti_aliasing": "Antialiasing",
"ui.apply": "Applica",
"ui.arc": "Arco",
- "ui.assemble": "Assembla",
"ui.autosave_every": "Salvataggio automatico ogni",
"ui.axes": "Assi",
"ui.axis": "Asse",
@@ -1143,7 +1126,6 @@
"ui.chamfer": "Smusso",
"ui.chamfer_type": "Tipo di smusso",
"ui.change_workspace": "Cambia area di lavoro",
- "ui.chord_length": "Lunghezza della corda",
"ui.circle": "Cerchio",
"ui.circular_pattern": "Ripetizione circolare",
"ui.clear": "Cancella",
@@ -1176,11 +1158,9 @@
"ui.command_done": "{command} completato",
"ui.command_palette_hint": "Digita un comando, ad es. {example} — oppure premi S per cercare",
"ui.concentric": "Concentrico",
- "ui.configurations": "Configurazioni",
"ui.conic_curve": "Curva conica",
"ui.constant": "Costante",
"ui.constraints_conflict": "Vincoli in conflitto",
- "ui.construct": "Costruisci",
"ui.construction": "Costruzione",
"ui.context_menu": "Menu contestuale",
"ui.continuity_g0": "G0 spigolo vivo",
@@ -1206,7 +1186,6 @@
"ui.cylinder": "Cilindro",
"ui.dark": "Scuro",
"ui.default_modelling_orientation": "Orientamento di modellazione predefinito",
- "ui.degrees_of_freedom": "gradi di libertà",
"ui.delete": "Elimina",
"ui.depth": "Profondità",
"ui.design": "Progettazione",
@@ -1248,7 +1227,6 @@
"ui.equivalent_radius": "Raggio equivalente",
"ui.expand": "Espandi",
"ui.exportDxf": "Esporta DXF…",
- "ui.export_ellipsis": "Esporta...",
"ui.export_ellipsis_keymap": "Esporta…",
"ui.export_keymap_tip": "Tasti, preferiti del riquadro S e barra degli strumenti, in un file",
"ui.extend": "Estendi",
@@ -1332,7 +1310,6 @@
"ui.heading_sheet_metal": "LAMIERA",
"ui.heading_shell": "SVUOTA",
"ui.heading_sketch": "SCHIZZO",
- "ui.heading_sketch_palette": "TAVOLOZZA SCHIZZO",
"ui.heading_sketch_scale": "SCALA SCHIZZO",
"ui.heading_solid": "SOLIDO",
"ui.heading_sphere": "SFERA",
@@ -1371,7 +1348,6 @@
"ui.length_decimals": "Decimali delle lunghezze",
"ui.light": "Chiaro",
"ui.line": "Linea",
- "ui.linetype": "Tipo di linea",
"ui.lock": "Blocca",
"ui.loft": "Loft",
"ui.look_at": "Vista normale",
@@ -1403,10 +1379,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF con etichette delle facce",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Punto medio",
"ui.mirror": "Specchia",
"ui.mirror_line": "Asse di simmetria",
- "ui.modify": "Modifica",
"ui.move": "Sposta",
"ui.multiple": "Multiplo",
"ui.named_views": "Viste con nome",
@@ -1426,7 +1400,6 @@
"ui.offset_plane": "Piano offset",
"ui.one_side": "Un lato",
"ui.open": "Apri",
- "ui.open_ellipsis": "Apri...",
"ui.open_ends_tip": "Non tocca altre curve",
"ui.open_preferences": "Apri preferenze",
"ui.open_recent": "Apri recenti",
@@ -1438,8 +1411,6 @@
"ui.origin": "Origine",
"ui.palette_construction_mode": "Modalità costruzione (X)",
"ui.palette_more": "Altro",
- "ui.palette_points": "Punti",
- "ui.palette_profile": "Profilo",
"ui.palette_sketch_options": "Opzioni schizzo",
"ui.pan": "Panoramica",
"ui.pan_zoom_orbit": "Panoramica, zoom, orbita",
@@ -1475,7 +1446,6 @@
"ui.quit": "Esci",
"ui.radial_context_menu": "Menu contestuale radiale",
"ui.radius": "Raggio",
- "ui.radius_type": "Tipo di raggio",
"ui.rail": "Guida",
"ui.rail_fit": "Adattamento alla guida",
"ui.reachable": "Raggiungibile",
@@ -1505,7 +1475,6 @@
"ui.right": "Destra",
"ui.save": "Salva",
"ui.save_as": "Salva con nome",
- "ui.save_as_ellipsis": "Salva con nome...",
"ui.save_mesh_no_slicer": "Nessuno slicer trovato: scegli Personalizzato… e seleziona lo slicer, oppure disattiva Invia allo slicer",
"ui.save_mesh_pick_bodies": "Seleziona i corpi da salvare",
"ui.save_mesh_temp_failed": "Impossibile creare {folder}: {error}",
@@ -1518,7 +1487,6 @@
"ui.select": "Seleziona",
"ui.selectOther": "Seleziona altro…",
"ui.selectTangentChain": "Seleziona catena tangente",
- "ui.select_other_hint": "Seleziona altro: tieni premuto il pulsante sinistro senza muovere il puntatore sul modello (o fai clic destro › Seleziona altro…) per elencare gli oggetti sotto il cursore; fai di nuovo clic nello stesso punto per selezionare l'oggetto successivo.",
"ui.selection": "Selezione",
"ui.send": "Invia",
"ui.send_to_slicer": "Invia allo slicer",
@@ -1535,7 +1503,6 @@
"ui.show_constraints": "Vincoli",
"ui.show_construction_geometries": "Geometrie di costruzione",
"ui.show_dimensions": "Quote",
- "ui.show_points": "Mostra punti",
"ui.show_profile": "Mostra profilo",
"ui.show_projected_geometries": "Geometrie proiettate",
"ui.simple": "Semplice",
@@ -1545,7 +1512,6 @@
"ui.sketch_dimension": "Quota dello schizzo",
"ui.sketch_grid": "Griglia dello schizzo",
"ui.sketch_scale": "Scala schizzo",
- "ui.sketch_status": "Stato dello schizzo",
"ui.sketches": "Schizzi",
"ui.slice": "Genera sezioni",
"ui.slicer": "Slicer",
@@ -1591,7 +1557,6 @@
"ui.stand_up_tip": "Dopo l'apertura di un file STEP o IGES con asse Z verticale, proponi un quarto di giro attorno a X",
"ui.start": "Inizio",
"ui.start_over": "Ricomincia",
- "ui.start_radius": "Raggio iniziale",
"ui.stretch": "Stira",
"ui.supersampling": "Sovracampionamento (SSAA)",
"ui.supersampling_adaptive": "Solo quando la vista è ferma",
@@ -1639,7 +1604,6 @@
"ui.untitled": "Senza titolo",
"ui.up_axis_note": "L'asse verticale nelle viste (viste degli assi, Vista iniziale, Vista normale). I progetti restano invariati.",
"ui.updateToCurrentView": "Aggiorna alla vista corrente",
- "ui.variable": "Variabile",
"ui.view_centre": "Centro della vista",
"ui.visual_shaded_hidden_edges": "Ombreggiato con spigoli nascosti",
"ui.visual_shaded_with_edges": "Ombreggiato con spigoli",
@@ -1655,7 +1619,6 @@
"ui.zoom_to_the_cursor": "Zoom verso il cursore",
"update.available": "È disponibile SolidCraft {version}",
"update.button": "Aggiorna",
- "update.button_tip": "È disponibile SolidCraft {version}",
"update.button_version": "Aggiorna a {version}",
"update.check_automatically": "Controlla automaticamente gli aggiornamenti",
"update.check_now": "Controlla ora",
diff --git a/assets/locales/ja.json b/assets/locales/ja.json
index c7cbe8b610..e063b9cf01 100644
--- a/assets/locales/ja.json
+++ b/assets/locales/ja.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. GitHubでSubmit new issueをクリックしてレポートを送信します。",
"A new configuration, a copy of the active one": "アクティブな構成をコピーして新しい構成を作成",
- "AI": "AI",
"ARRANGE": "配置",
"About SolidCraft": "SolidCraft について",
"Acceleration": "加速度",
@@ -81,7 +80,6 @@
"Config Table": "構成テーブル",
"Configuration": "構成",
"Configuration rules": "構成ルール",
- "Construction": "コンストラクション",
"Contact": "接触",
"Contact Sets": "接触セット",
"Contact sets": "接触セット",
@@ -110,7 +108,6 @@
"Delete rule": "ルールを削除",
"Delete the row": "行を削除",
"Delete the set": "セットを削除",
- "Delete this parameter": "このパラメータを削除",
"Density": "密度",
"Dependents": "依存先",
"Designs you open or save appear here.": "開いたデザインや保存したデザインがここに表示されます。",
@@ -157,7 +154,6 @@
"Filter": "フィルター",
"Find in Browser": "ブラウザで検索",
"Finish": "終了",
- "Flat": "展開",
"Flat Pattern": "フラットパターン",
"Flat size": "展開サイズ",
"Follow camera (Look At sketches)": "カメラ追従(スケッチを正面視)",
@@ -238,7 +234,6 @@
"No matching appearances": "一致する外観がありません",
"No visible bodies to export.": "出力する表示中のボディがありません。",
"None": "なし",
- "Normal to sketch": "スケッチに垂直",
"Not available yet": "まだ利用できません",
"Notch": "ノッチ",
"OUTPUT": "出力",
@@ -253,7 +248,6 @@
"Overall length": "全長",
"Param. Graph": "パラメータ図",
"Parameter": "パラメータ",
- "Parameter values": "パラメータ値",
"Parts": "部品",
"Pass through": "通過点",
"Path": "パス",
@@ -274,7 +268,6 @@
"Preview Row": "行をプレビュー",
"Preview leaves the current design unchanged.": "プレビューは現在のデザインを変更しません。",
"Profiles/Curves": "プロファイル/曲線",
- "Projection": "投影",
"Quantity": "量",
"RECENT": "最近使用した項目",
"REFERENCE": "参照",
@@ -401,7 +394,6 @@
"Velocity": "速度",
"Vertices": "頂点",
"View navigator": "ビューナビゲーター",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "表示中のボディを出力します。曲線は線分で近似します(許容誤差0.01 mm)。",
"Volume": "体積",
"Wall": "肉厚",
"Wall Location": "壁の位置",
@@ -768,7 +760,6 @@
"cmd.view_navigate": "ビューナビゲーション",
"cmd.view_rename": "名前付きビューの名前を変更",
"cmd.view_save": "新規名前付きビュー",
- "command name": "コマンド名",
"contact.components_count": "{count}個のコンポーネント",
"contact.enabled_label": "有効",
"coupling.gear_1": "ギア 1",
@@ -834,7 +825,6 @@
"dxf.progress.write": "DXFを書き込み中 (5/5)",
"dxf.tolerance": "曲線の許容誤差",
"dxf.tolerance_help": "表示中のボディを出力し、曲線は線分で近似します。許容誤差を小さくすると曲線が滑らかになりますが、処理時間とメモリ使用量が増えます。",
- "expression, e.g. 25 mm": "計算式 (例: 25 mm)",
"file_load.built": "構築済み: 全{total}フィーチャー中{built}件。",
"file_load.converting": "ソリッドを変換中: {done}/{total}",
"file_load.inserting": "ジオメトリを挿入中",
@@ -937,7 +927,6 @@
"nav.touchpad.zoom": "ズーム(縦スクロールまたはピンチ)",
"needs two joints": "2つのジョイントが必要",
"new configuration": "新規構成",
- "new name": "新しい名前",
"new parameter": "新規パラメータ",
"no hole": "穴なし",
"no interference": "干渉なし",
@@ -963,10 +952,8 @@
"recovery.never_saved": "未保存",
"render.background": "シーンの背景",
"render.fit": "製品を画面に合わせる",
- "render.image_cancel": "レンダリングをキャンセル",
"render.image_cancelled": "レンダリングをキャンセルしました",
"render.image_cancelling": "キャンセル中",
- "render.image_check": "レンダリング要求を確認",
"render.image_completed": "画像をエクスポートできます",
"render.image_encoding": "PNGをエンコード中",
"render.image_export": "PNGをエクスポート",
@@ -1047,7 +1034,6 @@
"sketch_text.align_right": "右",
"sketch_text.bold": "太字",
"sketch_text.builtin_font": "{family}(内蔵)",
- "sketch_text.font_search": "フォントを検索",
"sketch_text.italic": "斜体",
"sketch_text.loading_fonts": "インストール済みフォントを検索中…",
"sketch_text.on_path": "文字はパスに沿います: 位置は曲線で決まります",
@@ -1077,9 +1063,7 @@
"trace.stopped_by_loop": "サンプル {sample} で終了: {joint} を通るループはこれ以上閉じられません",
"ui.1_degree_of_freedom": "自由度 1",
"ui.3d_mouse_speed": "3D マウス速度",
- "ui.3d_mouse_windows": "3D マウス",
"ui.3d_sketch": "3D スケッチ",
- "ui.about": "SolidCraft について",
"ui.activate": "アクティブ化",
"ui.active_component": "アクティブなコンポーネント",
"ui.agent_chat": "エージェントチャット",
@@ -1146,7 +1130,6 @@
"ui.agent_chat_model_tip": "エージェントが使うモデル。選択はこのエージェントに対して記憶されます。",
"ui.agent_chat_new": "新しいチャット",
"ui.agent_chat_new_confirm": "新しいチャットを始めますか? 現在のチャットは消去されます。",
- "ui.agent_chat_new_yes": "新しいチャット",
"ui.agent_chat_next_picture": "次の画像",
"ui.agent_chat_no_cli": "アプリの隣に solidcraft-cli が見つからないため、エージェントはデザインにアクセスできません。",
"ui.agent_chat_no_control": "エージェントチャットのエンドポイントが起動しなかったため、エージェントはデザインにアクセスできません。",
@@ -1288,7 +1271,6 @@
"ui.anti_aliasing": "アンチエイリアス",
"ui.apply": "適用",
"ui.arc": "円弧",
- "ui.assemble": "アセンブリ",
"ui.assistant": "アシスタント",
"ui.assistant_waiting": "{count} 件の承認待ち",
"ui.autosave_every": "自動保存の間隔",
@@ -1315,7 +1297,6 @@
"ui.chamfer": "面取り",
"ui.chamfer_type": "面取りタイプ",
"ui.change_workspace": "ワークスペースの変更",
- "ui.chord_length": "弦長",
"ui.circle": "円",
"ui.circular_pattern": "円形パターン",
"ui.clear": "クリア",
@@ -1348,11 +1329,9 @@
"ui.command_done": "{command} 完了",
"ui.command_palette_hint": "コマンドを入力(例: {example})— または S キーで検索",
"ui.concentric": "同心",
- "ui.configurations": "構成",
"ui.conic_curve": "円錐曲線",
"ui.constant": "一定",
"ui.constraints_conflict": "拘束が競合しています",
- "ui.construct": "構築",
"ui.construction": "コンストラクション",
"ui.context_menu": "コンテキスト メニュー",
"ui.continuity_g0": "G0 折れ",
@@ -1378,7 +1357,6 @@
"ui.cylinder": "円柱",
"ui.dark": "ダーク",
"ui.default_modelling_orientation": "モデリングのデフォルト方向",
- "ui.degrees_of_freedom": "自由度",
"ui.delete": "削除",
"ui.depth": "深さ",
"ui.design": "デザイン",
@@ -1420,7 +1398,6 @@
"ui.equivalent_radius": "等価半径",
"ui.expand": "展開",
"ui.exportDxf": "DXF をエクスポート…",
- "ui.export_ellipsis": "エクスポート…",
"ui.export_ellipsis_keymap": "エクスポート…",
"ui.export_keymap_tip": "ショートカット、Sボックスのお気に入り、ツールバー設定をファイルに保存",
"ui.extend": "延長",
@@ -1510,7 +1487,6 @@
"ui.heading_sheet_metal": "板金",
"ui.heading_shell": "シェル",
"ui.heading_sketch": "スケッチ",
- "ui.heading_sketch_palette": "スケッチ パレット",
"ui.heading_sketch_scale": "スケッチの尺度",
"ui.heading_solid": "ソリッド",
"ui.heading_sphere": "球",
@@ -1549,7 +1525,6 @@
"ui.length_decimals": "長さの小数点以下の桁数",
"ui.light": "ライト",
"ui.line": "線分",
- "ui.linetype": "線種",
"ui.lock": "ロック",
"ui.loft": "ロフト",
"ui.look_at": "正面視",
@@ -1583,10 +1558,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "面タグ付き 3MF",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "中点",
"ui.mirror": "ミラー",
"ui.mirror_line": "ミラー線",
- "ui.modify": "修正",
"ui.move": "移動",
"ui.multiple": "複数",
"ui.named_views": "名前付きビュー",
@@ -1607,7 +1580,6 @@
"ui.offset_plane": "オフセット平面",
"ui.one_side": "片側",
"ui.open": "開く",
- "ui.open_ellipsis": "開く…",
"ui.open_ends_tip": "どこにも接していない",
"ui.open_preferences": "環境設定を開く",
"ui.open_recent": "最近使った項目を開く",
@@ -1619,8 +1591,6 @@
"ui.origin": "原点",
"ui.palette_construction_mode": "補助線モード (X)",
"ui.palette_more": "その他",
- "ui.palette_points": "点",
- "ui.palette_profile": "プロファイル",
"ui.palette_sketch_options": "スケッチオプション",
"ui.pan": "パン",
"ui.pan_zoom_orbit": "パン、ズーム、オービット",
@@ -1662,7 +1632,6 @@
"ui.quit": "終了",
"ui.radial_context_menu": "パイ メニュー",
"ui.radius": "半径",
- "ui.radius_type": "半径タイプ",
"ui.rail": "レール",
"ui.rail_fit": "レールの合わせ方",
"ui.reachable": "到達可能",
@@ -1695,7 +1664,6 @@
"ui.right": "右側面",
"ui.save": "保存",
"ui.save_as": "名前を付けて保存",
- "ui.save_as_ellipsis": "名前を付けて保存…",
"ui.save_mesh_no_slicer": "スライサーが見つかりません。「カスタム…」でスライサーのプログラムを選ぶか、「スライサーに送る」をオフにしてください",
"ui.save_mesh_pick_bodies": "保存するボディを選択してください",
"ui.save_mesh_temp_failed": "{folder} を作成できません: {error}",
@@ -1708,7 +1676,6 @@
"ui.select": "選択",
"ui.selectOther": "その他を選択…",
"ui.selectTangentChain": "接線チェーンを選択",
- "ui.select_other_hint": "その他を選択: モデル上で左ボタンを長押し(または右クリック › その他を選択…)するとカーソル下の要素が一覧表示されます。同じ場所を再度クリックすると次の要素が選択されます。",
"ui.selection": "選択",
"ui.selection_modifiers": "選択修飾キー",
"ui.selection_shift_add_only": "Shift+クリックで追加のみ(解除なし)",
@@ -1728,7 +1695,6 @@
"ui.show_constraints": "拘束",
"ui.show_construction_geometries": "構築ジオメトリ",
"ui.show_dimensions": "寸法",
- "ui.show_points": "点を表示",
"ui.show_profile": "プロファイルを表示",
"ui.show_projected_geometries": "投影ジオメトリ",
"ui.simple": "単純",
@@ -1739,7 +1705,6 @@
"ui.sketch_grid": "スケッチ グリッド",
"ui.sketch_modifiers": "スケッチ修飾キー",
"ui.sketch_scale": "スケッチ尺度",
- "ui.sketch_status": "スケッチの状態",
"ui.sketches": "スケッチ",
"ui.slice": "スライス",
"ui.slicer": "スライサー",
@@ -1786,7 +1751,6 @@
"ui.start": "開始",
"ui.start_over": "最初からやり直す",
"ui.start_page": "スタートページ",
- "ui.start_radius": "開始半径",
"ui.stretch": "伸縮",
"ui.supersampling": "スーパーサンプリング (SSAA)",
"ui.supersampling_adaptive": "ビューが静止しているときのみ",
@@ -1836,7 +1800,6 @@
"ui.untitled": "無題",
"ui.up_axis_note": "ビュー(軸ビュー、ホーム、正面視)で上向きにする軸を指定します。デザインデータ自体は変更されません。",
"ui.updateToCurrentView": "現在のビューに更新",
- "ui.variable": "可変",
"ui.view_centre": "ビュー中心",
"ui.visual_shaded_hidden_edges": "隠線付きシェーディング",
"ui.visual_shaded_with_edges": "エッジ付きシェーディング",
@@ -1864,7 +1827,6 @@
"ui.zoom_to_the_cursor": "カーソル位置へズーム",
"update.available": "SolidCraft {version} が利用できます",
"update.button": "アップデート",
- "update.button_tip": "SolidCraft {version} が利用できます",
"update.button_version": "{version} にアップデート",
"update.check_automatically": "アップデートを自動的に確認",
"update.check_now": "今すぐ確認",
diff --git a/assets/locales/ko.json b/assets/locales/ko.json
index 7dd28d7bef..e5c59e7f14 100644
--- a/assets/locales/ko.json
+++ b/assets/locales/ko.json
@@ -4,7 +4,6 @@
"2. Attach your screenshot: copy and paste it, or save and upload the PNG.": "2. 스크린샷을 첨부하세요. 복사하여 붙여넣거나 PNG로 저장한 뒤 업로드하세요.",
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. GitHub에서 Submit new issue를 클릭하여 보고서를 보내세요.",
- "AI": "AI",
"ARRANGE": "배치",
"Acceleration": "가속도",
"Actions": "작업",
@@ -32,7 +31,6 @@
"Collisions": "충돌",
"Comment": "설명",
"Configuration rules": "Configuration rules",
- "Construction": "구성선",
"Contact sets": "접촉 집합",
"Continuity": "연속성",
"Copy Error Message": "오류 메시지 복사",
@@ -71,7 +69,6 @@
"Feature": "피처",
"Filter": "Filter",
"Find in Browser": "브라우저에서 찾기",
- "Flat": "플랫",
"From edges": "시작 모서리",
"HISTORY": "이력",
"Hidden edges": "숨겨진 모서리",
@@ -109,7 +106,6 @@
"No matching appearance presets.": "일치하는 외관 프리셋이 없습니다.",
"No visible bodies to export.": "표시된 바디가 없어 내보낼 수 없습니다.",
"None": "없음",
- "Normal to sketch": "스케치에 수직",
"Notch": "노치",
"OUTPUT": "출력",
"Open local libraries in the desktop app. You can export this design's library here.": "로컬 라이브러리는 데스크톱 앱에서 여세요. 이 디자인의 라이브러리는 여기서 내보낼 수 있습니다.",
@@ -127,7 +123,6 @@
"Position (G0)": "위치 (G0)",
"Preferences › Design turns the offer back on": "환경 설정 › 디자인에서 다시 켤 수 있습니다",
"Profiles/Curves": "프로파일/곡선",
- "Projection": "투영",
"Quantity": "양",
"REFERENCE": "참조",
"RULED SURFACE": "룰드 서피스",
@@ -177,7 +172,6 @@
"Value": "Value",
"Velocity": "속도",
"Vertices": "꼭짓점",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "표시된 바디만 내보냅니다. 곡선은 선분으로 근사합니다 (허용오차 0.01 mm).",
"Wall Location": "벽 위치",
"Wall Thickness": "벽 두께",
"When": "When",
@@ -655,10 +649,8 @@
"properties.title": "속성: {name}",
"render.background": "장면 배경",
"render.fit": "제품에 맞추기",
- "render.image_cancel": "렌더링 취소",
"render.image_cancelled": "렌더링 취소됨",
"render.image_cancelling": "취소 중",
- "render.image_check": "렌더 요청 확인",
"render.image_completed": "이미지 내보내기 준비됨",
"render.image_encoding": "PNG 인코딩 중",
"render.image_export": "PNG 내보내기",
@@ -737,7 +729,6 @@
"sketch_text.align_right": "오른쪽",
"sketch_text.bold": "굵게",
"sketch_text.builtin_font": "{family}(내장)",
- "sketch_text.font_search": "글꼴 검색",
"sketch_text.italic": "기울임꼴",
"sketch_text.loading_fonts": "설치된 글꼴을 찾는 중…",
"sketch_text.on_path": "텍스트가 경로를 따릅니다: 위치는 곡선이 정합니다",
@@ -759,7 +750,6 @@
"trace.stopped_by_loop": "샘플 {sample}에서 끝남: {joint}을(를) 지나는 루프를 더 이상 닫을 수 없습니다",
"ui.1_degree_of_freedom": "자유도 1개",
"ui.3d_sketch": "3D 스케치",
- "ui.about": "정보",
"ui.activate": "활성화",
"ui.active_component": "활성 컴포넌트",
"ui.agent_chat": "에이전트 채팅",
@@ -922,7 +912,6 @@
"ui.anti_aliasing": "안티앨리어싱",
"ui.apply": "적용",
"ui.arc": "호",
- "ui.assemble": "조립",
"ui.autosave_every": "자동 저장 간격",
"ui.axes": "축",
"ui.axis": "축",
@@ -947,7 +936,6 @@
"ui.chamfer": "모따기",
"ui.chamfer_type": "모따기 유형",
"ui.change_workspace": "작업 공간 변경",
- "ui.chord_length": "현 길이",
"ui.circle": "원",
"ui.circular_pattern": "원형 패턴",
"ui.clear_recent": "최근 항목 지우기",
@@ -977,11 +965,9 @@
"ui.command_done": "{command} 완료",
"ui.command_palette_hint": "명령 입력(예: {example}) — 또는 S 키를 눌러 검색",
"ui.concentric": "동심",
- "ui.configurations": "구성",
"ui.conic_curve": "원뿔 곡선",
"ui.constant": "상수",
"ui.constraints_conflict": "구속 조건 충돌",
- "ui.construct": "구성",
"ui.construction": "구성선",
"ui.continuity_g0": "G0 꺾임",
"ui.continuity_g1": "G1 접선",
@@ -1006,7 +992,6 @@
"ui.cylinder": "원통",
"ui.dark": "어둡게",
"ui.default_modelling_orientation": "기본 모델링 방향",
- "ui.degrees_of_freedom": "자유도",
"ui.delete": "삭제",
"ui.depth": "깊이",
"ui.design": "디자인",
@@ -1048,7 +1033,6 @@
"ui.equivalent_radius": "등가 반지름",
"ui.expand": "펼치기",
"ui.exportDxf": "DXF 내보내기…",
- "ui.export_ellipsis": "내보내기...",
"ui.export_ellipsis_keymap": "내보내기…",
"ui.extend": "연장",
"ui.extent_type": "범위 유형",
@@ -1130,7 +1114,6 @@
"ui.heading_sheet_metal": "판금",
"ui.heading_shell": "쉘",
"ui.heading_sketch": "스케치",
- "ui.heading_sketch_palette": "스케치 팔레트",
"ui.heading_sketch_scale": "스케치 배율",
"ui.heading_solid": "솔리드",
"ui.heading_sphere": "구",
@@ -1167,7 +1150,6 @@
"ui.length_decimals": "길이 소수점 자릿수",
"ui.light": "밝게",
"ui.line": "선",
- "ui.linetype": "선 종류",
"ui.lock": "잠금",
"ui.loft": "로프트",
"ui.look_at": "바라보기",
@@ -1198,10 +1180,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "면 태그가 있는 3MF",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "중간점",
"ui.mirror": "대칭 복사",
"ui.mirror_line": "대칭선",
- "ui.modify": "수정",
"ui.move": "이동",
"ui.multiple": "다중",
"ui.named_views": "명명된 뷰",
@@ -1221,7 +1201,6 @@
"ui.offset_plane": "오프셋 평면",
"ui.one_side": "한 방향",
"ui.open": "열기",
- "ui.open_ellipsis": "열기...",
"ui.open_preferences": "환경 설정 열기",
"ui.open_recent": "최근 항목 열기",
"ui.operation": "작업",
@@ -1232,8 +1211,6 @@
"ui.origin": "원점",
"ui.palette_construction_mode": "보조선 모드 (X)",
"ui.palette_more": "더 보기",
- "ui.palette_points": "점",
- "ui.palette_profile": "프로파일",
"ui.palette_sketch_options": "스케치 옵션",
"ui.pan": "이동",
"ui.pan_zoom_orbit": "이동, 확대/축소, 궤도 회전",
@@ -1264,7 +1241,6 @@
"ui.quantity_2": "수량 2",
"ui.quit": "종료",
"ui.radius": "반지름",
- "ui.radius_type": "반지름 유형",
"ui.reachable": "도달 가능",
"ui.rectangle": "직사각형",
"ui.rectangular_pattern": "직사각형 패턴",
@@ -1284,7 +1260,6 @@
"ui.right": "우측면",
"ui.save": "저장",
"ui.save_as": "다른 이름으로 저장",
- "ui.save_as_ellipsis": "다른 이름으로 저장...",
"ui.save_mesh_no_slicer": "슬라이서를 찾을 수 없습니다. '사용자 지정…'에서 슬라이서 프로그램을 선택하거나 '슬라이서로 보내기'를 끄세요",
"ui.save_mesh_pick_bodies": "저장할 바디를 선택하세요",
"ui.save_mesh_temp_failed": "{folder}을(를) 만들 수 없습니다: {error}",
@@ -1312,7 +1287,6 @@
"ui.show_constraints": "구속 조건",
"ui.show_construction_geometries": "구성 형상",
"ui.show_dimensions": "치수",
- "ui.show_points": "점 표시",
"ui.show_profile": "프로파일 표시",
"ui.show_projected_geometries": "투영된 형상",
"ui.simple": "단순",
@@ -1322,7 +1296,6 @@
"ui.sketch_dimension": "스케치 치수",
"ui.sketch_grid": "스케치 격자",
"ui.sketch_scale": "스케치 축척",
- "ui.sketch_status": "스케치 상태",
"ui.sketches": "스케치",
"ui.slice": "슬라이스",
"ui.slicer": "슬라이서",
@@ -1363,7 +1336,6 @@
"ui.split_body": "바디 분할",
"ui.start": "시작",
"ui.start_over": "처음부터 다시",
- "ui.start_radius": "시작 반지름",
"ui.supersampling": "슈퍼샘플링 (SSAA)",
"ui.supersampling_adaptive": "뷰가 멈춰 있을 때만",
"ui.supersampling_off": "끔 (1×)",
@@ -1404,7 +1376,6 @@
"ui.unsuppress": "비활성화 해제",
"ui.untitled": "제목 없음",
"ui.updateToCurrentView": "현재 보기로 업데이트",
- "ui.variable": "가변",
"ui.view_centre": "뷰 중심",
"ui.visual_style": "시각 스타일",
"ui.workspace": "작업 공간",
@@ -1414,7 +1385,6 @@
"ui.zoom_to_the_cursor": "커서 위치로 확대/축소",
"update.available": "SolidCraft {version} 사용 가능",
"update.button": "업데이트",
- "update.button_tip": "SolidCraft {version} 사용 가능",
"update.button_version": "{version}(으)로 업데이트",
"update.check_automatically": "업데이트 자동 확인",
"update.check_now": "지금 확인",
diff --git a/assets/locales/ms.json b/assets/locales/ms.json
index 510fea6c2f..7e2f231a43 100644
--- a/assets/locales/ms.json
+++ b/assets/locales/ms.json
@@ -5,7 +5,6 @@
"2. Attach your screenshot: copy and paste it, or save and upload the PNG.": "2. Lampirkan tangkapan skrin anda: salin dan tampal, atau simpan dan muat naik PNG.",
"3. Click Submit new issue on GitHub to send your report.": "3. Klik Submit new issue di GitHub untuk menghantar laporan anda.",
"A new configuration, a copy of the active one": "Konfigurasi baharu, salinan konfigurasi aktif",
- "AI": "AI",
"About SolidCraft": "Tentang SolidCraft",
"Acceleration": "Pecutan",
"Active": "Aktif",
@@ -59,7 +58,6 @@
"Component1": "Komponen1",
"Configuration": "Konfigurasi",
"Configuration rules": "Peraturan konfigurasi",
- "Construction": "Binaan",
"Contact": "Sentuhan",
"Contact sets": "Set sentuhan",
"Continuity": "Keselanjaran",
@@ -84,7 +82,6 @@
"Delete rule": "Padam peraturan",
"Delete the row": "Padam baris",
"Delete the set": "Padam set",
- "Delete this parameter": "Padam parameter ini",
"Density": "Ketumpatan",
"Designs you open or save appear here.": "Reka bentuk dibuka atau disimpan ada di sini.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Ditentukan oleh tetapan Ke Objek. Pilih Sudut untuk mengubah julat sudut.",
@@ -116,7 +113,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Banyak fail CAD menggunakan Y ke atas, jadi model terbaring di sini (Z ke atas).",
"Filter": "Tapis",
"Find in Browser": "Cari dalam Pelayar",
- "Flat": "Rata",
"Flat size": "Saiz rata",
"Follow camera (Look At sketches)": "Ikut kamera (Pandang Tepat pada lakaran)",
"Follow the camera (Look At sketches)": "Ikut kamera (Pandang Tepat pada lakaran)",
@@ -166,7 +162,6 @@
"No matching appearances": "Tiada penampilan yang sepadan",
"No visible bodies to export.": "Tiada jasad kelihatan untuk dieksport.",
"None": "Tiada",
- "Normal to sketch": "Serenjang",
"Not available yet": "Belum tersedia",
"Notch": "Takuk",
"Opacity": "Kelegapan",
@@ -175,7 +170,6 @@
"Other side": "Sebelah lagi",
"Outside": "Luar",
"Overall length": "Panjang keseluruhan",
- "Parameter values": "Nilai parameter",
"Pass through": "Tembus",
"Path": "Laluan",
"Per Edge": "Setiap Tepi",
@@ -193,7 +187,6 @@
"Preview Row": "Pratonton Baris",
"Preview leaves the current design unchanged.": "Pratonton tidak mengubah reka bentuk semasa.",
"Profiles/Curves": "Profil/Lengkung",
- "Projection": "Unjuran",
"Quantity": "Kuantiti",
"RECENT": "TERKINI",
"RULED SURFACE": "PERMUKAAN BERGARIS",
@@ -294,7 +287,6 @@
"Velocity": "Halaju",
"Vertices": "Bucu",
"View navigator": "Kawalan pandangan",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Jasad kelihatan sahaja. Lengkung guna segmen garis (toleransi 0.01 mm).",
"Volume": "Isi padu",
"Wall": "Dinding",
"Wall Location": "Lokasi Dinding",
@@ -638,7 +630,6 @@
"cmd.view_navigate": "Navigasi Pandangan",
"cmd.view_rename": "Tukar Nama Pandangan",
"cmd.view_save": "Simpan Pandangan",
- "command name": "nama arahan",
"coupling.gear_1": "Gear 1",
"coupling.gear_1_pick": "Gear 1 (tidak wajib)",
"coupling.gear_2": "Gear 2",
@@ -680,7 +671,6 @@
"dxf.progress.write": "Menulis DXF (5/5)",
"dxf.tolerance": "Toleransi lengkung",
"dxf.tolerance_help": "Jasad kelihatan sahaja. Lengkung guna segmen lurus. Toleransi kecil lebih halus tetapi guna lebih masa dan memori.",
- "expression, e.g. 25 mm": "ungkapan, cth. 25 mm",
"fits the face, e.g. M8": "padan dengan muka, cth. M8",
"from the rule": "daripada peraturan",
"home.documentation": "Dokumentasi",
@@ -723,7 +713,6 @@
"nav.touchpad.zoom": "Zum (tatal menegak atau cubit)",
"needs two joints": "memerlukan dua sendi",
"new configuration": "konfigurasi baharu",
- "new name": "nama baharu",
"new parameter": "parameter baharu",
"no interference": "tiada pertindihan",
"no joint that moves yet": "belum ada sendi yang bergerak",
@@ -737,10 +726,8 @@
"pick one or two vertices, edges or faces": "pilih satu atau dua bucu, tepi atau muka",
"render.background": "Latar belakang adegan",
"render.fit": "Muatkan Produk",
- "render.image_cancel": "Batal Render",
"render.image_cancelled": "Render dibatalkan",
"render.image_cancelling": "Membatalkan",
- "render.image_check": "Semak Permintaan Render",
"render.image_completed": "Imej sedia untuk dieksport",
"render.image_encoding": "Mengekod PNG",
"render.image_export": "Eksport PNG",
@@ -807,7 +794,6 @@
"sketch_text.align_right": "Kanan",
"sketch_text.bold": "Tebal",
"sketch_text.builtin_font": "{family} (terbina dalam)",
- "sketch_text.font_search": "Cari fon",
"sketch_text.italic": "Condong",
"sketch_text.loading_fonts": "Mencari fon yang dipasang…",
"sketch_text.on_path": "Teks mengikut laluan lengkung, yang menentukan kedudukannya",
@@ -834,9 +820,7 @@
"trace.stopped_by_loop": "Berakhir pada sampel {sample}: gelung melalui {joint} tidak lagi dapat ditutup",
"ui.1_degree_of_freedom": "1 darjah kebebasan",
"ui.3d_mouse_speed": "Kelajuan tetikus 3D",
- "ui.3d_mouse_windows": "Tetikus 3D",
"ui.3d_sketch": "Lakaran 3D",
- "ui.about": "Tentang",
"ui.activate": "Aktifkan",
"ui.active_component": "Komponen aktif",
"ui.agent_chat": "Sembang ejen",
@@ -878,7 +862,6 @@
"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.",
- "ui.agent_chat_new_yes": "Sembang baharu",
"ui.agent_chat_no_cli": "solidcraft-cli tidak ditemui dalam folder aplikasi, jadi ejen tidak dapat mengakses reka bentuk.",
"ui.agent_chat_no_control": "Titik akhir sembang ejen gagal dimulakan, jadi ejen tidak dapat mengakses reka bentuk.",
"ui.agent_chat_no_images": "Ejen ini tidak menerima imej",
@@ -1006,7 +989,6 @@
"ui.anti_aliasing": "Antialias",
"ui.apply": "Gunakan",
"ui.arc": "Lengkok",
- "ui.assemble": "Pasang",
"ui.autosave_every": "Autosimpan setiap",
"ui.axes": "Paksi",
"ui.axis": "Paksi",
@@ -1029,7 +1011,6 @@
"ui.chamfer": "Serong",
"ui.chamfer_type": "Jenis Serong",
"ui.change_workspace": "Tukar ruang kerja",
- "ui.chord_length": "Panjang Perentas",
"ui.circle": "Bulatan",
"ui.circular_pattern": "Corak Membulat",
"ui.clear": "Kosongkan",
@@ -1062,11 +1043,9 @@
"ui.command_done": "{command} selesai",
"ui.command_palette_hint": "Taip arahan, cth. {example} — atau tekan S untuk mencari",
"ui.concentric": "Sepusat",
- "ui.configurations": "Konfigurasi",
"ui.conic_curve": "Lengkung Kon",
"ui.constant": "Malar",
"ui.constraints_conflict": "Kekangan bercanggah",
- "ui.construct": "Bina",
"ui.construction": "Binaan",
"ui.context_menu": "Menu konteks",
"ui.continuity_g0": "Lipatan G0",
@@ -1092,7 +1071,6 @@
"ui.cylinder": "Silinder",
"ui.dark": "Gelap",
"ui.default_modelling_orientation": "Orientasi pemodelan lalai",
- "ui.degrees_of_freedom": "darjah kebebasan",
"ui.delete": "Padam",
"ui.depth": "Kedalaman",
"ui.design": "Reka",
@@ -1134,7 +1112,6 @@
"ui.equivalent_radius": "Jejari Setara",
"ui.expand": "Kembangkan",
"ui.exportDxf": "Eksport DXF…",
- "ui.export_ellipsis": "Eksport...",
"ui.export_ellipsis_keymap": "Eksport…",
"ui.export_keymap_tip": "Simpan kekunci, kegemaran kotak S dan bar alat ke fail",
"ui.extend": "Panjangkan",
@@ -1218,7 +1195,6 @@
"ui.heading_sheet_metal": "LOGAM KEPINGAN",
"ui.heading_shell": "RONGGAKAN",
"ui.heading_sketch": "LAKARAN",
- "ui.heading_sketch_palette": "PALET LAKARAN",
"ui.heading_sketch_scale": "SKALA LAKARAN",
"ui.heading_solid": "PEPEJAL",
"ui.heading_sphere": "SFERA",
@@ -1257,7 +1233,6 @@
"ui.length_decimals": "Perpuluhan panjang",
"ui.light": "Cerah",
"ui.line": "Garis",
- "ui.linetype": "Jenis garis",
"ui.lock": "Kunci",
"ui.loft": "Loft",
"ui.look_at": "Pandang Tepat",
@@ -1289,10 +1264,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF dengan tag muka",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Titik tengah",
"ui.mirror": "Cermin",
"ui.mirror_line": "Garis cermin",
- "ui.modify": "Ubah Suai",
"ui.move": "Alih",
"ui.multiple": "Berbilang",
"ui.named_views": "Pandangan Bernama",
@@ -1312,7 +1285,6 @@
"ui.offset_plane": "Satah Ofset",
"ui.one_side": "Satu Sisi",
"ui.open": "Buka",
- "ui.open_ellipsis": "Buka...",
"ui.open_ends_tip": "Tidak bersentuh",
"ui.open_preferences": "Buka Tetapan",
"ui.open_recent": "Buka Terkini",
@@ -1322,8 +1294,6 @@
"ui.orbit_around": "Orbit mengelilingi",
"ui.orientation": "Orientasi",
"ui.origin": "Titik Asal",
- "ui.palette_points": "Titik",
- "ui.palette_profile": "Profil",
"ui.pan": "Sorot",
"ui.pan_zoom_orbit": "Sorot, zum, orbit",
"ui.parallel": "Selari",
@@ -1357,7 +1327,6 @@
"ui.quit": "Keluar",
"ui.radial_context_menu": "Menu konteks membulat",
"ui.radius": "Jejari",
- "ui.radius_type": "Jenis Jejari",
"ui.rail": "Rel",
"ui.rail_fit": "Padanan Rel",
"ui.reachable": "Boleh dicapai",
@@ -1380,7 +1349,6 @@
"ui.right": "Kanan",
"ui.save": "Simpan",
"ui.save_as": "Simpan Sebagai",
- "ui.save_as_ellipsis": "Simpan Sebagai...",
"ui.save_mesh_no_slicer": "Tiada penghiris: pilih program melalui Tersuai… atau matikan Hantar ke penghiris",
"ui.save_mesh_pick_bodies": "Pilih jasad untuk disimpan",
"ui.save_mesh_temp_failed": "Tidak dapat mencipta {folder}: {error}",
@@ -1391,7 +1359,6 @@
"ui.select": "Pilih",
"ui.selectOther": "Pilih Lain…",
"ui.selectTangentChain": "Pilih Rantaian Tangen",
- "ui.select_other_hint": "Pilih Lain: tahan butang kiri pada model tanpa bergerak (atau klik kanan › Pilih Lain…) untuk senarai objek di bawah kursor. Klik tempat sama untuk objek seterusnya.",
"ui.selection": "Pilihan",
"ui.send": "Hantar",
"ui.send_to_slicer": "Hantar ke penghiris",
@@ -1407,7 +1374,6 @@
"ui.show_constraints": "Kekangan",
"ui.show_construction_geometries": "Geometri Binaan",
"ui.show_dimensions": "Dimensi",
- "ui.show_points": "Papar Titik",
"ui.show_profile": "Papar Profil",
"ui.show_projected_geometries": "Geometri Unjuran",
"ui.simple": "Ringkas",
@@ -1417,7 +1383,6 @@
"ui.sketch_dimension": "Dimensi Lakaran",
"ui.sketch_grid": "Grid Lakaran",
"ui.sketch_scale": "Skala Lakaran",
- "ui.sketch_status": "Status Lakaran",
"ui.sketches": "Lakaran",
"ui.slice": "Hiris",
"ui.slicer": "Penghiris",
@@ -1436,7 +1401,6 @@
"ui.split_body": "Belah Jasad",
"ui.stand_up_tip": "Selepas buka STEP atau IGES dengan Z ke atas, cadangkan suku putaran pada X",
"ui.start": "Mula",
- "ui.start_radius": "Jejari Mula",
"ui.stretch": "Regang",
"ui.supersampling": "Pensampelan super (SSAA)",
"ui.supersampling_adaptive": "Hanya apabila pandangan pegun",
@@ -1484,7 +1448,6 @@
"ui.untitled": "Tanpa Tajuk",
"ui.up_axis_note": "Paksi yang menghala ke atas dalam pandangan paksi, Utama dan Pandang Tepat. Reka bentuk tidak berubah.",
"ui.updateToCurrentView": "Kemas Kini Pandangan Semasa",
- "ui.variable": "Berubah",
"ui.view_centre": "Pusat pandangan",
"ui.visual_shaded_hidden_edges": "Berlorek dengan tepi tersembunyi",
"ui.visual_shaded_with_edges": "Berlorek dengan tepi",
@@ -1500,7 +1463,6 @@
"ui.zoom_to_the_cursor": "Zum ke kursor",
"update.available": "SolidCraft {version} tersedia",
"update.button": "Kemas kini",
- "update.button_tip": "SolidCraft {version} tersedia",
"update.button_version": "Kemas kini ke {version}",
"update.check_automatically": "Semak kemas kini secara automatik",
"update.check_now": "Semak sekarang",
diff --git a/assets/locales/pl.json b/assets/locales/pl.json
index 95e811323b..e605331700 100644
--- a/assets/locales/pl.json
+++ b/assets/locales/pl.json
@@ -5,7 +5,6 @@
"2. Attach your screenshot: copy and paste it, or save and upload the PNG.": "2. Dołącz zrzut ekranu: skopiuj go i wklej albo zapisz i prześlij plik PNG.",
"3. Click Submit new issue on GitHub to send your report.": "3. Kliknij Submit new issue na GitHubie, aby wysłać raport.",
"A new configuration, a copy of the active one": "Nowa konfiguracja, kopia aktywnej",
- "AI": "AI",
"About SolidCraft": "O programie SolidCraft",
"Acceleration": "Przyspieszenie",
"Actions": "Działania",
@@ -64,7 +63,6 @@
"Component1": "Komponent1",
"Configuration": "Konfiguracja",
"Configuration rules": "Reguły konfiguracji",
- "Construction": "Konstrukcyjne",
"Contact": "Kontakt",
"Contact sets": "Zestawy kontaktów",
"Continuity": "Ciągłość",
@@ -90,7 +88,6 @@
"Delete rule": "Usuń regułę",
"Delete the row": "Usuń wiersz",
"Delete the set": "Usuń zestaw",
- "Delete this parameter": "Usuń ten parametr",
"Density": "Gęstość",
"Designs you open or save appear here.": "Tutaj pojawiają się otwierane lub zapisywane projekty.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Wynika z opcji Do obiektu. Wybierz Kąt, aby edytować zakres kątowy.",
@@ -128,7 +125,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Pliki z wielu programów CAD mają oś Y skierowaną w górę, więc otwierają się tutaj leżąc na plecach (oś Z w górę).",
"Filter": "Filtr",
"Find in Browser": "Znajdź w przeglądarce",
- "Flat": "Płaskie",
"Flat size": "Wymiary rozwinięcia",
"Follow camera (Look At sketches)": "Podążaj za kamerą (Patrz na szkice)",
"Follow the camera (Look At sketches)": "Podążaj za kamerą (Patrz na szkice)",
@@ -188,7 +184,6 @@
"No matching appearances": "Brak pasujących wyglądów",
"No visible bodies to export.": "Brak widocznych brył do wyeksportowania.",
"None": "Brak",
- "Normal to sketch": "Prostopadle do szkicu",
"Not available yet": "Jeszcze niedostępne",
"Notch": "Wycięcie",
"Opacity": "Nieprzezroczystość",
@@ -200,7 +195,6 @@
"Outside": "Na zewnątrz",
"Overall length": "Długość całkowita",
"Parameter": "Parametr",
- "Parameter values": "Wartości parametrów",
"Pass through": "Przechodzi przez",
"Path": "Ścieżka",
"Per Edge": "Dla każdej krawędzi",
@@ -218,7 +212,6 @@
"Preview Row": "Podgląd wiersza",
"Preview leaves the current design unchanged.": "Podgląd nie zmienia bieżącego projektu.",
"Profiles/Curves": "Profile/krzywe",
- "Projection": "Rzutowanie",
"Quantity": "Liczba",
"RECENT": "OSTATNIE",
"RULED SURFACE": "POWIERZCHNIA PROSTOKREŚLNA",
@@ -324,7 +317,6 @@
"Velocity": "Prędkość",
"Vertices": "Wierzchołki",
"View navigator": "Nawigator widoku",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Tylko widoczne bryły. Krzywe są przybliżane odcinkami (tolerancja 0,01 mm).",
"Volume": "Objętość",
"Wall": "Ścianka",
"Wall Location": "Położenie ścianki",
@@ -678,7 +670,6 @@
"cmd.view_navigate": "Nawiguj widokiem",
"cmd.view_rename": "Zmień nazwę widoku nazwanego",
"cmd.view_save": "Nowy widok nazwany",
- "command name": "nazwa polecenia",
"contact.components_count": "Liczba komponentów: {count}",
"contact.enabled_label": "włączone",
"coupling.gear_1": "Koło zębate 1",
@@ -725,7 +716,6 @@
"dxf.progress.write": "Zapisywanie DXF (5/5)",
"dxf.tolerance": "Tolerancja krzywych",
"dxf.tolerance_help": "Tylko widoczne bryły. Krzywe są przybliżane odcinkami. Mniejsza tolerancja daje dokładniejsze krzywe, ale zajmuje więcej czasu i pamięci.",
- "expression, e.g. 25 mm": "wyrażenie, np. 25 mm",
"fits the face, e.g. M8": "pasuje do ściany, np. M8",
"from the rule": "z reguły",
"help.apache": "Licencja Apache 2.0",
@@ -797,7 +787,6 @@
"nav.touchpad.zoom": "Powiększanie (przewijanie w pionie lub szczypanie)",
"needs two joints": "wymaga dwóch złączy",
"new configuration": "nowa konfiguracja",
- "new name": "nowa nazwa",
"new parameter": "nowy parametr",
"no interference": "brak kolizji",
"no joint that moves yet": "brak jeszcze ruchomego złącza",
@@ -816,10 +805,8 @@
"properties.title": "Właściwości: {name}",
"render.background": "Tło sceny",
"render.fit": "Dopasuj produkt",
- "render.image_cancel": "Anuluj renderowanie",
"render.image_cancelled": "Anulowano renderowanie",
"render.image_cancelling": "Anulowanie",
- "render.image_check": "Sprawdź zlecenie renderowania",
"render.image_completed": "Obraz gotowy do eksportu",
"render.image_encoding": "Kodowanie PNG",
"render.image_export": "Eksportuj PNG",
@@ -900,7 +887,6 @@
"sketch_text.align_right": "Do prawej",
"sketch_text.bold": "Pogrubienie",
"sketch_text.builtin_font": "{family} (wbudowana)",
- "sketch_text.font_search": "Szukaj czcionek",
"sketch_text.italic": "Kursywa",
"sketch_text.loading_fonts": "Wyszukiwanie zainstalowanych czcionek…",
"sketch_text.on_path": "Tekst biegnie wzdłuż ścieżki: krzywa go rozmieszcza",
@@ -928,9 +914,7 @@
"trace.stopped_by_loop": "Kończy się na próbce {sample}: pętla przez {joint} nie może się bardziej zamknąć",
"ui.1_degree_of_freedom": "1 stopień swobody",
"ui.3d_mouse_speed": "Czułość myszy 3D",
- "ui.3d_mouse_windows": "Mysz 3D",
"ui.3d_sketch": "Szkic 3D",
- "ui.about": "O programie",
"ui.activate": "Aktywuj",
"ui.active_component": "Aktywny komponent",
"ui.agent_chat": "Czat z agentem",
@@ -973,7 +957,6 @@
"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.",
- "ui.agent_chat_new_yes": "Nowy czat",
"ui.agent_chat_next_picture": "Następny obraz",
"ui.agent_chat_no_cli": "Nie znaleziono solidcraft-cli obok aplikacji, więc agent nie ma dostępu do projektu.",
"ui.agent_chat_no_control": "Punkt końcowy czatu z agentem się nie uruchomił, więc agent nie ma dostępu do projektu.",
@@ -1109,7 +1092,6 @@
"ui.anti_aliasing": "Wygładzanie krawędzi",
"ui.apply": "Zastosuj",
"ui.arc": "Łuk",
- "ui.assemble": "Złożenie",
"ui.autosave_every": "Autozapis co",
"ui.axes": "Osie",
"ui.axis": "Oś",
@@ -1132,7 +1114,6 @@
"ui.chamfer": "Faza",
"ui.chamfer_type": "Typ fazy",
"ui.change_workspace": "Zmień środowisko pracy",
- "ui.chord_length": "Długość cięciwy",
"ui.circle": "Okrąg",
"ui.circular_pattern": "Szyk kołowy",
"ui.clear": "Wyczyść",
@@ -1165,11 +1146,9 @@
"ui.command_done": "Wykonano: {command}",
"ui.command_palette_hint": "Wpisz polecenie, np. {example} — lub naciśnij S, aby wyszukać",
"ui.concentric": "Współśrodkowość",
- "ui.configurations": "Konfiguracje",
"ui.conic_curve": "Krzywa stożkowa",
"ui.constant": "Stały",
"ui.constraints_conflict": "Konflikt wiązań",
- "ui.construct": "Konstrukcja",
"ui.construction": "Konstrukcyjne",
"ui.context_menu": "Menu kontekstowe",
"ui.continuity_g0": "G0 załamanie",
@@ -1195,7 +1174,6 @@
"ui.cylinder": "Walec",
"ui.dark": "Ciemny",
"ui.default_modelling_orientation": "Domyślna orientacja modelowania",
- "ui.degrees_of_freedom": "stopnie swobody",
"ui.delete": "Usuń",
"ui.depth": "Głębokość",
"ui.design": "Projekt",
@@ -1237,7 +1215,6 @@
"ui.equivalent_radius": "Promień zastępczy",
"ui.expand": "Rozwiń",
"ui.exportDxf": "Eksportuj DXF…",
- "ui.export_ellipsis": "Eksportuj...",
"ui.export_ellipsis_keymap": "Eksportuj…",
"ui.export_keymap_tip": "Klawisze, ulubione z okna S i pasek narzędzi, jako plik",
"ui.extend": "Wydłuż",
@@ -1321,7 +1298,6 @@
"ui.heading_sheet_metal": "BLACHA",
"ui.heading_shell": "SKORUPA",
"ui.heading_sketch": "SZKIC",
- "ui.heading_sketch_palette": "PALETA SZKICU",
"ui.heading_sketch_scale": "SKALA SZKICU",
"ui.heading_solid": "BRYŁA",
"ui.heading_sphere": "SFERA",
@@ -1360,7 +1336,6 @@
"ui.length_decimals": "Miejsca dziesiętne długości",
"ui.light": "Jasny",
"ui.line": "Linia",
- "ui.linetype": "Rodzaj linii",
"ui.lock": "Zablokuj",
"ui.loft": "Wyciągnięcie złożone",
"ui.look_at": "Patrz na",
@@ -1392,10 +1367,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF ze znacznikami ścian",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Punkt środkowy",
"ui.mirror": "Lustro",
"ui.mirror_line": "Linia odbicia",
- "ui.modify": "Modyfikuj",
"ui.move": "Przesuń",
"ui.multiple": "Wiele",
"ui.named_views": "Widoki nazwane",
@@ -1415,7 +1388,6 @@
"ui.offset_plane": "Płaszczyzna odsunięta",
"ui.one_side": "Jedna strona",
"ui.open": "Otwórz",
- "ui.open_ellipsis": "Otwórz...",
"ui.open_ends_tip": "Niczego nie dotyka",
"ui.open_preferences": "Otwórz preferencje",
"ui.open_recent": "Otwórz ostatnie",
@@ -1427,8 +1399,6 @@
"ui.origin": "Początek układu",
"ui.palette_construction_mode": "Tryb konstrukcyjny (X)",
"ui.palette_more": "Więcej",
- "ui.palette_points": "Punkty",
- "ui.palette_profile": "Profil",
"ui.palette_sketch_options": "Opcje szkicu",
"ui.pan": "Przesuwanie",
"ui.pan_zoom_orbit": "Przesuwanie, powiększanie, obracanie",
@@ -1463,7 +1433,6 @@
"ui.quit": "Zakończ",
"ui.radial_context_menu": "Promieniste menu kontekstowe",
"ui.radius": "Promień",
- "ui.radius_type": "Typ promienia",
"ui.rail": "Prowadnica",
"ui.rail_fit": "Dopasowanie do prowadnicy",
"ui.reachable": "Osiągalne",
@@ -1488,7 +1457,6 @@
"ui.right": "Prawy",
"ui.save": "Zapisz",
"ui.save_as": "Zapisz jako",
- "ui.save_as_ellipsis": "Zapisz jako...",
"ui.save_mesh_no_slicer": "Nie znaleziono slicera: wybierz Niestandardowy… i wskaż program slicera albo wyłącz Wyślij do slicera",
"ui.save_mesh_pick_bodies": "Zaznacz bryły do zapisania",
"ui.save_mesh_temp_failed": "Nie udało się utworzyć {folder}: {error}",
@@ -1501,7 +1469,6 @@
"ui.select": "Zaznacz",
"ui.selectOther": "Wybierz inny…",
"ui.selectTangentChain": "Zaznacz łańcuch styczny",
- "ui.select_other_hint": "Wybierz inny: przytrzymaj nieruchomo lewy przycisk na modelu (lub prawy przycisk › Wybierz inny…), aby wyświetlić wszystko pod kursorem; kliknij ponownie w tym samym miejscu, aby zaznaczyć kolejny obiekt.",
"ui.selection": "Zaznaczenie",
"ui.send": "Wyślij",
"ui.send_to_slicer": "Wyślij do slicera",
@@ -1518,7 +1485,6 @@
"ui.show_constraints": "Wiązania",
"ui.show_construction_geometries": "Geometria konstrukcyjna",
"ui.show_dimensions": "Wymiary",
- "ui.show_points": "Pokaż punkty",
"ui.show_profile": "Pokaż profil",
"ui.show_projected_geometries": "Geometria rzutowana",
"ui.simple": "Prosty",
@@ -1528,7 +1494,6 @@
"ui.sketch_dimension": "Wymiar szkicu",
"ui.sketch_grid": "Siatka szkicu",
"ui.sketch_scale": "Skala szkicu",
- "ui.sketch_status": "Stan szkicu",
"ui.sketches": "Szkice",
"ui.slice": "Przetnij",
"ui.slicer": "Slicer",
@@ -1547,7 +1512,6 @@
"ui.split_body": "Podziel bryłę",
"ui.stand_up_tip": "Gdy plik STEP lub IGES otworzy się z osią Z w górę, proponuj obrót o ćwierć obrotu wokół osi X",
"ui.start": "Start",
- "ui.start_radius": "Promień początkowy",
"ui.stretch": "Rozciągnij",
"ui.supersampling": "Supersampling (SSAA)",
"ui.supersampling_adaptive": "Tylko gdy widok jest nieruchomy",
@@ -1595,7 +1559,6 @@
"ui.untitled": "Bez tytułu",
"ui.up_axis_note": "Która oś wskazuje górę w widokach (widok osi, Widok główny, Patrz na). Projekty pozostają bez zmian.",
"ui.updateToCurrentView": "Aktualizuj do bieżącego widoku",
- "ui.variable": "Zmienny",
"ui.view_centre": "Środek widoku",
"ui.visual_shaded_hidden_edges": "Cieniowany z krawędziami niewidocznymi",
"ui.visual_shaded_with_edges": "Cieniowany z krawędziami",
@@ -1611,7 +1574,6 @@
"ui.zoom_to_the_cursor": "Powiększaj w stronę kursora",
"update.available": "Dostępna jest wersja SolidCraft {version}",
"update.button": "Aktualizuj",
- "update.button_tip": "Dostępna jest wersja SolidCraft {version}",
"update.button_version": "Aktualizuj do {version}",
"update.check_automatically": "Automatycznie sprawdzaj aktualizacje",
"update.check_now": "Sprawdź teraz",
diff --git a/assets/locales/pt-BR.json b/assets/locales/pt-BR.json
index f70fe3a7d7..f48d0d7122 100644
--- a/assets/locales/pt-BR.json
+++ b/assets/locales/pt-BR.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Clique em Submit new issue no GitHub para enviar o relatório.",
"A new configuration, a copy of the active one": "Uma nova configuração, cópia da ativa",
- "AI": "IA",
"ARRANGE": "ORGANIZAR",
"About SolidCraft": "Sobre o SolidCraft",
"Actions": "Ações",
@@ -68,7 +67,6 @@
"Component1": "Componente1",
"Configuration": "Configuração",
"Configuration rules": "Regras de configuração",
- "Construction": "Construção",
"Contact": "Contato",
"Continuity": "Continuidade",
"Copy Error Message": "Copiar mensagem de erro",
@@ -93,7 +91,6 @@
"Delete rule": "Excluir regra",
"Delete the row": "Excluir a linha",
"Delete the set": "Excluir o conjunto",
- "Delete this parameter": "Excluir este parâmetro",
"Density": "Densidade",
"Designs you open or save appear here.": "Os projetos que você abrir ou salvar aparecem aqui.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Determinado por Até o objeto. Escolha Ângulo para editar a extensão angular.",
@@ -131,7 +128,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Arquivos de muitos programas CAD usam Y para cima, então abrem deitados aqui (Z para cima).",
"Filter": "Filtro",
"Find in Browser": "Localizar no navegador",
- "Flat": "Plano",
"Flat size": "Tamanho planificado",
"Follow camera (Look At sketches)": "Seguir a câmera (Olhar para os esboços)",
"Follow the camera (Look At sketches)": "Seguir a câmera (Olhar para os esboços)",
@@ -201,7 +197,6 @@
"No matching appearances": "Nenhuma aparência correspondente",
"No visible bodies to export.": "Nenhum corpo visível para exportar.",
"None": "Nenhum",
- "Normal to sketch": "Normal ao esboço",
"Not available yet": "Ainda não disponível",
"Notch": "Entalhe",
"OUTPUT": "SAÍDA",
@@ -215,7 +210,6 @@
"Outside": "Fora",
"Overall length": "Comprimento total",
"Parameter": "Parâmetro",
- "Parameter values": "Valores dos parâmetros",
"Pass through": "Atravessar",
"Path": "Caminho",
"Per Edge": "Por aresta",
@@ -230,7 +224,6 @@
"Preview Row": "Visualizar linha",
"Preview leaves the current design unchanged.": "A visualização não altera o projeto atual.",
"Profiles/Curves": "Perfis/Curvas",
- "Projection": "Projeção",
"RECENT": "RECENTES",
"REFERENCE": "REFERÊNCIA",
"RULED SURFACE": "SUPERFÍCIE REGRADA",
@@ -343,7 +336,6 @@
"Value": "Valor",
"Vertices": "Vértices",
"View navigator": "Navegador de vistas",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Somente corpos visíveis. As curvas usam segmentos de reta (tolerância de 0,01 mm).",
"Volume": "Volume",
"Wall": "Parede",
"Wall Location": "Posição da parede",
@@ -683,7 +675,6 @@
"cmd.view_navigate": "Navegar na vista",
"cmd.view_rename": "Renomear vista nomeada",
"cmd.view_save": "Nova vista nomeada",
- "command name": "nome do comando",
"contact.components_count": "{count} componentes",
"contact.enabled_label": "ativado",
"coupling.gear_1": "Engrenagem 1",
@@ -721,7 +712,6 @@
"drive.stopped_by_contact": "Parado em {value}: {a} atravessaria {b}",
"drive.stopped_by_loop": "Parado em {value}: o laço por {joint} não pode fechar mais",
"drive.unconnected": "Não move nada: {part} não está conectado a nada fixo",
- "expression, e.g. 25 mm": "expressão, p. ex. 25 mm",
"fits the face, e.g. M8": "se ajusta à face, p. ex. M8",
"from the rule": "da regra",
"help.apache": "Licença Apache 2.0",
@@ -789,7 +779,6 @@
"nav.touchpad.zoom": "Zoom (rolagem vertical ou pinça)",
"needs two joints": "precisa de duas juntas",
"new configuration": "nova configuração",
- "new name": "novo nome",
"new parameter": "novo parâmetro",
"no interference": "sem interferência",
"no joint that moves yet": "ainda não há junta que se mova",
@@ -808,10 +797,8 @@
"properties.title": "Propriedades: {name}",
"render.background": "Fundo da cena",
"render.fit": "Enquadrar produto",
- "render.image_cancel": "Cancelar renderização",
"render.image_cancelled": "Renderização cancelada",
"render.image_cancelling": "Cancelando",
- "render.image_check": "Verificar pedido de renderização",
"render.image_completed": "Imagem pronta para exportar",
"render.image_encoding": "Codificando PNG",
"render.image_export": "Exportar PNG",
@@ -890,7 +877,6 @@
"sketch_text.align_right": "Direita",
"sketch_text.bold": "Negrito",
"sketch_text.builtin_font": "{family} (incorporada)",
- "sketch_text.font_search": "Pesquisar fontes",
"sketch_text.italic": "Itálico",
"sketch_text.loading_fonts": "Procurando fontes instaladas…",
"sketch_text.on_path": "O texto segue seu caminho: a curva o posiciona",
@@ -914,9 +900,7 @@
"trace.stopped_by_loop": "Termina na amostra {sample}: o laço por {joint} não pode fechar mais",
"ui.1_degree_of_freedom": "1 grau de liberdade",
"ui.3d_mouse_speed": "Velocidade do mouse 3D",
- "ui.3d_mouse_windows": "Mouse 3D",
"ui.3d_sketch": "Esboço 3D",
- "ui.about": "Sobre",
"ui.activate": "Ativar",
"ui.active_component": "Componente ativo",
"ui.agent_chat": "Chat com agente",
@@ -958,7 +942,6 @@
"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.",
- "ui.agent_chat_new_yes": "Novo chat",
"ui.agent_chat_next_picture": "Próxima imagem",
"ui.agent_chat_no_cli": "O solidcraft-cli não foi encontrado junto ao aplicativo, então o agente não consegue acessar o projeto.",
"ui.agent_chat_no_control": "O endpoint do chat com agente não iniciou, então o agente não consegue acessar o projeto.",
@@ -1092,7 +1075,6 @@
"ui.anti_aliasing": "Antisserrilhamento",
"ui.apply": "Aplicar",
"ui.arc": "Arco",
- "ui.assemble": "Montar",
"ui.autosave_every": "Salvar automaticamente a cada",
"ui.axes": "Eixos",
"ui.axis": "Eixo",
@@ -1116,7 +1098,6 @@
"ui.chamfer": "Chanfro",
"ui.chamfer_type": "Tipo de chanfro",
"ui.change_workspace": "Mudar espaço de trabalho",
- "ui.chord_length": "Comprimento da corda",
"ui.circle": "Círculo",
"ui.circular_pattern": "Padrão circular",
"ui.clear": "Limpar",
@@ -1149,11 +1130,9 @@
"ui.command_done": "{command} concluído",
"ui.command_palette_hint": "Digite um comando, p. ex. {example} — ou pressione S para pesquisar",
"ui.concentric": "Concêntrico",
- "ui.configurations": "Configurações",
"ui.conic_curve": "Curva cônica",
"ui.constant": "Constante",
"ui.constraints_conflict": "Restrições em conflito",
- "ui.construct": "Construir",
"ui.construction": "Construção",
"ui.context_menu": "Menu de contexto",
"ui.continuity_gap": "Folga",
@@ -1176,7 +1155,6 @@
"ui.cylinder": "Cilindro",
"ui.dark": "Escuro",
"ui.default_modelling_orientation": "Orientação padrão de modelagem",
- "ui.degrees_of_freedom": "graus de liberdade",
"ui.delete": "Excluir",
"ui.depth": "Profundidade",
"ui.design": "Projeto",
@@ -1218,7 +1196,6 @@
"ui.equivalent_radius": "Raio equivalente",
"ui.expand": "Expandir",
"ui.exportDxf": "Exportar DXF…",
- "ui.export_ellipsis": "Exportar...",
"ui.export_ellipsis_keymap": "Exportar…",
"ui.export_keymap_tip": "Teclas, favoritos da caixa S e a barra de ferramentas, como um arquivo",
"ui.extend": "Estender",
@@ -1300,7 +1277,6 @@
"ui.heading_sheet_metal": "CHAPA METÁLICA",
"ui.heading_shell": "CASCA",
"ui.heading_sketch": "ESBOÇO",
- "ui.heading_sketch_palette": "PALETA DE ESBOÇO",
"ui.heading_sketch_scale": "ESCALA DO ESBOÇO",
"ui.heading_solid": "SÓLIDO",
"ui.heading_sphere": "ESFERA",
@@ -1339,7 +1315,6 @@
"ui.length_decimals": "Casas decimais de comprimento",
"ui.light": "Claro",
"ui.line": "Linha",
- "ui.linetype": "Tipo de linha",
"ui.lock": "Bloquear",
"ui.loft": "Loft",
"ui.look_at": "Olhar para",
@@ -1371,10 +1346,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF com marcação de faces",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Ponto médio",
"ui.mirror": "Espelhar",
"ui.mirror_line": "Linha de espelho",
- "ui.modify": "Modificar",
"ui.move": "Mover",
"ui.multiple": "Múltiplo",
"ui.named_views": "Vistas nomeadas",
@@ -1394,7 +1367,6 @@
"ui.offset_plane": "Plano deslocado",
"ui.one_side": "Um lado",
"ui.open": "Abrir",
- "ui.open_ellipsis": "Abrir...",
"ui.open_preferences": "Abrir preferências",
"ui.open_recent": "Abrir recente",
"ui.operation": "Operação",
@@ -1405,8 +1377,6 @@
"ui.origin": "Origem",
"ui.palette_construction_mode": "Modo de construção (X)",
"ui.palette_more": "Mais",
- "ui.palette_points": "Pontos",
- "ui.palette_profile": "Perfil",
"ui.palette_sketch_options": "Opções de esboço",
"ui.pan": "Deslocar",
"ui.pan_zoom_orbit": "Deslocar, zoom, orbitar",
@@ -1441,7 +1411,6 @@
"ui.quit": "Sair",
"ui.radial_context_menu": "Menu de contexto radial",
"ui.radius": "Raio",
- "ui.radius_type": "Tipo de raio",
"ui.reachable": "Alcançável",
"ui.rectangle": "Retângulo",
"ui.rectangular_pattern": "Padrão retangular",
@@ -1464,7 +1433,6 @@
"ui.right": "Direita",
"ui.save": "Salvar",
"ui.save_as": "Salvar como",
- "ui.save_as_ellipsis": "Salvar como...",
"ui.save_mesh_no_slicer": "Nenhum fatiador encontrado: escolha Personalizado… e selecione seu programa fatiador, ou desative Enviar ao fatiador",
"ui.save_mesh_pick_bodies": "Selecione os corpos a salvar",
"ui.save_mesh_temp_failed": "Não foi possível criar {folder}: {error}",
@@ -1476,7 +1444,6 @@
"ui.select": "Selecionar",
"ui.selectOther": "Selecionar outro…",
"ui.selectTangentChain": "Selecionar cadeia tangente",
- "ui.select_other_hint": "Selecionar outro: mantenha o botão esquerdo parado sobre o modelo (ou clique com o botão direito › Selecionar outro…) para listar tudo sob o cursor; clique de novo no mesmo ponto para selecionar o próximo item ali.",
"ui.selection": "Seleção",
"ui.send": "Enviar",
"ui.send_to_slicer": "Enviar ao fatiador",
@@ -1493,7 +1460,6 @@
"ui.show_constraints": "Restrições",
"ui.show_construction_geometries": "Geometrias de construção",
"ui.show_dimensions": "Cotas",
- "ui.show_points": "Mostrar pontos",
"ui.show_profile": "Mostrar perfil",
"ui.show_projected_geometries": "Geometrias projetadas",
"ui.simple": "Simples",
@@ -1503,7 +1469,6 @@
"ui.sketch_dimension": "Cota do esboço",
"ui.sketch_grid": "Grade do esboço",
"ui.sketch_scale": "Escala do esboço",
- "ui.sketch_status": "Estado do esboço",
"ui.sketches": "Esboços",
"ui.slice": "Fatiar",
"ui.slicer": "Fatiador",
@@ -1549,7 +1514,6 @@
"ui.stand_up_tip": "Depois que um arquivo STEP ou IGES abrir com Z para cima, oferecer um quarto de volta em torno de X",
"ui.start": "Início",
"ui.start_over": "Recomeçar",
- "ui.start_radius": "Raio inicial",
"ui.supersampling": "Supersampling (SSAA)",
"ui.supersampling_adaptive": "Só quando a vista está parada",
"ui.supersampling_off": "Desativado (1×)",
@@ -1593,7 +1557,6 @@
"ui.untitled": "Sem título",
"ui.up_axis_note": "Qual eixo aponta para cima nas vistas (vista do eixo, Início, Olhar para). Os projetos não mudam.",
"ui.updateToCurrentView": "Atualizar para a vista atual",
- "ui.variable": "Variável",
"ui.view_centre": "Centro da vista",
"ui.visual_shaded_hidden_edges": "Sombreado com arestas ocultas",
"ui.visual_shaded_with_edges": "Sombreado com arestas",
@@ -1609,7 +1572,6 @@
"ui.zoom_to_the_cursor": "Zoom em direção ao cursor",
"update.available": "O SolidCraft {version} está disponível",
"update.button": "Atualizar",
- "update.button_tip": "O SolidCraft {version} está disponível",
"update.button_version": "Atualizar para {version}",
"update.check_automatically": "Verificar atualizações automaticamente",
"update.check_now": "Verificar agora",
diff --git a/assets/locales/ru.json b/assets/locales/ru.json
index ad7cb798ad..e28b45de84 100644
--- a/assets/locales/ru.json
+++ b/assets/locales/ru.json
@@ -63,7 +63,6 @@
"Component1": "Компонент1",
"Configuration": "Конфигурация",
"Configuration rules": "Правила конфигурации",
- "Construction": "Вспомогательная",
"Contact": "Контакт",
"Contact sets": "Наборы контактов",
"Continuity": "Непрерывность",
@@ -87,7 +86,6 @@
"Delete rule": "Удалить правило",
"Delete the row": "Удалить строку",
"Delete the set": "Удалить набор",
- "Delete this parameter": "Удалить этот параметр",
"Density": "Плотность",
"Designs you open or save appear here.": "Здесь появляются открытые и сохранённые дизайны.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Определяется параметром «До объекта». Выберите «Угол», чтобы задать угловой предел.",
@@ -120,7 +118,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Файлы многих CAD-программ ориентированы Y вверх, поэтому здесь они открываются лёжа на спине (Z вверх).",
"Filter": "Фильтр",
"Find in Browser": "Найти в браузере",
- "Flat": "Плоский",
"Flat size": "Размер развёртки",
"Follow camera (Look At sketches)": "Следовать за камерой (эскизы «Взгляд на»)",
"Follow the camera (Look At sketches)": "Следовать за камерой (эскизы «Взгляд на»)",
@@ -181,7 +178,6 @@
"No crash reports.": "Нет отчётов о сбоях.",
"No matching appearance presets.": "Нет подходящих наборов внешнего вида.",
"No matching appearances": "Нет подходящих внешних видов",
- "Normal to sketch": "По нормали к эскизу",
"Not available yet": "Пока недоступно",
"Notch": "Вырез",
"OUTPUT": "ВЫВОД",
@@ -193,7 +189,6 @@
"Other side": "Другая сторона",
"Other surface (mutual trim)": "Другая поверхность (взаимная обрезка)",
"Parameter": "Параметр",
- "Parameter values": "Значения параметров",
"Pass through": "Через точки",
"Path": "Траектория",
"Per Edge": "По каждому ребру",
@@ -654,7 +649,6 @@
"cmd.view_navigate": "Навигация вида",
"cmd.view_rename": "Переименовать именованный вид",
"cmd.view_save": "Новый именованный вид",
- "command name": "имя команды",
"contact.components_count": "Компонентов: {count}",
"contact.enabled_label": "включено",
"coupling.gear_1": "Шестерня 1",
@@ -688,7 +682,6 @@
"drive.stopped_by_contact": "Остановлено на {value}: {a} прошёл бы сквозь {b}",
"drive.stopped_by_loop": "Остановлено на {value}: контур через {joint} дальше не замыкается",
"drive.unconnected": "Ничего не движется: {part} не соединён ни с чем закреплённым",
- "expression, e.g. 25 mm": "выражение, напр. 25 мм",
"fits the face, e.g. M8": "подходит грани, напр. M8",
"from the rule": "из правила",
"help.apache": "Лицензия Apache 2.0",
@@ -754,7 +747,6 @@
"motion.track_name": "Дорожка {number}",
"needs two joints": "нужны два сопряжения",
"new configuration": "новая конфигурация",
- "new name": "новое имя",
"new parameter": "новый параметр",
"no interference": "нет интерференции",
"no joint that moves yet": "пока нет подвижных сопряжений",
@@ -773,10 +765,8 @@
"properties.title": "Свойства: {name}",
"render.background": "Фон сцены",
"render.fit": "Вписать модель",
- "render.image_cancel": "Отменить рендеринг",
"render.image_cancelled": "Рендеринг отменён",
"render.image_cancelling": "Отмена",
- "render.image_check": "Проверить запрос рендеринга",
"render.image_completed": "Изображение готово к экспорту",
"render.image_encoding": "Кодирование PNG",
"render.image_export": "Экспорт PNG",
@@ -852,7 +842,6 @@
"sketch_text.align_right": "По правому краю",
"sketch_text.bold": "Полужирный",
"sketch_text.builtin_font": "{family} (встроенный)",
- "sketch_text.font_search": "Поиск шрифтов",
"sketch_text.italic": "Курсив",
"sketch_text.loading_fonts": "Поиск установленных шрифтов…",
"sketch_text.on_path": "Текст следует по траектории: кривая задаёт его положение",
@@ -876,9 +865,7 @@
"trace.stopped_by_loop": "Заканчивается на отсчёте {sample}: контур через {joint} дальше не замыкается",
"ui.1_degree_of_freedom": "1 степень свободы",
"ui.3d_mouse_speed": "Скорость 3D-мыши",
- "ui.3d_mouse_windows": "3D-мышь",
"ui.3d_sketch": "3D-эскиз",
- "ui.about": "О программе",
"ui.activate": "Активировать",
"ui.active_component": "Активный компонент",
"ui.agent_chat_next_picture": "Следующее изображение",
@@ -902,7 +889,6 @@
"ui.anti_aliasing": "Сглаживание",
"ui.apply": "Применить",
"ui.arc": "Дуга",
- "ui.assemble": "Сборка",
"ui.autosave_every": "Автосохранение каждые",
"ui.axes": "Оси",
"ui.axis": "Ось",
@@ -925,7 +911,6 @@
"ui.chamfer": "Фаска",
"ui.chamfer_type": "Тип фаски",
"ui.change_workspace": "Сменить рабочую область",
- "ui.chord_length": "Длина хорды",
"ui.circle": "Окружность",
"ui.circular_pattern": "Круговой массив",
"ui.clear": "Очистить",
@@ -958,11 +943,9 @@
"ui.command_done": "{command} — готово",
"ui.command_palette_hint": "Введите команду, напр. {example} — или нажмите S для поиска",
"ui.concentric": "Концентричность",
- "ui.configurations": "Конфигурации",
"ui.conic_curve": "Коническая кривая",
"ui.constant": "Постоянный",
"ui.constraints_conflict": "Ограничения конфликтуют",
- "ui.construct": "Построение",
"ui.construction": "Вспомогательная",
"ui.context_menu": "Контекстное меню",
"ui.continuity_gap": "Зазор",
@@ -985,7 +968,6 @@
"ui.cylinder": "Цилиндр",
"ui.dark": "Тёмная",
"ui.default_modelling_orientation": "Ориентация моделирования по умолчанию",
- "ui.degrees_of_freedom": "степеней свободы",
"ui.delete": "Удалить",
"ui.depth": "Глубина",
"ui.design": "Дизайн",
@@ -1022,7 +1004,6 @@
"ui.equivalent_radius": "Эквивалентный радиус",
"ui.expand": "Развернуть",
"ui.exportDxf": "Экспорт DXF…",
- "ui.export_ellipsis": "Экспорт...",
"ui.export_ellipsis_keymap": "Экспорт…",
"ui.export_keymap_tip": "Сочетания клавиш, избранное панели S и панель инструментов — в файл",
"ui.extend": "Удлинить",
@@ -1108,7 +1089,6 @@
"ui.heading_sheet_metal": "ЛИСТОВОЙ МЕТАЛЛ",
"ui.heading_shell": "ОБОЛОЧКА",
"ui.heading_sketch": "ЭСКИЗ",
- "ui.heading_sketch_palette": "ПАЛИТРА ЭСКИЗА",
"ui.heading_sketch_scale": "МАСШТАБ ЭСКИЗА",
"ui.heading_solid": "ТЕЛО",
"ui.heading_sphere": "СФЕРА",
@@ -1147,7 +1127,6 @@
"ui.length_decimals": "Знаков после запятой (длины)",
"ui.light": "Светлая",
"ui.line": "Линия",
- "ui.linetype": "Тип линии",
"ui.lock": "Заблокировать",
"ui.loft": "Лофт",
"ui.look_at": "Взгляд на",
@@ -1179,10 +1158,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF с метками граней",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Середина",
"ui.mirror": "Зеркало",
"ui.mirror_line": "Линия зеркала",
- "ui.modify": "Изменение",
"ui.move": "Переместить",
"ui.multiple": "Несколько",
"ui.named_views": "Именованные виды",
@@ -1202,7 +1179,6 @@
"ui.offset_plane": "Смещённая плоскость",
"ui.one_side": "Одна сторона",
"ui.open": "Открыть",
- "ui.open_ellipsis": "Открыть...",
"ui.open_preferences": "Открыть настройки",
"ui.open_recent": "Открыть недавние",
"ui.operation": "Операция",
@@ -1213,8 +1189,6 @@
"ui.origin": "Начало координат",
"ui.palette_construction_mode": "Вспомогательный режим (X)",
"ui.palette_more": "Ещё",
- "ui.palette_points": "Точки",
- "ui.palette_profile": "Профиль",
"ui.palette_sketch_options": "Параметры эскиза",
"ui.pan": "Панорамирование",
"ui.pan_zoom_orbit": "Панорама, масштаб, орбита",
@@ -1248,7 +1222,6 @@
"ui.quit": "Выход",
"ui.radial_context_menu": "Радиальное контекстное меню",
"ui.radius": "Радиус",
- "ui.radius_type": "Тип радиуса",
"ui.rectangle": "Прямоугольник",
"ui.rectangular_pattern": "Прямоугольный массив",
"ui.redo": "Повторить",
@@ -1270,7 +1243,6 @@
"ui.right": "Справа",
"ui.save": "Сохранить",
"ui.save_as": "Сохранить как",
- "ui.save_as_ellipsis": "Сохранить как...",
"ui.save_mesh_no_slicer": "Слайсер не найден: выберите «Другая…» и укажите программу или отключите «Отправить в слайсер»",
"ui.save_mesh_pick_bodies": "Выберите тела для сохранения",
"ui.save_mesh_temp_failed": "Не удалось создать {folder}: {error}",
@@ -1282,7 +1254,6 @@
"ui.select": "Выбрать",
"ui.selectOther": "Выбрать другое…",
"ui.selectTangentChain": "Выбрать касательную цепочку",
- "ui.select_other_hint": "Выбрать другое: удерживайте левую кнопку на модели (или правый щелчок › Выбрать другое…), чтобы увидеть всё под курсором; повторный щелчок в том же месте выбирает следующий объект.",
"ui.selection": "Выделение",
"ui.send": "Отправить",
"ui.send_to_slicer": "Отправить в слайсер",
@@ -1299,7 +1270,6 @@
"ui.show_constraints": "Ограничения",
"ui.show_construction_geometries": "Вспомогательная геометрия",
"ui.show_dimensions": "Размеры",
- "ui.show_points": "Показать точки",
"ui.show_profile": "Показать профиль",
"ui.show_projected_geometries": "Спроецированная геометрия",
"ui.simple": "Простой",
@@ -1309,7 +1279,6 @@
"ui.sketch_dimension": "Размер эскиза",
"ui.sketch_grid": "Сетка эскиза",
"ui.sketch_scale": "Масштаб эскиза",
- "ui.sketch_status": "Статус эскиза",
"ui.sketches": "Эскизы",
"ui.slice": "Срез",
"ui.slicer": "Слайсер",
@@ -1355,7 +1324,6 @@
"ui.stand_up_tip": "Если файл STEP или IGES открывается с Z вверх, предложить поворот на четверть оборота вокруг X",
"ui.start": "Старт",
"ui.start_over": "Начать заново",
- "ui.start_radius": "Начальный радиус",
"ui.suppress": "Подавить",
"ui.sweep": "Сдвиг",
"ui.sweep_follow_direction": "Следовать направлению",
@@ -1395,7 +1363,6 @@
"ui.untitled": "Без имени",
"ui.up_axis_note": "Какая ось направлена вверх в видах (осевые виды, «Главная», «Взгляд на»). Дизайны не меняются.",
"ui.updateToCurrentView": "Обновить до текущего вида",
- "ui.variable": "Переменный",
"ui.view_centre": "Центр вида",
"ui.visual_shaded_hidden_edges": "Заполненный с невидимыми рёбрами",
"ui.visual_shaded_with_edges": "Заполненный с рёбрами",
diff --git a/assets/locales/tr.json b/assets/locales/tr.json
index a92a060adb..641a162c5c 100644
--- a/assets/locales/tr.json
+++ b/assets/locales/tr.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Raporu göndermek için GitHub'da Submit new issue düğmesine tıklayın.",
"A new configuration, a copy of the active one": "Etkin konfigürasyonun kopyası olan yeni bir konfigürasyon",
- "AI": "AI",
"ARRANGE": "DÜZENLE",
"About SolidCraft": "SolidCraft hakkında",
"Acceleration": "İvme",
@@ -70,7 +69,6 @@
"Component1": "Bileşen1",
"Configuration": "Konfigürasyon",
"Configuration rules": "Konfigürasyon kuralları",
- "Construction": "Yapı çizgisi",
"Contact": "Temas",
"Contact sets": "Temas kümeleri",
"Copy Error Message": "Hata mesajını kopyala",
@@ -91,7 +89,6 @@
"Delete rule": "Kuralı sil",
"Delete the row": "Satırı sil",
"Delete the set": "Kümeyi sil",
- "Delete this parameter": "Bu parametreyi sil",
"Density": "Yoğunluk",
"Designs you open or save appear here.": "Açtığınız veya kaydettiğiniz tasarımlar burada görünür.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Nesneye kadar seçeneğiyle belirlenir. Açısal kapsamı düzenlemek için Açı seçeneğini seçin.",
@@ -125,7 +122,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Birçok CAD programının dosyalarında Y yukarıyı gösterir; bu yüzden burada (Z yukarı) sırtüstü yatar hâlde açılırlar.",
"Filter": "Filtre",
"Find in Browser": "Tarayıcıda bul",
- "Flat": "Düz",
"Flat size": "Açınım boyutu",
"Follow camera (Look At sketches)": "Kamera takibi (eskizlerde Bak)",
"Follow the camera (Look At sketches)": "Kamera takibi (eskizlerde Bak)",
@@ -194,7 +190,6 @@
"No matching appearance presets.": "Eşleşen görünüm ön ayarı yok.",
"No matching appearances": "Eşleşen görünüm yok",
"None": "Hiçbiri",
- "Normal to sketch": "Eskize dik",
"Not available yet": "Henüz kullanılamıyor",
"OUTPUT": "ÇIKTI",
"Opacity": "Opaklık",
@@ -207,7 +202,6 @@
"Outside": "Dış",
"Overall length": "Toplam uzunluk",
"Parameter": "Parametre",
- "Parameter values": "Parametre değerleri",
"Path": "Yol",
"Per Edge": "Kenar başına",
"Pick the tool bodies": "Araç gövdelerini seçin",
@@ -666,7 +660,6 @@
"cmd.view_navigate": "Görünümde gezin",
"cmd.view_rename": "Adlandırılmış görünümü yeniden adlandır",
"cmd.view_save": "Yeni adlandırılmış görünüm",
- "command name": "komut adı",
"contact.components_count": "{count} bileşen",
"contact.enabled_label": "etkin",
"delete.and_more": "… ve {count} tane daha",
@@ -685,7 +678,6 @@
"drive.stopped_by_contact": "{value} değerinde durdu: {a} ile {b} iç içe geçerdi",
"drive.stopped_by_loop": "{value} değerinde durdu: {joint} üzerinden geçen döngü daha fazla kapatılamıyor",
"drive.unconnected": "Hiçbir şey hareket etmiyor: {part} sabitlenmiş hiçbir parçaya bağlı değil",
- "expression, e.g. 25 mm": "ifade, ör. 25 mm",
"fits the face, e.g. M8": "yüze uyar, ör. M8",
"from the rule": "kuraldan",
"help.apache": "Apache lisansı 2.0",
@@ -757,7 +749,6 @@
"nav.touchpad.zoom": "Yakınlaştır (dikey kaydırın veya parmaklarınızı açıp kapatın)",
"needs two joints": "iki bağlantı gerektirir",
"new configuration": "yeni konfigürasyon",
- "new name": "yeni ad",
"new parameter": "yeni parametre",
"no interference": "girişim yok",
"no joint that moves yet": "henüz hareket eden bir bağlantı yok",
@@ -776,10 +767,8 @@
"properties.title": "Özellikler: {name}",
"render.background": "Sahne arka planı",
"render.fit": "Ürünü sığdır",
- "render.image_cancel": "Render'ı iptal et",
"render.image_cancelled": "Render iptal edildi",
"render.image_cancelling": "İptal ediliyor",
- "render.image_check": "Render isteğini kontrol et",
"render.image_completed": "Resim dışa aktarmaya hazır",
"render.image_encoding": "PNG kodlanıyor",
"render.image_export": "PNG dışa aktar",
@@ -855,7 +844,6 @@
"sketch_text.align_right": "Sağ",
"sketch_text.bold": "Kalın",
"sketch_text.builtin_font": "{family} (yerleşik)",
- "sketch_text.font_search": "Yazı tiplerini ara",
"sketch_text.italic": "İtalik",
"sketch_text.loading_fonts": "Yüklü yazı tipleri aranıyor…",
"sketch_text.on_path": "Metin eğrisini izler: konumunu eğri belirler",
@@ -876,9 +864,7 @@
"toolbar.render_scene": "SAHNE",
"ui.1_degree_of_freedom": "1 serbestlik derecesi",
"ui.3d_mouse_speed": "3D fare hızı",
- "ui.3d_mouse_windows": "3D fare (Windows)",
"ui.3d_sketch": "3D eskiz",
- "ui.about": "Hakkında",
"ui.activate": "Etkinleştir",
"ui.active_component": "Etkin bileşen",
"ui.agent_chat": "Ajan sohbeti",
@@ -1039,7 +1025,6 @@
"ui.anti_aliasing": "Kenar yumuşatma",
"ui.apply": "Uygula",
"ui.arc": "Yay",
- "ui.assemble": "Montaj",
"ui.autosave_every": "Otomatik kaydetme aralığı",
"ui.axes": "Eksenler",
"ui.axis": "Eksen",
@@ -1063,7 +1048,6 @@
"ui.chamfer": "Pah",
"ui.chamfer_type": "Pah türü",
"ui.change_workspace": "Çalışma alanını değiştir",
- "ui.chord_length": "Kiriş uzunluğu",
"ui.circle": "Daire",
"ui.circular_pattern": "Dairesel desen",
"ui.clear": "Temizle",
@@ -1096,11 +1080,9 @@
"ui.command_done": "{command} tamamlandı",
"ui.command_palette_hint": "Bir komut yazın (ör. {example}) — veya aramak için S tuşuna basın",
"ui.concentric": "Eş merkezli",
- "ui.configurations": "Konfigürasyonlar",
"ui.conic_curve": "Konik eğri",
"ui.constant": "Sabit",
"ui.constraints_conflict": "Kısıtlamalar çakışıyor",
- "ui.construct": "Yapı",
"ui.construction": "Yapı çizgisi",
"ui.context_menu": "Bağlam menüsü",
"ui.continuity_gap": "Boşluk",
@@ -1123,7 +1105,6 @@
"ui.cylinder": "Silindir",
"ui.dark": "Koyu",
"ui.default_modelling_orientation": "Varsayılan modelleme yönü",
- "ui.degrees_of_freedom": "Serbestlik dereceleri",
"ui.delete": "Sil",
"ui.depth": "Derinlik",
"ui.design": "Tasarım",
@@ -1165,7 +1146,6 @@
"ui.equivalent_radius": "Eşdeğer yarıçap",
"ui.expand": "Genişlet",
"ui.exportDxf": "DXF olarak dışa aktar…",
- "ui.export_ellipsis": "Dışa aktar...",
"ui.export_ellipsis_keymap": "Dışa aktar…",
"ui.export_keymap_tip": "Tuşları, S kutusu favorilerini ve araç çubuğunu dosya olarak dışa aktarır",
"ui.extend": "Uzat",
@@ -1246,7 +1226,6 @@
"ui.heading_sheet_metal": "SAC METAL",
"ui.heading_shell": "KABUK",
"ui.heading_sketch": "ESKİZ",
- "ui.heading_sketch_palette": "ESKİZ PALETİ",
"ui.heading_sketch_scale": "ESKİZİ ÖLÇEKLENDİR",
"ui.heading_solid": "KATI",
"ui.heading_sphere": "KÜRE",
@@ -1284,7 +1263,6 @@
"ui.length_decimals": "Uzunluk ondalık basamakları",
"ui.light": "Açık",
"ui.line": "Çizgi",
- "ui.linetype": "Çizgi türü",
"ui.lock": "Kilitle",
"ui.loft": "Loft",
"ui.look_at": "Bak",
@@ -1316,10 +1294,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "Yüz etiketli 3MF",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Orta nokta",
"ui.mirror": "Aynala",
"ui.mirror_line": "Ayna çizgisi",
- "ui.modify": "Değiştir",
"ui.move": "Taşı",
"ui.multiple": "Çoklu",
"ui.named_views": "Adlandırılmış görünümler",
@@ -1339,7 +1315,6 @@
"ui.offset_plane": "Ofset düzlem",
"ui.one_side": "Tek taraflı",
"ui.open": "Aç",
- "ui.open_ellipsis": "Aç...",
"ui.open_preferences": "Ayarları aç",
"ui.open_recent": "Son kullanılanlar",
"ui.operation": "İşlem",
@@ -1350,8 +1325,6 @@
"ui.origin": "Orijin",
"ui.palette_construction_mode": "Yardımcı çizim modu (X)",
"ui.palette_more": "Diğer",
- "ui.palette_points": "Noktalar",
- "ui.palette_profile": "Profil",
"ui.palette_sketch_options": "Eskiz seçenekleri",
"ui.pan": "Kaydır",
"ui.pan_zoom_orbit": "Kaydır, yakınlaştır, döndür",
@@ -1386,7 +1359,6 @@
"ui.quit": "Çıkış",
"ui.radial_context_menu": "Dairesel bağlam menüsü",
"ui.radius": "Yarıçap",
- "ui.radius_type": "Yarıçap türü",
"ui.reachable": "Erişilebilir",
"ui.rectangle": "Dikdörtgen",
"ui.rectangular_pattern": "Dikdörtgen desen",
@@ -1409,7 +1381,6 @@
"ui.right": "Sağ",
"ui.save": "Kaydet",
"ui.save_as": "Farklı kaydet",
- "ui.save_as_ellipsis": "Farklı kaydet...",
"ui.save_mesh_no_slicer": "Dilimleyici bulunamadı: “Özel…” seçeneğini seçip dilimleyici programını belirtin veya “Dilimleyiciye gönder” seçeneğini kapatın",
"ui.save_mesh_pick_bodies": "Kaydedilecek gövdeleri seçin",
"ui.save_mesh_temp_failed": "{folder} oluşturulamadı: {error}",
@@ -1421,7 +1392,6 @@
"ui.select": "Seç",
"ui.selectOther": "Diğerini seç…",
"ui.selectTangentChain": "Teğet zinciri seç",
- "ui.select_other_hint": "Diğerini seç: İmlecin altındaki her şeyi listelemek için sol tuşu model üzerinde hareket ettirmeden basılı tutun (veya sağ tık › Diğerini seç…); oradaki bir sonraki öğeyi seçmek için aynı noktaya tekrar tıklayın.",
"ui.selection": "Seçim",
"ui.send": "Gönder",
"ui.send_to_slicer": "Dilimleyiciye gönder",
@@ -1438,7 +1408,6 @@
"ui.show_constraints": "Kısıtlamalar",
"ui.show_construction_geometries": "Yapı geometrileri",
"ui.show_dimensions": "Ölçüler",
- "ui.show_points": "Noktaları göster",
"ui.show_profile": "Profili göster",
"ui.show_projected_geometries": "Yansıtılmış geometriler",
"ui.simple": "Basit",
@@ -1448,7 +1417,6 @@
"ui.sketch_dimension": "Eskiz ölçüsü",
"ui.sketch_grid": "Eskiz ızgarası",
"ui.sketch_scale": "Eskiz ölçeği",
- "ui.sketch_status": "Eskiz durumu",
"ui.sketches": "Eskizler",
"ui.slice": "Dilim",
"ui.slicer": "Dilimleyici",
@@ -1494,7 +1462,6 @@
"ui.stand_up_tip": "Bir STEP veya IGES dosyası Z yukarı olarak açıldığında X etrafında çeyrek tur döndürmeyi öner",
"ui.start": "Başlangıç",
"ui.start_over": "Baştan başla",
- "ui.start_radius": "Başlangıç yarıçapı",
"ui.supersampling": "Süper örnekleme (SSAA)",
"ui.supersampling_adaptive": "Yalnızca görünüm hareketsizken",
"ui.supersampling_off": "Kapalı (1×)",
@@ -1538,7 +1505,6 @@
"ui.untitled": "Adsız",
"ui.up_axis_note": "Görünümlerde (eksen görünümü, Başlangıç, Bak) hangi eksenin yukarıyı gösterdiğini belirler. Tasarımlar değişmez.",
"ui.updateToCurrentView": "Geçerli görünüme güncelle",
- "ui.variable": "Değişken",
"ui.view_centre": "Görünüm merkezi",
"ui.visual_shaded_hidden_edges": "Gizli kenarlarla gölgeli",
"ui.visual_shaded_with_edges": "Kenarlarla gölgeli",
@@ -1554,7 +1520,6 @@
"ui.zoom_to_the_cursor": "İmlece doğru yakınlaştır",
"update.available": "SolidCraft {version} kullanılabilir",
"update.button": "Güncelle",
- "update.button_tip": "SolidCraft {version} kullanılabilir",
"update.check_automatically": "Güncellemeleri otomatik denetle",
"update.check_now": "Şimdi denetle",
"update.checking": "Denetleniyor…",
diff --git a/assets/locales/uk.json b/assets/locales/uk.json
index 139432659c..4eea652946 100644
--- a/assets/locales/uk.json
+++ b/assets/locales/uk.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. Натисніть Submit new issue на GitHub, щоб надіслати звіт.",
"A new configuration, a copy of the active one": "Нова конфігурація, копія активної",
- "AI": "ШІ",
"ARRANGE": "РОЗТАШУВАННЯ",
"About SolidCraft": "Про SolidCraft",
"Acceleration": "Прискорення",
@@ -72,7 +71,6 @@
"Component1": "Компонент1",
"Configuration": "Конфігурація",
"Configuration rules": "Правила конфігурації",
- "Construction": "Конструкційна",
"Contact": "Контакт",
"Contact sets": "Набори контактів",
"Continuity": "Неперервність",
@@ -99,7 +97,6 @@
"Delete rule": "Видалити правило",
"Delete the row": "Видалити рядок",
"Delete the set": "Видалити набір",
- "Delete this parameter": "Видалити цей параметр",
"Density": "Густина",
"Designs you open or save appear here.": "Проєкти, які ви відкриваєте чи зберігаєте, з'являються тут.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Визначається об'єктом призначення. Виберіть «Кут», щоб редагувати кутову протяжність.",
@@ -140,7 +137,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Файли з багатьох CAD-програм мають напрямок Y вгору, тому тут вони відкриваються лежачи на спині (Z вгору).",
"Filter": "Фільтр",
"Find in Browser": "Знайти в браузері",
- "Flat": "Плоска",
"Flat size": "Розмір розгортки",
"Follow camera (Look At sketches)": "Стежити за камерою (ескізи наведення)",
"Follow the camera (Look At sketches)": "Стежити за камерою (ескізи наведення)",
@@ -212,7 +208,6 @@
"No matching appearances": "Немає відповідних виглядів",
"No visible bodies to export.": "Немає видимих тіл для експорту.",
"None": "Немає",
- "Normal to sketch": "За нормаллю до ескізу",
"Not available yet": "Ще недоступно",
"Notch": "Виріз",
"OUTPUT": "ВИВЕДЕННЯ",
@@ -226,7 +221,6 @@
"Outside": "Назовні",
"Overall length": "Загальна довжина",
"Parameter": "Параметр",
- "Parameter values": "Значення параметрів",
"Pass through": "Через точки",
"Path": "Траєкторія",
"Per Edge": "На кожне ребро",
@@ -244,7 +238,6 @@
"Preview Row": "Рядок перегляду",
"Preview leaves the current design unchanged.": "Попередній перегляд не змінює поточний проєкт.",
"Profiles/Curves": "Профілі/криві",
- "Projection": "Проєкція",
"Quantity": "Величина",
"RECENT": "НЕДАВНІ",
"REFERENCE": "ДОПОМІЖНА ГЕОМЕТРІЯ",
@@ -361,7 +354,6 @@
"Velocity": "Швидкість",
"Vertices": "Вершини",
"View navigator": "Навігатор виду",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Лише видимі тіла. Криві подаються відрізками (допуск 0,01 mm).",
"Volume": "Об'єм",
"Wall": "Стінка",
"Wall Location": "Розташування стінки",
@@ -718,7 +710,6 @@
"cmd.view_navigate": "Навігація видом",
"cmd.view_rename": "Перейменувати іменований вид",
"cmd.view_save": "Новий іменований вид",
- "command name": "назва команди",
"contact.components_count": "Компонентів: {count}",
"contact.enabled_label": "увімкнено",
"coupling.gear_1": "Шестерня 1",
@@ -770,7 +761,6 @@
"dxf.progress.write": "Запис DXF (5/5)",
"dxf.tolerance": "Допуск кривої",
"dxf.tolerance_help": "Лише видимі тіла. Криві подаються відрізками. Менший допуск дає точніші криві, але потребує більше часу й пам'яті.",
- "expression, e.g. 25 mm": "вираз, напр. 25 mm",
"fits the face, e.g. M8": "відповідає грані, напр. M8",
"from the rule": "з правила",
"help.apache": "Ліцензія Apache 2.0",
@@ -842,7 +832,6 @@
"nav.touchpad.zoom": "Масштаб (вертикальна прокрутка або стискання)",
"needs two joints": "потрібні два з'єднання",
"new configuration": "нова конфігурація",
- "new name": "нова назва",
"new parameter": "новий параметр",
"no hole": "без отвору",
"no interference": "немає перетинів",
@@ -862,10 +851,8 @@
"properties.title": "Властивості: {name}",
"render.background": "Фон сцени",
"render.fit": "Вписати виріб",
- "render.image_cancel": "Скасувати рендеринг",
"render.image_cancelled": "Рендеринг скасовано",
"render.image_cancelling": "Скасування",
- "render.image_check": "Перевірити запит на рендеринг",
"render.image_completed": "Зображення готове до експорту",
"render.image_encoding": "Кодування PNG",
"render.image_export": "Експортувати PNG",
@@ -946,7 +933,6 @@
"sketch_text.align_right": "Праворуч",
"sketch_text.bold": "Жирний",
"sketch_text.builtin_font": "{family} (вбудований)",
- "sketch_text.font_search": "Пошук шрифтів",
"sketch_text.italic": "Курсив",
"sketch_text.loading_fonts": "Пошук встановлених шрифтів…",
"sketch_text.on_path": "Текст дотримується своєї траєкторії: крива його розміщує",
@@ -976,9 +962,7 @@
"trace.stopped_by_loop": "Закінчується на відліку {sample}: контур через {joint} далі не замикається",
"ui.1_degree_of_freedom": "1 ступінь вільності",
"ui.3d_mouse_speed": "Швидкість 3D-миші",
- "ui.3d_mouse_windows": "3D-миша",
"ui.3d_sketch": "3D-ескіз",
- "ui.about": "Про програму",
"ui.activate": "Активувати",
"ui.active_component": "Активний компонент",
"ui.agent_chat": "Чат з агентом",
@@ -1044,7 +1028,6 @@
"ui.agent_chat_model_tip": "Модель, яку використовує агент. Ваш вибір запам'ятовується для цього агента.",
"ui.agent_chat_new": "Новий чат",
"ui.agent_chat_new_confirm": "Почати новий чат? Поточний буде очищено.",
- "ui.agent_chat_new_yes": "Новий чат",
"ui.agent_chat_next_picture": "Наступне зображення",
"ui.agent_chat_no_cli": "solidcraft-cli не знайдено поруч із програмою, тож агент не може дістатися до проєкту.",
"ui.agent_chat_no_control": "Кінцева точка чату з агентом не запустилася, тож агент не може дістатися до проєкту.",
@@ -1186,7 +1169,6 @@
"ui.anti_aliasing": "Згладжування",
"ui.apply": "Застосувати",
"ui.arc": "Дуга",
- "ui.assemble": "Скласти",
"ui.autosave_every": "Автозбереження кожні",
"ui.axes": "Осі",
"ui.axis": "Вісь",
@@ -1211,7 +1193,6 @@
"ui.chamfer": "Фаска",
"ui.chamfer_type": "Тип фаски",
"ui.change_workspace": "Змінити робочу область",
- "ui.chord_length": "Довжина хорди",
"ui.circle": "Коло",
"ui.circular_pattern": "Круговий масив",
"ui.clear": "Очистити",
@@ -1244,11 +1225,9 @@
"ui.command_done": "{command} виконано",
"ui.command_palette_hint": "Введіть команду, напр. {example} — або натисніть S для пошуку",
"ui.concentric": "Концентричність",
- "ui.configurations": "Конфігурації",
"ui.conic_curve": "Конічна крива",
"ui.constant": "Стала",
"ui.constraints_conflict": "Конфлікт обмежень",
- "ui.construct": "Побудувати",
"ui.construction": "Конструкційна",
"ui.context_menu": "Контекстне меню",
"ui.continuity_g0": "G0 злам",
@@ -1274,7 +1253,6 @@
"ui.cylinder": "Циліндр",
"ui.dark": "Темна",
"ui.default_modelling_orientation": "Типова орієнтація моделювання",
- "ui.degrees_of_freedom": "ступенів вільності",
"ui.delete": "Видалити",
"ui.depth": "Глибина",
"ui.design": "Проєкт",
@@ -1316,7 +1294,6 @@
"ui.equivalent_radius": "Еквівалентний радіус",
"ui.expand": "Розгорнути",
"ui.exportDxf": "Експорт DXF…",
- "ui.export_ellipsis": "Експорт...",
"ui.export_ellipsis_keymap": "Експорт…",
"ui.export_keymap_tip": "Клавіші, обрані в полі S і панель інструментів як файл",
"ui.extend": "Подовжити",
@@ -1406,7 +1383,6 @@
"ui.heading_sheet_metal": "ЛИСТОВИЙ МЕТАЛ",
"ui.heading_shell": "ОБОЛОНКА",
"ui.heading_sketch": "ЕСКІЗ",
- "ui.heading_sketch_palette": "ПАЛІТРА ЕСКІЗУ",
"ui.heading_sketch_scale": "МАСШТАБ ЕСКІЗУ",
"ui.heading_solid": "ТІЛО",
"ui.heading_sphere": "КУЛЯ",
@@ -1445,7 +1421,6 @@
"ui.length_decimals": "Знаки після коми для довжин",
"ui.light": "Світла",
"ui.line": "Пряма",
- "ui.linetype": "Тип лінії",
"ui.lock": "Заблокувати",
"ui.loft": "Лофт",
"ui.look_at": "Наведення",
@@ -1477,10 +1452,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF з мітками граней",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Середня точка",
"ui.mirror": "Дзеркало",
"ui.mirror_line": "Вісь дзеркала",
- "ui.modify": "Змінити",
"ui.move": "Перемістити",
"ui.multiple": "Кілька",
"ui.named_views": "Іменовані види",
@@ -1500,7 +1473,6 @@
"ui.offset_plane": "Зсунута площина",
"ui.one_side": "Один бік",
"ui.open": "Відкрити",
- "ui.open_ellipsis": "Відкрити...",
"ui.open_ends_tip": "Нічого не торкається",
"ui.open_preferences": "Відкрити налаштування",
"ui.open_recent": "Відкрити недавні",
@@ -1512,8 +1484,6 @@
"ui.origin": "Початок координат",
"ui.palette_construction_mode": "Допоміжний режим (X)",
"ui.palette_more": "Більше",
- "ui.palette_points": "Точки",
- "ui.palette_profile": "Профіль",
"ui.palette_sketch_options": "Параметри ескізу",
"ui.pan": "Панорамувати",
"ui.pan_zoom_orbit": "Панорамування, масштаб, обертання",
@@ -1548,7 +1518,6 @@
"ui.quit": "Вихід",
"ui.radial_context_menu": "Кругове контекстне меню",
"ui.radius": "Радіус",
- "ui.radius_type": "Тип радіуса",
"ui.rail": "Напрямна",
"ui.rail_fit": "Підгонка за напрямною",
"ui.reachable": "Досяжні",
@@ -1575,7 +1544,6 @@
"ui.right": "Справа",
"ui.save": "Зберегти",
"ui.save_as": "Зберегти як",
- "ui.save_as_ellipsis": "Зберегти як...",
"ui.save_mesh_no_slicer": "Слайсер не знайдено: виберіть «Власна…» і вкажіть свою програму-слайсер або вимкніть «Надіслати в слайсер»",
"ui.save_mesh_pick_bodies": "Виберіть тіла для збереження",
"ui.save_mesh_temp_failed": "Не вдалося створити {folder}: {error}",
@@ -1588,7 +1556,6 @@
"ui.select": "Вибрати",
"ui.selectOther": "Вибрати інше…",
"ui.selectTangentChain": "Вибрати дотичний ланцюг",
- "ui.select_other_hint": "Вибір іншого: утримуйте ліву кнопку нерухомо на моделі (або клацніть правою › Вибрати інше…), щоб побачити список усього під курсором; клацніть ще раз у тому ж місці, щоб вибрати наступний об'єкт там.",
"ui.selection": "Виділення",
"ui.send": "Надіслати",
"ui.send_to_slicer": "Надіслати в слайсер",
@@ -1605,7 +1572,6 @@
"ui.show_constraints": "Обмеження",
"ui.show_construction_geometries": "Конструкційна геометрія",
"ui.show_dimensions": "Розміри",
- "ui.show_points": "Показати точки",
"ui.show_profile": "Показати профіль",
"ui.show_projected_geometries": "Проєкційна геометрія",
"ui.simple": "Простий",
@@ -1615,7 +1581,6 @@
"ui.sketch_dimension": "Розмір ескізу",
"ui.sketch_grid": "Сітка ескізу",
"ui.sketch_scale": "Масштаб ескізу",
- "ui.sketch_status": "Стан ескізу",
"ui.sketches": "Ескізи",
"ui.slice": "Розріз",
"ui.slicer": "Слайсер",
@@ -1661,7 +1626,6 @@
"ui.stand_up_tip": "Після відкриття файлу STEP або IGES з напрямком Z вгору пропонувати поворот на чверть оберту навколо X",
"ui.start": "Початок",
"ui.start_over": "Почати спочатку",
- "ui.start_radius": "Початковий радіус",
"ui.stretch": "Розтягнути",
"ui.supersampling": "Наддискретизація (SSAA)",
"ui.supersampling_adaptive": "Лише коли вид нерухомий",
@@ -1709,7 +1673,6 @@
"ui.untitled": "Без назви",
"ui.up_axis_note": "Яка вісь спрямована вгору у видах (вид осі, головний, наведення). Проєкти не змінюються.",
"ui.updateToCurrentView": "Оновити до поточного виду",
- "ui.variable": "Змінна",
"ui.view_centre": "Центр виду",
"ui.visual_shaded_hidden_edges": "Затінений із прихованими ребрами",
"ui.visual_shaded_with_edges": "Затінений із ребрами",
@@ -1725,7 +1688,6 @@
"ui.zoom_to_the_cursor": "Масштабувати до курсора",
"update.available": "Доступна версія SolidCraft {version}",
"update.button": "Оновити",
- "update.button_tip": "Доступна версія SolidCraft {version}",
"update.button_version": "Оновити до {version}",
"update.check_automatically": "Автоматично перевіряти оновлення",
"update.check_now": "Перевірити зараз",
diff --git a/assets/locales/vi.json b/assets/locales/vi.json
index 623e5e3431..0f96cd0db6 100644
--- a/assets/locales/vi.json
+++ b/assets/locales/vi.json
@@ -5,7 +5,6 @@
"2. Attach your screenshot: copy and paste it, or save and upload the PNG.": "2. Đính kèm ảnh chụp màn hình: sao chép và dán, hoặc lưu và tải lên tệp PNG.",
"3. Click Submit new issue on GitHub to send your report.": "3. Nhấp vào 'Submit new issue' trên GitHub để gửi báo cáo.",
"A new configuration, a copy of the active one": "Cấu hình mới, sao chép từ cấu hình hiện tại",
- "AI": "AI",
"About SolidCraft": "Giới thiệu SolidCraft",
"Acceleration": "Gia tốc",
"Active": "Đang kích hoạt",
@@ -59,7 +58,6 @@
"Component1": "Cụm chi tiết 1",
"Configuration": "Cấu hình",
"Configuration rules": "Quy tắc cấu hình",
- "Construction": "Đường dựng hình (nét đứt)",
"Contact": "Tiếp xúc",
"Contact sets": "Tập hợp tiếp xúc",
"Continuity": "Độ liên tục",
@@ -84,7 +82,6 @@
"Delete rule": "Xóa quy tắc",
"Delete the row": "Xóa hàng",
"Delete the set": "Xóa tập hợp",
- "Delete this parameter": "Xóa tham số này",
"Density": "Khối lượng riêng",
"Designs you open or save appear here.": "Các thiết kế bạn mở hoặc lưu sẽ xuất hiện tại đây.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Được xác định theo Đến đối tượng (To Object). Chọn Góc để chỉnh sửa góc mở rộng.",
@@ -116,7 +113,6 @@
"Files from many CAD programs have Y up, so they open lying on their back here (Z up).": "Tệp từ nhiều phần mềm CAD có trục Y hướng lên, nên khi mở ở đây (trục Z hướng lên) mô hình sẽ nằm ngang.",
"Filter": "Bộ lọc",
"Find in Browser": "Tìm trong cây đối tượng",
- "Flat": "Trải phẳng",
"Flat size": "Kích thước phôi phẳng",
"Follow camera (Look At sketches)": "Đi theo camera (Nhìn vuông góc phác thảo)",
"Follow the camera (Look At sketches)": "Đi theo camera (Nhìn vuông góc phác thảo)",
@@ -166,7 +162,6 @@
"No matching appearances": "Không có màu sắc/vật liệu phù hợp",
"No visible bodies to export.": "Không có thân khối hiển thị nào để xuất.",
"None": "Không có",
- "Normal to sketch": "Vuông góc với phác thảo",
"Not available yet": "Chưa khả dụng",
"Notch": "Rãnh khía chữ V",
"Opacity": "Độ mờ đục",
@@ -175,7 +170,6 @@
"Other side": "Phía bên kia",
"Outside": "Bên ngoài",
"Overall length": "Chiều dài tổng thể",
- "Parameter values": "Giá trị tham số",
"Pass through": "Đi xuyên qua",
"Path": "Đường dẫn",
"Per Edge": "Theo từng cạnh",
@@ -193,7 +187,6 @@
"Preview Row": "Xem trước hàng",
"Preview leaves the current design unchanged.": "Xem trước giữ nguyên thiết kế hiện tại không đổi.",
"Profiles/Curves": "Biên dạng / Đường cong",
- "Projection": "Phép chiếu",
"Quantity": "Số lượng",
"RECENT": "GẦN ĐÂY",
"RULED SURFACE": "MẶT KẺ (RULED SURFACE)",
@@ -294,7 +287,6 @@
"Velocity": "Vận tốc",
"Vertices": "Các đỉnh",
"View navigator": "Khối điều hướng góc nhìn",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "Chỉ các thân khối hiển thị. Đường cong sử dụng các đoạn thẳng (dung sai 0,01 mm).",
"Volume": "Thể tích",
"Wall": "Thành vách",
"Wall Location": "Vị trí thành vách",
@@ -640,7 +632,6 @@
"cmd.view_navigate": "Điều hướng góc nhìn",
"cmd.view_rename": "Đổi tên góc nhìn đã lưu",
"cmd.view_save": "Tạo góc nhìn đã lưu mới",
- "command name": "tên lệnh",
"coupling.gear_1": "Bánh răng 1",
"coupling.gear_1_pick": "Bánh răng 1 (tùy chọn)",
"coupling.gear_2": "Bánh răng 2",
@@ -687,7 +678,6 @@
"dxf.progress.write": "Đang ghi tệp DXF (5/5)",
"dxf.tolerance": "Dung sai đường cong",
"dxf.tolerance_help": "Chỉ áp dụng cho các thân khối hiển thị. Đường cong sử dụng các đoạn thẳng. Dung sai nhỏ hơn cho đường cong mịn hơn nhưng tốn nhiều thời gian và bộ nhớ hơn.",
- "expression, e.g. 25 mm": "biểu thức, ví dụ: 25 mm",
"fits the face, e.g. M8": "vừa khít bề mặt, ví dụ M8",
"from the rule": "từ quy tắc",
"home.documentation": "Tài liệu hướng dẫn",
@@ -730,7 +720,6 @@
"nav.touchpad.zoom": "Thu phóng (cuộn dọc hoặc chụm ngón tay)",
"needs two joints": "cần hai khớp nối",
"new configuration": "cấu hình mới",
- "new name": "tên mới",
"new parameter": "tham số mới",
"no hole": "không có lỗ",
"no interference": "không có giao thoa",
@@ -746,10 +735,8 @@
"pick one or two vertices, edges or faces": "chọn một hoặc hai đỉnh, cạnh hoặc bề mặt",
"render.background": "Hình nền khung cảnh",
"render.fit": "Thu phóng vừa sản phẩm",
- "render.image_cancel": "Hủy bỏ Kết xuất hình ảnh",
"render.image_cancelled": "Đã hủy kết xuất hình ảnh",
"render.image_cancelling": "Đang hủy…",
- "render.image_check": "Kiểm tra yêu cầu kết xuất",
"render.image_completed": "Hình ảnh đã sẵn sàng để xuất",
"render.image_encoding": "Đang mã hóa PNG",
"render.image_export": "Xuất tệp PNG",
@@ -816,7 +803,6 @@
"sketch_text.align_right": "Phải",
"sketch_text.bold": "In đậm",
"sketch_text.builtin_font": "{family} (tích hợp sẵn)",
- "sketch_text.font_search": "Tìm kiếm phông chữ",
"sketch_text.italic": "In nghiêng",
"sketch_text.loading_fonts": "Đang tìm kiếm các phông chữ đã cài đặt…",
"sketch_text.on_path": "Văn bản đi theo đường dẫn: đường cong định vị văn bản",
@@ -845,9 +831,7 @@
"trace.stopped_by_loop": "Kết thúc tại mẫu {sample}: vòng lặp qua {joint} không thể khép kín thêm được nữa",
"ui.1_degree_of_freedom": "1 bậc tự do",
"ui.3d_mouse_speed": "Tốc độ chuột 3D",
- "ui.3d_mouse_windows": "Chuột 3D",
"ui.3d_sketch": "3D Phác thảo",
- "ui.about": "Thông tin phiên bản",
"ui.activate": "Kích hoạt",
"ui.active_component": "Cụm chi tiết đang kích hoạt",
"ui.agent_chat": "Trò chuyện với AI Agent",
@@ -913,7 +897,6 @@
"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.",
- "ui.agent_chat_new_yes": "Cuộc trò chuyện mới",
"ui.agent_chat_no_cli": "Không tìm thấy solidcraft-cli cạnh ứng dụng, vì vậy AI Agent không thể truy cập thiết kế.",
"ui.agent_chat_no_control": "Điểm cuối trò chuyện của tác tử không thể khởi động, vì vậy AI Agent không thể truy cập thiết kế.",
"ui.agent_chat_no_images": "AI Agent này không hỗ trợ tiếp nhận hình ảnh",
@@ -1049,7 +1032,6 @@
"ui.anti_aliasing": "Khử răng cưa",
"ui.apply": "Áp dụng",
"ui.arc": "Cung tròn",
- "ui.assemble": "Lắp ráp",
"ui.autosave_every": "Tự động lưu sau mỗi",
"ui.axes": "Các trục",
"ui.axis": "Trục",
@@ -1068,7 +1050,6 @@
"ui.chamfer": "Vát mép",
"ui.chamfer_type": "Kiểu vát mép",
"ui.change_workspace": "Đổi không gian làm việc",
- "ui.chord_length": "Chiều dài dây cung",
"ui.circle": "Hình tròn",
"ui.circular_pattern": "Mảng tròn quanh trục",
"ui.clear": "Xóa",
@@ -1101,11 +1082,9 @@
"ui.command_done": "Hoàn tất lệnh {command}",
"ui.command_palette_hint": "Nhập một lệnh, ví dụ: {example} — hoặc nhấn S để tìm kiếm",
"ui.concentric": "Đồng tâm",
- "ui.configurations": "Các cấu hình",
"ui.conic_curve": "Đường cong Conic",
"ui.constant": "Hằng số",
"ui.constraints_conflict": "Xung đột ràng buộc",
- "ui.construct": "Dựng hình",
"ui.construction": "Đường gióng dựng hình",
"ui.context_menu": "Menu ngữ cảnh",
"ui.continuity_g0": "Nếp gập G0",
@@ -1131,7 +1110,6 @@
"ui.cylinder": "Hình trụ",
"ui.dark": "Tối",
"ui.default_modelling_orientation": "Hướng mô hình hóa mặc định",
- "ui.degrees_of_freedom": "bậc tự do",
"ui.delete": "Xóa",
"ui.depth": "Độ sâu",
"ui.design": "Thiết kế",
@@ -1173,7 +1151,6 @@
"ui.equivalent_radius": "Bán kính tương đương",
"ui.expand": "Mở rộng",
"ui.exportDxf": "Xuất tệp DXF…",
- "ui.export_ellipsis": "Xuất tệp...",
"ui.export_ellipsis_keymap": "Xuất tệp…",
"ui.export_keymap_tip": "Xuất phím tắt, danh sách S box yêu thích và thanh công cụ ra tệp",
"ui.extend": "Kéo dài đường",
@@ -1263,7 +1240,6 @@
"ui.heading_sheet_metal": "KIM LOẠI TẤM",
"ui.heading_shell": "TẠO VỎ MỎNG",
"ui.heading_sketch": "PHÁC THẢO",
- "ui.heading_sketch_palette": "BẢNG ĐIỀU KHIỂN PHÁC THẢO",
"ui.heading_sketch_scale": "TỶ LỆ PHÁC THẢO",
"ui.heading_solid": "KHỐI ĐẶC",
"ui.heading_sphere": "HÌNH CẦU",
@@ -1301,7 +1277,6 @@
"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",
- "ui.linetype": "Kiểu đường nét",
"ui.lock": "Khóa",
"ui.loft": "Vuốt nối biên dạng (Loft)",
"ui.look_at": "Nhìn trực diện",
@@ -1333,10 +1308,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "3MF kèm thẻ bề mặt",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "Trung điểm",
"ui.mirror": "Lấy đối xứng",
"ui.mirror_line": "Đường đối xứng",
- "ui.modify": "Hiệu chỉnh",
"ui.move": "Di chuyển",
"ui.multiple": "Nhiều đối tượng",
"ui.named_views": "Các góc nhìn đã đặt tên",
@@ -1356,7 +1329,6 @@
"ui.offset_plane": "Mặt phẳng song song cách khoảng (Offset Plane)",
"ui.one_side": "Một phía",
"ui.open": "Mở tệp",
- "ui.open_ellipsis": "Mở tệp...",
"ui.open_ends_tip": "Không chạm vào đối tượng nào",
"ui.open_preferences": "Mở tệp Tùy chọn cài đặt",
"ui.open_recent": "Mở tệp gần đây",
@@ -1366,8 +1338,6 @@
"ui.orbit_around": "Xoay quanh",
"ui.orientation": "Định hướng",
"ui.origin": "Gốc tọa độ",
- "ui.palette_points": "Điểm",
- "ui.palette_profile": "Biên dạng",
"ui.pan": "Dời góc nhìn (Pan)",
"ui.pan_zoom_orbit": "Dời góc nhìn, thu phóng, xoay quanh tâm",
"ui.parallel": "Song song",
@@ -1401,7 +1371,6 @@
"ui.quit": "Thoát ứng dụng",
"ui.radial_context_menu": "Menu ngữ cảnh dạng vòng (Radial)",
"ui.radius": "Bán kính",
- "ui.radius_type": "Loại bán kính",
"ui.rail": "Đường ray dẫn hướng",
"ui.rail_fit": "Độ khớp đường dẫn (Rail Fit)",
"ui.reachable": "Có thể tiếp cận",
@@ -1426,7 +1395,6 @@
"ui.right": "Phải (Hình chiếu cạnh)",
"ui.save": "Lưu",
"ui.save_as": "Lưu thành tệp mới",
- "ui.save_as_ellipsis": "Lưu thành...",
"ui.save_mesh_no_slicer": "Không tìm thấy phần mềm cắt lớp (slicer): hãy chọn Tùy chỉnh… và chỉ định chương trình cắt lớp, hoặc tắt tùy chọn Gửi đến slicer",
"ui.save_mesh_pick_bodies": "Chọn các thân khối cần lưu",
"ui.save_mesh_temp_failed": "Không thể tạo thư mục {folder}: {error}",
@@ -1439,7 +1407,6 @@
"ui.select": "Chọn",
"ui.selectOther": "Chọn đối tượng khác…",
"ui.selectTangentChain": "Chọn chuỗi tiếp tuyến",
- "ui.select_other_hint": "Chọn đối tượng khác: giữ nút chuột trái đứng yên trên mô hình (hoặc nhấp chuột phải › Chọn đối tượng khác…) để liệt kê mọi đối tượng dưới con trỏ; nhấp lại vào cùng vị trí đó để chọn đối tượng kế tiếp.",
"ui.selection": "Vùng chọn",
"ui.send": "Gửi",
"ui.send_to_slicer": "Gửi sang phần mềm cắt lát (Slicer)",
@@ -1456,7 +1423,6 @@
"ui.show_constraints": "Các ràng buộc",
"ui.show_construction_geometries": "Đối tượng dựng hình (nét đứt)",
"ui.show_dimensions": "Các kích thước",
- "ui.show_points": "Hiển thị điểm",
"ui.show_profile": "Hiển thị biên dạng",
"ui.show_projected_geometries": "Hình học đã chiếu",
"ui.simple": "Đơn giản",
@@ -1466,7 +1432,6 @@
"ui.sketch_dimension": "Phác thảo Kích thước",
"ui.sketch_grid": "Lưới phác thảo",
"ui.sketch_scale": "Tỷ lệ phác thảo",
- "ui.sketch_status": "Trạng thái phác thảo",
"ui.sketches": "Các phác thảo",
"ui.slice": "Cắt lát",
"ui.slicer": "Phần mềm cắt lát (Slicer)",
@@ -1485,7 +1450,6 @@
"ui.split_body": "Chia tách khối",
"ui.stand_up_tip": "Sau khi mở tệp STEP hoặc IGES với trục Z hướng lên, đề xuất xoay 90° quanh trục X",
"ui.start": "Bắt đầu",
- "ui.start_radius": "Bán kính bắt đầu",
"ui.stretch": "Kéo giãn",
"ui.supersampling": "Khử răng cưa SSAA",
"ui.supersampling_adaptive": "Chỉ khi góc nhìn đứng yên",
@@ -1533,7 +1497,6 @@
"ui.untitled": "Chưa đặt tên",
"ui.up_axis_note": "Trục nào hướng lên trên trong các góc nhìn (góc nhìn theo trục, Chuẩn, Nhìn thẳng). Các mô hình thiết kế không bị thay đổi.",
"ui.updateToCurrentView": "Cập nhật theo góc nhìn hiện tại",
- "ui.variable": "Biến thiên",
"ui.view_centre": "Tâm góc nhìn",
"ui.visual_shaded_hidden_edges": "Tô bóng kèm nét khuất",
"ui.visual_shaded_with_edges": "Tô bóng kèm hiển thị cạnh",
@@ -1549,7 +1512,6 @@
"ui.zoom_to_the_cursor": "Thu phóng theo con trỏ chuột",
"update.available": "Đã có phiên bản SolidCraft {version}",
"update.button": "Cập nhật",
- "update.button_tip": "Đã có phiên bản SolidCraft {version}",
"update.button_version": "Cập nhật lên {version}",
"update.check_automatically": "Tự động kiểm tra bản cập nhật",
"update.check_now": "Kiểm tra ngay",
diff --git a/assets/locales/zh.json b/assets/locales/zh.json
index 671335734c..95c61608d5 100644
--- a/assets/locales/zh.json
+++ b/assets/locales/zh.json
@@ -6,7 +6,6 @@
"2D": "2D",
"3. Click Submit new issue on GitHub to send your report.": "3. 在 GitHub 上点击 Submit new issue 发送报告。",
"A new configuration, a copy of the active one": "新建配置,为当前配置的副本",
- "AI": "AI",
"ARRANGE": "排列",
"About SolidCraft": "关于 SolidCraft",
"Acceleration": "加速度",
@@ -81,7 +80,6 @@
"Config Table": "配置表",
"Configuration": "配置",
"Configuration rules": "配置规则",
- "Construction": "构造",
"Contact": "接触",
"Contact Sets": "接触集",
"Contact sets": "接触集",
@@ -110,7 +108,6 @@
"Delete rule": "删除规则",
"Delete the row": "删除此行",
"Delete the set": "删除此集合",
- "Delete this parameter": "删除此参数",
"Density": "密度",
"Dependents": "依赖项",
"Designs you open or save appear here.": "你打开或保存的设计会显示在此处。",
@@ -157,7 +154,6 @@
"Filter": "筛选",
"Find in Browser": "在浏览器中查找",
"Finish": "完成",
- "Flat": "平面",
"Flat Pattern": "展开图",
"Flat size": "平板尺寸",
"Follow camera (Look At sketches)": "跟随相机(注视草图)",
@@ -238,7 +234,6 @@
"No matching appearances": "没有匹配的外观",
"No visible bodies to export.": "没有可导出的可见实体。",
"None": "无",
- "Normal to sketch": "垂直于草图",
"Not available yet": "暂不可用",
"Notch": "缺口",
"OUTPUT": "输出",
@@ -253,7 +248,6 @@
"Overall length": "总长",
"Param. Graph": "参数图",
"Parameter": "参数",
- "Parameter values": "参数值",
"Parts": "零件",
"Pass through": "通过点",
"Path": "路径",
@@ -274,7 +268,6 @@
"Preview Row": "预览行",
"Preview leaves the current design unchanged.": "预览不会更改当前设计。",
"Profiles/Curves": "轮廓/曲线",
- "Projection": "投影",
"Quantity": "物理量",
"RECENT": "最近使用",
"REFERENCE": "参考",
@@ -401,7 +394,6 @@
"Velocity": "速度",
"Vertices": "顶点",
"View navigator": "视图导航器",
- "Visible bodies only. Curves use line segments (0.01 mm tolerance).": "仅导出可见实体。曲线以线段近似(公差0.01毫米)。",
"Volume": "体积",
"Wall": "壁厚",
"Wall Location": "壁位置",
@@ -768,7 +760,6 @@
"cmd.view_navigate": "导航视图",
"cmd.view_rename": "重命名命名视图",
"cmd.view_save": "新建命名视图",
- "command name": "命令名称",
"contact.components_count": "{count} 个组件",
"contact.enabled_label": "已启用",
"coupling.gear_1": "齿轮 1",
@@ -834,7 +825,6 @@
"dxf.progress.write": "正在写入 DXF (5/5)",
"dxf.tolerance": "曲线公差",
"dxf.tolerance_help": "仅导出可见实体。曲线使用直线段近似。公差越小,曲线越精细,但需要更多时间和内存。",
- "expression, e.g. 25 mm": "表达式,例如 25 mm",
"file_load.built": "已构建:{built}/{total} 个特征。",
"file_load.converting": "正在转换实体 {done}/{total}",
"file_load.inserting": "正在插入几何体",
@@ -937,7 +927,6 @@
"nav.touchpad.zoom": "缩放(垂直滚动或双指捏合)",
"needs two joints": "需要两个接头",
"new configuration": "新配置",
- "new name": "新名称",
"new parameter": "新参数",
"no hole": "无孔",
"no interference": "无干涉",
@@ -963,10 +952,8 @@
"recovery.never_saved": "从未保存",
"render.background": "场景背景",
"render.fit": "适配产品视图",
- "render.image_cancel": "取消渲染",
"render.image_cancelled": "渲染已取消",
"render.image_cancelling": "正在取消",
- "render.image_check": "检查渲染请求",
"render.image_completed": "图像可导出",
"render.image_encoding": "正在编码 PNG",
"render.image_export": "导出 PNG",
@@ -1047,7 +1034,6 @@
"sketch_text.align_right": "右对齐",
"sketch_text.bold": "粗体",
"sketch_text.builtin_font": "{family}(内置)",
- "sketch_text.font_search": "搜索字体",
"sketch_text.italic": "斜体",
"sketch_text.loading_fonts": "正在查找已安装字体…",
"sketch_text.on_path": "文字沿路径排列:由曲线放置",
@@ -1077,9 +1063,7 @@
"trace.stopped_by_loop": "在采样 {sample} 处结束:经过 {joint} 的环路无法再闭合",
"ui.1_degree_of_freedom": "1 个自由度",
"ui.3d_mouse_speed": "3D 鼠标速度",
- "ui.3d_mouse_windows": "3D 鼠标",
"ui.3d_sketch": "3D 草图",
- "ui.about": "关于",
"ui.activate": "激活",
"ui.active_component": "活动组件",
"ui.agent_chat": "智能体聊天",
@@ -1146,7 +1130,6 @@
"ui.agent_chat_model_tip": "智能体使用的模型。你的选择会为此智能体记住。",
"ui.agent_chat_new": "新对话",
"ui.agent_chat_new_confirm": "开始新对话?当前对话将被清除。",
- "ui.agent_chat_new_yes": "新对话",
"ui.agent_chat_next_picture": "下一张图片",
"ui.agent_chat_no_cli": "在应用旁边未找到 solidcraft-cli,因此智能体无法访问设计。",
"ui.agent_chat_no_control": "智能体聊天的端点未能启动,因此智能体无法访问设计。",
@@ -1288,7 +1271,6 @@
"ui.anti_aliasing": "抗锯齿",
"ui.apply": "应用",
"ui.arc": "圆弧",
- "ui.assemble": "装配",
"ui.assistant": "助手",
"ui.assistant_waiting": "{count} 个批准请求等待中",
"ui.autosave_every": "自动保存间隔",
@@ -1315,7 +1297,6 @@
"ui.chamfer": "倒角",
"ui.chamfer_type": "倒角类型",
"ui.change_workspace": "更改工作区",
- "ui.chord_length": "弦长",
"ui.circle": "圆",
"ui.circular_pattern": "圆形阵列",
"ui.clear": "清除",
@@ -1348,11 +1329,9 @@
"ui.command_done": "{command} 完成",
"ui.command_palette_hint": "输入命令,例如 {example} — 或按 S 搜索",
"ui.concentric": "同心",
- "ui.configurations": "配置",
"ui.conic_curve": "圆锥曲线",
"ui.constant": "恒定",
"ui.constraints_conflict": "约束冲突",
- "ui.construct": "构造",
"ui.construction": "构造",
"ui.context_menu": "上下文菜单",
"ui.continuity_g0": "G0 折痕",
@@ -1378,7 +1357,6 @@
"ui.cylinder": "圆柱体",
"ui.dark": "深色",
"ui.default_modelling_orientation": "默认建模方向",
- "ui.degrees_of_freedom": "自由度",
"ui.delete": "删除",
"ui.depth": "深度",
"ui.design": "设计",
@@ -1420,7 +1398,6 @@
"ui.equivalent_radius": "等效半径",
"ui.expand": "展开",
"ui.exportDxf": "导出 DXF…",
- "ui.export_ellipsis": "导出...",
"ui.export_ellipsis_keymap": "导出…",
"ui.export_keymap_tip": "将按键、S 框收藏和工具栏导出为文件",
"ui.extend": "延伸",
@@ -1510,7 +1487,6 @@
"ui.heading_sheet_metal": "钣金",
"ui.heading_shell": "抽壳",
"ui.heading_sketch": "草图",
- "ui.heading_sketch_palette": "草图面板",
"ui.heading_sketch_scale": "草图缩放",
"ui.heading_solid": "实体",
"ui.heading_sphere": "球体",
@@ -1549,7 +1525,6 @@
"ui.length_decimals": "长度小数位",
"ui.light": "浅色",
"ui.line": "直线",
- "ui.linetype": "线型",
"ui.lock": "锁定",
"ui.loft": "放样",
"ui.look_at": "朝向",
@@ -1583,10 +1558,8 @@
"ui.mesh_format_3mf": "3MF",
"ui.mesh_format_3mf_tagged": "带面标签的 3MF",
"ui.mesh_format_stl": "STL",
- "ui.midpoint": "中点",
"ui.mirror": "镜像",
"ui.mirror_line": "镜像线",
- "ui.modify": "修改",
"ui.move": "移动",
"ui.multiple": "多个",
"ui.named_views": "命名视图",
@@ -1607,7 +1580,6 @@
"ui.offset_plane": "偏移平面",
"ui.one_side": "单侧",
"ui.open": "打开",
- "ui.open_ellipsis": "打开...",
"ui.open_ends_tip": "未接触任何曲线",
"ui.open_preferences": "打开首选项",
"ui.open_recent": "打开最近",
@@ -1619,8 +1591,6 @@
"ui.origin": "原点",
"ui.palette_construction_mode": "构造模式 (X)",
"ui.palette_more": "更多",
- "ui.palette_points": "点",
- "ui.palette_profile": "轮廓",
"ui.palette_sketch_options": "草图选项",
"ui.pan": "平移",
"ui.pan_zoom_orbit": "平移、缩放、环绕",
@@ -1662,7 +1632,6 @@
"ui.quit": "退出",
"ui.radial_context_menu": "环形上下文菜单",
"ui.radius": "半径",
- "ui.radius_type": "半径类型",
"ui.rail": "导轨",
"ui.rail_fit": "导轨适配方式",
"ui.reachable": "可到达",
@@ -1695,7 +1664,6 @@
"ui.right": "右视",
"ui.save": "保存",
"ui.save_as": "另存为",
- "ui.save_as_ellipsis": "另存为...",
"ui.save_mesh_no_slicer": "未找到切片软件:请选择“自定义…”并指定切片软件程序,或关闭“发送到切片软件”",
"ui.save_mesh_pick_bodies": "请选择要保存的实体",
"ui.save_mesh_temp_failed": "无法创建 {folder}:{error}",
@@ -1708,7 +1676,6 @@
"ui.select": "选择",
"ui.selectOther": "选择其他…",
"ui.selectTangentChain": "选择相切链",
- "ui.select_other_hint": "“选择其他”:在模型上按住左键(或右键单击 › 选择其他…)列出光标下的所有对象;在同一位置再次单击可选择该处的下一个对象。",
"ui.selection": "选择",
"ui.selection_modifiers": "选择修饰键",
"ui.selection_shift_add_only": "Shift+点击仅添加、不取消选择",
@@ -1728,7 +1695,6 @@
"ui.show_constraints": "约束",
"ui.show_construction_geometries": "构造几何图元",
"ui.show_dimensions": "尺寸",
- "ui.show_points": "显示点",
"ui.show_profile": "显示轮廓",
"ui.show_projected_geometries": "投影几何",
"ui.simple": "简单",
@@ -1739,7 +1705,6 @@
"ui.sketch_grid": "草图网格",
"ui.sketch_modifiers": "草图修饰键",
"ui.sketch_scale": "草图比例",
- "ui.sketch_status": "草图状态",
"ui.sketches": "草图",
"ui.slice": "切片",
"ui.slicer": "切片软件",
@@ -1786,7 +1751,6 @@
"ui.start": "开始",
"ui.start_over": "重新开始",
"ui.start_page": "起始页",
- "ui.start_radius": "起始半径",
"ui.stretch": "伸展",
"ui.supersampling": "超级采样 (SSAA)",
"ui.supersampling_adaptive": "仅在视图静止时",
@@ -1836,7 +1800,6 @@
"ui.untitled": "无标题",
"ui.up_axis_note": "视图中朝上的轴(轴视图、主视图、注视)。设计本身不变。",
"ui.updateToCurrentView": "更新为当前视图",
- "ui.variable": "变量",
"ui.view_centre": "视图中心",
"ui.visual_shaded_hidden_edges": "带隐藏边的着色",
"ui.visual_shaded_with_edges": "带边着色",
@@ -1864,7 +1827,6 @@
"ui.zoom_to_the_cursor": "缩放到光标",
"update.available": "SolidCraft {version} 已发布",
"update.button": "更新",
- "update.button_tip": "SolidCraft {version} 已发布",
"update.button_version": "更新到 {version}",
"update.check_automatically": "自动检查更新",
"update.check_now": "立即检查",
diff --git a/crates/ui-egui/src/agent_chat/panel.rs b/crates/ui-egui/src/agent_chat/panel.rs
index 1003f2885b..4b9c7ef9d4 100644
--- a/crates/ui-egui/src/agent_chat/panel.rs
+++ b/crates/ui-egui/src/agent_chat/panel.rs
@@ -186,9 +186,9 @@ fn gallery_window(app: &mut SolveApp, ctx: &egui::Context) {
let modal = egui::Modal::new(Id::new("sc_agent_chat_gallery")).show(ctx, |ui| {
ui.set_max_width(max.x);
ui.horizontal(|ui| {
- let prev = ui_kit::enabled_button(ui, tr("ui.agent_chat_previous_picture"), count > 1);
+ let prev = ui_kit::button(ui, tr("ui.agent_chat_previous_picture"), ui_kit::Button::Enabled(count > 1));
crate::scenario::publish_handle("agent_chat:gallery_prev", prev.rect.center());
- let next = ui_kit::enabled_button(ui, tr("ui.agent_chat_next_picture"), count > 1);
+ let next = ui_kit::button(ui, tr("ui.agent_chat_next_picture"), ui_kit::Button::Enabled(count > 1));
crate::scenario::publish_handle("agent_chat:gallery_next", next.rect.center());
if prev.clicked() {
step = -1;
@@ -505,9 +505,9 @@ fn header(app: &mut SolveApp, ui: &mut egui::Ui, left: bool) {
#[cfg(not(target_arch = "wasm32"))]
{
let b = if state.running() {
- ui_kit::secondary_button(ui, tr("ui.agent_chat_stop")).on_hover_text(tr("ui.agent_chat_stop_tip"))
+ 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::secondary_button(ui, tr("ui.agent_chat_connect"))
+ 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() {
@@ -582,14 +582,14 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::Ui) {
if app.agent_chat.confirm_new {
ui_kit::scope(ui, |ui| {
ui.set_width(ui.available_width());
- ui_kit::text_block(ui, "new_chat", tr("ui.agent_chat_new_confirm"), false);
+ ui_kit::text(ui, tr("ui.agent_chat_new_confirm"), ui_kit::Text::Report("new_chat", false));
ui.horizontal(|ui| {
- let yes = ui_kit::secondary_button(ui, tr("ui.agent_chat_new_yes"));
+ let yes = ui_kit::button(ui, tr("ui.agent_chat_new"), ui_kit::Button::Normal);
crate::scenario::publish_handle("agent_chat:new_confirm", yes.rect.center());
if yes.clicked() {
new_chat(app);
}
- if ui_kit::secondary_button(ui, tr("ui.agent_chat_cancel")).clicked() {
+ if ui_kit::button(ui, tr("ui.agent_chat_cancel"), ui_kit::Button::Normal).clicked() {
app.agent_chat.confirm_new = false;
}
});
@@ -651,7 +651,7 @@ fn desktop_body(app: &mut SolveApp, ui: &mut egui::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::enabled_button(ui, tr(if busy { "ui.agent_chat_queue" } else { "ui.agent_chat_send" }), !reading)
+ 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();
@@ -820,19 +820,19 @@ fn picker(app: &mut SolveApp, ui: &mut egui::Ui) {
let all = agents::entries(app);
let current = agents::current(app);
ui.horizontal(|ui| {
- ui_kit::inline_text(ui, tr("ui.agent_chat_pick"));
+ ui_kit::text(ui, tr("ui.agent_chat_pick"), ui_kit::Text::Inline);
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
let refreshing = app.agent_chat.detecting.is_some();
- if ui_kit::enabled_button(ui, tr("ui.agent_chat_refresh"), !refreshing).clicked() {
+ if ui_kit::button(ui, tr("ui.agent_chat_refresh"), ui_kit::Button::Enabled(!refreshing)).clicked() {
refresh(app, ui.ctx());
}
- if ui_kit::small_button(ui, tr("ui.ai_add_agent")).clicked() {
+ if ui_kit::button(ui, tr("ui.ai_add_agent"), ui_kit::Button::Small).clicked() {
super::settings::open_add(app);
}
});
});
if app.agent_chat.detecting.is_some() {
- ui_kit::note(ui, "detecting", tr("ui.agent_chat_detecting"));
+ ui_kit::text(ui, tr("ui.agent_chat_detecting"), ui_kit::Text::Note("detecting"));
}
for e in &all {
let selected = current.as_ref().is_some_and(|c| c.id == e.id);
@@ -848,12 +848,12 @@ fn picker(app: &mut SolveApp, ui: &mut egui::Ui) {
ui_kit::section(ui, "sc_agent_missing", heading, all.is_empty(), |ui| {
for m in missing {
ui.horizontal(|ui| {
- ui_kit::inline_text(ui, m.name);
- if ui_kit::small_button(ui, tr("ui.agent_chat_copy")).on_hover_text(m.install).clicked() {
+ ui_kit::text(ui, m.name, ui_kit::Text::Inline);
+ if ui_kit::button(ui, tr("ui.agent_chat_copy"), ui_kit::Button::Small).on_hover_text(m.install).clicked() {
ui.ctx().copy_text(m.install.to_string());
}
});
- ui_kit::text_block(ui, m.name, m.install, false);
+ ui_kit::text(ui, m.install, ui_kit::Text::Report(m.name, false));
}
});
}
@@ -863,41 +863,45 @@ fn picker(app: &mut SolveApp, ui: &mut egui::Ui) {
fn auth_box(app: &mut SolveApp, ui: &mut egui::Ui) {
ui_kit::section(ui, "authentication", tr("ui.agent_chat_auth_title"), true, |ui| {
ui.set_width(ui.available_width());
- ui_kit::note(ui, "auth_needed", tr("ui.agent_chat_auth_needed"));
+ ui_kit::text(ui, tr("ui.agent_chat_auth_needed"), ui_kit::Text::Note("auth_needed"));
let methods = app.agent_chat.auth.clone();
let base = app.agent_chat.argv.iter().map(|a| quote(a)).collect::<Vec<_>>().join(" ");
if methods.is_empty() {
- ui_kit::note(ui, "auth_none", tr("ui.agent_chat_auth_none"));
+ ui_kit::text(ui, tr("ui.agent_chat_auth_none"), ui_kit::Text::Note("auth_none"));
}
for m in methods {
ui.add_space(crate::theme::Tokens::get().space_4);
let desc = m.description.trim();
- ui_kit::text_block(ui, &m.id, &if desc.is_empty() || desc == m.name { m.name.clone() } else { format!("{} — {desc}", m.name) }, false);
+ ui_kit::text(
+ ui,
+ &if desc.is_empty() || desc == m.name { m.name.clone() } else { format!("{} — {desc}", m.name) },
+ ui_kit::Text::Report(&m.id, false),
+ );
match &m.kind {
acp::AuthKind::Terminal { args, .. } => {
- ui_kit::note(ui, "terminal", tr("ui.agent_chat_auth_terminal"));
+ ui_kit::text(ui, tr("ui.agent_chat_auth_terminal"), ui_kit::Text::Note("terminal"));
let cmd = format!("{base} {}", args.iter().map(|a| quote(a)).collect::<Vec<_>>().join(" "));
ui.horizontal_wrapped(|ui| {
- ui_kit::text_block(ui, "auth_command", &cmd, false);
- if ui_kit::small_button(ui, tr("ui.agent_chat_copy")).clicked() {
+ ui_kit::text(ui, &cmd, ui_kit::Text::Report("auth_command", false));
+ if ui_kit::button(ui, tr("ui.agent_chat_copy"), ui_kit::Button::Small).clicked() {
ui.ctx().copy_text(cmd.clone());
}
});
}
acp::AuthKind::Agent => {
- let b = ui_kit::secondary_button(ui, trf("ui.agent_chat_auth_agent", &[("name", &m.name)]));
+ let b = ui_kit::button(ui, trf("ui.agent_chat_auth_agent", &[("name", &m.name)]), ui_kit::Button::Normal);
crate::scenario::publish_handle(&format!("agent_chat:auth:{}", m.id), b.rect.center());
if b.clicked() {
app.agent_chat.authenticate(&m.id);
}
}
acp::AuthKind::EnvVar { vars } => {
- ui_kit::text_block(ui, "auth_environment", &trf("ui.agent_chat_auth_env", &[("vars", &vars.join(", "))]), false);
+ ui_kit::text(ui, &trf("ui.agent_chat_auth_env", &[("vars", &vars.join(", "))]), ui_kit::Text::Report("auth_environment", false));
}
}
}
ui.add_space(crate::theme::Tokens::get().space_4);
- if ui_kit::secondary_button(ui, tr("ui.agent_chat_auth_retry")).clicked() {
+ if ui_kit::button(ui, tr("ui.agent_chat_auth_retry"), ui_kit::Button::Normal).clicked() {
connect(app, ui.ctx());
}
});
@@ -969,7 +973,7 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
let r = if o.kind.starts_with("allow") {
ui_kit::primary_button(ui, &o.name)
} else {
- ui_kit::secondary_button(ui, &o.name)
+ 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() {
@@ -996,9 +1000,9 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
None => {
ui.horizontal(|ui| {
let allow = ui_kit::primary_button(ui, tr("ui.agent_chat_allow"));
- let always = ui_kit::secondary_button(ui, tr("ui.ai_always_allow"))
+ 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::secondary_button(ui, tr("ui.agent_chat_deny"));
+ let deny = ui_kit::button(ui, tr("ui.agent_chat_deny"), ui_kit::Button::Normal);
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());
@@ -1023,7 +1027,7 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
if *undone {
ui.label(RichText::new(tr("ui.agent_chat_undone")).color(t.text_dim).size(crate::theme::Tokens::get().font_caption));
} else if Arc::ptr_eq(doc, &current_doc) {
- let b = ui_kit::secondary_button(ui, tr("ui.agent_chat_undo_changes")).on_hover_text(tr("ui.ai_undo_tip"));
+ let b = ui_kit::button(ui, tr("ui.agent_chat_undo_changes"), ui_kit::Button::Normal).on_hover_text(tr("ui.ai_undo_tip"));
crate::scenario::publish_handle("agent_chat:undo", b.rect.center());
if b.clicked() {
undo = Some(n);
@@ -1053,13 +1057,13 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::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::small_button(ui, "×").on_hover_text(tr("ui.agent_chat_remove"));
+ 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::small_button(ui, tr("ui.agent_chat_edit"));
+ 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()));
@@ -1072,10 +1076,10 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
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::secondary_button(ui, tr("ui.agent_chat_save")).clicked() {
+ 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::secondary_button(ui, tr("ui.agent_chat_cancel")).clicked() {
+ if ui_kit::button(ui, tr("ui.agent_chat_cancel"), ui_kit::Button::Normal).clicked() {
edit_done = Some((n, None));
}
});
@@ -1095,7 +1099,7 @@ fn conversation(app: &mut SolveApp, ui: &mut egui::Ui) {
if !app.agent_chat.pending.is_empty() && editing.is_none() {
ui.horizontal(|ui| {
if busy {
- let b = ui_kit::secondary_button(ui, tr("ui.agent_chat_send_now")).on_hover_text(tr("ui.agent_chat_send_now_tip"));
+ let b = ui_kit::button(ui, tr("ui.agent_chat_send_now"), ui_kit::Button::Normal).on_hover_text(tr("ui.agent_chat_send_now_tip"));
crate::scenario::publish_handle("agent_chat:send_now", b.rect.center());
send_now_clicked = b.clicked();
} else {
@@ -1302,8 +1306,7 @@ fn chip(ui: &mut egui::Ui, thumbs: &mut std::collections::HashMap<u64, egui::Tex
});
},
);
- crate::scenario::publish_rect(&format!("agent_chat:file:{i}"), r.response.rect);
- crate::scenario::publish_handle(&format!("agent_chat:file:{i}"), r.response.rect.center());
+ crate::scenario::publish_target(&format!("agent_chat:file:{i}"), r.response.rect);
clicked
}
@@ -1313,9 +1316,9 @@ fn chip(ui: &mut egui::Ui, thumbs: &mut std::collections::HashMap<u64, egui::Tex
fn add_menu(app: &mut SolveApp, ui: &mut egui::Ui) {
let (mut choose, mut paste) = (false, false);
let r = ui_kit::action_menu(ui, "+", |ui| {
- let a = ui_kit::secondary_button(ui, tr("ui.agent_chat_add_file"));
+ let a = ui_kit::button(ui, tr("ui.agent_chat_add_file"), ui_kit::Button::Normal);
crate::scenario::publish_handle("agent_chat:add_file", a.rect.center());
- let b = ui_kit::secondary_button(ui, tr("ui.agent_chat_paste_picture"));
+ let b = ui_kit::button(ui, tr("ui.agent_chat_paste_picture"), ui_kit::Button::Normal);
crate::scenario::publish_handle("agent_chat:paste_picture", b.rect.center());
if a.clicked() {
choose = true;
diff --git a/crates/ui-egui/src/agent_chat/settings.rs b/crates/ui-egui/src/agent_chat/settings.rs
index 5e79c96cf3..6b598055f1 100644
--- a/crates/ui-egui/src/agent_chat/settings.rs
+++ b/crates/ui-egui/src/agent_chat/settings.rs
@@ -89,13 +89,13 @@ fn start_test(app: &SolveApp, e: &agents::Entry, key: Option<String>) -> Test {
fn test_line(ui: &mut egui::Ui, test: &Option<&Test>) {
match test {
Some(Test::Running(_)) => {
- ui_kit::note(ui, "testing", tr("ui.ai_testing"));
+ ui_kit::text(ui, tr("ui.ai_testing"), ui_kit::Text::Note("testing"));
}
Some(Test::Done(Ok(message))) => {
- ui_kit::text_block(ui, "test_ok", message, false);
+ ui_kit::text(ui, message, ui_kit::Text::Report("test_ok", false));
}
Some(Test::Done(Err(error))) => {
- ui_kit::text_block(ui, "test_error", error, true);
+ ui_kit::text(ui, error, ui_kit::Text::Report("test_error", true));
}
None => {}
}
@@ -105,9 +105,9 @@ fn test_line(ui: &mut egui::Ui, test: &Option<&Test>) {
pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
let r = ui_kit::checkbox(ui, tr("ui.ai_show_features"), &mut app.preferences.ai_features);
crate::scenario::publish_handle("prefs:ai_features", r.rect.center());
- ui_kit::note(ui, "features", tr("ui.ai_show_features_note"));
+ ui_kit::text(ui, tr("ui.ai_show_features_note"), ui_kit::Text::Note("features"));
if cfg!(target_arch = "wasm32") {
- ui_kit::note(ui, "desktop", tr("ui.agent_chat_desktop_only"));
+ ui_kit::text(ui, tr("ui.agent_chat_desktop_only"), ui_kit::Text::Note("desktop"));
return;
}
if !app.preferences.ai_features {
@@ -115,7 +115,7 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
}
let r = ui_kit::checkbox(ui, tr("ui.ai_toolbar_button"), &mut app.preferences.ai_toolbar_button);
crate::scenario::publish_handle("prefs:ai_toolbar_button", r.rect.center());
- ui_kit::note(ui, "toolbar", tr("ui.ai_toolbar_button_note"));
+ ui_kit::text(ui, tr("ui.ai_toolbar_button_note"), ui_kit::Text::Note("toolbar"));
#[cfg(not(target_arch = "wasm32"))]
{
if app.agent_chat.detection.is_none() && app.agent_chat.detecting.is_none() {
@@ -130,34 +130,34 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
if r.clicked() {
app.preferences.ai_permissions = mode;
}
- ui_kit::note(
+ ui_kit::text(
ui,
- mode.id(),
tr(match mode {
Mode::Ask => "ui.ai_mode_ask_note",
Mode::Edits => "ui.ai_mode_edits_note",
Mode::All => "ui.ai_mode_all_note",
}),
+ ui_kit::Text::Note(mode.id()),
);
}
if app.preferences.ai_permissions == Mode::All {
- ui_kit::text_block(ui, "permissions_warning", tr("ui.ai_mode_all_warning"), true);
+ ui_kit::text(ui, tr("ui.ai_mode_all_warning"), ui_kit::Text::Report("permissions_warning", true));
}
- ui_kit::note(ui, "scope", tr("ui.ai_modes_scope"));
+ ui_kit::text(ui, tr("ui.ai_modes_scope"), ui_kit::Text::Note("scope"));
ui_kit::section(ui, "always_allowed", tr("ui.ai_always_allowed"), true, |ui| {
let remembered: Vec<_> =
app.preferences.agent_always_allow.iter().filter(|(_, v)| !v.is_empty()).map(|(k, v)| (k.clone(), v.clone())).collect();
if remembered.is_empty() {
- ui_kit::note(ui, "none", tr("ui.ai_always_allowed_none"));
+ ui_kit::text(ui, tr("ui.ai_always_allowed_none"), ui_kit::Text::Note("none"));
}
let names: std::collections::HashMap<_, _> = agents::entries(app).into_iter().map(|e| (e.id, e.name)).collect();
for (agent, tools) in remembered {
ui_kit::label_actions(ui, names.get(&agent).unwrap_or(&agent), |ui| {
- if ui_kit::small_button(ui, tr("ui.ai_reset")).clicked() {
+ if ui_kit::button(ui, tr("ui.ai_reset"), ui_kit::Button::Small).clicked() {
app.preferences.agent_always_allow.remove(&agent);
}
});
- ui_kit::text_block(ui, &agent, &tools.join(", "), false);
+ ui_kit::text(ui, &tools.join(", "), ui_kit::Text::Report(&agent, false));
}
});
});
@@ -166,7 +166,7 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
let p = &mut app.preferences;
let mut selected = if p.agent_chat_popped { 2 } else { usize::from(p.agent_chat_side != "left") };
let options = [tr("ui.agent_chat_left"), tr("ui.agent_chat_right"), tr("ui.agent_chat_own_window")];
- if ui_kit::segmented(ui, &mut selected, &options) {
+ if ui_kit::segmented(ui, &mut selected, &options, Default::default()) {
p.agent_chat_popped = selected == 2;
if selected < 2 {
p.agent_chat_side = if selected == 0 { "left" } else { "right" }.into();
@@ -176,7 +176,7 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
ui_kit::row(ui, tr("ui.agent_chat_turn_limit"), |ui| {
ui_kit::number_field(ui, &mut app.preferences.agent_chat_turn_limit, 1..=200, 1.0, "");
});
- ui_kit::note(ui, "privacy", tr("ui.agent_chat_privacy_note"));
+ ui_kit::text(ui, tr("ui.agent_chat_privacy_note"), ui_kit::Text::Note("privacy"));
});
}
@@ -193,16 +193,16 @@ fn agents_section(app: &mut SolveApp, ui: &mut egui::Ui) {
let mut test: Option<agents::Entry> = None;
ui_kit::section(ui, "agents", tr("ui.ai_agents"), true, |ui| {
if app.agent_chat.detecting.is_some() {
- ui_kit::note(ui, "detecting", tr("ui.agent_chat_detecting"));
+ ui_kit::text(ui, tr("ui.agent_chat_detecting"), ui_kit::Text::Note("detecting"));
} else if all.is_empty() {
- ui_kit::note(ui, "none", tr("ui.agent_chat_none_found"));
+ ui_kit::text(ui, tr("ui.agent_chat_none_found"), ui_kit::Text::Note("none"));
}
for e in &all {
ui_kit::section(ui, &e.id, &e.name, true, |ui| {
- ui_kit::text_block(ui, "detail", &e.detail(), false);
+ ui_kit::text(ui, &e.detail(), ui_kit::Text::Report("detail", false));
super::panel::login_chip(ui, e.login);
if !e.found {
- ui_kit::note(ui, "added", tr("ui.ai_added"));
+ ui_kit::text(ui, tr("ui.ai_added"), ui_kit::Text::Note("added"));
}
ui.horizontal_wrapped(|ui| {
if ui_kit::list_picker(ui, &e.id, tr("ui.ai_default"), default.as_deref() == Some(e.id.as_str())).clicked() {
@@ -234,12 +234,12 @@ fn agents_section(app: &mut SolveApp, ui: &mut egui::Ui) {
}
});
ui.horizontal_wrapped(|ui| {
- let b = ui_kit::secondary_button(ui, tr("ui.ai_test"));
+ let b = ui_kit::button(ui, tr("ui.ai_test"), ui_kit::Button::Normal);
crate::scenario::publish_handle(&format!("prefs:ai_test:{}", e.id), b.rect.center());
if b.on_hover_text(tr(if e.kind == Kind::Acp { "ui.ai_test_acp_tip" } else { "ui.ai_test_api_tip" })).clicked() {
test = Some(e.clone());
}
- if !e.found && ui_kit::secondary_button(ui, tr("ui.ai_remove")).clicked() {
+ if !e.found && ui_kit::button(ui, tr("ui.ai_remove"), ui_kit::Button::Normal).clicked() {
remove = Some(e.id.clone());
}
});
@@ -247,12 +247,12 @@ fn agents_section(app: &mut SolveApp, ui: &mut egui::Ui) {
});
}
ui.horizontal_wrapped(|ui| {
- let b = ui_kit::secondary_button(ui, tr("ui.ai_add_agent"));
+ let b = ui_kit::button(ui, tr("ui.ai_add_agent"), ui_kit::Button::Normal);
crate::scenario::publish_handle("prefs:ai_add", b.rect.center());
if b.clicked() {
open_add(app);
}
- if ui_kit::enabled_button(ui, tr("ui.agent_chat_refresh"), app.agent_chat.detecting.is_none()).clicked() {
+ if ui_kit::button(ui, tr("ui.agent_chat_refresh"), ui_kit::Button::Enabled(app.agent_chat.detecting.is_none())).clicked() {
refresh(app, &ui.ctx().clone());
}
});
@@ -304,7 +304,7 @@ pub fn dialog(app: &mut SolveApp, ctx: &egui::Context) {
ui_kit::row(ui, tr("ui.ai_preset"), |ui| {
let mut selected = kinds.iter().position(|(k, _)| *k == s.kind).unwrap_or(0);
let labels = kinds.map(|(_, key)| tr(key));
- if ui_kit::segmented_compact(ui, &mut selected, &labels)
+ if ui_kit::segmented(ui, &mut selected, &labels, ui_kit::Segments { compact: true, ..Default::default() })
&& let Some((kind, _)) = kinds.get(selected)
{
s.kind = *kind;
@@ -321,7 +321,7 @@ pub fn dialog(app: &mut SolveApp, ctx: &egui::Context) {
AddKind::Installed => {
ui_kit::row(ui, tr("ui.agent_chat_pick"), |ui| {
if found.is_empty() {
- ui_kit::inline_text(ui, tr("ui.agent_chat_none_found_short"));
+ ui_kit::text(ui, tr("ui.agent_chat_none_found_short"), ui_kit::Text::Inline);
} else {
let sel = found.get(s.installed).map(|e| e.name.clone()).unwrap_or_default();
ui_kit::dropdown_menu(ui, "sc_ai_add_installed", &sel, |ui| {
@@ -347,7 +347,7 @@ pub fn dialog(app: &mut SolveApp, ctx: &egui::Context) {
ui_kit::row(ui, tr("ui.agent_chat_command"), |ui| {
ui_kit::text_field(ui, &mut s.command, "");
});
- ui_kit::note(ui, "installed", tr("ui.ai_add_installed_note"));
+ ui_kit::text(ui, tr("ui.ai_add_installed_note"), ui_kit::Text::Note("installed"));
}
AddKind::Custom => {
ui_kit::row(ui, tr("ui.ai_name"), |ui| {
@@ -356,7 +356,7 @@ pub fn dialog(app: &mut SolveApp, ctx: &egui::Context) {
ui_kit::row(ui, tr("ui.agent_chat_command"), |ui| {
ui_kit::text_field(ui, &mut s.command, tr("ui.ai_command_hint"));
});
- ui_kit::note(ui, "custom", tr("ui.agent_chat_custom_hint"));
+ ui_kit::text(ui, tr("ui.agent_chat_custom_hint"), ui_kit::Text::Note("custom"));
}
AddKind::Api => {
let presets: Vec<_> = agents::API_PRESETS.iter().map(|p| p.0).chain(std::iter::once(tr("ui.ai_custom_url"))).collect();
@@ -387,19 +387,18 @@ pub fn dialog(app: &mut SolveApp, ctx: &egui::Context) {
ui_kit::row(ui, tr("ui.ai_key"), |ui| {
ui.add_enabled_ui(has_keychain, |ui| {
let r = ui_kit::password_field(ui, egui::Id::new("sc_ai_add_key"), &mut s.key, tr("ui.ai_key_hint"));
- crate::scenario::publish_rect("ai_add:key", r.rect);
- crate::scenario::publish_handle("ai_add:key", r.rect.center());
+ crate::scenario::publish_target("ai_add:key", r.rect);
});
});
- ui_kit::note(ui, "keychain", tr(if has_keychain { "ui.ai_key_note" } else { "ui.ai_no_keychain" }));
- if ui_kit::secondary_button(ui, tr("ui.ai_test")).clicked() {
+ ui_kit::text(ui, tr(if has_keychain { "ui.ai_key_note" } else { "ui.ai_no_keychain" }), ui_kit::Text::Note("keychain"));
+ if ui_kit::button(ui, tr("ui.ai_test"), ui_kit::Button::Normal).clicked() {
test = true;
}
test_line(ui, &s.test.as_ref());
}
}
if let Some(e) = &s.error {
- ui_kit::text_block(ui, "add_error", e, true);
+ ui_kit::text(ui, e, ui_kit::Text::Report("add_error", true));
}
});
if let Some(rect) = crate::scenario::rect_of("dialog:ok") {
diff --git a/crates/ui-egui/src/browser.rs b/crates/ui-egui/src/browser.rs
index 25fb224d0d..cc51563fd5 100644
--- a/crates/ui-egui/src/browser.rs
+++ b/crates/ui-egui/src/browser.rs
@@ -811,8 +811,7 @@ fn browser_header(app: &mut SolveApp, ui: &mut egui::Ui, collapsible: bool) {
let t = Tokens::get();
let (rect, _) = ui.allocate_exact_size(vec2(ui.available_width(), HEADER_H), Sense::hover());
let response = ui.interact(rect, ui.id().with("browser_header"), if collapsible { Sense::click() } else { Sense::hover() });
- crate::scenario::publish_handle("browser:header", rect.center());
- crate::scenario::publish_rect("browser:header", rect);
+ crate::scenario::publish_target("browser:header", rect);
let collapsed = collapsible && app.tree.panel_collapsed;
if collapsible && (response.hovered() || response.has_focus()) {
ui.painter().rect_filled(rect, t.radius_lg.saturating_sub(CARD_INSET as u8), t.hover);
diff --git a/crates/ui-egui/src/browser_card_tests.rs b/crates/ui-egui/src/browser_card_tests.rs
index 2ca4bd7b94..da891fefb5 100644
--- a/crates/ui-egui/src/browser_card_tests.rs
+++ b/crates/ui-egui/src/browser_card_tests.rs
@@ -54,11 +54,10 @@ fn selected_row_paints_tab_soft_fill_and_accent_text_in_both_layouts() {
crate::theme::TabAccent::publish(&app, &ctx);
let accent = crate::theme::TabAccent::for_tab(&Tokens::get(), tab);
let mut row_rect = Rect::NOTHING;
- let mut out = ctx.run_ui(egui::RawInput::default(), |ui| {
+ let out = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
let row = Row { selected: true, label: "Selected body", dim: true, color: Some(Tokens::get().error), ..Default::default() };
row_rect = draw_row(ui, egui::Id::new("selected-row"), &row).rect.unwrap();
});
- out.textures_delta.clear();
assert_eq!(row_rect.height(), 26.0);
assert!(out.shapes.iter().any(|s| matches!(&s.shape, egui::Shape::Rect(r) if r.rect == row_rect && r.fill == accent.soft)));
assert!(
@@ -171,11 +170,10 @@ fn one_browser_keeps_its_resized_width_across_layouts_and_overlay_preferences()
fn browser_title_uses_a_single_semibold_run() {
let ctx = crate::fonts::test_context();
let mut app = SolveApp::new(Default::default(), Default::default());
- let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
ui.set_width(250.0);
browser_header(&mut app, ui, true);
});
- output.textures_delta.clear();
let title = crate::i18n::tr("ui.browser_title");
let titles: Vec<_> = output
.shapes
diff --git a/crates/ui-egui/src/browser_model_tests.rs b/crates/ui-egui/src/browser_model_tests.rs
index 8f4ceadc62..c2c3f41a86 100644
--- a/crates/ui-egui/src/browser_model_tests.rs
+++ b/crates/ui-egui/src/browser_model_tests.rs
@@ -3,17 +3,7 @@ use std::sync::Arc;
use serde_json::json;
use solidcraft_engine::Sel;
-use crate::scenario::Harness;
-
-fn fixture() -> (Harness, u64, u64) {
- let mut h = Harness::new();
- let part = h.app.run("component.create", json!({"name":"Block"})).unwrap();
- let component = part["component"].as_u64().unwrap();
- let occurrence = part["occurrence"].as_u64().unwrap();
- h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();
- h.app.run("component.activate", json!({"component":0})).unwrap();
- (h, component, occurrence)
-}
+use crate::test_support::component_box as fixture;
#[test]
fn navigating_and_selecting_reuse_placements_but_rows_read_live_view_state() {
diff --git a/crates/ui-egui/src/browser_prompts.rs b/crates/ui-egui/src/browser_prompts.rs
index d5bad960d0..b09597b573 100644
--- a/crates/ui-egui/src/browser_prompts.rs
+++ b/crates/ui-egui/src/browser_prompts.rs
@@ -48,7 +48,11 @@ pub(crate) fn occurrence_panel(app: &mut SolveApp, ui: &mut egui::Ui) {
.actions("Capture All Positions", "Cancel", Some("Revert All Positions"))
.show(&ctx, true, |ui| {
if shared {
- ui_kit::note(ui, "shared", crate::i18n::tr_label("This child is shared. Position changes apply to every copy of its parent."));
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("This child is shared. Position changes apply to every copy of its parent."),
+ ui_kit::Text::Note("shared"),
+ );
}
for (k, axis) in ["X distance", "Y distance", "Z distance"].into_iter().enumerate() {
if let Some(v) = m.translate.get_mut(k) {
@@ -102,8 +106,8 @@ pub(crate) fn capture_prompt(app: &mut SolveApp, ctx: &egui::Context) {
} else {
crate::i18n::format("browser.capture_many", &[("count", &n.to_string())])
};
- ui_kit::text_block(ui, "question", &question, false);
- ui_kit::note(ui, "capture", crate::i18n::tr("browser.capture_note"));
+ ui_kit::text(ui, &question, ui_kit::Text::Report("question", false));
+ ui_kit::text(ui, crate::i18n::tr("browser.capture_note"), ui_kit::Text::Note("capture"));
});
let answer = match action {
ui_kit::Action::Ok => Some("capture"),
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 960c6c491c..2203d74b48 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -891,8 +891,7 @@ fn measure_line(app: &SolveApp, painter: &egui::Painter, proj: &Proj, r: &serde_
let mid = sa + (sb - sa) * 0.5 + vec2(10.0, -14.0);
let galley = painter.layout_no_wrap(crate::prefs::show_mm(app, d, 1), egui::FontId::proportional(crate::theme::Tokens::get().font_label), t.text);
let rect = egui::Rect::from_min_size(mid, galley.size() + vec2(10.0, 6.0));
- crate::scenario::publish_handle("measure:label", rect.center());
- crate::scenario::publish_rect("measure:label", rect);
+ crate::scenario::publish_target("measure:label", rect);
if app.preferences.measure_axis_distances {
measure_components(app, painter, proj, a, b, rect);
}
@@ -959,8 +958,7 @@ fn measure_components(app: &SolveApp, painter: &egui::Painter, proj: &Proj, a: V
painter.rect(rect, 3.0, t.overlay, Stroke::new(1.0, color), egui::StrokeKind::Inside);
painter.galley(rect.min + vec2(5.0, 3.0), galley, t.text);
let handle = format!("measure:label:{axis}");
- crate::scenario::publish_handle(&handle, rect.center());
- crate::scenario::publish_rect(&handle, rect);
+ crate::scenario::publish_target(&handle, rect);
occupied.push(rect);
}
}
diff --git a/crates/ui-egui/src/configuration_rules_ui.rs b/crates/ui-egui/src/configuration_rules_ui.rs
index dc91476b9a..6e162ed59d 100644
--- a/crates/ui-egui/src/configuration_rules_ui.rs
+++ b/crates/ui-egui/src/configuration_rules_ui.rs
@@ -74,9 +74,13 @@ pub(super) fn show(ui: &mut Ui, app: &mut SolveApp, error: &mut Option<String>,
let suppression_features: Vec<(u64, String)> =
features.iter().filter(|(id, _)| app.session.doc.configs.columns.contains(&Column::Suppress(*id))).cloned().collect();
ui_kit::divider(ui, "configuration_rules");
- ui_kit::text_block(ui, "rules_heading", crate::i18n::tr_label("Configuration rules"), false);
- ui_kit::note(ui, "rules_drives", crate::i18n::tr_label("Rules run from top to bottom. Matched drives change effective values."));
- ui_kit::note(ui, "rules_restrictions", crate::i18n::tr_label("Matched restrictions check the final values."));
+ ui_kit::text(ui, crate::i18n::tr_label("Configuration rules"), ui_kit::Text::Report("rules_heading", false));
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("Rules run from top to bottom. Matched drives change effective values."),
+ ui_kit::Text::Note("rules_drives"),
+ );
+ ui_kit::text(ui, crate::i18n::tr_label("Matched restrictions check the final values."), ui_kit::Text::Note("rules_restrictions"));
for (index, rule) in rules.iter().enumerate() {
ui.push_id(&rule.id, |ui| {
ui.horizontal_wrapped(|ui| {
@@ -86,19 +90,22 @@ pub(super) fn show(ui: &mut Ui, app: &mut SolveApp, error: &mut Option<String>,
r.enabled = enabled;
*error = app.run("config.rule", json!({"rule":r})).err();
}
- ui_kit::inline_text(ui, &rule.name);
- if ui_kit::small_button(ui, crate::i18n::tr_label("Edit")).clicked() {
+ ui_kit::text(ui, &rule.name, ui_kit::Text::Inline);
+ if ui_kit::button(ui, crate::i18n::tr_label("Edit"), ui_kit::Button::Small).clicked() {
editor.rule = rule.clone();
}
- let up = ui_kit::enabled_button(ui, "↑", index > 0).on_hover_text(crate::i18n::tr_label("Move earlier"));
+ let up = ui_kit::button(ui, "↑", ui_kit::Button::Enabled(index > 0)).on_hover_text(crate::i18n::tr_label("Move earlier"));
crate::scenario::publish_handle(&format!("config:rule:{}:up", rule.id), up.rect.center());
if up.clicked() {
*error = app.run("config.rule", json!({"id":rule.id,"index":index-1})).err();
}
- if ui_kit::enabled_button(ui, "↓", index + 1 < rules.len()).on_hover_text(crate::i18n::tr_label("Move later")).clicked() {
+ if ui_kit::button(ui, "↓", ui_kit::Button::Enabled(index + 1 < rules.len()))
+ .on_hover_text(crate::i18n::tr_label("Move later"))
+ .clicked()
+ {
*error = app.run("config.rule", json!({"id":rule.id,"index":index+1})).err();
}
- if ui_kit::small_button(ui, crate::i18n::tr_label("Delete")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label("Delete"), ui_kit::Button::Small).clicked() {
*error = app.run("config.rule", json!({"id":rule.id,"delete":true})).err();
}
});
@@ -120,7 +127,7 @@ pub(super) fn show(ui: &mut Ui, app: &mut SolveApp, error: &mut Option<String>,
ui.vertical(|ui| {
expression(ui, "Rule name", &mut editor.rule.name);
ui_kit::checkbox(ui, crate::i18n::tr_label("Enabled"), &mut editor.rule.enabled);
- if ui_kit::small_button(ui, crate::i18n::tr_label("New")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label("New"), ui_kit::Button::Small).clicked() {
editor.rule = Editor::default().rule;
}
});
@@ -188,7 +195,7 @@ pub(super) fn show(ui: &mut Ui, app: &mut SolveApp, error: &mut Option<String>,
}
}
}
- let save = ui_kit::enabled_button(ui, "Save Rule", !app.session.doc.configs.rows.is_empty());
+ let save = ui_kit::button(ui, "Save Rule", ui_kit::Button::Enabled(!app.session.doc.configs.rows.is_empty()));
crate::scenario::publish_handle("config:save_rule", save.rect.center());
if save.clicked() {
let result = (|| -> Result<(), String> {
@@ -210,7 +217,7 @@ pub(super) fn show(ui: &mut Ui, app: &mut SolveApp, error: &mut Option<String>,
let previous_row = editor.row.clone();
ui.vertical(|ui| {
choose(ui, "preview_configuration", &mut editor.row, &rows);
- let preview = ui_kit::enabled_button(ui, "Preview Row", !editor.row.is_empty());
+ let preview = ui_kit::button(ui, "Preview Row", ui_kit::Button::Enabled(!editor.row.is_empty()));
crate::scenario::publish_handle("config:preview_row", preview.rect.center());
if preview.clicked() {
match app.session.execute("config.preview", &json!({"row":editor.row})) {
@@ -282,11 +289,10 @@ pub(super) fn show(ui: &mut Ui, app: &mut SolveApp, error: &mut Option<String>,
if let Some(name) = parameter["name"].as_str()
&& all_parameters.iter().any(|p| p == name)
{
- let response = ui_kit::text_block(
+ let response = ui_kit::text(
ui,
- "preview_parameter",
&format!("{name} = {}", parameter["expression"].as_str().unwrap_or("")),
- false,
+ ui_kit::Text::Report("preview_parameter", false),
);
crate::scenario::publish_handle(&format!("config:preview:param:{name}"), response.rect.center());
}
@@ -296,7 +302,7 @@ pub(super) fn show(ui: &mut Ui, app: &mut SolveApp, error: &mut Option<String>,
}
}
fn report(ui: &mut Ui, text: impl AsRef<str>) {
- ui_kit::text_block(ui, "rule_report", crate::i18n::tr_label(text.as_ref()), false);
+ ui_kit::text(ui, crate::i18n::tr_label(text.as_ref()), ui_kit::Text::Report("rule_report", false));
}
fn feature_choice(ui: &mut Ui, id: &str, feature: &mut u64, features: &[(u64, String)]) {
@@ -373,7 +379,7 @@ fn condition_editor(ui: &mut Ui, condition: &mut RuleCondition, parameters: &[St
ui.push_id(index, |ui| {
ui.indent("condition_group", |ui| {
condition_editor(ui, child, parameters, features, depth + 1);
- if ui_kit::small_button(ui, crate::i18n::tr_label("Remove condition")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label("Remove condition"), ui_kit::Button::Small).clicked() {
remove = Some(index);
}
});
@@ -382,7 +388,7 @@ fn condition_editor(ui: &mut Ui, condition: &mut RuleCondition, parameters: &[St
if let Some(index) = remove {
conditions.remove(index);
}
- if ui_kit::enabled_button(ui, "Add condition", conditions.len() < 32).clicked() {
+ if ui_kit::button(ui, "Add condition", ui_kit::Button::Enabled(conditions.len() < 32)).clicked() {
conditions.push(RuleCondition::Always);
}
}
diff --git a/crates/ui-egui/src/configurations_ui.rs b/crates/ui-egui/src/configurations_ui.rs
index 0de609c1ed..f9acef24c3 100644
--- a/crates/ui-egui/src/configurations_ui.rs
+++ b/crates/ui-egui/src/configurations_ui.rs
@@ -59,16 +59,39 @@ pub(super) fn configurations_rows(
}))
.chain(std::iter::once(crate::i18n::tr_label("Actions").to_owned()))
.collect();
- let columns: Vec<_> = labels.iter().map(|label| ui_kit::Column { label, width: 2.0 }).collect();
+ let gap = ui.spacing().item_spacing.x;
+ let name_width = tb.rows.iter().map(|(name, _)| ui_kit::ContentWidth::label(ui, name)).fold(0.0, f32::max);
+ let status_width = (ui_kit::ContentWidth::label(ui, "Active") + gap + ui_kit::ContentWidth::button(ui, "Apply"))
+ .max(ui_kit::ContentWidth::button(ui, "Activate"));
+ let columns: Vec<_> = labels
+ .iter()
+ .enumerate()
+ .map(|(index, label)| {
+ let min_width = if index == 0 {
+ (name_width + gap + status_width).max(ui_kit::ContentWidth::label(ui, "Remove the column"))
+ } else if index <= tb.columns.len() {
+ tb.rows
+ .iter()
+ .filter_map(|(_, values)| values.get(index - 1))
+ .map(|value| ui_kit::ContentWidth::editor(ui, value))
+ .fold(ui_kit::ContentWidth::button(ui, "×"), f32::max)
+ } else {
+ ui_kit::ContentWidth::button(ui, "×")
+ };
+ ui_kit::Column::new(label, 2.0).min_content_width(min_width)
+ })
+ .collect();
ui_kit::table(ui, "configuration_table", &columns, crate::i18n::tr("manage.empty"), |ui, table| {
- // Column actions are ordinary cells, so they share the header's exact widths.
+ // The column-action band shares the header's exact widths without posing as a data row.
if !tb.columns.is_empty() {
- table.row(ui, "columns", false, |row| {
- row.cell(|_| {});
+ table.column_actions(ui, |row| {
+ row.cell(|ui| {
+ ui_kit::text(ui, crate::i18n::tr_label("Remove the column"), ui_kit::Text::Cell);
+ });
for c in &tb.columns {
row.cell(|ui| {
let (kind, name) = column_parts(c);
- if ui_kit::small_button(ui, "×").on_hover_text(crate::i18n::tr_label("Remove the column")).clicked() {
+ if ui_kit::button(ui, "×", ui_kit::Button::Normal).on_hover_text(crate::i18n::tr_label("Remove the column")).clicked() {
let key = if kind == "suppress" { "feature" } else { kind };
run(app, error, "config.column", json!({key:if kind == "face_appearance" {c.as_str()} else {name},"delete":true}));
}
@@ -81,25 +104,30 @@ pub(super) fn configurations_rows(
let active = tb.active.as_deref() == Some(name.as_str());
table.row(ui, name, active, |row| {
row.cell(|ui| {
- // Reserve space for Activate/Apply even when the row name is long.
- ui_kit::label_actions(ui, name, |ui| {
- if active {
- ui_kit::inline_text(ui, crate::i18n::tr_label("Active"));
- if v.get("matches").and_then(Value::as_bool) == Some(false) {
- let apply = ui_kit::small_button(ui, crate::i18n::tr_label("Apply"));
- crate::scenario::publish_handle(&format!("config:activate:{name}"), apply.rect.center());
- if apply.clicked() {
- run(app, error, "config.activate", json!({"row":name}));
- }
- }
- } else {
- let activate = ui_kit::small_button(ui, crate::i18n::tr_label("Activate"));
- crate::scenario::publish_handle(&format!("config:activate:{name}"), activate.rect.center());
- if activate.clicked() {
+ // A measured name slot keeps status/actions inside the Configuration column.
+ ui.allocate_ui_with_layout(
+ egui::vec2(name_width, ui_kit::row_height()),
+ egui::Layout::left_to_right(egui::Align::Center),
+ |ui| {
+ ui_kit::text(ui, name, ui_kit::Text::Cell);
+ },
+ );
+ if active {
+ ui_kit::text(ui, crate::i18n::tr_label("Active"), ui_kit::Text::Inline);
+ if v.get("matches").and_then(Value::as_bool) == Some(false) {
+ let apply = ui_kit::button(ui, crate::i18n::tr_label("Apply"), ui_kit::Button::Small);
+ crate::scenario::publish_handle(&format!("config:activate:{name}"), apply.rect.center());
+ if apply.clicked() {
run(app, error, "config.activate", json!({"row":name}));
}
}
- });
+ } else {
+ let activate = ui_kit::button(ui, crate::i18n::tr_label("Activate"), ui_kit::Button::Small);
+ crate::scenario::publish_handle(&format!("config:activate:{name}"), activate.rect.center());
+ if activate.clicked() {
+ run(app, error, "config.activate", json!({"row":name}));
+ }
+ }
});
for (column, value) in tb.columns.iter().zip(values) {
row.cell(|ui| {
@@ -125,7 +153,7 @@ pub(super) fn configurations_rows(
} else {
"Default material"
};
- if ui_kit::secondary_button(ui, crate::i18n::tr_label(follow)).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label(follow), ui_kit::Button::Normal).clicked() {
choice = Some("Default".to_owned());
ui.close();
}
@@ -135,7 +163,7 @@ pub(super) fn configurations_rows(
solidcraft_engine::doc::appearance::LIBRARY.iter().map(|(name, _, _)| *name).collect()
};
for name in choices {
- if ui_kit::secondary_button(ui, name).clicked() {
+ if ui_kit::button(ui, name, ui_kit::Button::Normal).clicked() {
choice = Some(name.to_owned());
ui.close();
}
@@ -165,7 +193,7 @@ pub(super) fn configurations_rows(
});
}
row.cell(|ui| {
- if ui_kit::small_button(ui, "×").on_hover_text(crate::i18n::tr_label("Delete the row")).clicked() {
+ if ui_kit::button(ui, "×", ui_kit::Button::Small).on_hover_text(crate::i18n::tr_label("Delete the row")).clicked() {
run(app, error, "config.row", json!({"name":name,"delete":true}));
}
});
@@ -180,7 +208,7 @@ pub(super) fn configurations_rows(
ui.horizontal_wrapped(|ui| {
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
- if ui_kit::secondary_button(ui, crate::i18n::tr_label("Add Row"))
+ if ui_kit::button(ui, crate::i18n::tr_label("Add Row"), ui_kit::Button::Normal)
.on_hover_text(crate::i18n::tr_label("A new configuration, a copy of the active one"))
.clicked()
{
@@ -229,13 +257,17 @@ pub(super) fn configurations_rows(
ui_kit::action_menu(ui, "Add Column", |ui| {
egui::ScrollArea::vertical().max_height(ui_kit::row_height() * 12.0).show(ui, |ui| {
for (label, p) in &options {
- if ui_kit::secondary_button(ui, label.as_str()).clicked() {
+ if ui_kit::button(ui, label.as_str(), ui_kit::Button::Normal).clicked() {
pick = Some(p.clone());
ui.close();
}
}
ui_kit::action_menu(ui, "Face Appearance", |ui| {
- ui_kit::note(ui, "semantic_faces", crate::i18n::tr_label("Semantic faces share their appearance across instances."));
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("Semantic faces share their appearance across instances."),
+ ui_kit::Text::Note("semantic_faces"),
+ );
let state = app.session.model.state();
for body in &state.bodies {
if body.body.is_mesh() {
@@ -269,7 +301,7 @@ pub(super) fn configurations_rows(
continue;
}
let Some((_, role)) = target.name.split_once(':') else { continue };
- if ui_kit::secondary_button(ui, role).clicked() {
+ if ui_kit::button(ui, role, ui_kit::Button::Normal).clicked() {
pick = Some(json!({"face_appearance":{"target":target}}));
ui.close();
}
@@ -308,19 +340,18 @@ pub(super) fn configurations_rows(
configuration_rules_ui::show(ui, app, error, rule_editor);
if let Some(styles) = v["style_status"].as_array() {
for style in styles.iter().filter(|style| style["dormant"].as_bool() == Some(true)) {
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "dormant",
&format!("{}: appearance dormant while its feature is suppressed", style["target"].as_str().unwrap_or("Face")),
- false,
+ ui_kit::Text::Report("dormant", false),
);
}
}
if let Some(message) = v["style_error"].as_str() {
- ui_kit::text_block(ui, "style_error", message, true);
+ ui_kit::text(ui, message, ui_kit::Text::Report("style_error", true));
}
if let Some(message) = error {
- ui_kit::text_block(ui, "config_error", message, true);
+ ui_kit::text(ui, message, ui_kit::Text::Report("config_error", true));
}
// Table cells and rule editors own Enter. As in the legacy wide manager, it
// commits an edited cell without also submitting the enclosing card.
diff --git a/crates/ui-egui/src/context_menu.rs b/crates/ui-egui/src/context_menu.rs
index 014d68a057..c957f3d641 100644
--- a/crates/ui-egui/src/context_menu.rs
+++ b/crates/ui-egui/src/context_menu.rs
@@ -266,32 +266,6 @@ fn body_feature(app: &SolveApp, body: &str) -> Option<u64> {
app.session.world_state().body(body).map(|b| b.feature)
}
-/// The bodies a target stands for.
-pub fn target_bodies(app: &SolveApp, target: &Target) -> Vec<String> {
- match target {
- Target::Viewport => touched_bodies(app),
- Target::Body { name } => vec![name.clone()],
- Target::Component { id } => component_bodies(app, *id),
- Target::Occurrence { path } => app.session.occurrence_bodies(path, true).unwrap_or_default(),
- Target::Group { id, .. } => crate::browser::group_bodies(app, *id),
- Target::Sketch { .. }
- | Target::Feature { .. }
- | Target::Plane { .. }
- | Target::OriginPlane { .. }
- | Target::Folder { .. }
- | Target::Canvas { .. }
- | Target::Origin
- | Target::Units
- | Target::Joint { .. }
- | Target::ToolbarCommand { .. }
- | Target::Toolbar
- | Target::Workspace
- | Target::NamedViews
- | Target::NamedView { .. }
- | Target::Section => Vec::new(),
- }
-}
-
/// Bodies in a component and its subcomponents.
pub fn component_bodies(app: &SolveApp, id: u64) -> Vec<String> {
let doc = &app.session.doc;
@@ -1825,8 +1799,7 @@ fn workspace_menu(ui: &mut egui::Ui, items: &[Item], key_row: Option<usize>, hei
let (r, resp) = ui
.allocate_exact_size(vec2(450.0, if planned { 60.0 } else { 72.0 }), if item.enabled { Sense::click() } else { Sense::hover() });
for handle in [format!("menu:{}", item.id), format!("workspace:menu:{slug}")] {
- crate::scenario::publish_handle(&handle, r.center());
- crate::scenario::publish_rect(&handle, r);
+ crate::scenario::publish_target(&handle, r);
}
if current || (item.enabled && (resp.hovered() || key_row == Some(k))) {
ui.painter().rect_filled(r, 5.0, soft);
diff --git a/crates/ui-egui/src/crash_ui.rs b/crates/ui-egui/src/crash_ui.rs
index a94cd41b9e..54f873a04e 100644
--- a/crates/ui-egui/src/crash_ui.rs
+++ b/crates/ui-egui/src/crash_ui.rs
@@ -71,30 +71,30 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
.cards(2.0)
.actions("", crate::i18n::tr("ui.close"), None)
.show(ctx, true, |ui| {
- ui_kit::note(ui, "intro", crate::i18n::tr("crash.intro"));
+ ui_kit::text(ui, crate::i18n::tr("crash.intro"), ui_kit::Text::Note("intro"));
if let Some(d) = app.crashes.dir.clone() {
// A long path is cut short (hover shows it all): it must not widen the card.
ui_kit::label_actions(ui, &d, |ui| {
- if ui_kit::small_button(ui, crate::i18n::tr("crash.copy_folder")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr("crash.copy_folder"), ui_kit::Button::Small).clicked() {
ctx.copy_text(d.clone());
}
});
}
ui_kit::divider(ui, "reports");
if app.crashes.reports.is_empty() {
- ui_kit::note(ui, "none", crate::i18n::tr_label("No crash reports."));
+ ui_kit::text(ui, crate::i18n::tr_label("No crash reports."), ui_kit::Text::Note("none"));
}
egui::ScrollArea::vertical().max_height(320.0).show(ui, |ui| {
for r in &app.crashes.reports {
let title = report_heading(r);
ui_kit::label_actions(ui, &title, |ui| {
- if ui_kit::small_button(ui, crate::i18n::tr("crash.report")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr("crash.report"), ui_kit::Button::Small).clicked() {
report = Some(r.id.clone());
}
- if ui_kit::small_button(ui, crate::i18n::tr("crash.copy_path")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr("crash.copy_path"), ui_kit::Button::Small).clicked() {
ctx.copy_text(r.path.clone());
}
- if ui_kit::small_button(ui, crate::i18n::tr("ui.delete")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr("ui.delete"), ui_kit::Button::Small).clicked() {
delete = Some(Some(r.id.clone()));
}
});
@@ -104,9 +104,9 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
detail = format!("{detail}{sep}{}", crate::i18n::tr("crash.replayable"));
}
if !detail.is_empty() {
- ui_kit::note(ui, &format!("detail:{}", r.id), &detail);
+ ui_kit::text(ui, &detail, ui_kit::Text::Note(&format!("detail:{}", r.id)));
}
- ui_kit::text_block(ui, &format!("message:{}", r.id), &r.message, false);
+ ui_kit::text(ui, &r.message, ui_kit::Text::Report(&format!("message:{}", r.id), false));
if r.kind == "unclean_exit" {
ui_kit::note(ui, &format!("unclean:{}", r.id), crate::i18n::tr("crash.unclean_explanation"));
}
@@ -114,9 +114,9 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
}
});
if !app.crashes.note.is_empty() {
- ui_kit::note(ui, "note", &app.crashes.note);
+ ui_kit::text(ui, &app.crashes.note, ui_kit::Text::Note("note"));
}
- if ui_kit::enabled_button(ui, "Delete all", !app.crashes.reports.is_empty()).clicked() {
+ if ui_kit::button(ui, "Delete all", ui_kit::Button::Enabled(!app.crashes.reports.is_empty())).clicked() {
delete = Some(None);
}
});
@@ -253,7 +253,7 @@ mod tests {
h.frames(6);
let window = h.ctx.memory(|m| m.area_rect(egui::Id::new("sc_crash_reports"))).unwrap();
// The frame's margins come on top of the content's maximum width.
- assert!(window.width() <= crate::frame::WINDOW_WIDE_MAX_W + 40.0, "{} wide", window.width());
+ assert!(window.width() <= 760.0 + 40.0, "{} wide", window.width());
let _ = std::fs::remove_dir_all(&d);
}
diff --git a/crates/ui-egui/src/delete.rs b/crates/ui-egui/src/delete.rs
index f12389f149..91f31c7565 100644
--- a/crates/ui-egui/src/delete.rs
+++ b/crates/ui-egui/src/delete.rs
@@ -126,11 +126,10 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
.actions("Delete", "Cancel", None)
.show(ctx, true, |ui| {
if shared {
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "shared",
crate::i18n::tr_label("This child is shared. Deleting it removes it from every copy of its parent."),
- false,
+ ui_kit::Text::Report("shared", false),
);
}
for (key, heading, names, error) in
@@ -139,13 +138,17 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
if names.is_empty() {
continue;
}
- ui_kit::text_block(ui, key, crate::i18n::tr_label(heading), error);
+ ui_kit::text(ui, crate::i18n::tr_label(heading), ui_kit::Text::Report(key, error));
for name in names.iter().take(MAX_LISTED) {
- ui_kit::text_block(ui, &format!("{key}:{name}"), &format!(" • {name}"), error);
+ ui_kit::text(ui, &format!(" • {name}"), ui_kit::Text::Report(&format!("{key}:{name}"), error));
}
if names.len() > MAX_LISTED {
let more = (names.len() - MAX_LISTED).to_string();
- ui_kit::text_block(ui, &format!("{key}:more"), &crate::i18n::format("delete.and_more", &[("count", &more)]), error);
+ ui_kit::text(
+ ui,
+ &crate::i18n::format("delete.and_more", &[("count", &more)]),
+ ui_kit::Text::Report(&format!("{key}:more"), error),
+ );
}
}
});
diff --git a/crates/ui-egui/src/design_properties.rs b/crates/ui-egui/src/design_properties.rs
index 53d21b828a..6fcc92e804 100644
--- a/crates/ui-egui/src/design_properties.rs
+++ b/crates/ui-egui/src/design_properties.rs
@@ -104,21 +104,21 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
ui_kit::caption(ui, label, crate::i18n::tr("ui.design_properties.not_text"));
}
}
- ui_kit::note(ui, "exports", crate::i18n::tr("ui.design_properties.exports"));
+ ui_kit::text(ui, crate::i18n::tr("ui.design_properties.exports"), ui_kit::Text::Note("exports"));
let others: Vec<(&String, &Value)> = metadata.others().collect();
if !others.is_empty() {
let heading = format!("{} ({})", crate::i18n::tr("ui.design_properties.others"), others.len());
ui_kit::section(ui, "sc_design_properties_others", &heading, false, |ui| {
- ui_kit::note(ui, "others", crate::i18n::tr("ui.design_properties.others_note"));
+ ui_kit::text(ui, crate::i18n::tr("ui.design_properties.others_note"), ui_kit::Text::Note("others"));
egui::ScrollArea::vertical().max_height(ui_kit::row_height() * OTHERS_ROWS).show(ui, |ui| {
for (key, value) in others {
- ui_kit::row(ui, key, |ui| ui_kit::cell_text(ui, &preview(value)));
+ ui_kit::row(ui, key, |ui| ui_kit::text(ui, &preview(value), ui_kit::Text::Cell));
}
});
});
}
if let Some(error) = &d.error {
- ui_kit::text_block(ui, "error", error, true);
+ ui_kit::text(ui, error, ui_kit::Text::Report("error", true));
}
});
if closed || action == ui_kit::Action::Cancel || (action == ui_kit::Action::Ok && apply(app, &mut d)) {
@@ -160,7 +160,7 @@ pub fn show_object(app: &mut SolveApp, ctx: &egui::Context) {
let heading = crate::i18n::format("properties.title", &[("name", &title)]);
let (closed, action) = ui_kit::Prompt::new(egui::Id::new("sc_props"), "settings", &heading).actions("", "Close", None).show(ctx, true, |ui| {
for (label, value) in &rows {
- ui_kit::row(ui, crate::i18n::tr_label(label), |ui| ui_kit::cell_text(ui, value));
+ ui_kit::row(ui, crate::i18n::tr_label(label), |ui| ui_kit::text(ui, value, ui_kit::Text::Cell));
}
});
if closed || action == ui_kit::Action::Cancel {
diff --git a/crates/ui-egui/src/dialog_descriptor.rs b/crates/ui-egui/src/dialog_descriptor.rs
new file mode 100644
index 0000000000..e04c04b108
--- /dev/null
+++ b/crates/ui-egui/src/dialog_descriptor.rs
@@ -0,0 +1,69 @@
+//! Typed records for dialogs whose defaults and scalar restoration are mechanical.
+//! Selection, geometry, optional parameters and form rows stay with their callers.
+
+macro_rules! dialog_descriptors {
+ (
+ $(#[$attr:meta])* $vis:vis enum $name:ident {
+ $( $variant:ident ($command:literal, $title:literal,
+ [$(($label:literal, $accept:expr, $many:expr)),* $(,)?], $feature:pat) {
+ $( $field:ident: $ty:ty = $default:expr => $restore:expr, )*
+ } => $params:expr; )*
+ ; custom { $($custom:tt)* }
+ }
+ ) => {
+ $(#[$attr])* $vis enum $name {
+ $( $variant { $($field: $ty,)* }, )*
+ $($custom)*
+ }
+
+ impl $name {
+ pub(crate) fn simple_start(id: &str) -> Option<(Self, Vec<crate::selection::SelInput>)> {
+ let kind = match id {
+ $( $command => Self::$variant { $($field: $default,)* }, )*
+ _ => return None,
+ };
+ let inputs = kind.simple_inputs();
+ Some((kind, inputs))
+ }
+
+ pub(crate) fn simple_inputs(&self) -> Vec<crate::selection::SelInput> {
+ match self {
+ $( Self::$variant { .. } => vec![$(crate::selection::SelInput::new($label, $accept, $many)),*], )*
+ _ => Vec::new(),
+ }
+ }
+
+ pub(crate) fn simple_metadata(&self) -> Option<(&'static str, &'static str)> {
+ match self {
+ $( Self::$variant { .. } => Some(($command, $title)), )*
+ _ => None,
+ }
+ }
+
+ pub(crate) fn fill_simple_params(&self, params: &mut serde_json::Value) {
+ let scalars = match self {
+ $( Self::$variant { $($field,)* } => {
+ // Some fields have conditional emission in the explicit command builder.
+ let _ = ($($field,)*);
+ $params
+ }, )*
+ _ => return,
+ };
+ if let (serde_json::Value::Object(params), serde_json::Value::Object(scalars)) = (params, scalars) {
+ for (key, value) in scalars {
+ params.entry(key).or_insert(value);
+ }
+ }
+ }
+
+ pub(crate) fn simple_restore(feature: &solidcraft_engine::doc::FeatureKind) -> Option<Self> {
+ Some(match feature {
+ $( $feature => Self::$variant { $($field: $restore,)* }, )*
+ _ => return None,
+ })
+ }
+ }
+ };
+}
+
+pub(crate) use dialog_descriptors;
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index fbe47fa5ee..4ce75d6c36 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -2,6 +2,7 @@
//! inputs (geometry picked in the viewport, never typed), then runs its command; it never
//! changes the design itself. Things selected before the command starts become its input.
+use crate::ui_kit::choice_row;
use std::hash::{Hash, Hasher};
use egui::{RichText, vec2};
@@ -13,7 +14,9 @@ use solidcraft_engine::doc::{AxisRef, Direction, FeatureKind, FilletStyle, HoleK
use solidcraft_engine::geom::{Aabb3, Vec3};
use crate::SolveApp;
-use crate::selection::{self, AXES, Accept, BODIES, CURVES, EDGES, FACES, PLANAR_FACES, PLANES, PROFILES, SelInput};
+use crate::selection::{
+ self, AXES, Accept, BODIES, CURVES, EDGES, FACES, PLANAR_FACES, PLANES, PROFILES, SelInput, SelectionExt as _, point_value as pt, polyline_mid,
+};
use crate::theme::Tokens;
use crate::tool_modifiers::{Audit, Scope, ToolModifiers};
use crate::viewport::Hit;
@@ -91,273 +94,278 @@ const THIN_ACCEPT: Accept = PROFILES | CURVES;
const HOLE_TYPES: [&str; 3] = ["simple", "counterbore", "countersink"];
const HOLE_LABELS: [&str; 3] = ["Simple", "Counterbore", "Countersink"];
-#[derive(Clone, Debug)]
-pub enum Kind {
- /// Pick a plane or planar face; the sketch starts on it at once.
- Sketch,
- Extrude {
- distance: String,
- direction: usize,
- operation: usize,
- /// Into a body: cut; additions: join when a solid exists, otherwise new.
- /// until the user picks one.
- auto_op: bool,
- /// The direction from the picked side and the latched operation (#1257).
- smart: crate::smart_extrude::Smart,
- /// The other side's distance (two sides).
- distance2: String,
- /// Taper angle (empty or zero: none).
- taper: String,
- /// An explicitly authored zero taper is still a model parameter.
- taper_present: bool,
- /// Optional distance beyond the selected end object.
- to_offset: String,
- /// Start offset from the profile plane (empty: start on the profile plane).
- start: String,
- /// Extent type All (through everything) instead of a distance.
- all: bool,
- /// Thin Extrude: a wall along the picked curves (or profiles' outlines).
- thin: bool,
- /// The wall thickness (inside, with Two Sides).
- wall: String,
- /// Wall location: an index into [`WALL_SIDES`].
- wall_side: usize,
- /// The thickness outside, with Two Sides.
- wall2: String,
- },
- Revolve {
- angle: String,
- operation: usize,
- /// An arbitrary stored line until the user deliberately picks a replacement.
- axis: Option<Value>,
- },
- Fillet {
- radius: String,
- chamfer: bool,
- chain: bool,
- /// Chamfer type: 0 equal distance, 1 two distances, 2 distance and angle; with the
- /// second distance, the angle and which face the first distance is on.
- ctype: usize,
- distance2: String,
- angle: String,
- flip: bool,
- },
- Shell {
- thickness: String,
- },
- Draft {
- angle: String,
- },
- Mirror,
- /// Rectangular pattern of bodies: along one direction, optionally a second.
- PatternRect {
- count: String,
- spacing: String,
- count2: String,
- spacing2: String,
- },
- /// Circular pattern of bodies around an axis.
- PatternCirc {
- count: String,
- angle: String,
- },
- /// Loft through profiles of different sketches, in pick order; `rail_fit` how its guide
- /// rails reshape the sections (an index into the sweep dialog's rail fits).
- Loft {
- operation: usize,
- rail_fit: usize,
- },
- /// Sweep a profile along a path of sketch curves.
- Sweep {
- operation: usize,
- opts: crate::dialogs_sweep::SweepOpts,
- },
- /// A construction plane offset from a plane.
- OffsetPlane {
- offset: String,
- },
- /// Halfway between two planes or planar faces.
- Midplane,
- /// An imported mesh body rebuilt as editable faces (#3001).
- MeshConvert {
- tolerance: String,
- },
- /// A construction axis, point or plane made from picks alone (#2474): input `i` is the
- /// command's parameter `keys[i]`, and `t` (along a path) when it takes one.
- Construct {
- command: &'static str,
- title: &'static str,
- keys: Vec<&'static str>,
- t: Option<String>,
- },
- /// A construction plane through an axis at an angle to a plane.
- AnglePlane {
- angle: String,
- },
- /// A plane perpendicular to one selected path at a fractional distance.
- PathPlane {
- t: String,
- sketch: Option<u64>,
- },
- /// Split a body by a plane.
- Split,
- /// Scale bodies uniformly.
- Scale {
- factor: String,
- },
- /// Move planar faces along their normals.
- OffsetFaces {
- distance: String,
- },
- /// A cosmetic thread on a cylindrical face.
- Thread {
- designation: String,
- length: String,
- /// The last automatic size; a different value is a manual override. Keep automatic
- /// features automatic when applying, even though their resolved size is visible.
- suggested: Option<String>,
- /// The picks used for the suggestion, so an unchanged dialog does no geometry work.
- of: Vec<Sel>,
- },
- /// A rib (one wall along open curves) or a web (a wall per curve).
- Rib {
- web: bool,
- thickness: String,
- depth: String,
- flip: bool,
- /// Grow along the sketch normal rather than across the plane.
- normal: bool,
- },
- /// Raise or sink profiles of a sketch on a face.
- Emboss {
- depth: String,
- deboss: bool,
- },
- /// Move planar faces onto a target plane or face.
- ReplaceFace,
- /// Take faces off a body; the neighbouring faces close the gap (#2167).
- DeleteFaces,
- /// Boundary Fill: the cells the tool bodies make (a point inside, a description, filled
- /// or not), found again when the tools change.
- BoundaryFill {
- operation: usize,
- cells: Vec<(Vec3, String, bool)>,
- of: Vec<Sel>,
- },
- /// Move bodies so a face or point meets another.
- Align {
- flip: bool,
- },
- /// Remove bodies from here on in the timeline.
- Remove,
- /// Pattern bodies along a path of sketch curves.
- PathPattern {
- count: String,
- spacing: String,
- },
- /// A pipe (round, optionally hollow) along sketch curves.
- Pipe {
- diameter: String,
- wall: String,
- },
- /// A stock block around bodies.
- Stock {
- margin: String,
- },
- /// Physical material (and with it the appearance) of bodies.
- Material {
- index: usize,
- },
- /// Section Analysis: cut the view by a plane, moved along its normal.
- Section {
- offset: String,
- flip: bool,
- },
- /// Measure one or two picked items (vertices, edges, faces): the result of the last
- /// measurement and the items it was for.
- Measure {
- result: Option<Value>,
- of: Vec<Sel>,
- /// The measure chosen in the panel (centre, min or max); `None` follows the result's
- /// own default (centre where a round item gives one).
- show: Option<Shown>,
- },
- /// Move bodies by a distance along X, Y and Z.
- /// Move/Copy (see `dialogs_move`): the move type, X/Y/Z distances (Point to Position: the
- /// target), X/Y/Z angles (Free Move) and the angle (Rotate).
- Move {
- mode: usize,
- x: String,
- y: String,
- z: String,
- rx: String,
- ry: String,
- rz: String,
- angle: String,
- },
- Hole {
- diameter: String,
- depth: String,
- kind: usize,
- cb_diameter: String,
- cb_depth: String,
- cs_diameter: String,
- cs_angle: String,
- opts: HoleOpts,
- },
- Primitive {
- cmd: &'static str,
- fields: Vec<(&'static str, String)>,
- operation: usize,
- /// Where it goes: a picked point on a face or vertex, with the face's normal when the
- /// face is planar. `None` keeps the command's own placement (the origin, or the edited
- /// feature's).
- at: Option<(Vec3, Option<Vec3>)>,
- },
- Combine {
- operation: usize,
- keep_tools: bool,
- },
- EditParam {
- name: String,
- expr: String,
- },
- Rename {
- feature: u64,
- name: String,
- },
- /// Delete a feature that others depend on.
- ConfirmDelete {
- features: Vec<u64>,
- with: Vec<String>,
- fail: Vec<String>,
- },
- /// Joints and components (`dialogs_assembly`).
- Assembly(crate::dialogs_assembly::Asm),
- /// Sheet metal (`dialogs_sheet`).
- Sheet(crate::dialogs_sheet::Sm),
- /// Surface tools and Split Face (`dialogs_surface`).
- Surface(crate::dialogs_surface::Surf),
- SaveMesh(crate::dialogs_save_mesh::SaveMesh),
- ViewDxf {
- dashed: bool,
- tolerance: f64,
- },
- /// Plastic features (`dialogs_plastic`).
- Plastic(crate::dialogs_plastic::Pl),
- /// Appearance (`dialogs_appearance`).
- Appearance(crate::dialogs_appearance::Ap),
- /// Contact sets, motion studies, exploded views, configurations (`dialogs_motion`).
- Motion(crate::dialogs_motion::Mo),
- /// Insert Part from the standard parts library (`dialogs_parts`).
- Part(crate::dialogs_parts::Pt),
- PartSize(crate::dialogs_part_size::Resize),
- /// Edit Text: a sketch text's content and placement (`sketch_text`).
- Text(Box<crate::sketch_text::Tx>),
- TextMove(crate::sketch_text_move::TextMove),
- /// Sketch-space modify tools: scale and offset, and later fillet, chamfer, the patterns,
- /// mirror and move (`sketch_modify_ui`).
- SketchModify(crate::sketch_modify_ui::Mod),
+crate::dialog_descriptor::dialog_descriptors! {
+ #[derive(Clone, Debug)]
+ pub enum Kind {
+ Shell("solid.shell", "SHELL", [("Faces/Body", FACES, true)],
+ FeatureKind::Shell { thickness, .. }) {
+ thickness: String = "2 mm".into() => thickness.to_string(),
+ } => json!({"thickness": thickness});
+ Draft("solid.draft", "DRAFT", [("Faces", FACES, true), ("Neutral plane", PLANES | PLANAR_FACES, false)],
+ FeatureKind::Draft { angle, .. }) {
+ angle: String = "5 deg".into() => angle.to_string(),
+ } => json!({"angle": angle});
+ OffsetPlane("construct.plane.offset", "OFFSET PLANE", [("Plane", PLANES | PLANAR_FACES, false)],
+ FeatureKind::ConstructionPlane { plane: PlaneRef::Offset { distance, .. } }) {
+ offset: String = "0 mm".into() => distance.to_string(),
+ } => json!({"offset": offset});
+ AnglePlane("construct.plane.at_angle", "PLANE AT ANGLE", [("Plane", PLANES, false), ("Axis", AXES, false)],
+ FeatureKind::ConstructionPlane { plane: PlaneRef::AtAngle { angle, .. } }) {
+ angle: String = "45 deg".into() => angle.to_string(),
+ } => json!({"angle": angle});
+ Scale("solid.scale", "SCALE", [("Bodies", BODIES, true)],
+ FeatureKind::Scale { factor, .. }) {
+ factor: String = "2".into() => factor.to_string(),
+ } => json!({"factor": factor});
+ OffsetFaces("solid.offset_face", "OFFSET FACE", [("Faces", PLANAR_FACES, true)],
+ FeatureKind::OffsetFace { distance, .. }) {
+ distance: String = "2 mm".into() => distance.to_string(),
+ } => json!({"distance": distance});
+ Stock("solid.bounding_solid", "STOCK", [("Bodies (all if none)", BODIES, true)],
+ FeatureKind::BoundingSolid { margin, .. }) {
+ margin: String = "2 mm".into() => margin.to_string(),
+ } => json!({"margin": margin});
+ Pipe("solid.pipe", "PIPE", [("Path", CURVES, true)],
+ FeatureKind::Pipe { diameter, wall, .. }) {
+ diameter: String = "5 mm".into() => diameter.to_string(),
+ wall: String = String::new() => wall.as_deref().map(str::to_string).unwrap_or_default(),
+ } => json!({"diameter": diameter});
+ Emboss("solid.emboss", "EMBOSS", [("Profiles", PROFILES, true), ("Target Face (optional)", FACES, false)],
+ FeatureKind::Emboss { depth, deboss, .. }) {
+ depth: String = "1 mm".into() => depth.to_string(),
+ deboss: bool = false => *deboss,
+ } => json!({"depth": depth, "mode": if *deboss { "deboss" } else { "emboss" }});
+ ; custom {
+ /// Pick a plane or planar face; the sketch starts on it at once.
+ Sketch,
+ Extrude {
+ distance: String,
+ direction: usize,
+ operation: usize,
+ /// Into a body: cut; additions: join when a solid exists, otherwise new.
+ /// until the user picks one.
+ auto_op: bool,
+ /// The direction from the picked side and the latched operation (#1257).
+ smart: crate::smart_extrude::Smart,
+ /// The other side's distance (two sides).
+ distance2: String,
+ /// Taper angle (empty or zero: none).
+ taper: String,
+ /// An explicitly authored zero taper is still a model parameter.
+ taper_present: bool,
+ /// Optional distance beyond the selected end object.
+ to_offset: String,
+ /// Start offset from the profile plane (empty: start on the profile plane).
+ start: String,
+ /// Extent type All (through everything) instead of a distance.
+ all: bool,
+ /// Thin Extrude: a wall along the picked curves (or profiles' outlines).
+ thin: bool,
+ /// The wall thickness (inside, with Two Sides).
+ wall: String,
+ /// Wall location: an index into [`WALL_SIDES`].
+ wall_side: usize,
+ /// The thickness outside, with Two Sides.
+ wall2: String,
+ },
+ Revolve {
+ angle: String,
+ operation: usize,
+ /// An arbitrary stored line until the user deliberately picks a replacement.
+ axis: Option<Value>,
+ },
+ Fillet {
+ radius: String,
+ chamfer: bool,
+ chain: bool,
+ /// Chamfer type: 0 equal distance, 1 two distances, 2 distance and angle; with the
+ /// second distance, the angle and which face the first distance is on.
+ ctype: usize,
+ distance2: String,
+ angle: String,
+ flip: bool,
+ },
+ Mirror,
+ /// Rectangular pattern of bodies: along one direction, optionally a second.
+ PatternRect {
+ count: String,
+ spacing: String,
+ count2: String,
+ spacing2: String,
+ },
+ /// Circular pattern of bodies around an axis.
+ PatternCirc {
+ count: String,
+ angle: String,
+ },
+ /// Loft through profiles of different sketches, in pick order; `rail_fit` how its guide
+ /// rails reshape the sections (an index into the sweep dialog's rail fits).
+ Loft {
+ operation: usize,
+ rail_fit: usize,
+ },
+ /// Sweep a profile along a path of sketch curves.
+ Sweep {
+ operation: usize,
+ opts: crate::dialogs_sweep::SweepOpts,
+ },
+ /// Halfway between two planes or planar faces.
+ Midplane,
+ /// An imported mesh body rebuilt as editable faces (#3001).
+ MeshConvert {
+ tolerance: String,
+ },
+ /// A construction axis, point or plane made from picks alone (#2474): input `i` is the
+ /// command's parameter `keys[i]`, and `t` (along a path) when it takes one.
+ Construct {
+ command: &'static str,
+ title: &'static str,
+ keys: Vec<&'static str>,
+ t: Option<String>,
+ },
+ /// A plane perpendicular to one selected path at a fractional distance.
+ PathPlane {
+ t: String,
+ sketch: Option<u64>,
+ },
+ /// Split a body by a plane.
+ Split,
+ /// A cosmetic thread on a cylindrical face.
+ Thread {
+ designation: String,
+ length: String,
+ /// The last automatic size; a different value is a manual override. Keep automatic
+ /// features automatic when applying, even though their resolved size is visible.
+ suggested: Option<String>,
+ /// The picks used for the suggestion, so an unchanged dialog does no geometry work.
+ of: Vec<Sel>,
+ },
+ /// A rib (one wall along open curves) or a web (a wall per curve).
+ Rib {
+ web: bool,
+ thickness: String,
+ depth: String,
+ flip: bool,
+ /// Grow along the sketch normal rather than across the plane.
+ normal: bool,
+ },
+ /// Move planar faces onto a target plane or face.
+ DeleteFaces,
+ ReplaceFace,
+ /// Boundary Fill: the cells the tool bodies make (a point inside, a description, filled
+ /// or not), found again when the tools change.
+ BoundaryFill {
+ operation: usize,
+ cells: Vec<(Vec3, String, bool)>,
+ of: Vec<Sel>,
+ },
+ /// Move bodies so a face or point meets another.
+ Align {
+ flip: bool,
+ },
+ /// Remove bodies from here on in the timeline.
+ Remove,
+ /// Pattern bodies along a path of sketch curves.
+ PathPattern {
+ count: String,
+ spacing: String,
+ },
+ /// Physical material (and with it the appearance) of bodies.
+ Material {
+ index: usize,
+ },
+ /// Section Analysis: cut the view by a plane, moved along its normal.
+ Section {
+ offset: String,
+ flip: bool,
+ },
+ /// Measure one or two picked items (vertices, edges, faces): the result of the last
+ /// measurement and the items it was for.
+ Measure {
+ result: Option<Value>,
+ of: Vec<Sel>,
+ /// The measure chosen in the panel (centre, min or max); `None` follows the result's
+ /// own default (centre where a round item gives one).
+ show: Option<Shown>,
+ },
+ /// Move bodies by a distance along X, Y and Z.
+ /// Move/Copy (see `dialogs_move`): the move type, X/Y/Z distances (Point to Position: the
+ /// target), X/Y/Z angles (Free Move) and the angle (Rotate).
+ Move {
+ mode: usize,
+ x: String,
+ y: String,
+ z: String,
+ rx: String,
+ ry: String,
+ rz: String,
+ angle: String,
+ },
+ Hole {
+ diameter: String,
+ depth: String,
+ kind: usize,
+ cb_diameter: String,
+ cb_depth: String,
+ cs_diameter: String,
+ cs_angle: String,
+ opts: HoleOpts,
+ },
+ Primitive {
+ cmd: &'static str,
+ fields: Vec<(&'static str, String)>,
+ operation: usize,
+ /// Where it goes: a picked point on a face or vertex, with the face's normal when the
+ /// face is planar. `None` keeps the command's own placement (the origin, or the edited
+ /// feature's).
+ at: Option<(Vec3, Option<Vec3>)>,
+ },
+ Combine {
+ operation: usize,
+ keep_tools: bool,
+ },
+ EditParam {
+ name: String,
+ expr: String,
+ },
+ Rename {
+ feature: u64,
+ name: String,
+ },
+ /// Delete a feature that others depend on.
+ ConfirmDelete {
+ features: Vec<u64>,
+ with: Vec<String>,
+ fail: Vec<String>,
+ },
+ /// Joints and components (`dialogs_assembly`).
+ Assembly(crate::dialogs_assembly::Asm),
+ /// Sheet metal (`dialogs_sheet`).
+ Sheet(crate::dialogs_sheet::Sm),
+ /// Surface tools and Split Face (`dialogs_surface`).
+ Surface(crate::dialogs_surface::Surf),
+ SaveMesh(crate::dialogs_save_mesh::SaveMesh),
+ ViewDxf {
+ dashed: bool,
+ tolerance: f64,
+ },
+ /// Plastic features (`dialogs_plastic`).
+ Plastic(crate::dialogs_plastic::Pl),
+ /// Appearance (`dialogs_appearance`).
+ Appearance(crate::dialogs_appearance::Ap),
+ /// Contact sets, motion studies, exploded views, configurations (`dialogs_motion`).
+ Motion(crate::dialogs_motion::Mo),
+ /// Insert Part from the standard parts library (`dialogs_parts`).
+ Part(crate::dialogs_parts::Pt),
+ PartSize(crate::dialogs_part_size::Resize),
+ /// Edit Text: a sketch text's content and placement (`sketch_text`).
+ Text(Box<crate::sketch_text::Tx>),
+ TextMove(crate::sketch_text_move::TextMove),
+ /// Sketch-space modify tools: scale and offset, and later fillet, chamfer, the patterns,
+ /// mirror and move (`sketch_modify_ui`).
+ SketchModify(crate::sketch_modify_ui::Mod),
+ }
+ }
}
/// The Single hole placement's input: places on planar faces. A pick on or near a sketch point
@@ -572,15 +580,12 @@ impl Dialog {
"solid.fillet" => Dialog::new(fillet_kind("2 mm", false), vec![SelInput::new("Edges", EDGES | FACES, true)]),
"solid.chamfer" => Dialog::new(fillet_kind("1 mm", true), vec![SelInput::new("Edges", EDGES | FACES, true)]),
"solid.shell" => {
- let mut d = Dialog::new(Kind::Shell { thickness: "2 mm".into() }, vec![SelInput::new("Faces/Body", FACES, true)]);
+ let (kind, inputs) = Kind::simple_start(id)?;
+ let mut d = Dialog::new(kind, inputs);
// Faces joined smoothly to the picked ones too.
d.extra.insert("tangent_chain".into(), json!(true));
d
}
- "solid.draft" => Dialog::new(
- Kind::Draft { angle: "5 deg".into() },
- vec![SelInput::new("Faces", FACES, true), SelInput::new("Neutral plane", PLANES | PLANAR_FACES, false)],
- ),
"solid.mirror" => {
Dialog::new(Kind::Mirror, vec![SelInput::new("Objects", BODIES, true), SelInput::new("Mirror Plane", PLANES | PLANAR_FACES, false)])
}
@@ -588,10 +593,6 @@ impl Dialog {
Kind::Rib { web: id == "solid.web", thickness: "2 mm".into(), depth: String::new(), flip: false, normal: false },
vec![SelInput::new("Curves", CURVES, true)],
),
- "solid.emboss" => Dialog::new(
- Kind::Emboss { depth: "1 mm".into(), deboss: false },
- vec![SelInput::new("Profiles", PROFILES, true), SelInput::new("Target Face (optional)", FACES, false)],
- ),
"solid.replace_face" => Dialog::new(
Kind::ReplaceFace,
vec![SelInput::new("Faces", PLANAR_FACES, true), SelInput::new("Target", PLANES | PLANAR_FACES, false)],
@@ -613,11 +614,6 @@ impl Dialog {
Kind::PathPattern { count: "4".into(), spacing: "20 mm".into() },
vec![SelInput::new("Objects", BODIES, true), SelInput::new("Path", CURVES, true)],
),
- "solid.pipe" => Dialog::new(Kind::Pipe { diameter: "5 mm".into(), wall: String::new() }, vec![SelInput::new("Path", CURVES, true)]),
- "solid.bounding_solid" => Dialog::new(Kind::Stock { margin: "2 mm".into() }, vec![SelInput::new("Bodies (all if none)", BODIES, true)]),
- "construct.plane.offset" => {
- Dialog::new(Kind::OffsetPlane { offset: "0 mm".into() }, vec![SelInput::new("Plane", PLANES | PLANAR_FACES, false)])
- }
"mesh.convert" => Dialog::new(Kind::MeshConvert { tolerance: "0.05 mm".into() }, vec![SelInput::new("Mesh body", BODIES, false)]),
"construct.plane.midplane" => Dialog::new(
Kind::Midplane,
@@ -633,16 +629,10 @@ impl Dialog {
"construct.plane.along_path" => {
Dialog::new(Kind::PathPlane { t: "0.5".into(), sketch: None }, vec![SelInput::new("Path", CURVES | EDGES, false)])
}
- "construct.plane.at_angle" => Dialog::new(
- Kind::AnglePlane { angle: "45 deg".into() },
- vec![SelInput::new("Plane", PLANES, false), SelInput::new("Axis", AXES, false)],
- ),
"solid.split_body" => Dialog::new(
Kind::Split,
vec![SelInput::new("Body to split", BODIES, false), SelInput::new("Splitting tool", PLANES | FACES | AXES, false)],
),
- "solid.scale" => Dialog::new(Kind::Scale { factor: "2".into() }, vec![SelInput::new("Bodies", BODIES, true)]),
- "solid.offset_face" => Dialog::new(Kind::OffsetFaces { distance: "2 mm".into() }, vec![SelInput::new("Faces", PLANAR_FACES, true)]),
"solid.thread" => Dialog::new(
Kind::Thread { designation: String::new(), length: String::new(), suggested: None, of: Vec::new() },
vec![SelInput::new("Cylindrical face", FACES, false)],
@@ -733,7 +723,8 @@ impl Dialog {
vec![SelInput::new("Target Body", BODIES, false), SelInput::new("Tool Bodies", BODIES, true)],
),
_ => {
- let (kind, inputs) = crate::dialogs_assembly::start(app, id)
+ let (kind, inputs) = Kind::simple_start(id)
+ .or_else(|| crate::dialogs_assembly::start(app, id))
.or_else(|| crate::dialogs_sheet::start(app, id))
.or_else(|| crate::dialogs_surface::start(app, id))
.or_else(|| crate::dialogs_save_mesh::start(app, id))
@@ -848,6 +839,7 @@ impl Dialog {
Dialog::new(Kind::Rename { feature, name: name.to_string() }, vec![])
}
+ #[cfg(test)]
pub fn confirm_delete(feature: u64, with: Vec<String>, fail: Vec<String>) -> Dialog {
Dialog::confirm_delete_many(vec![feature], with, fail)
}
@@ -1514,23 +1506,6 @@ thread_local! {
const { std::cell::RefCell::new((None, Vec::new())) };
}
-fn polyline_mid(pts: &[Vec3]) -> Vec3 {
- let len: f64 = pts.windows(2).map(|w| w[0].dist(w[1])).sum();
- let mut acc = 0.0;
- for w in pts.windows(2) {
- let l = w[0].dist(w[1]);
- if acc + l >= len * 0.5 && l > 0.0 {
- return w[0].lerp(w[1], (len * 0.5 - acc) / l);
- }
- acc += l;
- }
- pts.first().copied().unwrap_or_default()
-}
-
-fn pt(v: Vec3) -> Value {
- json!([v.x, v.y, v.z])
-}
-
/// A plane input as a command parameter: an origin/construction plane name or a face plane.
fn plane_value(s: &Session, sel: Option<&Sel>) -> Option<Value> {
match sel? {
@@ -1543,11 +1518,17 @@ fn plane_value(s: &Session, sel: Option<&Sel>) -> Option<Value> {
}
}
-/// A value field; true when Enter was pressed in it.
-pub(crate) fn field(ui: &mut egui::Ui, s: &mut String) -> bool {
- crate::ui_kit::field(ui, s)
+/// Put non-empty optional values into the parameters.
+pub(crate) fn put(p: &mut Value, list: &[(&str, &str)]) {
+ for (k, v) in list {
+ if !v.trim().is_empty() {
+ p[*k] = json!(v);
+ }
+ }
}
+pub(crate) use crate::ui_kit::{field, row as form_row};
+
pub(crate) fn check(ui: &mut egui::Ui, on: &mut bool) {
let r = crate::ui_kit::checkbox(ui, "", on);
publish_check(ui, &r, *on);
@@ -1557,25 +1538,12 @@ pub(crate) fn combo(ui: &mut egui::Ui, id: &str, labels: &[&str], sel: &mut usiz
crate::ui_kit::dropdown(ui, id, sel, labels);
}
-thread_local! {
- /// The label of the dialog row being laid out (its widgets publish `dialog:<label>` handles).
- static ROW: std::cell::RefCell<String> = const { std::cell::RefCell::new(String::new()) };
-}
-
fn tr(text: &str) -> &str {
crate::i18n::tr_label(text)
}
fn publish_check(ui: &egui::Ui, response: &egui::Response, selected: bool) {
- if crate::ui_kit::contains(ui) {
- ROW.with(|row| response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), selected, tr(&row.borrow()))));
- }
- publish_row(response);
-}
-
-/// A dialog row's widget, for scenarios and demos: the handle `dialog:<row label>`.
-pub(crate) fn publish_row(r: &egui::Response) {
- ROW.with(|row| crate::scenario::publish_handle(&format!("dialog:{}", row.borrow()), r.rect.center()));
+ response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), selected, tr(crate::ui_kit::row_label(ui))));
}
fn title(k: &Kind) -> &'static str {
@@ -1585,31 +1553,22 @@ fn title(k: &Kind) -> &'static str {
Kind::Revolve { .. } => "REVOLVE",
Kind::Fillet { chamfer: false, .. } => "FILLET",
Kind::Fillet { chamfer: true, .. } => "CHAMFER",
- Kind::Shell { .. } => "SHELL",
- Kind::Draft { .. } => "DRAFT",
Kind::Mirror => "MIRROR",
Kind::Measure { .. } => "MEASURE",
Kind::Material { .. } => "PHYSICAL MATERIAL",
- Kind::OffsetPlane { .. } => "OFFSET PLANE",
Kind::Midplane => "MIDPLANE",
Kind::MeshConvert { .. } => "CONVERT MESH",
Kind::Construct { title, .. } => title,
Kind::PathPlane { .. } => "PLANE ALONG PATH",
Kind::Rib { web: false, .. } => "RIB",
Kind::Rib { web: true, .. } => "WEB",
- Kind::Emboss { .. } => "EMBOSS",
Kind::ReplaceFace => "REPLACE FACE",
Kind::DeleteFaces => "DELETE FACE",
Kind::Align { .. } => "ALIGN",
Kind::BoundaryFill { .. } => "BOUNDARY FILL",
Kind::Remove => "REMOVE",
Kind::PathPattern { .. } => "PATTERN ON PATH",
- Kind::Pipe { .. } => "PIPE",
- Kind::Stock { .. } => "STOCK",
- Kind::AnglePlane { .. } => "PLANE AT ANGLE",
Kind::Split => "SPLIT BODY",
- Kind::Scale { .. } => "SCALE",
- Kind::OffsetFaces { .. } => "OFFSET FACE",
Kind::Thread { .. } => "THREAD",
Kind::Section { .. } => "SECTION ANALYSIS",
Kind::PatternRect { .. } => "RECTANGULAR PATTERN",
@@ -1642,6 +1601,7 @@ fn title(k: &Kind) -> &'static str {
Kind::Text(_) => "EDIT TEXT",
Kind::TextMove(_) => "MOVE/COPY TEXT",
Kind::SketchModify(k) => k.title(),
+ _ => k.simple_metadata().map_or("", |(_, title)| title),
}
}
@@ -1666,11 +1626,6 @@ fn hint(inp: &SelInput) -> &'static str {
}
}
-pub(crate) fn form_row<R>(ui: &mut egui::Ui, label: &str, add: impl FnOnce(&mut egui::Ui) -> R) -> R {
- ROW.with(|row| *row.borrow_mut() = label.to_string());
- crate::ui_kit::row(ui, label, add)
-}
-
thread_local! {
/// Faces already traced to their feature, by (revision, body, face).
static FACE_FEATURE: std::cell::RefCell<(u64, std::collections::HashMap<(String, usize), Option<u64>>)> = Default::default();
@@ -1747,9 +1702,7 @@ fn object_type_row(d: &mut Dialog, ui: &mut egui::Ui) {
let Some(inp) = d.inputs.first_mut() else { return };
let cur = usize::from(inp.accept == selection::FEATURES);
let mut ty = cur;
- form_row(ui, "Object Type", |ui| {
- combo(ui, "pat_obj", &["Bodies", "Features"], &mut ty);
- });
+ choice_row(ui, "Object Type", "pat_obj", &mut ty, &["Bodies", "Features"]);
if ty != cur {
inp.accept = if ty == 1 { selection::FEATURES } else { BODIES };
inp.label = objects_label(inp.accept);
@@ -1777,9 +1730,7 @@ fn placement_row(d: &mut Dialog, ui: &mut egui::Ui) {
};
if let Some(cur) = current {
let mut ty = cur;
- form_row(ui, "Type", |ui| {
- combo(ui, "pat_type", &["Rectangular", "Circular", "Path"], &mut ty);
- });
+ choice_row(ui, "Type", "pat_type", &mut ty, &["Rectangular", "Circular", "Path"]);
if ty != cur {
// Same objects, the new pattern's other inputs.
let objects = d.inputs.first().map(|i| i.items.clone()).unwrap_or_default();
@@ -1817,9 +1768,7 @@ fn placement_row(d: &mut Dialog, ui: &mut egui::Ui) {
}
let Kind::Hole { opts, .. } = &mut d.kind else { return };
let mut m = usize::from(opts.multiple);
- form_row(ui, "Placement", |ui| {
- combo(ui, "hole_place", &["Single", "Multiple"], &mut m);
- });
+ choice_row(ui, "Placement", "hole_place", &mut m, &["Single", "Multiple"]);
if (m == 1) != opts.multiple {
opts.multiple = m == 1;
d.inputs = vec![if opts.multiple { SelInput::new("Points", selection::POINTS, true) } else { SelInput::new("Face", HOLE_FACES, true) }];
@@ -1902,9 +1851,8 @@ fn input_rows_range(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, range: std::
};
let selected_text = text.text().strip_prefix("↖ ").unwrap_or_else(|| text.text());
let prompt = if !filled && inp.label == "Edges" { tr("Select edges") } else { selected_text };
- let chip = crate::ui_kit::selection_field_state(ui, prompt, active, filled);
+ let chip = crate::ui_kit::selection_field(ui, prompt, crate::ui_kit::Selection { active, filled });
let chip_rect = chip.rect;
- publish_row(&chip);
let tooltip = if let Some(reference) = stored_reference {
reference.to_string()
} else if custom_axis {
@@ -1936,7 +1884,7 @@ fn input_rows_range(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, range: std::
}
});
});
- if crate::ui_kit::contains(ui) && matches!(d.kind, Kind::SketchModify(_)) && inp.multi {
+ if matches!(d.kind, Kind::SketchModify(_)) && inp.multi {
for (index, item) in inp.items.iter().enumerate() {
if crate::ui_kit::list_row(ui, &format!("{}:{index}", inp.label), &selection_label(s, item)).clicked() {
remove = Some((i, index));
@@ -2019,8 +1967,8 @@ fn error_rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui: &mut
return;
}
ui.vertical(|ui| {
- crate::ui_kit::text_block(ui, "error", &error, true);
- let response = crate::ui_kit::secondary_button(ui, "Create Issue…");
+ crate::ui_kit::text(ui, &error, crate::ui_kit::Text::Report("error", true));
+ let response = crate::ui_kit::button(ui, "Create Issue…", crate::ui_kit::Button::Normal);
crate::scenario::publish_handle("dialog:create_issue", response.rect.center());
if response.clicked() {
crate::issue_report::begin(app, ctx, Some(d), Some(&error));
@@ -2037,7 +1985,7 @@ fn update_fill_cells(app: &SolveApp, d: &mut Dialog) {
if *of == tools {
return;
}
- let names: Vec<String> = tools.iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect();
+ let names: Vec<String> = tools.body_names();
// Editing: the tools as they were before this feature (it may have removed them).
let st = match d.editing {
Some((id, _)) => app.session.model.state_before(id),
@@ -2359,8 +2307,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
app.viewport.dialog_rect = response.map(|r| r.response.rect);
if let Some(r) = app.viewport.dialog_rect {
crate::scenario::publish_rect("dialog:outer", r);
- crate::scenario::publish_rect("dialog:card", r);
- crate::scenario::publish_handle("dialog:card", r.center());
+ crate::scenario::publish_target("dialog:card", r);
}
// Keyboard: Enter applies (from a value field, or with nothing focused), Esc cancels.
let (enter_free, esc) = ctx.input(|i| (i.key_pressed(egui::Key::Enter), i.key_pressed(egui::Key::Escape)));
@@ -2818,7 +2765,7 @@ pub(crate) fn facing(app: &SolveApp, n: Vec3, again: bool) -> Vec3 {
}
fn sels(d: &Dialog, i: usize) -> &[Sel] {
- d.inputs.get(i).map(|x| x.items.as_slice()).unwrap_or(&[])
+ selection::items(&d.inputs, i)
}
pub(crate) fn run_dialog(app: &mut SolveApp, d: &Dialog) -> Result<(), String> {
@@ -2940,15 +2887,10 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
let s = &app.session;
let need = |i: usize, what: &str| -> Result<(), String> { if sels(d, i).is_empty() { Err(format!("select {what} first")) } else { Ok(()) } };
let profiles = || -> (Value, Value) {
- let ps: Vec<(u64, usize)> =
- sels(d, 0).iter().filter_map(|x| if let Sel::Profile { sketch, index } = x { Some((*sketch, *index)) } else { None }).collect();
+ let ps: Vec<(u64, usize)> = sels(d, 0).profiles();
(ps.first().map(|x| json!(x.0)).unwrap_or(Value::Null), json!(ps.iter().map(|x| x.1).collect::<Vec<_>>()))
};
- let body_names =
- |i: usize| -> Vec<String> { sels(d, i).iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect() };
- let face_points = |i: usize| -> Vec<Value> {
- sels(d, i).iter().filter_map(|x| if let Sel::Face { point, .. } = x { Some(pt(*point)) } else { None }).collect()
- };
+ let face_points = |i: usize| -> Vec<Value> { sels(d, i).face_points().into_iter().map(pt).collect() };
let (cmd, params): (&str, Value) = match &d.kind {
Kind::Extrude {
distance,
@@ -2974,17 +2916,13 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
} else if *direction < 2 && (*taper_present || tapered) {
common["taper"] = json!(taper);
}
- if !start.trim().is_empty() {
- common["start_offset"] = json!(start);
- }
+ put(&mut common, &[("start_offset", start)]);
if *all {
common["through_all"] = json!(true);
}
if to_object_on(&d.inputs) {
common["to"] = to_object_point(&d.inputs).ok_or("select the object to extrude to")?;
- if !to_offset.trim().is_empty() {
- common["to_offset"] = json!(to_offset);
- }
+ put(&mut common, &[("to_offset", to_offset)]);
}
if object_on(&d.inputs, FROM_OBJECT) {
common["from"] = object_point(&d.inputs, FROM_OBJECT).ok_or("select the object to extrude from")?;
@@ -3002,7 +2940,7 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
if *thin {
// The picked curves, and the outlines (outer and holes) of picked profiles.
let st = s.world_state();
- let mut curves = curve_ids(d, 0);
+ let mut curves = sels(d, 0).curve_ids();
let mut sketch = None;
for x in sels(d, 0) {
if let Sel::Profile { sketch: id, index } = x
@@ -3154,15 +3092,15 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
("solid.fillet", p)
}
}
- Kind::Shell { thickness } => {
+ Kind::Shell { .. } => {
need(0, "faces to remove")?;
- ("solid.shell", json!({"faces": face_points(0), "thickness": thickness}))
+ ("solid.shell", json!({"faces": face_points(0)}))
}
- Kind::Draft { angle } => {
+ Kind::Draft { .. } => {
need(0, "faces")?;
need(1, "the neutral plane")?;
let neutral = plane_value(s, sels(d, 1).first()).ok_or("the neutral plane must be a plane or a planar face")?;
- ("solid.draft", json!({"faces": face_points(0), "angle": angle, "neutral": neutral}))
+ ("solid.draft", json!({"faces": face_points(0), "neutral": neutral}))
}
Kind::Mirror => {
need(0, "objects")?;
@@ -3233,16 +3171,16 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
need(0, "a profile")?;
need(1, "the path")?;
let (sketch, idx) = profiles();
- let path: Vec<String> = sels(d, 1).iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect();
+ let path: Vec<String> = sels(d, 1).curve_ids();
let path_sketch = curves_sketch(app, &path, sketch.as_u64()).ok_or("the path curves must be in one sketch")?;
let mut p = json!({"sketch": sketch, "profiles": idx, "path_sketch": path_sketch, "path": path, "operation": OPS.get(*operation).copied().unwrap_or("new")});
crate::dialogs_sweep::params(app, opts, sels(d, 2).first(), [sels(d, 3), sels(d, 4)], &mut p)?;
("solid.sweep", p)
}
- Kind::OffsetPlane { offset } => {
+ Kind::OffsetPlane { .. } => {
need(0, "a plane")?;
let base = plane_arg(app, sels(d, 0).first())?;
- ("construct.plane.offset", json!({"base": base, "offset": offset}))
+ ("construct.plane.offset", json!({"base": base}))
}
Kind::MeshConvert { tolerance } => {
need(0, "the mesh body")?;
@@ -3294,7 +3232,7 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
};
("construct.plane.along_path", json!({"path": path, "t": t}))
}
- Kind::AnglePlane { angle } => {
+ Kind::AnglePlane { .. } => {
need(0, "a plane")?;
let base = match sels(d, 0).first() {
Some(Sel::Plane { name }) => name.clone(),
@@ -3308,25 +3246,23 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
}
None => d.extra.get("axis").cloned().ok_or("pick an axis")?,
};
- ("construct.plane.at_angle", json!({"base": base, "axis": axis, "angle": angle}))
+ ("construct.plane.at_angle", json!({"base": base, "axis": axis}))
}
Kind::Rib { web, thickness, depth, flip, normal } => {
need(0, "open sketch curves")?;
- let curves = curve_ids(d, 0);
+ let curves = sels(d, 0).curve_ids();
let sketch = curves_sketch(app, &curves, None).ok_or("the curves must be in one sketch")?;
let mut p = json!({"sketch": sketch, "curves": curves, "thickness": thickness, "flip": flip});
if *normal {
p["direction"] = json!("normal");
}
- if !depth.trim().is_empty() {
- p["depth"] = json!(depth);
- }
+ put(&mut p, &[("depth", depth)]);
(if *web { "solid.web" } else { "solid.rib" }, p)
}
- Kind::Emboss { depth, deboss } => {
+ Kind::Emboss { .. } => {
need(0, "profiles")?;
let (sketch, idx) = profiles();
- let mut p = json!({"sketch": sketch, "profiles": idx, "depth": depth, "mode": if *deboss { "deboss" } else { "emboss" }});
+ let mut p = json!({"sketch": sketch, "profiles": idx});
if let Some(Sel::Face { body, point, .. }) = sels(d, 1).first() {
p["face"] = pt(*point);
p["targets"] = json!([body]);
@@ -3352,7 +3288,7 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
need(0, "bodies")?;
need(1, "what to move from")?;
need(2, "where to move it to")?;
- let mut p = json!({"bodies": body_names(0), "flip": flip});
+ let mut p = json!({"bodies": sels(d, 0).body_names(), "flip": flip});
for (i, key) in [(1, "from"), (2, "to")] {
let snap = d.extra.get(&format!("{key}_snap")).and_then(Value::as_str).unwrap_or("picked");
match (sels(d, i).first(), snap) {
@@ -3370,38 +3306,36 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
}
Kind::Remove => {
need(0, "bodies")?;
- ("solid.remove", json!({"bodies": body_names(0)}))
+ ("solid.remove", json!({"bodies": sels(d, 0).body_names()}))
}
Kind::PathPattern { count, spacing } => {
need(0, "objects")?;
need(1, "the path")?;
- let path = curve_ids(d, 1);
+ let path = sels(d, 1).curve_ids();
let sketch = curves_sketch(app, &path, None).ok_or("the path curves must be in one sketch")?;
let mut p = json!({"path_sketch": sketch, "path": path, "count": count, "spacing": spacing});
pattern_objects(s, sels(d, 0), &mut p);
("solid.pattern.path", p)
}
- Kind::Pipe { diameter, wall } => {
+ Kind::Pipe { wall, .. } => {
need(0, "the path")?;
- let path = curve_ids(d, 0);
+ let path = sels(d, 0).curve_ids();
let sketch = curves_sketch(app, &path, None).ok_or("the path curves must be in one sketch")?;
- let mut p = json!({"path_sketch": sketch, "path": path, "diameter": diameter});
- if !wall.trim().is_empty() {
- p["wall"] = json!(wall);
- }
+ let mut p = json!({"path_sketch": sketch, "path": path});
+ put(&mut p, &[("wall", wall)]);
("solid.pipe", p)
}
- Kind::Stock { margin } => {
- let mut p = json!({"margin": margin});
+ Kind::Stock { .. } => {
+ let mut p = json!({});
if !sels(d, 0).is_empty() {
- p["bodies"] = json!(body_names(0));
+ p["bodies"] = json!(sels(d, 0).body_names());
}
("solid.bounding_solid", p)
}
Kind::Split => {
need(0, "the body to split")?;
need(1, "the splitting plane")?;
- let body = body_names(0).into_iter().next().unwrap_or_default();
+ let body = sels(d, 0).body_names().into_iter().next().unwrap_or_default();
// A plane, a planar face's plane, or any other face (its surface extended).
let p = match sels(d, 1).first() {
Some(Sel::Plane { name }) => json!({"body": body, "plane": name}),
@@ -3425,13 +3359,13 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
};
("solid.split_body", p)
}
- Kind::Scale { factor } => {
+ Kind::Scale { .. } => {
need(0, "bodies")?;
- ("solid.scale", json!({"bodies": body_names(0), "factor": factor}))
+ ("solid.scale", json!({"bodies": sels(d, 0).body_names()}))
}
- Kind::OffsetFaces { distance } => {
+ Kind::OffsetFaces { .. } => {
need(0, "planar faces")?;
- ("solid.offset_face", json!({"faces": face_points(0), "distance": distance}))
+ ("solid.offset_face", json!({"faces": face_points(0)}))
}
Kind::Thread { designation, length, suggested, .. } => {
need(0, "a cylindrical face")?;
@@ -3439,15 +3373,13 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
if !designation.trim().is_empty() && suggested.as_deref() != Some(designation.as_str()) {
p["designation"] = json!(designation.trim());
}
- if !length.trim().is_empty() {
- p["length"] = json!(length);
- }
+ put(&mut p, &[("length", length)]);
("solid.thread", p)
}
Kind::Material { index } => {
need(0, "bodies")?;
let name = s.doc.material_names().get(*index).cloned().unwrap_or_else(|| "Default".into());
- ("material.assign", json!({"bodies": body_names(0), "material": name}))
+ ("material.assign", json!({"bodies": sels(d, 0).body_names(), "material": name}))
}
Kind::Section { offset, flip } => {
need(0, "a plane or planar face")?;
@@ -3583,13 +3515,16 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
if picked.is_empty() {
return Err("tick the cells to fill".into());
}
- ("solid.boundary_fill", json!({"tools": body_names(0), "cells": picked, "operation": OPS.get(*operation).copied().unwrap_or("new")}))
+ (
+ "solid.boundary_fill",
+ json!({"tools": sels(d, 0).body_names(), "cells": picked, "operation": OPS.get(*operation).copied().unwrap_or("new")}),
+ )
}
Kind::Combine { operation, keep_tools } => {
need(0, "the target body")?;
need(1, "tool bodies")?;
- let target = body_names(0).into_iter().next().unwrap_or_default();
- let tools: Vec<String> = body_names(1).into_iter().filter(|n| *n != target).collect();
+ let target = sels(d, 0).body_names().into_iter().next().unwrap_or_default();
+ let tools: Vec<String> = sels(d, 1).body_names().into_iter().filter(|n| *n != target).collect();
(
"solid.combine",
json!({"target": target, "tools": tools, "operation": OPS.get(*operation).copied().unwrap_or("join"), "keep_tools": keep_tools}),
@@ -3614,6 +3549,7 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
Kind::TextMove(k) => return crate::sketch_text_move::commands(app, k),
};
let mut params = params;
+ d.kind.fill_simple_params(&mut params);
if let Value::Object(m) = &mut params {
for (k, v) in &d.extra {
m.entry(k.clone()).or_insert_with(|| v.clone());
@@ -3664,11 +3600,6 @@ fn set_thin(inputs: &mut [SelInput], thin: bool) {
}
}
-/// Sketch curve ids picked in an input.
-fn curve_ids(d: &Dialog, i: usize) -> Vec<String> {
- sels(d, i).iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect()
-}
-
/// The features that made these bodies (what patterns and mirrors copy).
/// The features a pattern repeats: picked features as they are, picked bodies by the features
/// that made them.
@@ -3678,14 +3609,13 @@ fn pattern_objects(s: &Session, objects: &[Sel], p: &mut Value) {
if objects.iter().any(|x| matches!(x, Sel::Feature { .. })) {
p["features"] = json!(pattern_features(s, objects));
} else {
- let bodies: Vec<&str> = objects.iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.as_str()) } else { None }).collect();
- p["bodies"] = json!(bodies);
+ p["bodies"] = json!(objects.body_names());
}
}
fn pattern_features(s: &Session, objects: &[Sel]) -> Vec<String> {
let mut out: Vec<String> = Vec::new();
- let bodies: Vec<String> = objects.iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect();
+ let bodies: Vec<String> = objects.body_names();
for x in objects {
if let Sel::Feature { id } = x
&& let Some(f) = s.doc.feature(*id)
@@ -4205,9 +4135,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
d.chain_applied = false;
d
}
- FeatureKind::Shell { faces, thickness, direction, tangent_chain, .. } => {
+ FeatureKind::Shell { faces, direction, tangent_chain, .. } => {
let mut d = start("solid.shell")?;
- d.kind = Kind::Shell { thickness: thickness.to_string() };
+ d.kind = Kind::simple_restore(&f.kind)?;
d.extra.insert("tangent_chain".into(), json!(tangent_chain));
if !direction.is_empty() && direction != "inside" {
d.extra.insert("direction".into(), json!(direction));
@@ -4217,9 +4147,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
}
d
}
- FeatureKind::Draft { faces, angle, neutral, pull, .. } => {
+ FeatureKind::Draft { faces, neutral, pull, .. } => {
let mut d = start("solid.draft")?;
- d.kind = Kind::Draft { angle: angle.to_string() };
+ d.kind = Kind::simple_restore(&f.kind)?;
if let Some(inp) = d.inputs.get_mut(0) {
inp.items = faces.iter().filter_map(|p| face_sel(s, p.0)).collect();
}
@@ -4522,9 +4452,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
}
d
}
- FeatureKind::ConstructionPlane { plane: PlaneRef::Offset { base, distance } } => {
+ FeatureKind::ConstructionPlane { plane: PlaneRef::Offset { base, .. } } => {
let mut d = start("construct.plane.offset")?;
- d.kind = Kind::OffsetPlane { offset: distance.to_string() };
+ d.kind = Kind::simple_restore(&f.kind)?;
if let Some(inp) = d.inputs.first_mut() {
inp.items = plane_sel(s, base).into_iter().collect();
}
@@ -4557,9 +4487,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
}
d
}
- FeatureKind::ConstructionPlane { plane: PlaneRef::AtAngle { base, axis_origin, axis_dir, angle } } => {
+ FeatureKind::ConstructionPlane { plane: PlaneRef::AtAngle { base, axis_origin, axis_dir, .. } } => {
let mut d = start("construct.plane.at_angle")?;
- d.kind = Kind::AnglePlane { angle: angle.to_string() };
+ d.kind = Kind::simple_restore(&f.kind)?;
if let Some(inp) = d.inputs.first_mut() {
inp.items = plane_sel(s, base).into_iter().collect();
}
@@ -4593,9 +4523,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
}
d
}
- FeatureKind::Scale { bodies, origin, factor, factors } => {
+ FeatureKind::Scale { bodies, origin, factors, .. } => {
let mut d = start("solid.scale")?;
- d.kind = Kind::Scale { factor: factor.to_string() };
+ d.kind = Kind::simple_restore(&f.kind)?;
if let Some(inp) = d.inputs.first_mut() {
inp.items = bodies.iter().map(|n| Sel::Body { name: n.to_string() }).collect();
}
@@ -4605,9 +4535,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
}
d
}
- FeatureKind::OffsetFace { faces, distance, body } => {
+ FeatureKind::OffsetFace { faces, body, .. } => {
let mut d = start("solid.offset_face")?;
- d.kind = Kind::OffsetFaces { distance: distance.to_string() };
+ d.kind = Kind::simple_restore(&f.kind)?;
if let Some(inp) = d.inputs.first_mut() {
inp.items = faces.iter().filter_map(|p| face_sel(s, p.0)).collect();
}
@@ -4633,17 +4563,17 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
d.sync_thread(s);
d
}
- FeatureKind::BoundingSolid { bodies, margin } => {
+ FeatureKind::BoundingSolid { bodies, .. } => {
let mut d = start("solid.bounding_solid")?;
- d.kind = Kind::Stock { margin: margin.to_string() };
+ d.kind = Kind::simple_restore(&f.kind)?;
if let Some(inp) = d.inputs.first_mut() {
inp.items = bodies.iter().map(|n| Sel::Body { name: n.to_string() }).collect();
}
d
}
- FeatureKind::Pipe { path, diameter, wall, operation, targets, .. } => {
+ FeatureKind::Pipe { path, operation, targets, .. } => {
let mut d = start("solid.pipe")?;
- d.kind = Kind::Pipe { diameter: diameter.to_string(), wall: wall.as_deref().map(str::to_string).unwrap_or_default() };
+ d.kind = Kind::simple_restore(&f.kind)?;
if let Some(inp) = d.inputs.first_mut() {
inp.items = path.iter().map(|id| Sel::SketchCurve { id: id.clone() }).collect();
}
@@ -4653,9 +4583,9 @@ pub fn for_feature(app: &SolveApp, id: u64, marker: Option<usize>) -> Option<Dia
}
d
}
- FeatureKind::Emboss { sketch, profiles, depth, deboss, targets, face } => {
+ FeatureKind::Emboss { sketch, profiles, targets, face, .. } => {
let mut d = start("solid.emboss")?;
- d.kind = Kind::Emboss { depth: depth.to_string(), deboss: *deboss };
+ d.kind = Kind::simple_restore(&f.kind)?;
let items = st.sketch(sketch.0).map(|ss| profile_indices(ss, profiles)).unwrap_or_default();
if let Some(inp) = d.inputs.first_mut() {
inp.items = items.into_iter().map(|index| Sel::Profile { sketch: sketch.0, index }).collect();
diff --git a/crates/ui-egui/src/dialogs_all_tests.rs b/crates/ui-egui/src/dialogs_all_tests.rs
index 82de552260..da457bc986 100644
--- a/crates/ui-egui/src/dialogs_all_tests.rs
+++ b/crates/ui-egui/src/dialogs_all_tests.rs
@@ -102,7 +102,7 @@ fn check_form(command: &str, labels: &[&str]) {
ui_kit::scope(ui, |ui| {
ui_kit::header(ui, spec.icon, tr(spec.label), || {});
rows(&mut h.app, &h.ctx, &mut d, ui);
- ui_kit::footer(ui, "OK", "Cancel", true, None);
+ ui_kit::footer(ui, "OK", "Cancel", true, ui_kit::Footer::default());
});
},
);
@@ -175,7 +175,7 @@ fn check_form(command: &str, labels: &[&str]) {
assert!(scenario::handle_at("dialog:cancel").is_some());
let mut out = h.ctx.run_ui(egui::RawInput::default(), |ui| {
ui_kit::scope(ui, |ui| {
- assert_eq!(ui_kit::footer(ui, "OK", "Cancel", false, None), ui_kit::Action::None);
+ assert_eq!(ui_kit::footer(ui, "OK", "Cancel", false, ui_kit::Footer::default()), ui_kit::Action::None);
});
});
out.textures_delta.clear();
diff --git a/crates/ui-egui/src/dialogs_appearance.rs b/crates/ui-egui/src/dialogs_appearance.rs
index ddcadcc576..a5e22d126b 100644
--- a/crates/ui-egui/src/dialogs_appearance.rs
+++ b/crates/ui-egui/src/dialogs_appearance.rs
@@ -276,21 +276,12 @@ fn c32(c: [u8; 3], opacity: f64) -> Color32 {
Color32::from_rgba_unmultiplied(c[0], c[1], c[2], (opacity.clamp(0.0, 1.0) * 255.0) as u8)
}
-/// A swatch: a rounded square of the look; returns its response (click, drag).
-fn swatch(ui: &mut egui::Ui, id: egui::Id, color: [u8; 3], opacity: f64, picked: bool, tip: &str, payload: Look) -> egui::Response {
- ui_kit::color_swatch(ui, id, c32(color, opacity), picked, tip, payload)
-}
-
-fn swatch_rows<T>(ui: &mut egui::Ui, items: &[T], each: impl FnMut(&mut egui::Ui, &T)) {
- ui_kit::swatch_grid(ui, items, each);
-}
-
/// The dialog's rows (after the Objects input); applies drops and Apply at once.
pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &mut [SelInput]) -> bool {
// Apply To: bodies or faces (the input follows).
if let Some(component) = &k.component {
- ui_kit::row(ui, "Apply To", |ui| ui_kit::cell_text(ui, &format!("Component: {component}")));
- if ui_kit::secondary_button(ui, crate::i18n::tr_label("Select bodies or faces instead")).clicked() {
+ ui_kit::row(ui, "Apply To", |ui| ui_kit::text(ui, &format!("Component: {component}"), ui_kit::Text::Cell));
+ if ui_kit::button(ui, crate::i18n::tr_label("Select bodies or faces instead"), ui_kit::Button::Normal).clicked() {
k.component = None;
}
} else {
@@ -310,7 +301,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &mut [Sel
k.look = None;
k.remove_override = false;
}
- ui_kit::cell_text(ui, &k.look.clone().unwrap_or_else(|| hex(k.color)));
+ ui_kit::text(ui, &k.look.clone().unwrap_or_else(|| hex(k.color)), ui_kit::Text::Cell);
});
ui_kit::row(ui, "Opacity", |ui| {
if ui.add_enabled_ui(k.pbr.is_none(), |ui| ui_kit::slider(ui, &mut k.opacity, 0.0..=1.0)).inner.changed() {
@@ -350,7 +341,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &mut [Sel
let picked: Vec<Sel> = inputs.first().map(|i| i.items.clone()).unwrap_or_default();
ui.horizontal(|ui| {
let has_target = !picked.is_empty() || k.component.is_some();
- if ui_kit::enabled_button(ui, "Apply to selection", has_target).clicked()
+ if ui_kit::button(ui, "Apply to selection", ui_kit::Button::Enabled(has_target)).clicked()
&& let Some(p) = selected_params(k, &picked)
{
k.remove_override = false;
@@ -362,7 +353,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &mut [Sel
Err(e) => e,
});
}
- if ui_kit::enabled_button(ui, "Remove override", has_target)
+ if ui_kit::button(ui, "Remove override", ui_kit::Button::Enabled(has_target))
.on_hover_text(crate::i18n::tr_label("Restore the inherited component or physical material appearance"))
.clicked()
&& let Some(p) = clear_params(k, &picked)
@@ -383,12 +374,11 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &mut [Sel
if !used.is_empty() {
ui_kit::section(ui, "in_design", "In This Design", true, |ui| {
let items: Vec<_> = used.iter().enumerate().collect();
- swatch_rows(ui, &items, |ui, (i, (look, n))| {
- if swatch(
+ ui_kit::swatch_grid(ui, &items, |ui, (i, (look, n))| {
+ if ui_kit::color_swatch(
ui,
egui::Id::new(("ap_used", *i)),
- look.color,
- look.opacity,
+ c32(look.color, look.opacity),
k.color == look.color && k.opacity == look.opacity && k.pbr == look.pbr,
&format!("{} · {n} item(s)", look.name),
look.clone(),
@@ -424,12 +414,19 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &mut [Sel
let shown: Vec<(usize, &Look)> =
lib.iter().enumerate().filter(|(_, l)| (k.category == 0 || l.category == want) && l.name.to_lowercase().contains(&query)).collect();
if shown.is_empty() {
- ui_kit::note(ui, "appearances_empty", crate::i18n::tr_label("No matching appearances"));
+ ui_kit::text(ui, crate::i18n::tr_label("No matching appearances"), ui_kit::Text::Note("appearances_empty"));
}
- swatch_rows(ui, &shown, |ui, (i, l)| {
+ ui_kit::swatch_grid(ui, &shown, |ui, (i, l)| {
let picked_look = k.look.as_deref() == Some(l.name.as_str()) && k.pbr == l.pbr;
- if swatch(ui, egui::Id::new(("ap_lib", *i)), l.color, l.opacity, picked_look, &format!("{} (drag onto a body or face)", l.name), (*l).clone())
- .clicked()
+ if ui_kit::color_swatch(
+ ui,
+ egui::Id::new(("ap_lib", *i)),
+ c32(l.color, l.opacity),
+ picked_look,
+ &format!("{} (drag onto a body or face)", l.name),
+ (*l).clone(),
+ )
+ .clicked()
{
k.color = l.color;
k.opacity = l.opacity;
@@ -461,7 +458,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &mut [Sel
}
}
if let Some(n) = &k.note {
- ui_kit::text_block(ui, "appearance_status", n, false);
+ ui_kit::text(ui, n, ui_kit::Text::Report("appearance_status", false));
}
false
}
diff --git a/crates/ui-egui/src/dialogs_assembly.rs b/crates/ui-egui/src/dialogs_assembly.rs
index d90b21a630..806c02840c 100644
--- a/crates/ui-egui/src/dialogs_assembly.rs
+++ b/crates/ui-egui/src/dialogs_assembly.rs
@@ -6,6 +6,7 @@
//! component shows where it goes, and with Animate the joint plays its motion.
use crate::fonts::RichTextExt as _;
+use crate::ui_kit::{choice_row, expr_row, text_row};
use egui::{Color32, Pos2, RichText, Stroke, vec2};
use serde_json::{Value, json};
use solidcraft_engine::Sel;
@@ -17,13 +18,14 @@ use solidcraft_engine::geom::{Aabb3, Mesh, Vec3};
use crate::SolveApp;
use crate::dialogs::{Dialog, Kind, combo, field, form_row};
use crate::preview::{Built, Colors};
-use crate::selection::{BODIES, EDGES, FACES, SelInput, VERTICES};
+use crate::selection::{BODIES, EDGES, FACES, SelInput, SelectionExt as _, VERTICES, items as sel_items, point_value as pt, polyline_mid};
use crate::theme::Tokens;
use crate::viewport::Proj;
#[path = "dialogs_trace.rs"]
mod trace;
+pub(crate) use trace::stop_text;
pub use trace::{TraceForm, picked_point};
/// Joint types in the order the Type box lists them (command names).
@@ -298,9 +300,7 @@ fn current_values(s: &Session, index: usize) -> Vec<String> {
/// A value with its unit, without trailing zeros ("12 mm", "37.5 deg").
pub(crate) fn num(v: f64, unit: &str) -> String {
- let s = format!("{v:.4}");
- let s = s.trim_end_matches('0').trim_end_matches('.');
- format!("{} {unit}", if s == "-0" { "0" } else { s })
+ format!("{} {unit}", crate::dialogs_coupling::trim(v))
}
/// The Edit Joint dialog for a joint (by id).
@@ -386,10 +386,6 @@ pub struct SnapPt {
pub param: Value,
}
-fn pt(v: Vec3) -> Value {
- json!([v.x, v.y, v.z])
-}
-
/// The occurrence placing a body (0: the root design), when the body is its primary instance.
pub(crate) fn occurrence_of_body(s: &Session, body: &str) -> Option<u64> {
let st = s.world_state();
@@ -421,19 +417,6 @@ pub fn circle_of(pts: &[Vec3]) -> Option<(Vec3, Vec3)> {
pts.iter().all(|p| (p.dist(center) - r).abs() < tol && (*p - center).dot(normal).abs() < tol).then_some((center, normal))
}
-fn polyline_mid(pts: &[Vec3]) -> Vec3 {
- let len: f64 = pts.windows(2).map(|w| w[0].dist(w[1])).sum();
- let mut acc = 0.0;
- for w in pts.windows(2) {
- let l = w[0].dist(w[1]);
- if acc + l >= len * 0.5 && l > 0.0 {
- return w[0].lerp(w[1], (len * 0.5 - acc) / l);
- }
- acc += l;
- }
- pts.first().copied().unwrap_or_default()
-}
-
/// Normal of the mesh face `f` near `p`.
fn face_normal_near(m: &Mesh, f: u32, p: Vec3) -> Option<Vec3> {
m.triangles
@@ -519,9 +502,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
let problem = joint_problem(app, k, inputs);
match k {
Asm::NewComponent { name, activate } => {
- form_row(ui, "Name", |ui| {
- enter |= crate::ui_kit::text_field(ui, name, crate::i18n::tr_label("Component1")).0;
- });
+ enter |= text_row(ui, "Name", name, crate::i18n::tr_label("Component1")).0;
crate::ui_kit::options(ui, "component_options", &mut [("Activate", activate)]);
}
Asm::Joint(f) => {
@@ -534,7 +515,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
ui.vertical(|ui| {
ui.add(egui::Label::new(RichText::new(why).color(t.warning)).wrap());
if !bodies.is_empty()
- && crate::ui_kit::secondary_button(ui, crate::i18n::tr("cmd.component_from_bodies"))
+ && crate::ui_kit::button(ui, crate::i18n::tr("cmd.component_from_bodies"), crate::ui_kit::Button::Normal)
.on_hover_text(crate::i18n::tr("joint.from_bodies_hint"))
.clicked()
{
@@ -546,22 +527,16 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
form_row(ui, "Motion", |ui| {
ui.label("");
});
- form_row(ui, "Type", |ui| {
- combo(ui, "jt_type", &TYPE_LABELS, &mut f.kind);
- });
+ choice_row(ui, "Type", "jt_type", &mut f.kind, &TYPE_LABELS);
f.fit_limits();
if !f.as_built {
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, &mut f.angle);
- });
+ enter |= expr_row(ui, "Angle", &mut f.angle);
crate::ui_kit::section(ui, "joint_position", "Position", false, |ui| {
for (l, v) in ["Offset X", "Offset Y", "Offset Z"].iter().zip(f.offset.iter_mut()) {
if f.editing.is_some() && *l != "Offset Z" {
continue;
}
- form_row(ui, l, |ui| {
- enter |= field(ui, v);
- });
+ enter |= expr_row(ui, l, v);
}
});
crate::ui_kit::options(ui, "joint_options", &mut [("Flip", &mut f.flip)]);
@@ -570,7 +545,8 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
if kind != JointKind::Rigid {
form_row(ui, "Animate", |ui| {
let label = if f.animate { "■ Stop" } else { "▶ Play" };
- if crate::ui_kit::secondary_button(ui, label).on_hover_text("Play the joint's motion in the view").clicked() {
+ if crate::ui_kit::button(ui, label, crate::ui_kit::Button::Normal).on_hover_text("Play the joint's motion in the view").clicked()
+ {
f.animate = !f.animate;
}
});
@@ -581,12 +557,8 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
crate::ui_kit::checkbox(ui, "", on);
});
if *on {
- form_row(ui, " Minimum", |ui| {
- enter |= field(ui, lo);
- });
- form_row(ui, " Maximum", |ui| {
- enter |= field(ui, hi);
- });
+ enter |= expr_row(ui, " Minimum", lo);
+ enter |= expr_row(ui, " Maximum", hi);
}
}
});
@@ -601,9 +573,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
}
}
Asm::JointOrigin { name, .. } => {
- form_row(ui, "Name", |ui| {
- enter |= crate::ui_kit::text_field(ui, name, crate::i18n::tr_label("Joint Origin1")).0;
- });
+ enter |= text_row(ui, "Name", name, crate::i18n::tr_label("Joint Origin1")).0;
}
Asm::RigidGroup => {}
Asm::Drive { joint, values, focus } => {
@@ -619,9 +589,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
list.iter().filter_map(|i| s.doc.assembly.joints.get(*i)).map(|j| format!("{} ({:?})", j.name, j.kind)).collect();
let refs: Vec<&str> = labels.iter().map(String::as_str).collect();
let mut pos = list.iter().position(|i| i == joint).unwrap_or(0);
- form_row(ui, "Joint", |ui| {
- combo(ui, "drv_joint", &refs, &mut pos);
- });
+ choice_row(ui, "Joint", "drv_joint", &mut pos, &refs);
let pick = list.get(pos).copied().unwrap_or(0);
if pick != *joint || values.is_empty() {
*joint = pick;
@@ -702,9 +670,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
}
let labels: Vec<&str> = joints.iter().map(|j| j.name.as_str()).collect();
for (l, sel, idx, id) in [("Joint 1", &mut *a, &mut *ia, "ml_a"), ("Joint 2", &mut *b, &mut *ib, "ml_b")] {
- form_row(ui, l, |ui| {
- combo(ui, id, &labels, sel);
- });
+ choice_row(ui, l, id, sel, &labels);
let dofs = joints.get(*sel).map(|j| j.kind.dofs()).unwrap_or(&[]);
if dofs.len() > 1 {
form_row(ui, " Value", |ui| {
@@ -716,23 +682,23 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
*idx = 0;
}
}
- form_row(ui, "Ratio", |ui| {
- enter |= field(ui, ratio);
- });
- form_row(ui, "Offset", |ui| {
- enter |= field(ui, offset);
- });
+ enter |= expr_row(ui, "Ratio", ratio);
+ enter |= expr_row(ui, "Offset", offset);
}
Asm::Coupling(f) => enter |= crate::dialogs_coupling::rows(app, ui, f, inputs),
Asm::Cam(f) => enter |= crate::dialogs_coupling::cam::rows(app, ui, f, inputs),
Asm::Interference { result, overlaps, of, clearance } => {
let picked: Vec<Sel> = inputs.first().map(|i| i.items.clone()).unwrap_or_default();
- form_row(ui, "Clearance", |ui| {
- enter |= field(ui, clearance);
- });
+ enter |= expr_row(ui, "Clearance", clearance);
form_row(ui, "", |ui| {
let stale = result.is_some() && *of != picked;
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr(if stale { "dialog.compute_again" } else { "dialog.compute" })).clicked() {
+ if crate::ui_kit::button(
+ ui,
+ crate::i18n::tr(if stale { "dialog.compute_again" } else { "dialog.compute" }),
+ crate::ui_kit::Button::Normal,
+ )
+ .clicked()
+ {
let (r, o) = interference(app, &picked, clearance);
*result = Some(r);
*overlaps = o;
@@ -756,7 +722,7 @@ fn capital(s: &str) -> String {
/// Run the check (overlaps, pairs closer than the clearance, each body's nearest neighbour) and
/// find the overlapping volumes (world placement) to show in red.
fn interference(app: &mut SolveApp, picked: &[Sel], clearance: &str) -> (Value, Vec<Mesh>) {
- let names: Vec<String> = picked.iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect();
+ let names: Vec<String> = picked.body_names();
let (scale, _) = crate::prefs::unit_scale(&app.session.doc.units);
let clearance = match crate::prefs::parse_length_mm(clearance, scale) {
Some(v) if v >= 0.0 => v,
@@ -851,10 +817,6 @@ fn interference_rows(app: &SolveApp, ui: &mut egui::Ui, r: &Value) {
// ---- commands ----
-fn sel_items(inputs: &[SelInput], i: usize) -> &[Sel] {
- inputs.get(i).map(|x| x.items.as_slice()).unwrap_or(&[])
-}
-
/// The body a pick is on.
pub(crate) fn body_of(sel: &Sel) -> Option<&str> {
match sel {
@@ -917,8 +879,7 @@ pub fn commands(app: &SolveApp, k: &Asm, inputs: &[SelInput]) -> Result<Vec<(Str
let cmd = |id: &str, p: Value| vec![(id.to_string(), p)];
Ok(match k {
Asm::NewComponent { name, activate } => {
- let bodies: Vec<String> =
- sel_items(inputs, 0).iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect();
+ let bodies: Vec<String> = sel_items(inputs, 0).body_names();
if bodies.is_empty() {
let mut p = json!({ "activate": activate });
if !name.trim().is_empty() {
@@ -1217,20 +1178,20 @@ fn joint_menu(
open: &mut Option<Dialog>,
run: &mut Option<(&'static str, Value)>,
) {
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Edit Joint")).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Edit Joint"), crate::ui_kit::Button::Normal).clicked() {
*open = edit_joint(app, id);
ui.close();
}
- if kind != JointKind::Rigid && crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Drive Joint")).clicked() {
+ if kind != JointKind::Rigid && crate::ui_kit::button(ui, crate::i18n::tr_label("Drive Joint"), crate::ui_kit::Button::Normal).clicked() {
*open = drive_joint(app, id);
ui.close();
}
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr_label(if suppressed { "Unsuppress" } else { "Suppress" })).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label(if suppressed { "Unsuppress" } else { "Suppress" }), crate::ui_kit::Button::Normal).clicked() {
*run = Some(("joint.edit", json!({"joint": id, "suppressed": !suppressed})));
ui.close();
}
ui.separator();
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Delete")).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Delete"), crate::ui_kit::Button::Normal).clicked() {
*run = Some(("selection.delete", json!({ "joints": [id] })));
ui.close();
}
diff --git a/crates/ui-egui/src/dialogs_assembly_tests.rs b/crates/ui-egui/src/dialogs_assembly_tests.rs
index 8dbcfe3e51..e81aa0bbc4 100644
--- a/crates/ui-egui/src/dialogs_assembly_tests.rs
+++ b/crates/ui-egui/src/dialogs_assembly_tests.rs
@@ -8,13 +8,7 @@ use crate::dialogs::{apply_commands, face_sel, preview_commands};
/// Components A (grounded) and B: a 20 x 20 x 10 box each, B 30 mm along X.
fn two_boxes() -> SolveApp {
let mut s = Session::default();
- for (name, x) in [("A", 0), ("B", 30)] {
- s.execute("component.activate", &json!({"component": "root"})).unwrap();
- s.execute("component.create", &json!({ "name": name })).unwrap();
- s.execute("solid.box", &json!({"length": 20, "width": 20, "height": 10, "corner": [x, 0, 0]})).unwrap();
- }
- s.execute("component.activate", &json!({"component": "root"})).unwrap();
- s.execute("occurrence.ground", &json!({"occurrence": "A:1", "grounded": true})).unwrap();
+ crate::test_support::grounded_boxes(&[("A", 0), ("B", 30)], |id, p| s.execute(id, &p).unwrap());
SolveApp::new(s, Services::default())
}
diff --git a/crates/ui-egui/src/dialogs_cam.rs b/crates/ui-egui/src/dialogs_cam.rs
index 25885d30fa..4f156917d2 100644
--- a/crates/ui-egui/src/dialogs_cam.rs
+++ b/crates/ui-egui/src/dialogs_cam.rs
@@ -14,7 +14,7 @@ use super::{ROUND, joint_row, occurrence, pick, picked_radius, trim, turn};
use crate::SolveApp;
use crate::dialogs::{combo, field, form_row};
use crate::dialogs_assembly::Asm;
-use crate::selection::{EDGES, FACES, PROFILES, SelInput, VERTICES};
+use crate::selection::{EDGES, FACES, PROFILES, SelInput, SelectionExt as _, VERTICES};
use crate::theme::Tokens;
/// The follower types, as `joint.cam` takes them, and their labels.
@@ -125,7 +125,8 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, f: &mut CamForm, inputs: &[Se
crate::ui_kit::options(ui, "cam_options", &mut [("Other side", &mut f.flip)]);
form_row(ui, "Animate", |ui| {
let label = if f.animate { "■ Stop" } else { "▶ Play" };
- let r = crate::ui_kit::secondary_button(ui, label).on_hover_text(crate::i18n::tr_label("Play the joint's motion in the view"));
+ let r = crate::ui_kit::button(ui, label, crate::ui_kit::Button::Normal)
+ .on_hover_text(crate::i18n::tr_label("Play the joint's motion in the view"));
crate::scenario::publish_handle("dialog:Animate", r.rect.center());
if r.clicked() {
f.animate = !f.animate;
@@ -151,8 +152,7 @@ pub fn commands(app: &SolveApp, f: &CamForm, inputs: &[SelInput]) -> Result<Vec<
let profile = match items.first() {
Some(Sel::Profile { sketch, index }) => json!({"sketch": sketch, "index": index}),
Some(Sel::Edge { body, .. }) => {
- let pts: Vec<Value> =
- items.iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(json!([point.x, point.y, point.z])) } else { None }).collect();
+ let pts: Vec<Value> = items.edge_points().into_iter().map(crate::selection::point_value).collect();
let mut p = json!({ "edges": pts });
if let Some(o) = occurrence(s, body) {
p["occurrence"] = json!(o);
diff --git a/crates/ui-egui/src/dialogs_coupling.rs b/crates/ui-egui/src/dialogs_coupling.rs
index eb299666f2..90ac4f1a6d 100644
--- a/crates/ui-egui/src/dialogs_coupling.rs
+++ b/crates/ui-egui/src/dialogs_coupling.rs
@@ -4,6 +4,7 @@
//! face also picks the joint it turns on. Play turns the driving joint so the coupling shows its
//! motion before OK.
+use crate::ui_kit::{choice_row, expr_row};
use egui::RichText;
use serde_json::{Value, json};
use solidcraft_engine::Sel;
@@ -11,7 +12,7 @@ use solidcraft_engine::Session;
use solidcraft_engine::doc::expr::Kind as ValueKind;
use crate::SolveApp;
-use crate::dialogs::{combo, field, form_row};
+use crate::dialogs::{field, form_row};
use crate::dialogs_assembly::Asm;
use crate::selection::{EDGES, FACES, SelInput};
use crate::theme::Tokens;
@@ -119,9 +120,7 @@ fn size(s: &Session, f: &CouplingForm, inputs: &[SelInput], i: usize) -> Option<
fn joint_row(ui: &mut egui::Ui, label: &str, salt: &str, list: &[(u64, String)], sel: &mut u64) {
let labels: Vec<&str> = list.iter().map(|j| j.1.as_str()).collect();
let mut pos = list.iter().position(|j| j.0 == *sel).unwrap_or(0);
- form_row(ui, label, |ui| {
- combo(ui, salt, &labels, &mut pos);
- });
+ choice_row(ui, label, salt, &mut pos, &labels);
*sel = list.get(pos).map(|j| j.0).unwrap_or(0);
}
@@ -184,9 +183,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, f: &mut CouplingForm, inputs:
}
_ => {
joint_row(ui, role_b, "cp_b", &lb, &mut f.b);
- form_row(ui, "Pitch", |ui| {
- enter |= field(ui, s0);
- });
+ enter |= expr_row(ui, "Pitch", s0);
}
}
if f.command == "joint.gear" {
@@ -208,7 +205,8 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, f: &mut CouplingForm, inputs:
});
form_row(ui, "Animate", |ui| {
let label = if f.animate { "■ Stop" } else { "▶ Play" };
- let r = crate::ui_kit::secondary_button(ui, label).on_hover_text(crate::i18n::tr_label("Play the joint's motion in the view"));
+ let r = crate::ui_kit::button(ui, label, crate::ui_kit::Button::Normal)
+ .on_hover_text(crate::i18n::tr_label("Play the joint's motion in the view"));
crate::scenario::publish_handle("dialog:Animate", r.rect.center());
if r.clicked() {
f.animate = !f.animate;
@@ -224,7 +222,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, f: &mut CouplingForm, inputs:
}
/// A number without trailing zeros.
-fn trim(v: f64) -> String {
+pub(crate) fn trim(v: f64) -> String {
let s = format!("{v:.4}");
let s = s.trim_end_matches('0').trim_end_matches('.');
if s == "-0" { "0".into() } else { s.into() }
diff --git a/crates/ui-egui/src/dialogs_coupling_tests.rs b/crates/ui-egui/src/dialogs_coupling_tests.rs
index 0d24b5faaf..888c3ccd56 100644
--- a/crates/ui-egui/src/dialogs_coupling_tests.rs
+++ b/crates/ui-egui/src/dialogs_coupling_tests.rs
@@ -47,17 +47,6 @@ fn joint(app: &SolveApp, name: &str) -> u64 {
app.session.doc.assembly.joints.iter().find(|j| j.name == name).map(|j| j.id).unwrap_or(0)
}
-/// The text of every text shape in a frame's output.
-fn texts(out: &egui::FullOutput) -> Vec<String> {
- out.shapes
- .iter()
- .filter_map(|c| match &c.shape {
- egui::Shape::Text(t) => Some(t.galley.text().to_string()),
- _ => None,
- })
- .collect()
-}
-
/// Picking a gear's round face chooses the joint it turns on and takes its radius; the ratio
/// row says what the pair does, and OK makes the coupling.
#[test]
@@ -76,14 +65,11 @@ fn picked_gear_faces_choose_their_joints_and_radii() {
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 1000.0));
let frame = |app: &mut SolveApp| {
let input = egui::RawInput { screen_rect: Some(screen), ..Default::default() };
- let mut out = ctx.run_ui(input, |ui| crate::dialogs::show(app, ui.ctx()));
- // Nothing is painted: drop the texture changes (an unapplied delta panics on drop).
- out.textures_delta.clear();
- out
+ crate::test_support::frame(&ctx, input, |ui| crate::dialogs::show(app, ui.ctx()))
};
frame(&mut app);
let out = frame(&mut app);
- let shown = texts(&out);
+ let shown: Vec<_> = crate::test_support::text_shapes(&out).map(|t| t.galley.text().to_string()).collect();
assert!(shown.iter().any(|t| t == "-2 deg / deg"), "{shown:?}");
assert!(shown.iter().any(|t| t.starts_with("20 mm")), "{shown:?}");
let d = app.dialog.as_ref().expect("the dialog stays open");
diff --git a/crates/ui-egui/src/dialogs_dense.rs b/crates/ui-egui/src/dialogs_dense.rs
index 048b5889ad..1fabd7c01b 100644
--- a/crates/ui-egui/src/dialogs_dense.rs
+++ b/crates/ui-egui/src/dialogs_dense.rs
@@ -1,6 +1,7 @@
//! Dense ports of the common feature forms. Commands and parameter construction stay in dialogs.
use super::*;
use crate::ui_kit;
+use crate::ui_kit::{choice_row, expr_row, hint_row};
pub(super) fn command(kind: &Kind) -> Option<&'static str> {
match kind {
@@ -31,30 +32,21 @@ pub(super) fn command(kind: &Kind) -> Option<&'static str> {
Kind::PatternRect { .. } => Some("solid.pattern.rectangular"),
Kind::PatternCirc { .. } => Some("solid.pattern.circular"),
Kind::Revolve { .. } => Some("solid.revolve"),
- Kind::Shell { .. } => Some("solid.shell"),
- Kind::Draft { .. } => Some("solid.draft"),
Kind::Mirror => Some("solid.mirror"),
Kind::Loft { .. } => Some("solid.loft"),
Kind::Sweep { .. } => Some("solid.sweep"),
- Kind::OffsetPlane { .. } => Some("construct.plane.offset"),
Kind::Midplane => Some("construct.plane.midplane"),
Kind::MeshConvert { .. } => Some("mesh.convert"),
Kind::Construct { command, .. } => Some(command),
- Kind::AnglePlane { .. } => Some("construct.plane.at_angle"),
Kind::PathPlane { .. } => Some("construct.plane.along_path"),
Kind::Split => Some("solid.split_body"),
- Kind::Scale { .. } => Some("solid.scale"),
- Kind::OffsetFaces { .. } => Some("solid.offset_face"),
Kind::Move { .. } => Some("solid.move"),
Kind::Thread { .. } => Some("solid.thread"),
- Kind::Emboss { .. } => Some("solid.emboss"),
Kind::ReplaceFace => Some("solid.replace_face"),
Kind::BoundaryFill { .. } => Some("solid.boundary_fill"),
Kind::Align { .. } => Some("solid.align"),
Kind::Remove => Some("solid.remove"),
Kind::PathPattern { .. } => Some("solid.pattern.path"),
- Kind::Pipe { .. } => Some("solid.pipe"),
- Kind::Stock { .. } => Some("solid.bounding_solid"),
Kind::Combine { .. } => Some("solid.combine"),
Kind::Rib { web, .. } => Some(if *web { "solid.web" } else { "solid.rib" }),
Kind::Primitive { cmd, .. } => Some(cmd),
@@ -68,31 +60,25 @@ pub(super) fn command(kind: &Kind) -> Option<&'static str> {
crate::dialogs_surface::Surf::Patch { .. } => "surface.patch",
crate::dialogs_surface::Surf::Unstitch => "surface.unstitch",
crate::dialogs_surface::Surf::ReverseNormal => "surface.reverse_normal",
- crate::dialogs_surface::Surf::Offset { .. } => "surface.offset",
crate::dialogs_surface::Surf::Ruled { .. } => "surface.ruled",
- crate::dialogs_surface::Surf::Stitch { .. } => "surface.stitch",
- crate::dialogs_surface::Surf::Thicken { .. } => "surface.thicken",
- crate::dialogs_surface::Surf::Extend { .. } => "surface.extend",
crate::dialogs_surface::Surf::Trim { .. } => "surface.trim",
crate::dialogs_surface::Surf::Untrim { .. } => "surface.untrim",
crate::dialogs_surface::Surf::SplitFace => "solid.split_face",
+ _ => k.simple_metadata().map_or("", |(command, _)| command),
}),
Kind::Sheet(k) => match k {
crate::dialogs_sheet::Sm::Flange { .. } => Some("sheet.flange"),
- crate::dialogs_sheet::Sm::Hem { .. } => Some("sheet.hem"),
- crate::dialogs_sheet::Sm::Fold { .. } => Some("sheet.fold"),
crate::dialogs_sheet::Sm::Unfold { refold } => Some(if *refold { "sheet.refold" } else { "sheet.unfold" }),
crate::dialogs_sheet::Sm::Convert { .. } => Some("sheet.convert"),
crate::dialogs_sheet::Sm::Rules { .. } => Some("sheet.manage_rules"),
crate::dialogs_sheet::Sm::FlatPattern { .. } => Some("sheet.flat_pattern"),
+ _ => k.simple_metadata().map(|(command, _)| command),
},
Kind::Plastic(k) => match k {
- crate::dialogs_plastic::Pl::Boss { .. } => Some("plastic.boss"),
- crate::dialogs_plastic::Pl::Lip { .. } => Some("plastic.lip"),
crate::dialogs_plastic::Pl::SnapFit { .. } => Some("plastic.snap_fit"),
- crate::dialogs_plastic::Pl::Rest { .. } => Some("plastic.rest"),
crate::dialogs_plastic::Pl::Assign { .. } => Some("plastic.assign_rule"),
crate::dialogs_plastic::Pl::Rules { .. } => Some("plastic.manage_rules"),
+ _ => k.simple_metadata().map(|(command, _)| command),
},
Kind::Assembly(k) => match k {
crate::dialogs_assembly::Asm::NewComponent { .. } => Some("component.create"),
@@ -106,6 +92,7 @@ pub(super) fn command(kind: &Kind) -> Option<&'static str> {
crate::dialogs_assembly::Asm::Drive { .. } => Some("joint.drive"),
crate::dialogs_assembly::Asm::Interference { .. } => Some("inspect.interference"),
},
+ _ => kind.simple_metadata().map(|(command, _)| command),
}
}
@@ -159,14 +146,14 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
};
tr(key).to_owned()
};
- ui_kit::hint(ui, "tool", &prompt).on_hover_text(&prompt);
+ ui_kit::text(ui, &prompt, ui_kit::Text::Hint("tool")).on_hover_text(&prompt);
if matches!(&d.kind, Kind::SketchModify(k) if k.previews()) {
let label = d.active_input().map(|input| tr(input.label)).unwrap_or_else(|| tr("Objects"));
let step = crate::i18n::format(
"dialog.selection_step",
&[("step", &(d.active + 1).to_string()), ("total", &d.inputs.len().to_string()), ("input", label)],
);
- ui_kit::hint(ui, "step", &step).on_hover_text(tr("dialog.selection_guidance"));
+ ui_kit::text(ui, &step, ui_kit::Text::Hint("step")).on_hover_text(tr("dialog.selection_guidance"));
}
}
let manage_hint = match &d.kind {
@@ -178,7 +165,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
_ => None,
};
if let Some(key) = manage_hint {
- ui_kit::hint(ui, "manage", tr(key));
+ ui_kit::text(ui, tr(key), ui_kit::Text::Hint("manage"));
}
placement_row(d, ui);
input_rows(d, ui, &app.session);
@@ -186,7 +173,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
Kind::Material { index } => {
let names = app.session.doc.material_names();
let names: Vec<_> = names.iter().map(String::as_str).collect();
- ui_kit::row(ui, "Material", |ui| ui_kit::dropdown(ui, "mat", index, &names));
+ choice_row(ui, "Material", "mat", index, &names);
}
Kind::Appearance(k) => enter |= crate::dialogs_appearance::rows(app, ui, k, &mut d.inputs),
Kind::Motion(k) => enter |= crate::dialogs_motion::rows(app, ui, k, &mut d.inputs),
@@ -196,12 +183,12 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
Kind::ViewDxf { dashed, tolerance } => crate::dialogs_view_dxf::rows(app, ui, dashed, tolerance),
Kind::Sketch => {
if d.error.is_some() && matches!(d.inputs.first().and_then(|i| i.items.first()), Some(Sel::Face { .. })) {
- ui_kit::hint(
+ ui_kit::text(
ui,
- "attachment",
tr("This face cannot provide a durable attachment. Choose another face or explicitly use a fixed plane."),
+ ui_kit::Text::Hint("attachment"),
);
- if ui_kit::secondary_button(ui, tr("Use fixed plane")).clicked() {
+ if ui_kit::button(ui, tr("Use fixed plane"), ui_kit::Button::Normal).clicked() {
d.extra.insert("fixed_plane".into(), json!(true));
}
}
@@ -261,19 +248,13 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
set_to_object(&mut d.inputs, &mut d.active, ext == 1);
});
if ext == 0 {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, distance);
- });
+ enter |= expr_row(ui, "Distance", distance);
}
if ext == 1 {
- form_row(ui, "To Offset", |ui| {
- enter |= field(ui, to_offset);
- });
+ enter |= expr_row(ui, "To Offset", to_offset);
}
if two_sided(*direction) {
- form_row(ui, "Distance 2", |ui| {
- enter |= field(ui, distance2);
- });
+ enter |= expr_row(ui, "Distance 2", distance2);
}
form_row(ui, "Operation", |ui| {
let before = *operation;
@@ -305,16 +286,10 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
set_thin(&mut d.inputs, *thin);
}
if *thin {
- form_row(ui, "Wall Location", |ui| {
- combo(ui, "ex_wall", &WALL_LABELS, wall_side);
- });
- form_row(ui, "Wall Thickness", |ui| {
- enter |= field(ui, wall);
- });
+ choice_row(ui, "Wall Location", "ex_wall", wall_side, &WALL_LABELS);
+ enter |= expr_row(ui, "Wall Thickness", wall);
if *wall_side == 3 {
- form_row(ui, "Thickness Outside", |ui| {
- enter |= field(ui, wall2);
- });
+ enter |= expr_row(ui, "Thickness Outside", wall2);
}
}
});
@@ -335,9 +310,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
}
});
if st != 0 {
- form_row(ui, "Offset", |ui| {
- enter |= field(ui, start);
- });
+ enter |= expr_row(ui, "Offset", start);
}
if *direction < 2 {
form_row(ui, "Taper Angle", |ui| {
@@ -352,11 +325,9 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
}
Kind::Fillet { radius, chamfer, chain, ctype, distance2, angle, flip } => {
if *chamfer {
- form_row(ui, "Chamfer Type", |ui| combo(ui, "ch_type", &CHAMFER_TYPES, ctype));
+ choice_row(ui, "Chamfer Type", "ch_type", ctype, &CHAMFER_TYPES);
}
- form_row(ui, if *chamfer { if *ctype == 0 { "Distance" } else { "Distance 1" } } else { "Radius" }, |ui| {
- enter |= field(ui, radius);
- });
+ enter |= expr_row(ui, if *chamfer { if *ctype == 0 { "Distance" } else { "Distance 1" } } else { "Radius" }, radius);
let mut rtype = fillet_type(&d.extra);
if !*chamfer {
form_row(ui, "Type", |ui| {
@@ -368,7 +339,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
});
form_row(ui, "Continuity", |ui| {
let mut continuity = usize::from(rtype == 3);
- if ui_kit::segmented(ui, &mut continuity, &["G1", "G2"]) {
+ if ui_kit::segmented(ui, &mut continuity, &["G1", "G2"], Default::default()) {
rtype = if continuity == 1 { 3 } else { 0 };
choose_fillet_type(&mut d.extra, rtype, radius);
// G1 explicitly returns to rolling corners. G2 describes the edge blend,
@@ -378,14 +349,10 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
});
}
if *chamfer && *ctype == 1 {
- form_row(ui, "Distance 2", |ui| {
- enter |= field(ui, distance2);
- });
+ enter |= expr_row(ui, "Distance 2", distance2);
}
if *chamfer && *ctype == 2 {
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
+ enter |= expr_row(ui, "Angle", angle);
}
if *chamfer && *ctype > 0 {
form_row(ui, "Flip", |ui| check(ui, flip));
@@ -420,7 +387,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
ui.allocate_ui_with_layout(vec2(width, t.space_24), egui::Layout::left_to_right(egui::Align::Center), |ui| {
enter |= field(ui, r);
});
- if ui_kit::small_button(ui, "×").on_hover_text(tr("Remove this point")).clicked() {
+ if ui_kit::button(ui, "×", ui_kit::Button::Small).on_hover_text(tr("Remove this point")).clicked() {
remove = Some(k);
}
});
@@ -430,7 +397,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
mids.remove(k);
}
form_row(ui, "", |ui| {
- if ui_kit::secondary_button(ui, tr("Add Mid Radius")).clicked() && mids.len() < 20 {
+ if ui_kit::button(ui, tr("Add Mid Radius"), ui_kit::Button::Normal).clicked() && mids.len() < 20 {
let t = if mids.is_empty() { 0.5 } else { (mids.iter().map(|m| m.0).fold(0.0, f64::max) + 1.0) * 0.5 };
mids.push((t.min(0.99), radius.clone()));
}
@@ -449,9 +416,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
let mut radii = spline_radii(&mut d.extra, radius);
let n = radii.len();
for (k, r) in radii.iter_mut().enumerate() {
- form_row(ui, if k + 1 == n { "End Radius" } else { "Control Radius" }, |ui| {
- enter |= field(ui, r);
- });
+ enter |= expr_row(ui, if k + 1 == n { "End Radius" } else { "Control Radius" }, r);
}
d.extra.insert("radii".into(), json!(radii));
}
@@ -500,9 +465,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
}
Kind::PatternRect { count, spacing, count2, spacing2 } => {
for (l, v) in [("Quantity", count), ("Spacing", spacing), ("Quantity 2", count2), ("Spacing 2", spacing2)] {
- form_row(ui, l, |ui| {
- enter |= field(ui, v);
- });
+ enter |= expr_row(ui, l, v);
}
if d.inputs.first().is_some_and(|i| i.accept == selection::FEATURES) {
feature_pattern_alignment_row(ui, &mut d.extra, 0);
@@ -511,9 +474,7 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
}
Kind::PatternCirc { count, angle } => {
for (l, v) in [("Quantity", count), ("Total angle", angle)] {
- form_row(ui, l, |ui| {
- enter |= field(ui, v);
- });
+ enter |= expr_row(ui, l, v);
}
if d.inputs.first().is_some_and(|i| i.accept == selection::FEATURES) {
feature_pattern_alignment_row(ui, &mut d.extra, 0);
@@ -539,18 +500,14 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
extra_check(ui, &mut d.extra, "flip");
});
}
- form_row(ui, "Hole Type", |ui| {
- combo(ui, "hole_kind", &HOLE_LABELS, kind);
- });
+ choice_row(ui, "Hole Type", "hole_kind", kind, &HOLE_LABELS);
form_row(ui, "Hole Tap Type", |ui| {
let mut tap = usize::from(opts.tapped);
combo(ui, "hole_tap", &["Simple", "Tapped"], &mut tap);
opts.tapped = tap == 1;
});
if opts.tapped {
- form_row(ui, "Size", |ui| {
- enter |= field(ui, &mut opts.thread);
- });
+ enter |= expr_row(ui, "Size", &mut opts.thread);
}
if *kind == 0 {
form_row(ui, "Drill Point", |ui| {
@@ -560,33 +517,19 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
});
}
if !opts.all {
- form_row(ui, "Depth", |ui| {
- enter |= field(ui, depth);
- });
+ enter |= expr_row(ui, "Depth", depth);
}
if *kind == 0 && opts.angled {
- form_row(ui, "Tip Angle", |ui| {
- enter |= field(ui, &mut opts.tip_angle);
- });
+ enter |= expr_row(ui, "Tip Angle", &mut opts.tip_angle);
}
- form_row(ui, "Diameter", |ui| {
- enter |= field(ui, diameter);
- });
+ enter |= expr_row(ui, "Diameter", diameter);
if *kind == 1 {
- form_row(ui, "Counterbore Ø", |ui| {
- enter |= field(ui, cb_diameter);
- });
- form_row(ui, "Counterbore depth", |ui| {
- enter |= field(ui, cb_depth);
- });
+ enter |= expr_row(ui, "Counterbore Ø", cb_diameter);
+ enter |= expr_row(ui, "Counterbore depth", cb_depth);
}
if *kind == 2 {
- form_row(ui, "Countersink Ø", |ui| {
- enter |= field(ui, cs_diameter);
- });
- form_row(ui, "Countersink angle", |ui| {
- enter |= field(ui, cs_angle);
- });
+ enter |= expr_row(ui, "Countersink Ø", cs_diameter);
+ enter |= expr_row(ui, "Countersink angle", cs_angle);
}
}
_ => enter |= additional_rows(app, d, ui),
@@ -599,7 +542,7 @@ fn extra_segments(ui: &mut egui::Ui, extra: &mut serde_json::Map<String, Value>,
let current = extra.get(key).and_then(Value::as_str).and_then(|value| choices.iter().position(|(_, key)| *key == value)).unwrap_or(0);
let mut selected = current;
let labels: Vec<_> = choices.iter().map(|(label, _)| *label).collect();
- if ui_kit::segmented(ui, &mut selected, &labels) && selected != current {
+ if ui_kit::segmented(ui, &mut selected, &labels, Default::default()) && selected != current {
if selected == 0 {
extra.remove(key);
} else if let Some((_, value)) = choices.get(selected) {
@@ -628,7 +571,7 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
let cur = usize::from(to_object_on(&d.inputs));
let mut ty = cur;
form_row(ui, "Type", |ui| {
- ui_kit::segmented(ui, &mut ty, &["Angle", "To Object"]);
+ ui_kit::segmented(ui, &mut ty, &["Angle", "To Object"], Default::default());
set_to_object(&mut d.inputs, &mut d.active, ty == 1);
});
if ty == 0 {
@@ -642,7 +585,7 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
};
let mut dir = cur;
form_row(ui, "Direction", |ui| {
- ui_kit::segmented(ui, &mut dir, &["One Side", "Two Sides", "Symmetric"]);
+ ui_kit::segmented(ui, &mut dir, &["One Side", "Two Sides", "Symmetric"], Default::default());
if dir != cur {
d.extra.remove("angle2");
d.extra.remove("direction");
@@ -657,60 +600,45 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
}
}
});
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
+ enter |= expr_row(ui, "Angle", angle);
if dir == 1 {
form_row(ui, "Angle 2", |ui| {
enter |= extra_field(ui, &mut d.extra, "angle2", "90 deg");
});
}
}
- form_row(ui, "Operation", |ui| {
- combo(ui, "rv_op", &OP_LABELS, operation);
- });
+ choice_row(ui, "Operation", "rv_op", operation, &OP_LABELS);
}
-
Kind::Shell { thickness } => {
// The direction below says which side the wall grows to; the label stays short enough
// for the label column.
- form_row(ui, "Thickness", |ui| {
- enter |= field(ui, thickness);
- });
+ enter |= expr_row(ui, "Thickness", thickness);
form_row(ui, "Direction", |ui| {
extra_segments(ui, &mut d.extra, "direction", &[("Inside", "inside"), ("Outside", "outside"), ("Both", "both")]);
});
extra_options(ui, "shell_options", &mut d.extra, &[("Tangent Chain", "tangent_chain")]);
}
Kind::Draft { angle } => {
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
+ enter |= expr_row(ui, "Angle", angle);
}
Kind::Mirror => {
// Feature replay retains the source operation; Join is for body copies.
if !d.inputs.first().is_some_and(|i| i.accept == selection::FEATURES) {
form_row(ui, "Operation", |ui| {
let mut op = usize::from(d.extra.get("combine").and_then(Value::as_bool).unwrap_or(false));
- ui_kit::segmented(ui, &mut op, &["New Body", "Join"]);
+ ui_kit::segmented(ui, &mut op, &["New Body", "Join"], Default::default());
d.extra.insert("combine".into(), json!(op == 1));
});
}
}
Kind::OffsetPlane { offset } => {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, offset);
- });
+ enter |= expr_row(ui, "Distance", offset);
}
Kind::AnglePlane { angle } => {
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
+ enter |= expr_row(ui, "Angle", angle);
}
Kind::PathPlane { t, .. } => {
- form_row(ui, "Position (0 to 1)", |ui| {
- enter |= field(ui, t);
- });
+ enter |= expr_row(ui, "Position (0 to 1)", t);
}
Kind::MeshConvert { tolerance } => {
form_row(ui, "Tolerance", |ui| enter |= field(ui, tolerance));
@@ -722,24 +650,18 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
Kind::Rib { thickness, depth, flip, normal, .. } => {
form_row(ui, "Direction", |ui| {
let mut i = usize::from(*normal);
- ui_kit::segmented(ui, &mut i, &["In plane", "Normal"]);
+ ui_kit::segmented(ui, &mut i, &["In plane", "Normal"], Default::default());
*normal = i == 1;
});
- form_row(ui, "Thickness", |ui| {
- enter |= field(ui, thickness);
- });
- form_row(ui, "Depth", |ui| {
- enter |= ui_kit::hint_field(ui, depth, tr("to the next face"));
- });
+ enter |= expr_row(ui, "Thickness", thickness);
+ enter |= hint_row(ui, "Depth", depth, tr("to the next face"));
ui_kit::options(ui, "feature_options", &mut [("Flip", flip)]);
}
Kind::Emboss { depth, deboss } => {
- form_row(ui, "Depth", |ui| {
- enter |= field(ui, depth);
- });
+ enter |= expr_row(ui, "Depth", depth);
form_row(ui, "Type", |ui| {
let mut i = usize::from(*deboss);
- ui_kit::segmented(ui, &mut i, &["Emboss", "Deboss"]);
+ ui_kit::segmented(ui, &mut i, &["Emboss", "Deboss"], Default::default());
*deboss = i == 1;
});
ui.add(
@@ -768,40 +690,26 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
ui_kit::checkbox(ui, label.as_str(), on);
});
}
- form_row(ui, "Operation", |ui| {
- combo(ui, "bf_op", &OP_LABELS, operation);
- });
+ choice_row(ui, "Operation", "bf_op", operation, &OP_LABELS);
extra_options(ui, "boundary_options", &mut d.extra, &[("Remove Tools", "remove_tools")]);
}
Kind::PathPattern { count, spacing } => {
for (l, v) in [("Quantity", count), ("Spacing", spacing)] {
- form_row(ui, l, |ui| {
- enter |= field(ui, v);
- });
+ enter |= expr_row(ui, l, v);
}
}
Kind::Pipe { diameter, wall } => {
- form_row(ui, "Diameter", |ui| {
- enter |= field(ui, diameter);
- });
- form_row(ui, "Wall", |ui| {
- enter |= ui_kit::hint_field(ui, wall, tr("solid"));
- });
+ enter |= expr_row(ui, "Diameter", diameter);
+ enter |= hint_row(ui, "Wall", wall, tr("solid"));
}
Kind::Stock { margin } => {
- form_row(ui, "Margin", |ui| {
- enter |= field(ui, margin);
- });
+ enter |= expr_row(ui, "Margin", margin);
}
Kind::Scale { factor } => {
- form_row(ui, "Scale factor", |ui| {
- enter |= field(ui, factor);
- });
+ enter |= expr_row(ui, "Scale factor", factor);
}
Kind::OffsetFaces { distance } => {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, distance);
- });
+ enter |= expr_row(ui, "Distance", distance);
}
Kind::Thread { designation, length, suggested, of } => {
let mut full = length.trim().is_empty();
@@ -820,49 +728,37 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
of.clear();
}
if !full {
- form_row(ui, "Length", |ui| {
- enter |= field(ui, length);
- });
+ enter |= expr_row(ui, "Length", length);
}
}
-
Kind::Loft { operation, rail_fit } => {
- form_row(ui, "Operation", |ui| {
- combo(ui, "lf_op", &OP_LABELS, operation);
- });
+ choice_row(ui, "Operation", "lf_op", operation, &OP_LABELS);
crate::dialogs_sweep::rail_fit_row(ui, "lf", rail_fit);
}
Kind::Sweep { operation, opts } => {
enter |= crate::dialogs_sweep::rows_with(ui, opts, "sw", |ui| {
- form_row(ui, "Operation", |ui| {
- combo(ui, "sw_op", &OP_LABELS, operation);
- });
+ choice_row(ui, "Operation", "sw_op", operation, &OP_LABELS);
});
}
k @ Kind::Move { .. } => {
enter |= crate::dialogs_move::rows(ui, k);
extra_options(ui, "move_options", &mut d.extra, &[("Create Copy", "copy")]);
}
-
Kind::Primitive { fields, operation, at, .. } => {
for (k, v) in fields.iter_mut() {
- form_row(ui, k, |ui| {
- enter |= field(ui, v);
- });
+ enter |= expr_row(ui, k, v);
}
if let Some((p, _)) = *at {
form_row(ui, "Position", |ui| {
ui.horizontal(|ui| {
ui.label(format!("{:.2}, {:.2}, {:.2}", p.x, p.y, p.z));
- if ui_kit::small_button(ui, "×").on_hover_text(tr("Place at the origin instead")).clicked() {
+ if ui_kit::button(ui, "×", ui_kit::Button::Small).on_hover_text(tr("Place at the origin instead")).clicked() {
*at = None;
}
});
});
}
- form_row(ui, "Operation", |ui| {
- combo(ui, "pr_op", &OP_LABELS, operation);
- });
+ choice_row(ui, "Operation", "pr_op", operation, &OP_LABELS);
}
Kind::Combine { operation, keep_tools } => {
form_row(ui, "Operation", |ui| {
@@ -885,9 +781,7 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
Kind::Assembly(k) => enter |= crate::dialogs_assembly::rows(app, ui, k, &mut d.inputs, &mut d.active),
Kind::Measure { result, show, .. } => measure_rows(app, ui, result.as_ref(), show),
Kind::Section { offset, flip } => {
- form_row(ui, "Distance", |ui| {
- enter |= ui_kit::field(ui, offset);
- });
+ enter |= expr_row(ui, "Distance", offset);
ui_kit::options(ui, "feature_options", &mut [("Flip", flip)]);
}
Kind::Rename { name, .. } => {
@@ -898,11 +792,11 @@ fn additional_rows(app: &mut SolveApp, d: &mut Dialog, ui: &mut egui::Ui) -> boo
Kind::ConfirmDelete { with, fail, .. } => {
if !with.is_empty() {
form_row(ui, "Also deletes", |ui| {
- ui_kit::cell_text(ui, &with.join(", "));
+ ui_kit::text(ui, &with.join(", "), ui_kit::Text::Cell);
});
}
if !fail.is_empty() {
- ui_kit::text_block(ui, "will_fail", &format!("{}: {}", tr("Will fail"), fail.join(", ")), true);
+ ui_kit::text(ui, &format!("{}: {}", tr("Will fail"), fail.join(", ")), ui_kit::Text::Report("will_fail", true));
}
}
_ => {}
@@ -918,17 +812,17 @@ fn fmt_mm(app: &SolveApp, v: &Value) -> String {
/// offers centre to centre, closest and farthest), its ΔX/Y/Z and the angle between two items.
fn measure_rows(app: &SolveApp, ui: &mut egui::Ui, r: Option<&Value>, show: &mut Option<Shown>) {
let Some(r) = r else {
- ui_kit::hint(ui, "measure", tr("pick one or two vertices, edges or faces"));
+ ui_kit::text(ui, tr("pick one or two vertices, edges or faces"), ui_kit::Text::Hint("measure"));
return;
};
if let Some(e) = r.get("error").and_then(Value::as_str) {
- ui_kit::text_block(ui, "measure_error", e, true);
+ ui_kit::text(ui, e, ui_kit::Text::Report("measure_error", true));
return;
}
let mm = |v: &Value| fmt_mm(app, v);
let value = |ui: &mut egui::Ui, label: &str, text: &str| {
form_row(ui, label, |ui| {
- ui_kit::cell_text(ui, text);
+ ui_kit::text(ui, text, ui_kit::Text::Cell);
});
};
for (i, it) in r["items"].as_array().into_iter().flatten().enumerate() {
diff --git a/crates/ui-egui/src/dialogs_library.rs b/crates/ui-egui/src/dialogs_library.rs
index e10766a5c5..6042a0bf6c 100644
--- a/crates/ui-egui/src/dialogs_library.rs
+++ b/crates/ui-egui/src/dialogs_library.rs
@@ -109,14 +109,14 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &[SelInpu
#[cfg(target_arch = "wasm32")]
{
let _ = inputs;
- ui_kit::note(
+ ui_kit::text(
ui,
- "library_platform",
crate::i18n::tr_label("Open local libraries in the desktop app. You can export this design's library here."),
+ ui_kit::Text::Note("library_platform"),
);
}
ui_kit::checkbox(ui, crate::i18n::tr_label("Replace existing library file"), &mut k.local.overwrite);
- let save = ui_kit::secondary_button(ui, crate::i18n::tr_label("Export design library..."));
+ let save = ui_kit::button(ui, crate::i18n::tr_label("Export design library..."), ui_kit::Button::Normal);
crate::scenario::publish_handle("library:export", save.rect.center());
if save.clicked() {
if app.services.pick_save.is_some() {
@@ -125,10 +125,10 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &[SelInpu
export(app, k, k.local.path.clone(), k.local.overwrite);
}
}
- ui_kit::note(
+ ui_kit::text(
ui,
- "library_export",
crate::i18n::tr_label("Apply your appearance first. Exports assigned appearances and materials created in this design."),
+ ui_kit::Text::Note("library_export"),
);
});
}
@@ -145,10 +145,10 @@ fn import_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &[SelI
k.local.selected = None;
}
ui.horizontal(|ui| {
- if ui_kit::secondary_button(ui, crate::i18n::tr_label("Open library...")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label("Open library..."), ui_kit::Button::Normal).clicked() {
open_library(app, k.local.token.clone());
}
- let load_button = ui_kit::enabled_button(ui, "Load library", !k.local.path.is_empty());
+ let load_button = ui_kit::button(ui, "Load library", ui_kit::Button::Enabled(!k.local.path.is_empty()));
crate::scenario::publish_handle("library:load", load_button.rect.center());
if load_button.clicked() {
k.local.catalog = None;
@@ -157,7 +157,7 @@ fn import_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &[SelI
}
});
if let Some(catalog) = &k.local.catalog {
- ui_kit::text_block(ui, "library_name", &catalog.name, false);
+ ui_kit::text(ui, &catalog.name, ui_kit::Text::Report("library_name", false));
let search = ui_kit::row(ui, "Search this library", |ui| {
let id = ui.make_persistent_id("library_search");
ui_kit::search_field(ui, id, &mut k.local.search, "Search this library")
@@ -173,7 +173,7 @@ fn import_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &[SelI
.filter(|entry| matches!(&entry.definition, Definition::Appearance(_)) && entry.definition.name().to_lowercase().contains(&query))
.collect();
if appearances.is_empty() {
- ui_kit::note(ui, "library_empty", crate::i18n::tr_label("No matching appearance presets."));
+ ui_kit::text(ui, crate::i18n::tr_label("No matching appearance presets."), ui_kit::Text::Note("library_empty"));
}
let row_height = ui_kit::row_height();
egui::ScrollArea::vertical().id_salt("local_library_entries").max_height(row_height * 5.0).show_rows(
@@ -218,7 +218,7 @@ fn import_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Ap, inputs: &[SelI
.cloned();
let picked = inputs.first().map(|input| input.items.as_slice()).unwrap_or(&[]);
let selected = selected_params(k, picked);
- let apply = ui_kit::enabled_button(ui, "Apply library appearance", entry.is_some() && selected.is_some());
+ let apply = ui_kit::button(ui, "Apply library appearance", ui_kit::Button::Enabled(entry.is_some() && selected.is_some()));
crate::scenario::publish_handle("library:apply", apply.rect.center());
if apply.clicked()
&& let (Some(entry), Some(selected)) = (entry, selected)
diff --git a/crates/ui-egui/src/dialogs_motion.rs b/crates/ui-egui/src/dialogs_motion.rs
index e1f2e2b2b4..169ebf4c1d 100644
--- a/crates/ui-egui/src/dialogs_motion.rs
+++ b/crates/ui-egui/src/dialogs_motion.rs
@@ -3,6 +3,7 @@
//! show while open (a study's pose, an explosion) is display only: pending occurrence moves,
//! computed on a scratch copy of the design and put back when the dialog closes.
+use crate::ui_kit::{choice_row, expr_row, text_row};
use std::collections::BTreeMap;
use egui::{Pos2, RichText, Sense, Stroke, pos2, vec2};
@@ -12,7 +13,7 @@ use solidcraft_engine::doc::Mat;
use solidcraft_engine::doc::joints::JointKind;
use crate::SolveApp;
-use crate::dialogs::{Dialog, Kind, combo, field, form_row};
+use crate::dialogs::{Dialog, Kind, combo, form_row};
use crate::selection::{BODIES, SelInput};
use crate::theme::Tokens;
@@ -445,9 +446,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs: &mut [Sel
let mut enter = false;
match k {
Mo::ContactSet { name, check } => {
- form_row(ui, "Name", |ui| {
- crate::ui_kit::text_field(ui, name, "");
- });
+ text_row(ui, "Name", name, "");
let list = app.session.execute("contact.list", &json!({})).unwrap_or(Value::Null);
form_row(ui, "Contact", |ui| {
let mut on = list.get("enabled").and_then(Value::as_bool).unwrap_or(false);
@@ -462,10 +461,12 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs: &mut [Sel
ui.horizontal(|ui| {
let count = s.get("occurrences").and_then(Value::as_array).map_or(0, Vec::len);
ui.label(RichText::new(crate::i18n::format("contact.components_count", &[("count", &count.to_string())])).color(t.text_dim));
- if crate::ui_kit::small_button(ui, crate::i18n::tr_label(if off { "Unsuppress" } else { "Suppress" })).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label(if off { "Unsuppress" } else { "Suppress" }), crate::ui_kit::Button::Small)
+ .clicked()
+ {
let _ = app.run("contact.edit", json!({"set": n, "suppressed": !off}));
}
- if crate::ui_kit::small_button(ui, crate::i18n::tr_label("×"))
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("×"), crate::ui_kit::Button::Small)
.on_hover_text(crate::i18n::tr_label("Delete the set"))
.clicked()
{
@@ -475,7 +476,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs: &mut [Sel
});
}
ui.vertical(|ui| {
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Check collisions")).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Check collisions"), crate::ui_kit::Button::Normal).clicked() {
*check = Some(app.session.execute("contact.check", &json!({})).unwrap_or_else(|e| json!({"error": e.to_string()})));
}
});
@@ -506,9 +507,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs: &mut [Sel
}
Mo::MotionStudy { .. } => enter = motion_study_rows(app, ui, k, inputs, t),
Mo::Explode { name, scale, shown, saved, error } => {
- form_row(ui, "Name", |ui| {
- crate::ui_kit::text_field(ui, name, "");
- });
+ text_row(ui, "Name", name, "");
form_row(ui, "Explode", |ui| {
ui.spacing_mut().slider_width = 160.0;
crate::ui_kit::slider(ui, scale, 0.0..=2.0);
@@ -547,9 +546,7 @@ fn motion_study_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs:
let labels: Vec<&str> = std::iter::once("New study").chain(studies.iter().map(|(_, n)| n.as_str())).collect();
let was = study.as_ref().and_then(|id| studies.iter().position(|(x, _)| x == id)).map_or(0, |i| i + 1);
let mut pick = was;
- form_row(ui, "Study", |ui| {
- combo(ui, "ms_study", &labels, &mut pick);
- });
+ choice_row(ui, "Study", "ms_study", &mut pick, &labels);
if pick != was {
match pick.checked_sub(1).and_then(|i| studies.get(i)).map(|(id, _)| study_tracks(&app.session, id, true)) {
Some(Ok((id, n, st, t))) => (*study, *name, *steps, *tracks, *shown, *playing) = (Some(id.to_string()), n, st, t, None, false),
@@ -558,12 +555,8 @@ fn motion_study_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs:
}
}
}
- form_row(ui, "Name", |ui| {
- crate::ui_kit::text_field(ui, name, "");
- });
- form_row(ui, "Steps", |ui| {
- enter |= field(ui, steps);
- });
+ text_row(ui, "Name", name, "");
+ enter |= expr_row(ui, "Steps", steps);
let total = steps.trim().parse::<u32>().unwrap_or(100).clamp(1, 100_000);
let moving = joints_moving(app);
if moving.is_empty() {
@@ -635,7 +628,10 @@ fn motion_study_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs:
ui.horizontal(|ui| {
let width = (ui.available_width() - t.control_height - t.space_8).max(0.0);
ui.allocate_ui(vec2(width, t.control_height), |ui| combo(ui, &format!("ms_joint{ti}"), &refs, &mut pos));
- if crate::ui_kit::small_button(ui, crate::i18n::tr_label("×")).on_hover_text(crate::i18n::tr_label("Remove the track")).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("×"), crate::ui_kit::Button::Small)
+ .on_hover_text(crate::i18n::tr_label("Remove the track"))
+ .clicked()
+ {
remove = Some(ti);
}
});
@@ -658,13 +654,11 @@ fn motion_study_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs:
// The key at this step, if any: its value.
if let Some(p) = tr.points.iter_mut().find(|(s, _)| *s == now) {
// The key's value (Enter commits it; OK makes the study).
- form_row(ui, "Value", |ui| {
- let _ = field(ui, &mut p.1);
- });
+ let _ = expr_row(ui, "Value", &mut p.1);
}
ui.vertical(|ui| {
ui.horizontal(|ui| {
- if crate::ui_kit::small_button(ui, crate::i18n::tr_label("Key here"))
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Key here"), crate::ui_kit::Button::Small)
.on_hover_text(crate::i18n::tr_label("Add a key at this step with the joint's value now"))
.clicked()
&& !tr.points.iter().any(|(s, _)| *s == now)
@@ -674,7 +668,7 @@ fn motion_study_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs:
tr.points.push((now, format!("0 {unit}")));
tr.points.sort_by_key(|p| p.0);
}
- if crate::ui_kit::small_button(ui, crate::i18n::tr_label("Delete key")).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Delete key"), crate::ui_kit::Button::Small).clicked() {
tr.points.retain(|(s, _)| *s != now);
}
});
@@ -686,7 +680,7 @@ fn motion_study_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs:
let mut export = false;
ui.vertical(|ui| {
ui.horizontal(|ui| {
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Add Key"))
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Add Key"), crate::ui_kit::Button::Normal)
.on_hover_text(crate::i18n::tr_label("Key a joint's value at this step"))
.clicked()
&& let Some((ji, _, kind)) = moving.first()
@@ -694,7 +688,7 @@ fn motion_study_rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Mo, inputs:
let unit = if kind.is_angle(0) { "deg" } else { "mm" };
tracks.push(Track { joint: *ji, index: 0, points: vec![(now, format!("0 {unit}"))] });
}
- export = crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Export Animation…"))
+ export = crate::ui_kit::button(ui, crate::i18n::tr_label("Export Animation…"), crate::ui_kit::Button::Normal)
.on_hover_text(crate::i18n::tr_label("Save the study as an animated GIF, seen as the viewport shows it"))
.clicked();
});
diff --git a/crates/ui-egui/src/dialogs_motion_plot.rs b/crates/ui-egui/src/dialogs_motion_plot.rs
index ca5e6c59a2..03d9b01be7 100644
--- a/crates/ui-egui/src/dialogs_motion_plot.rs
+++ b/crates/ui-egui/src/dialogs_motion_plot.rs
@@ -3,6 +3,8 @@
//! the step shown; and the parts that collide as the study plays (`motion.interference`). Both
//! are worked out on a scratch copy, again only when what they are for changes.
+use crate::dialogs_assembly::stop_text;
+use crate::ui_kit::choice_row;
use std::hash::{Hash, Hasher};
use egui::{Align2, FontId, Rect, RichText, Sense, Stroke, pos2, vec2};
@@ -175,17 +177,6 @@ fn chart(ui: &mut egui::Ui, xs: &[f64], ys: &[f64], unit: &str, total: u32, now:
Some((f64::from((pos.x - plot.left()) / plot.width().max(1.0)).clamp(0.0, 1.0) * total).round())
}
-/// What the motion stopping short ends the chart with (`None`: it went all the way).
-fn stop_text(v: &Value) -> Option<String> {
- let at = v["stopped_at"].as_u64()?.to_string();
- let name = |x: &Value| x.as_str().unwrap_or_default().to_string();
- if let Some(l) = v["stopped_by_loop"].as_object() {
- return Some(crate::i18n::format("trace.stopped_by_loop", &[("sample", &at), ("joint", &name(&l["joint"]))]));
- }
- let c = v["stopped_by_contact"].as_object()?;
- Some(crate::i18n::format("trace.stopped_by_contact", &[("sample", &at), ("a", &name(&c["a"])), ("b", &name(&c["b"]))]))
-}
-
fn key_of(x: impl std::fmt::Debug) -> u64 {
let mut h = std::collections::hash_map::DefaultHasher::new();
format!("{x:?}").hash(&mut h);
@@ -274,7 +265,7 @@ fn collision_rows(
combo(ui, "ms_among", &["All components", "Contact sets"], &mut a.among)
});
}
- let button = crate::ui_kit::enabled_button(ui, "Check collisions", check.is_some());
+ let button = crate::ui_kit::button(ui, "Check collisions", crate::ui_kit::Button::Enabled(check.is_some()));
crate::scenario::publish_handle("motion:check", button.rect.center());
if button.clicked()
&& let Some((st, mut p)) = check
@@ -365,9 +356,7 @@ fn plot_rows(
let what = list.get(a.what).map_or(Plotted::Nothing, |(_, w)| *w);
let bands = a.collisions.as_ref().and_then(|(_, r)| r.as_ref().ok()).map(collision_bands).unwrap_or_default();
if what != Plotted::Nothing {
- form_row(ui, "Quantity", |ui| {
- combo(ui, "ms_quantity", &QUANTITIES, &mut a.quantity);
- });
+ choice_row(ui, "Quantity", "ms_quantity", &mut a.quantity, &QUANTITIES);
form_row(ui, "Duration", |ui| {
let r = crate::ui_kit::cell_editor(ui, ui.id().with("duration"), &mut a.duration, "motion.duration_hint", false);
crate::scenario::publish_handle("dialog:Duration", r.rect.center());
diff --git a/crates/ui-egui/src/dialogs_move.rs b/crates/ui-egui/src/dialogs_move.rs
index 8781e2fadb..eb1dfd25a4 100644
--- a/crates/ui-egui/src/dialogs_move.rs
+++ b/crates/ui-egui/src/dialogs_move.rs
@@ -2,13 +2,15 @@
//! their rows and inputs, the triad on the canvas and the solid.move they make. Nothing
//! moves until a value is typed or the triad is dragged.
+use crate::selection::SelectionExt as _;
+use crate::ui_kit::{choice_row, expr_row};
use serde_json::{Value, json};
use solidcraft_engine::Sel;
use solidcraft_engine::doc::expr::Kind as ValueKind;
use solidcraft_engine::geom::Vec3;
use crate::SolveApp;
-use crate::dialogs::{Dialog, Kind, combo, field, form_row};
+use crate::dialogs::{Dialog, Kind};
use crate::gizmo::{self, Change, Drag};
use crate::selection::{AXES, BODIES, EDGES, FACES, SelInput, VERTICES};
@@ -47,9 +49,7 @@ pub fn inputs(mode: usize) -> Vec<SelInput> {
pub fn type_row(d: &mut Dialog, ui: &mut egui::Ui) {
let Kind::Move { mode, .. } = d.kind else { return };
let mut m = mode;
- form_row(ui, "Move Type", |ui| {
- combo(ui, "move_type", &TYPES, &mut m);
- });
+ choice_row(ui, "Move Type", "move_type", &mut m, &TYPES);
if m != mode {
let bodies = d.inputs.first().map(|i| i.items.clone()).unwrap_or_default();
d.kind = kind(m);
@@ -70,27 +70,22 @@ fn bodies_empty(d: &Dialog) -> bool {
pub fn rows(ui: &mut egui::Ui, k: &mut Kind) -> bool {
let Kind::Move { mode, x, y, z, rx, ry, rz, angle } = k else { return false };
let mut enter = false;
- let mut row = |ui: &mut egui::Ui, l: &str, v: &mut String| {
- form_row(ui, l, |ui| {
- enter |= field(ui, v);
- });
- };
match *mode {
FREE | TRANSLATE => {
- row(ui, "X Distance", x);
- row(ui, "Y Distance", y);
- row(ui, "Z Distance", z);
+ enter |= expr_row(ui, "X Distance", x);
+ enter |= expr_row(ui, "Y Distance", y);
+ enter |= expr_row(ui, "Z Distance", z);
if *mode == FREE {
- row(ui, "X Angle", rx);
- row(ui, "Y Angle", ry);
- row(ui, "Z Angle", rz);
+ enter |= expr_row(ui, "X Angle", rx);
+ enter |= expr_row(ui, "Y Angle", ry);
+ enter |= expr_row(ui, "Z Angle", rz);
}
}
- ROTATE => row(ui, "Angle", angle),
+ ROTATE => enter |= expr_row(ui, "Angle", angle),
POINT_TO_POSITION => {
- row(ui, "X", x);
- row(ui, "Y", y);
- row(ui, "Z", z);
+ enter |= expr_row(ui, "X", x);
+ enter |= expr_row(ui, "Y", y);
+ enter |= expr_row(ui, "Z", z);
}
_ => {}
}
@@ -105,11 +100,7 @@ fn sel_point(s: Option<&Sel>) -> Option<Vec3> {
}
fn items(d: &Dialog, i: usize) -> &[Sel] {
- d.inputs.get(i).map(|x| x.items.as_slice()).unwrap_or(&[])
-}
-
-fn body_names(d: &Dialog) -> Vec<String> {
- items(d, 0).iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect()
+ crate::selection::items(&d.inputs, i)
}
/// The centre of the picked bodies where they are before this move.
@@ -119,7 +110,7 @@ fn bodies_center(app: &SolveApp, d: &Dialog) -> Option<Vec3> {
None => app.session.model.state(),
};
let mut bb: Option<(Vec3, Vec3)> = None;
- for n in body_names(d) {
+ for n in items(d, 0).body_names() {
let Some(b) = st.body(&n) else { continue };
let x = b.mesh().bounds();
bb = Some(match bb {
@@ -168,7 +159,7 @@ fn deg(v: f64) -> String {
/// The solid.move parameters (bodies, translate, axis, angle).
pub fn params(app: &SolveApp, d: &Dialog) -> Result<Value, String> {
let Kind::Move { mode, x, y, z, rx, ry, rz, angle } = &d.kind else { return Err("not a move".into()) };
- let bodies = body_names(d);
+ let bodies = items(d, 0).body_names();
if bodies.is_empty() {
return Err("select bodies first".into());
}
diff --git a/crates/ui-egui/src/dialogs_part_size.rs b/crates/ui-egui/src/dialogs_part_size.rs
index 0a651f145b..4f252d66c7 100644
--- a/crates/ui-egui/src/dialogs_part_size.rs
+++ b/crates/ui-egui/src/dialogs_part_size.rs
@@ -6,9 +6,10 @@ use serde_json::{Value, json};
use solidcraft_engine::{Sel, doc::Document};
use crate::SolveApp;
-use crate::dialogs::{Kind, combo, form_row};
+use crate::dialogs::Kind;
use crate::dialogs_parts::Family;
use crate::selection::SelInput;
+use crate::ui_kit::{choice_row, row};
/// The active catalogue configuration belongs to the shared part, not its placements.
pub(crate) fn configuration(app: &SolveApp, component: u64) -> Option<String> {
@@ -168,24 +169,24 @@ pub fn open(app: &mut SolveApp, component: u64) {
}
pub fn rows(app: &SolveApp, ui: &mut egui::Ui, k: &mut Resize) -> bool {
- form_row(ui, "Type", |ui| {
+ row(ui, "Type", |ui| {
ui.add(egui::Label::new(format!("{} ({})", k.family.name, k.family.standard)).wrap());
});
let sizes: Vec<&str> = k.family.sizes.iter().map(|s| s.0.as_str()).collect();
- form_row(ui, "Size", |ui| combo(ui, "part_resize_size", &sizes, &mut k.size));
+ choice_row(ui, "Size", "part_resize_size", &mut k.size, &sizes);
if let Some(lengths) = k.lengths() {
let mut index = k.length.and_then(|l| lengths.iter().position(|x| *x == l)).unwrap_or(0);
let labels: Vec<String> = lengths.iter().map(|l| crate::prefs::show_mm(app, *l, 1)).collect();
let labels: Vec<&str> = labels.iter().map(String::as_str).collect();
- form_row(ui, "Length", |ui| combo(ui, "part_resize_length", &labels, &mut index));
+ choice_row(ui, "Length", "part_resize_length", &mut index, &labels);
k.length = lengths.get(index).copied();
}
if let Some((size, _)) = k.family.sizes.get(k.size) {
- form_row(ui, "Configuration", |ui| {
+ row(ui, "Configuration", |ui| {
ui.label(configuration_name(size, k.length));
});
}
- crate::ui_kit::hint(ui, "part_size_shared", crate::i18n::tr("ui.part_size_shared"));
+ crate::ui_kit::text(ui, crate::i18n::tr("ui.part_size_shared"), crate::ui_kit::Text::Hint("part_size_shared"));
false
}
diff --git a/crates/ui-egui/src/dialogs_parts.rs b/crates/ui-egui/src/dialogs_parts.rs
index 8558a73fbe..cd4720f4df 100644
--- a/crates/ui-egui/src/dialogs_parts.rs
+++ b/crates/ui-egui/src/dialogs_parts.rs
@@ -3,6 +3,7 @@
//! Picking a hole (its wall or rim) seats the part in it with a rigid joint; without one the part
//! goes at the origin. The live preview shows it placed.
+use crate::ui_kit::{choice_row, text_row};
use egui::vec2;
use serde_json::{Value, json};
use solidcraft_engine::{Sel, Session};
@@ -123,7 +124,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pt, inputs: &[SelInpu
};
if lib.is_empty() {
ui.vertical(|ui| {
- crate::ui_kit::note(ui, "parts_unavailable", crate::i18n::tr_label("the parts library is not available"));
+ crate::ui_kit::text(ui, crate::i18n::tr_label("the parts library is not available"), crate::ui_kit::Text::Note("parts_unavailable"));
});
return false;
}
@@ -131,18 +132,14 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pt, inputs: &[SelInpu
lib.iter().map(|f| if f.standard.is_empty() { f.name.clone() } else { format!("{} ({})", f.name, f.standard) }).collect();
let refs: Vec<&str> = names.iter().map(String::as_str).collect();
let before = k.family;
- form_row(ui, "Type", |ui| {
- combo(ui, "pt_family", &refs, &mut k.family);
- });
+ choice_row(ui, "Type", "pt_family", &mut k.family, &refs);
if k.family != before {
k.size = 0;
k.length = None;
}
let Some(f) = lib.get(k.family) else { return false };
let sizes: Vec<&str> = f.sizes.iter().map(|s| s.0.as_str()).collect();
- form_row(ui, "Size", |ui| {
- combo(ui, "pt_size", &sizes, &mut k.size);
- });
+ choice_row(ui, "Size", "pt_size", &mut k.size, &sizes);
if let Some(ls) = &f.lengths {
let mut labels = vec!["Default".to_string()];
labels.extend(ls.iter().map(|l| crate::prefs::show_mm(app, *l, 1)));
@@ -153,9 +150,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pt, inputs: &[SelInpu
k.length = i.checked_sub(1);
});
}
- form_row(ui, "Name", |ui| {
- crate::ui_kit::text_field(ui, &mut k.name, "automatic");
- });
+ text_row(ui, "Name", &mut k.name, "automatic");
// The part, and its table values.
let key = (k.family, k.size, k.length);
let tex_id = egui::Id::new("sc_part_picture");
@@ -177,7 +172,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pt, inputs: &[SelInpu
ui.add(egui::Image::new(&tx).fit_to_exact_size(vec2(180.0, 112.0)).corner_radius(t.radius_sm));
}
None => {
- crate::ui_kit::note(ui, "parts_picture", crate::i18n::tr_label("no picture"));
+ crate::ui_kit::text(ui, crate::i18n::tr_label("no picture"), crate::ui_kit::Text::Note("parts_picture"));
}
});
if let Some((_, row)) = f.sizes.get(k.size)
@@ -185,13 +180,21 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pt, inputs: &[SelInpu
{
for (key, v) in o.iter().filter(|(key, _)| key.as_str() != "size") {
form_row(ui, &key.replace('_', " "), |ui| {
- crate::ui_kit::cell_text(ui, &v.as_f64().map(|x| crate::prefs::show_mm(app, x, 1)).unwrap_or_else(|| v.to_string()));
+ crate::ui_kit::text(
+ ui,
+ &v.as_f64().map(|x| crate::prefs::show_mm(app, x, 1)).unwrap_or_else(|| v.to_string()),
+ crate::ui_kit::Text::Cell,
+ );
});
}
}
if inputs.first().is_some_and(|i| i.items.is_empty()) {
ui.vertical(|ui| {
- crate::ui_kit::note(ui, "parts_placement", crate::i18n::tr_label("pick a hole to seat it, or OK places it at the origin"));
+ crate::ui_kit::text(
+ ui,
+ crate::i18n::tr_label("pick a hole to seat it, or OK places it at the origin"),
+ crate::ui_kit::Text::Note("parts_placement"),
+ );
});
}
false
diff --git a/crates/ui-egui/src/dialogs_plastic.rs b/crates/ui-egui/src/dialogs_plastic.rs
index 7e64e50517..2d98738ac4 100644
--- a/crates/ui-egui/src/dialogs_plastic.rs
+++ b/crates/ui-egui/src/dialogs_plastic.rs
@@ -1,6 +1,8 @@
//! Plastic dialogs: Boss, Lip / Groove, Snap Fit and Rest (placed by a pick on a face), Manage
//! Plastic Rules and Assign Plastic Rule. Values left empty take the body's plastic rule.
+use crate::dialogs::put;
+use crate::ui_kit::{choice_row, expr_row, hint_row};
use serde_json::{Map, Value, json};
use solidcraft_engine::Sel;
use solidcraft_engine::doc::FeatureKind;
@@ -10,68 +12,73 @@ use solidcraft_engine::geom::Vec3;
use crate::SolveApp;
use crate::dialogs::{Kind, combo, face_sel, field, form_row, shown_expr};
-use crate::selection::{BODIES, FACES, PLANAR_FACES, SelInput};
+use crate::selection::{BODIES, FACES, PLANAR_FACES, SelInput, SelectionExt as _, point_value as pt};
-#[derive(Clone, Debug)]
-pub enum Pl {
- Boss {
- diameter: String,
- height: String,
- hole_diameter: String,
- hole_depth: String,
- draft: String,
- fillet: String,
- ribs: String,
- rib_thickness: String,
- rib_length: String,
- rib_offset: String,
- },
- Lip {
- groove: bool,
- width: String,
- height: String,
- gap: String,
- outside: bool,
- },
- SnapFit {
- hook: usize,
- length: String,
- thickness: String,
- width: String,
- catch_depth: String,
- catch_length: String,
- },
- Rest {
- round: bool,
- width: String,
- length: String,
- height: String,
- draft: String,
- thickness: String,
- },
- /// The rule manager: the rule shown (index into the rules, past the end for a new one).
- Rules {
- pick: usize,
- name: String,
- values: Vec<String>,
- active: bool,
- loaded: Option<usize>,
- },
- Assign {
- rule: usize,
- },
+crate::dialog_descriptor::dialog_descriptors! {
+ #[derive(Clone, Debug)]
+ pub enum Pl {
+ Boss("plastic.boss", "BOSS", [("Position", PLANAR_FACES, false)],
+ FeatureKind::Boss { diameter, height, hole_diameter, hole_depth, draft, fillet, ribs, rib_thickness, rib_length, rib_offset, .. }) {
+ diameter: String = "6 mm".into() => shown_expr(diameter, ValueKind::Length),
+ height: String = "10 mm".into() => shown_expr(height, ValueKind::Length),
+ hole_diameter: String = "3 mm".into() => shown_expr(&s(hole_diameter), ValueKind::Length),
+ hole_depth: String = String::new() => shown_expr(&s(hole_depth), ValueKind::Length),
+ draft: String = String::new() => shown_expr(&s(draft), ValueKind::Angle),
+ fillet: String = String::new() => shown_expr(&s(fillet), ValueKind::Length),
+ ribs: String = "0".into() => ribs.as_deref().map(str::to_string).unwrap_or_else(|| "0".into()),
+ rib_thickness: String = "1 mm".into() => rib_thickness.as_deref().map(|v| shown_expr(v, ValueKind::Length)).unwrap_or_else(|| "1 mm".into()),
+ rib_length: String = "3 mm".into() => rib_length.as_deref().map(|v| shown_expr(v, ValueKind::Length)).unwrap_or_else(|| "3 mm".into()),
+ rib_offset: String = "1 mm".into() => rib_offset.as_deref().map(|v| shown_expr(v, ValueKind::Length)).unwrap_or_else(|| "1 mm".into()),
+ } => json!({"diameter": diameter, "height": height});
+ Lip("plastic.lip", "LIP", [("Rim face", FACES, false)],
+ FeatureKind::Lip { groove, width, height, gap, outside, .. }) {
+ groove: bool = false => *groove,
+ width: String = "1.5 mm".into() => shown_expr(width, ValueKind::Length),
+ height: String = "2 mm".into() => shown_expr(height, ValueKind::Length),
+ gap: String = String::new() => shown_expr(&s(gap), ValueKind::Length),
+ outside: bool = false => *outside,
+ } => json!({"width": width, "height": height, "type": if *groove { "groove" } else { "lip" }, "side": if *outside { "outside" } else { "inside" }});
+ Rest("plastic.rest", "REST", [("Position", PLANAR_FACES, false)],
+ FeatureKind::Rest { width, length, height, draft, thickness, .. }) {
+ round: bool = true => length.is_none(),
+ width: String = "10 mm".into() => shown_expr(width, ValueKind::Length),
+ length: String = "15 mm".into() => length.as_deref().map(|l| shown_expr(l, ValueKind::Length)).unwrap_or_else(|| "15 mm".into()),
+ height: String = "2 mm".into() => shown_expr(height, ValueKind::Length),
+ draft: String = String::new() => shown_expr(&s(draft), ValueKind::Angle),
+ thickness: String = String::new() => shown_expr(&s(thickness), ValueKind::Length),
+ } => json!({"width": width, "height": height});
+ ; custom {
+ SnapFit {
+ hook: usize,
+ length: String,
+ thickness: String,
+ width: String,
+ catch_depth: String,
+ catch_length: String,
+ },
+ /// The rule manager: the rule shown (index into the rules, past the end for a new one).
+ Rules {
+ pick: usize,
+ name: String,
+ values: Vec<String>,
+ active: bool,
+ loaded: Option<usize>,
+ },
+ Assign {
+ rule: usize,
+ },
+ }
+ }
}
impl Pl {
pub fn title(&self) -> &'static str {
match self {
- Pl::Boss { .. } => "BOSS",
- Pl::Lip { groove: false, .. } => "LIP",
- Pl::Lip { .. } => "GROOVE",
+ Pl::Lip { groove: true, .. } => "GROOVE",
Pl::SnapFit { .. } => "SNAP FIT",
- Pl::Rest { .. } => "REST",
Pl::Rules { .. } => "MANAGE PLASTIC RULES",
Pl::Assign { .. } => "ASSIGN PLASTIC RULE",
+ _ => self.simple_metadata().map_or("", |(_, title)| title),
}
}
@@ -88,21 +95,6 @@ impl Pl {
}
}
-fn boss() -> Pl {
- Pl::Boss {
- diameter: "6 mm".into(),
- height: "10 mm".into(),
- hole_diameter: "3 mm".into(),
- hole_depth: String::new(),
- draft: String::new(),
- fillet: String::new(),
- ribs: "0".into(),
- rib_thickness: "1 mm".into(),
- rib_length: "3 mm".into(),
- rib_offset: "1 mm".into(),
- }
-}
-
fn snap_fit() -> Pl {
Pl::SnapFit {
hook: 0,
@@ -114,28 +106,17 @@ fn snap_fit() -> Pl {
}
}
-fn rest() -> Pl {
- Pl::Rest { round: true, width: "10 mm".into(), length: "15 mm".into(), height: "2 mm".into(), draft: String::new(), thickness: String::new() }
-}
-
-fn lip(groove: bool) -> Pl {
- Pl::Lip { groove, width: "1.5 mm".into(), height: "2 mm".into(), gap: String::new(), outside: false }
-}
-
/// The dialog for a plastic command.
pub fn start(app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
let (pl, inputs) = match id {
- "plastic.boss" => (boss(), vec![SelInput::new("Position", PLANAR_FACES, false)]),
- "plastic.lip" => (lip(false), vec![SelInput::new("Rim face", FACES, false)]),
"plastic.snap_fit" => (snap_fit(), vec![SelInput::new("Position", PLANAR_FACES, false)]),
- "plastic.rest" => (rest(), vec![SelInput::new("Position", PLANAR_FACES, false)]),
"plastic.manage_rules" => {
let rules = app.session.doc.plastic_rules();
let pick = app.session.doc.plastic.active.as_ref().and_then(|a| rules.iter().position(|r| &r.name == a)).unwrap_or(0);
(Pl::Rules { pick, name: String::new(), values: Vec::new(), active: false, loaded: None }, vec![])
}
"plastic.assign_rule" => (Pl::Assign { rule: 1 }, vec![SelInput::new("Bodies", BODIES, true)]),
- _ => return None,
+ _ => Pl::simple_start(id)?,
};
Some((Kind::Plastic(pl), inputs))
}
@@ -143,19 +124,7 @@ pub fn start(app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
/// A value row whose empty value means "from the rule" (or another default).
fn opt_field(ui: &mut egui::Ui, label: &str, v: &mut String, unit: &str, hint: &str) -> bool {
let hint = format!("{unit}, {}", crate::i18n::tr_label(hint));
- form_row(ui, label, |ui| {
- if crate::ui_kit::contains(ui) {
- return crate::ui_kit::hint_field(ui, v, &hint);
- }
- let r = ui.add(egui::TextEdit::singleline(v).hint_text(hint));
- crate::dialogs::publish_row(&r);
- crate::params_dialog::complete(ui, &r, v);
- r.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter))
- })
-}
-
-fn value_row(ui: &mut egui::Ui, label: &str, v: &mut String) -> bool {
- form_row(ui, label, |ui| field(ui, v))
+ hint_row(ui, label, v, &hint)
}
/// Directions across a face (with normal `n`) a snap fit's catch can point: two axes and their
@@ -182,8 +151,8 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pl, inputs: &[SelInpu
let mut enter = false;
match k {
Pl::Boss { diameter, height, hole_diameter, hole_depth, draft, fillet, ribs, rib_thickness, rib_length, rib_offset } => {
- enter |= value_row(ui, "Diameter", diameter);
- enter |= value_row(ui, "Height", height);
+ enter |= expr_row(ui, "Diameter", diameter);
+ enter |= expr_row(ui, "Height", height);
crate::ui_kit::section(ui, "boss_options", "Options", true, |ui| {
enter |= opt_field(ui, "Hole Diameter", hole_diameter, "mm", "no hole");
enter |= opt_field(ui, "Hole Depth", hole_depth, "mm", "to the face");
@@ -191,11 +160,11 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pl, inputs: &[SelInpu
crate::ui_kit::section(ui, "boss_advanced", "Advanced", false, |ui| {
enter |= opt_field(ui, "Draft Angle", draft, "deg", "from the rule");
enter |= opt_field(ui, "Root Fillet", fillet, "mm", "none");
- enter |= value_row(ui, "Ribs", ribs);
+ enter |= expr_row(ui, "Ribs", ribs);
if app.session.doc.eval(ribs, ValueKind::Unitless).is_ok_and(|n| n >= 1.0) {
- enter |= value_row(ui, " Rib Thickness", rib_thickness);
- enter |= value_row(ui, " Rib Length", rib_length);
- enter |= value_row(ui, " Rib Offset", rib_offset);
+ enter |= expr_row(ui, " Rib Thickness", rib_thickness);
+ enter |= expr_row(ui, " Rib Length", rib_length);
+ enter |= expr_row(ui, " Rib Offset", rib_offset);
}
});
}
@@ -210,8 +179,8 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pl, inputs: &[SelInpu
combo(ui, "pl_side", &["Inside", "Outside"], &mut side);
*outside = side == 1;
});
- enter |= value_row(ui, "Width", width);
- enter |= value_row(ui, "Height", height);
+ enter |= expr_row(ui, "Width", width);
+ enter |= expr_row(ui, "Height", height);
if *groove {
enter |= opt_field(ui, "Clearance", gap, "mm", "from the rule");
}
@@ -220,15 +189,13 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pl, inputs: &[SelInpu
let dirs = face_normal(app, inputs).map(hook_dirs).unwrap_or_default();
if !dirs.is_empty() {
let names: Vec<&str> = dirs.iter().map(|(n, _)| n.as_str()).collect();
- form_row(ui, "Catch Direction", |ui| {
- combo(ui, "pl_hook", &names, hook);
- });
+ choice_row(ui, "Catch Direction", "pl_hook", hook, &names);
}
- enter |= value_row(ui, "Length", length);
- enter |= value_row(ui, "Thickness", thickness);
- enter |= value_row(ui, "Width", width);
- enter |= value_row(ui, "Catch Depth", catch_depth);
- enter |= value_row(ui, "Catch Length", catch_length);
+ enter |= expr_row(ui, "Length", length);
+ enter |= expr_row(ui, "Thickness", thickness);
+ enter |= expr_row(ui, "Width", width);
+ enter |= expr_row(ui, "Catch Depth", catch_depth);
+ enter |= expr_row(ui, "Catch Length", catch_length);
}
Pl::Rest { round, width, length, height, draft, thickness } => {
form_row(ui, "Shape", |ui| {
@@ -236,11 +203,11 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pl, inputs: &[SelInpu
combo(ui, "pl_rest", &["Round", "Rectangular"], &mut sh);
*round = sh == 0;
});
- enter |= value_row(ui, if *round { "Diameter" } else { "Width" }, width);
+ enter |= expr_row(ui, if *round { "Diameter" } else { "Width" }, width);
if !*round {
- enter |= value_row(ui, "Length", length);
+ enter |= expr_row(ui, "Length", length);
}
- enter |= value_row(ui, "Height", height);
+ enter |= expr_row(ui, "Height", height);
crate::ui_kit::section(ui, "rest_advanced", "Advanced", false, |ui| {
enter |= opt_field(ui, "Draft Angle", draft, "deg", "from the rule");
enter |= opt_field(ui, "Wall Thickness", thickness, "mm", "solid");
@@ -248,40 +215,32 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Pl, inputs: &[SelInpu
}
Pl::Rules { pick, name, values, active, loaded } => {
let rules = app.session.doc.plastic_rules();
- let mut names: Vec<String> = rules.iter().map(|r| r.name.clone()).collect();
- names.push("New rule…".into());
- let refs: Vec<&str> = names.iter().map(String::as_str).collect();
- form_row(ui, "Rule", |ui| combo(ui, "pl_rules", &refs, pick));
- if *loaded != Some(*pick) {
- let base = rules.get(*pick).or(rules.first()).cloned();
- if let Some(b) = base {
- *values = std::iter::once(b.material.clone()).chain(b.fields().iter().map(|(_, e, _)| (*e).clone())).collect();
- *active = app.session.doc.plastic.active.as_deref() == Some(b.name.as_str()) && *pick < rules.len();
- }
- if *pick >= rules.len() {
- *name = format!("Plastic Rule{}", app.session.doc.plastic.rules.len() + 1);
+ crate::rule_editor::rule_editor! {
+ ui, "pl_rules", rules, pick, name, active, loaded;
+ new_name: format!("Plastic Rule{}", app.session.doc.plastic.rules.len() + 1),
+ load: {
+ let base = rules.get(*pick).or(rules.first()).cloned();
+ if let Some(b) = base {
+ *values = std::iter::once(b.material.clone()).chain(b.fields().iter().map(|(_, e, _)| (*e).clone())).collect();
+ *active = app.session.doc.plastic.active.as_deref() == Some(b.name.as_str()) && *pick < rules.len();
+ }
+ },
+ fields: {
+ let keys = rule_keys();
+ for (i, v) in values.iter_mut().enumerate() {
+ let label = if i == 0 { "Material".to_string() } else { keys.get(i - 1).map(|k| label_of(k)).unwrap_or_default() };
+ form_row(ui, &label, |ui| {
+ enter |= if i == 0 { crate::ui_kit::text_field(ui, v, "Material").0 } else { field(ui, v) };
+ });
+ }
}
- *loaded = Some(*pick);
- }
- if *pick >= rules.len() {
- form_row(ui, "Name", |ui| {
- crate::ui_kit::text_field(ui, name, "Name");
- });
}
- let keys = rule_keys();
- for (i, v) in values.iter_mut().enumerate() {
- let label = if i == 0 { "Material".to_string() } else { keys.get(i - 1).map(|k| label_of(k)).unwrap_or_default() };
- form_row(ui, &label, |ui| {
- enter |= if i == 0 { crate::ui_kit::text_field(ui, v, "Material").0 } else { field(ui, v) };
- });
- }
- form_row(ui, "Active rule", |ui| crate::ui_kit::checkbox(ui, "", active));
}
Pl::Assign { rule } => {
let mut names: Vec<String> = vec!["(no rule)".into()];
names.extend(app.session.doc.plastic_rules().into_iter().map(|r| r.name));
let refs: Vec<&str> = names.iter().map(String::as_str).collect();
- form_row(ui, "Rule", |ui| combo(ui, "pl_assign", &refs, rule));
+ choice_row(ui, "Rule", "pl_assign", rule, &refs);
}
}
enter
@@ -302,19 +261,6 @@ fn label_of(key: &str) -> String {
.join(" ")
}
-fn pt(v: Vec3) -> Value {
- json!([v.x, v.y, v.z])
-}
-
-/// Put non-empty optional values into the parameters.
-fn put(p: &mut Value, list: &[(&str, &String)]) {
- for (k, v) in list {
- if !v.trim().is_empty() {
- p[*k] = json!(v);
- }
- }
-}
-
/// The commands the dialog's OK runs (`extra`: parameters kept from the feature being edited).
pub fn commands(app: &SolveApp, k: &Pl, inputs: &[SelInput], extra: &Map<String, Value>) -> Result<Vec<(String, Value)>, String> {
let face = inputs
@@ -326,20 +272,17 @@ pub fn commands(app: &SolveApp, k: &Pl, inputs: &[SelInput], extra: &Map<String,
Ok(json!({"position": pt(at), "body": body}))
};
let (cmd, mut p): (&str, Value) = match k {
- Pl::Boss { diameter, height, hole_diameter, hole_depth, draft, fillet, ribs, rib_thickness, rib_length, rib_offset } => {
+ Pl::Boss { hole_diameter, hole_depth, draft, fillet, ribs, rib_thickness, rib_length, rib_offset, .. } => {
let mut p = placed("a point on a face")?;
- p["diameter"] = json!(diameter);
- p["height"] = json!(height);
put(&mut p, &[("hole_diameter", hole_diameter), ("hole_depth", hole_depth), ("draft", draft), ("fillet", fillet)]);
if app.session.doc.eval(ribs, ValueKind::Unitless).is_ok_and(|n| n >= 1.0) {
put(&mut p, &[("ribs", ribs), ("rib_thickness", rib_thickness), ("rib_length", rib_length), ("rib_offset", rib_offset)]);
}
("plastic.boss", p)
}
- Pl::Lip { groove, width, height, gap, outside } => {
+ Pl::Lip { groove, gap, .. } => {
let (body, at) = face.clone().ok_or("select the rim face first")?;
- let mut p = json!({"face": pt(at), "body": body, "width": width, "height": height,
- "type": if *groove { "groove" } else { "lip" }, "side": if *outside { "outside" } else { "inside" }});
+ let mut p = json!({"face": pt(at), "body": body});
if *groove {
put(&mut p, &[("gap", gap)]);
}
@@ -360,10 +303,8 @@ pub fn commands(app: &SolveApp, k: &Pl, inputs: &[SelInput], extra: &Map<String,
}
("plastic.snap_fit", p)
}
- Pl::Rest { round, width, length, height, draft, thickness } => {
+ Pl::Rest { round, length, draft, thickness, .. } => {
let mut p = placed("a point on a face")?;
- p["width"] = json!(width);
- p["height"] = json!(height);
if !*round {
p["length"] = json!(length);
}
@@ -372,31 +313,12 @@ pub fn commands(app: &SolveApp, k: &Pl, inputs: &[SelInput], extra: &Map<String,
}
Pl::Rules { pick, name, values, active, .. } => {
let rules = app.session.doc.plastic_rules();
- let n = match rules.get(*pick) {
- Some(r) => r.name.clone(),
- None => name.trim().to_string(),
- };
- if n.is_empty() {
- return Err("give the rule a name".into());
- }
- let mut p = json!({"name": n, "active": active});
- if let Some(m) = values.first().filter(|m| !m.trim().is_empty()) {
- p["material"] = json!(m);
- }
- for (key, v) in rule_keys().iter().zip(values.iter().skip(1)) {
- if !v.trim().is_empty() {
- p[*key] = json!(v);
- }
- }
+ let fields = std::iter::once("material").chain(rule_keys()).zip(values);
+ let p = crate::rule_editor::params(rules.get(*pick).map(|r| r.name.as_str()), name, *active, fields)?;
("plastic.manage_rules", p)
}
Pl::Assign { rule } => {
- let bodies: Vec<String> = inputs
- .first()
- .into_iter()
- .flat_map(|i| &i.items)
- .filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None })
- .collect();
+ let bodies = crate::selection::items(inputs, 0).body_names();
if bodies.is_empty() {
return Err("select bodies first".into());
}
@@ -404,6 +326,7 @@ pub fn commands(app: &SolveApp, k: &Pl, inputs: &[SelInput], extra: &Map<String,
("plastic.assign_rule", json!({"bodies": bodies, "rule": name}))
}
};
+ k.fill_simple_params(&mut p);
if let Value::Object(m) = &mut p {
for (key, v) in extra {
m.entry(key.clone()).or_insert_with(|| v.clone());
@@ -421,69 +344,18 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind) -> Option<(Kind, Vec<SelI
let ss = &app.session;
let mut extra = Map::new();
let (pl, id, at): (Pl, &str, Vec3) = match kind {
- FeatureKind::Boss {
- position,
- direction,
- diameter,
- height,
- hole_diameter,
- hole_depth,
- draft,
- fillet,
- ribs,
- rib_thickness,
- rib_length,
- rib_offset,
- body,
- } => {
+ FeatureKind::Boss { position, direction, body, .. } => {
extra.insert("direction".into(), pt(direction.0));
if let Some(b) = body {
extra.insert("body".into(), json!(b));
}
- let mut b = boss();
- if let Pl::Boss {
- diameter: d,
- height: h,
- hole_diameter: hd,
- hole_depth: hp,
- draft: dr,
- fillet: f,
- ribs: r,
- rib_thickness: rt,
- rib_length: rl,
- rib_offset: ro,
- } = &mut b
- {
- *d = shown_expr(diameter, ValueKind::Length);
- *h = shown_expr(height, ValueKind::Length);
- *hd = shown_expr(&s(hole_diameter), ValueKind::Length);
- *hp = shown_expr(&s(hole_depth), ValueKind::Length);
- *dr = shown_expr(&s(draft), ValueKind::Angle);
- *f = shown_expr(&s(fillet), ValueKind::Length);
- *r = ribs.as_deref().map(str::to_string).unwrap_or_else(|| "0".into());
- for (slot, v) in [(rt, rib_thickness), (rl, rib_length), (ro, rib_offset)] {
- if let Some(v) = v {
- *slot = shown_expr(v, ValueKind::Length);
- }
- }
- }
- (b, "plastic.boss", position.0)
+ (Pl::simple_restore(kind)?, "plastic.boss", position.0)
}
- FeatureKind::Lip { face, width, height, groove, gap, outside, body } => {
+ FeatureKind::Lip { face, body, .. } => {
if let Some(b) = body {
extra.insert("body".into(), json!(b));
}
- (
- Pl::Lip {
- groove: *groove,
- width: shown_expr(width, ValueKind::Length),
- height: shown_expr(height, ValueKind::Length),
- gap: shown_expr(&s(gap), ValueKind::Length),
- outside: *outside,
- },
- "plastic.lip",
- face.0,
- )
+ (Pl::simple_restore(kind)?, "plastic.lip", face.0)
}
FeatureKind::SnapFit { position, direction, hook, length, thickness, width, catch_depth, catch_length, body } => {
extra.insert("direction".into(), pt(direction.0));
@@ -504,7 +376,7 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind) -> Option<(Kind, Vec<SelI
};
(f, "plastic.snap_fit", position.0)
}
- FeatureKind::Rest { position, direction, along, width, length, height, draft, thickness, body } => {
+ FeatureKind::Rest { position, direction, along, body, .. } => {
extra.insert("direction".into(), pt(direction.0));
if let Some(a) = along {
extra.insert("along".into(), pt(a.0));
@@ -512,14 +384,7 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind) -> Option<(Kind, Vec<SelI
if let Some(b) = body {
extra.insert("body".into(), json!(b));
}
- let r = Pl::Rest {
- round: length.is_none(),
- width: shown_expr(width, ValueKind::Length),
- length: length.as_deref().map(|l| shown_expr(l, ValueKind::Length)).unwrap_or_else(|| "15 mm".into()),
- height: shown_expr(height, ValueKind::Length),
- draft: shown_expr(&s(draft), ValueKind::Angle),
- thickness: shown_expr(&s(thickness), ValueKind::Length),
- };
+ let r = Pl::simple_restore(kind)?;
(r, "plastic.rest", position.0)
}
_ => return None,
diff --git a/crates/ui-egui/src/dialogs_plastic_tests.rs b/crates/ui-egui/src/dialogs_plastic_tests.rs
index eaf0890610..5a28428604 100644
--- a/crates/ui-egui/src/dialogs_plastic_tests.rs
+++ b/crates/ui-egui/src/dialogs_plastic_tests.rs
@@ -1,3 +1,4 @@
+use crate::test_support::run_all;
use serde_json::json;
use solidcraft_engine::Session;
@@ -13,12 +14,6 @@ fn app_with(cmds: &[(&str, Value)]) -> SolveApp {
SolveApp::new(s, Services::default())
}
-fn run_all(app: &mut SolveApp, c: Vec<(String, Value)>) {
- for (id, p) in c {
- app.run(&id, p).unwrap();
- }
-}
-
/// A face pick places a boss; optional values left empty take the rule; ribs only with a count;
/// Edit Feature keeps the direction and refills the values.
#[test]
diff --git a/crates/ui-egui/src/dialogs_save_mesh.rs b/crates/ui-egui/src/dialogs_save_mesh.rs
index b2821bc375..dbd1646105 100644
--- a/crates/ui-egui/src/dialogs_save_mesh.rs
+++ b/crates/ui-egui/src/dialogs_save_mesh.rs
@@ -7,15 +7,16 @@
//! for a program and adds it at the top; "Custom…" itself is never the selection. Pressing Delete
//! over a program the user added removes it.
+use crate::selection::SelectionExt as _;
+use crate::ui_kit::choice_row;
use std::collections::HashMap;
use egui::{Color32, Sense, vec2};
use serde_json::{Value, json};
-use solidcraft_engine::Sel;
use solidcraft_engine::slicers::{self, Slicer};
use crate::SolveApp;
-use crate::dialogs::{Kind, combo, form_row};
+use crate::dialogs::{Kind, form_row};
use crate::selection::{BODIES, SelInput};
use crate::theme::Tokens;
@@ -150,9 +151,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut SaveMesh) -> bool {
}
k.send &= !entries.is_empty();
}
- form_row(ui, "Format", |ui| {
- combo(ui, "sm_format", &FORMATS.map(|f| f.0), &mut k.format);
- });
+ choice_row(ui, "Format", "sm_format", &mut k.format, &FORMATS.map(|f| f.0));
// A browser has no installed programs to send a file to.
if app.services.pick_program.is_none() {
@@ -272,18 +271,11 @@ fn add_custom(app: &mut SolveApp, path: &str) -> Result<(), String> {
Ok(())
}
-fn bodies(inputs: &[SelInput]) -> Vec<String> {
- inputs
- .first()
- .map(|i| i.items.iter().filter_map(|s| if let Sel::Body { name } = s { Some(name.clone()) } else { None }).collect())
- .unwrap_or_default()
-}
-
/// What the Save (or Send) button asks `file.save_mesh` to do, without the file name.
pub fn commands(k: &SaveMesh, inputs: &[SelInput]) -> Result<Vec<(String, Value)>, String> {
let format = FORMATS.get(k.format).map_or("stl", |f| f.1);
let mut p = json!({ "format": format });
- let names = bodies(inputs);
+ let names = crate::selection::items(inputs, 0).body_names();
if names.is_empty() {
return Err(crate::i18n::tr("ui.save_mesh_pick_bodies").into());
}
@@ -299,7 +291,7 @@ pub fn commands(k: &SaveMesh, inputs: &[SelInput]) -> Result<Vec<(String, Value)
/// Save and Send need at least one body.
pub fn ready(inputs: &[SelInput]) -> bool {
- !bodies(inputs).is_empty()
+ !crate::selection::items(inputs, 0).body_names().is_empty()
}
/// The button's label: Save, or Send when the file goes to a slicer.
@@ -312,7 +304,7 @@ pub fn button(k: &SaveMesh) -> &'static str {
pub fn run(app: &mut SolveApp, k: &SaveMesh, inputs: &[SelInput]) -> Result<(), String> {
let (_, params) = commands(k, inputs)?.into_iter().next().ok_or("nothing to save")?;
let (format, ext) = FORMATS.get(k.format).map_or(("stl", "stl"), |f| (f.1, f.2));
- let name = bodies(inputs).first().cloned().unwrap_or_else(|| app.session.doc.name.clone());
+ let name = crate::selection::items(inputs, 0).body_names().first().cloned().unwrap_or_else(|| app.session.doc.name.clone());
let p = &mut app.preferences;
p.save_mesh_format = format.into();
p.save_mesh_send = k.send;
diff --git a/crates/ui-egui/src/dialogs_sheet.rs b/crates/ui-egui/src/dialogs_sheet.rs
index 2337aeee22..c32e9fb51a 100644
--- a/crates/ui-egui/src/dialogs_sheet.rs
+++ b/crates/ui-egui/src/dialogs_sheet.rs
@@ -3,6 +3,8 @@
//! Sheet Metal Rules (the rule manager) and Create Flat Pattern (a flat view of the part with
//! its bend lines, the bend table and DXF export).
+use crate::dialogs::put;
+use crate::ui_kit::{choice_row, expr_row, hint_row};
use egui::{Align2, Color32, FontId, Pos2, Rect, RichText, Stroke, pos2, vec2};
use serde_json::{Map, Value, json};
use solidcraft_engine::Sel;
@@ -12,8 +14,8 @@ use solidcraft_engine::doc::{FeatureKind, ProfileSel};
use solidcraft_engine::geom::Vec3;
use crate::SolveApp;
-use crate::dialogs::{Dialog, Kind, combo, edge_sel, face_sel, field, form_row, profile_indices};
-use crate::selection::{AXES, BODIES, CURVES, EDGES, PLANAR_FACES, PROFILES, SelInput};
+use crate::dialogs::{Dialog, Kind, edge_sel, face_sel, form_row, profile_indices};
+use crate::selection::{AXES, BODIES, CURVES, EDGES, PLANAR_FACES, PROFILES, SelInput, SelectionExt as _, items, point_value as pt};
use crate::theme::Tokens;
const FOLD_POSITIONS: [&str; 4] = ["centerline", "start", "end", "mould"];
@@ -39,74 +41,78 @@ const RELIEF_SHAPE_LABELS: [&str; 4] = ["Notch", "Round", "Rectangular", "Tear"]
/// the shapes of `RELIEF_SHAPES` in order.
const FLANGE_RELIEF_LABELS: [&str; 5] = ["Rule", "Notch", "Round", "Rectangular", "Tear"];
-#[derive(Clone, Debug)]
-pub enum Sm {
- /// Base, edge or contour flange (`ty` follows the picks: profiles, edges, sketch lines).
- Flange {
- ty: usize,
- height: String,
- angle: String,
- radius: String,
- position: usize,
- flip: bool,
- distance: String,
- reverse: bool,
- rule: usize,
- /// Edge flanges: the edges with an angle and/or a height of their own (the picked point,
- /// angle, height; an empty text means the dialog's), from the rows per edge.
- own: Vec<(Vec3, String, String)>,
- /// Edge flanges: the corner relief shape of their own (index into `FLANGE_RELIEF_LABELS`;
- /// 0 is the rule's) and its size (empty: the rule's).
- relief: usize,
- relief_size: String,
- },
- Hem {
- length: String,
- gap: String,
- flip: bool,
- },
- /// Fold (bend) along a sketch line; `position`: where the line sits in the bend.
- Fold {
- angle: String,
- radius: String,
- position: usize,
- flip: bool,
- },
- Unfold {
- refold: bool,
- },
- Convert {
- rule: usize,
- },
- /// The rule manager: the rule shown (index into the rules, or past the end for a new one).
- Rules {
- pick: usize,
- name: String,
- values: Vec<String>,
- /// The corner relief shape (index into `RELIEF_SHAPES`).
- relief: usize,
- active: bool,
- loaded: Option<usize>,
- },
- /// The flat pattern of the picked (or last) sheet body.
- FlatPattern {
- data: Option<Result<Value, String>>,
- key: Option<(u64, Option<String>)>,
- status: Option<String>,
- },
+crate::dialog_descriptor::dialog_descriptors! {
+ #[derive(Clone, Debug)]
+ pub enum Sm {
+ Hem("sheet.hem", "HEM", [("Edges", EDGES, true)],
+ FeatureKind::SheetHem { length, gap, flip, .. }) {
+ length: String = "5 mm".into() => length.to_string(),
+ gap: String = String::new() => gap.as_deref().map(str::to_string).unwrap_or_default(),
+ flip: bool = false => *flip,
+ } => json!({"length": length, "flip": flip});
+ Fold("sheet.fold", "FOLD", [("Bend Line", AXES, false), ("Stationary Side", PLANAR_FACES, false)],
+ FeatureKind::SheetFold { angle, radius, position, flip, .. }) {
+ angle: String = "90 deg".into() => angle.to_string(),
+ radius: String = String::new() => radius.as_deref().map(str::to_string).unwrap_or_default(),
+ position: usize = 0 => FOLD_POSITIONS.iter().position(|x| x == position || (*x == "mould" && position == "mold")).unwrap_or(0),
+ flip: bool = false => *flip,
+ } => json!({"angle": angle, "position": FOLD_POSITIONS.get(*position).copied().unwrap_or("centerline"), "flip": flip});
+ ; custom {
+ /// Base, edge or contour flange (`ty` follows the picks: profiles, edges, sketch lines).
+ Flange {
+ ty: usize,
+ height: String,
+ angle: String,
+ radius: String,
+ position: usize,
+ flip: bool,
+ distance: String,
+ reverse: bool,
+ rule: usize,
+ /// Edge flanges: the edges with an angle and/or a height of their own (the picked point,
+ /// angle, height; an empty text means the dialog's), from the rows per edge.
+ own: Vec<(Vec3, String, String)>,
+ /// Edge flanges: the corner relief shape of their own (index into `FLANGE_RELIEF_LABELS`;
+ /// 0 is the rule's) and its size (empty: the rule's).
+ relief: usize,
+ relief_size: String,
+ },
+ Unfold {
+ refold: bool,
+ },
+ Convert {
+ rule: usize,
+ },
+ /// The rule manager: the rule shown (index into the rules, or past the end for a new one).
+ Rules {
+ pick: usize,
+ name: String,
+ values: Vec<String>,
+ /// The corner relief shape (index into `RELIEF_SHAPES`).
+ relief: usize,
+ active: bool,
+ loaded: Option<usize>,
+ },
+ /// The flat pattern of the picked (or last) sheet body.
+ FlatPattern {
+ data: Option<Result<Value, String>>,
+ key: Option<(u64, Option<String>)>,
+ status: Option<String>,
+ },
+ }
+ }
}
impl Sm {
pub fn title(&self) -> &'static str {
match self {
Sm::Flange { .. } => "FLANGE",
- Sm::Hem { .. } => "HEM",
- Sm::Fold { .. } => "FOLD",
Sm::Unfold { refold: false } => "UNFOLD",
Sm::Unfold { refold: true } => "REFOLD",
Sm::Convert { .. } => "CONVERT TO SHEET METAL",
Sm::Rules { .. } => "SHEET METAL RULES",
Sm::FlatPattern { .. } => "FLAT PATTERN",
+ _ => self.simple_metadata().map_or("", |(_, title)| title),
}
}
@@ -150,11 +156,6 @@ fn new_flange(ty: usize) -> Sm {
pub fn start(app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
let (sm, inputs) = match id {
"sheet.flange" => (new_flange(0), vec![SelInput::new("Profile / Edges", PROFILES | EDGES | CURVES, true)]),
- "sheet.hem" => (Sm::Hem { length: "5 mm".into(), gap: String::new(), flip: false }, vec![SelInput::new("Edges", EDGES, true)]),
- "sheet.fold" => (
- Sm::Fold { angle: "90 deg".into(), radius: String::new(), position: 0, flip: false },
- vec![SelInput::new("Bend Line", AXES, false), SelInput::new("Stationary Side", PLANAR_FACES, false)],
- ),
"sheet.unfold" => (Sm::Unfold { refold: false }, vec![SelInput::new("Body (last if none)", BODIES, false)]),
"sheet.refold" => (Sm::Unfold { refold: true }, vec![SelInput::new("Body (last if none)", BODIES, false)]),
"sheet.convert" => {
@@ -167,7 +168,7 @@ pub fn start(app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
(Sm::Rules { pick, name: String::new(), values: Vec::new(), relief: 0, active: true, loaded: None }, vec![])
}
"sheet.flat_pattern" => (Sm::FlatPattern { data: None, key: None, status: None }, vec![SelInput::new("Body (last if none)", BODIES, false)]),
- _ => return None,
+ _ => Sm::simple_start(id)?,
};
Some((Kind::Sheet(sm), inputs))
}
@@ -186,9 +187,7 @@ fn rule_names(app: &SolveApp) -> Vec<String> {
fn rule_combo(app: &SolveApp, ui: &mut egui::Ui, id: &str, rule: &mut usize) {
let names = rule_names(app);
let refs: Vec<&str> = names.iter().map(String::as_str).collect();
- form_row(ui, "Rule", |ui| {
- combo(ui, id, &refs, rule);
- });
+ choice_row(ui, "Rule", id, rule, &refs);
}
/// The flange type the picks make: edges an edge flange, sketch lines a contour, else base.
@@ -215,26 +214,14 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Sm, inputs: &mut [Sel
});
match *ty {
1 => {
- form_row(ui, "Height", |ui| {
- enter |= field(ui, height);
- });
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
- form_row(ui, "Bend Position", |ui| {
- combo(ui, "sm_pos", &POSITION_LABELS, position);
- });
+ enter |= expr_row(ui, "Height", height);
+ enter |= expr_row(ui, "Angle", angle);
+ choice_row(ui, "Bend Position", "sm_pos", position, &POSITION_LABELS);
crate::ui_kit::section(ui, "flange_advanced", "Advanced", false, |ui| {
- form_row(ui, "Bend Radius", |ui| {
- enter |= crate::ui_kit::hint_field(ui, radius, crate::i18n::tr_label("from the rule"));
- });
+ enter |= hint_row(ui, "Bend Radius", radius, crate::i18n::tr_label("from the rule"));
// The relief at the corners these flanges make: the rule's unless set here.
- form_row(ui, "Corner Relief Shape", |ui| {
- combo(ui, "sm_flange_relief", &FLANGE_RELIEF_LABELS, relief);
- });
- form_row(ui, "Corner Relief", |ui| {
- enter |= crate::ui_kit::hint_field(ui, relief_size, crate::i18n::tr_label("from the rule"));
- });
+ choice_row(ui, "Corner Relief Shape", "sm_flange_relief", relief, &FLANGE_RELIEF_LABELS);
+ enter |= hint_row(ui, "Corner Relief", relief_size, crate::i18n::tr_label("from the rule"));
// With several edges, a row for each: an angle and a height of its own, left
// empty for the values above (shown as the hints).
let points = edge_point_list(inputs);
@@ -271,9 +258,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Sm, inputs: &mut [Sel
});
}
2 => {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, distance);
- });
+ enter |= expr_row(ui, "Distance", distance);
rule_combo(app, ui, "sm_rule", rule);
}
@@ -289,72 +274,52 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Sm, inputs: &mut [Sel
form_row(ui, "Type", |ui| {
ui.label(crate::i18n::tr_label("Flat"));
});
- form_row(ui, "Length", |ui| {
- enter |= field(ui, length);
- });
- form_row(ui, "ui.sheet_gap", |ui| {
- enter |= crate::ui_kit::hint_field(ui, gap, crate::i18n::tr_label("from the rule"));
- });
+ enter |= expr_row(ui, "Length", length);
+ enter |= hint_row(ui, "ui.sheet_gap", gap, crate::i18n::tr_label("from the rule"));
crate::ui_kit::options(ui, "sheet_options", &mut [("Flip", flip)]);
}
Sm::Fold { angle, radius, position, flip } => {
- form_row(ui, "Bend Line Position", |ui| {
- combo(ui, "sm_fold_pos", &FOLD_POSITION_LABELS, position);
- });
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
- form_row(ui, "Bend Radius", |ui| {
- enter |= crate::ui_kit::hint_field(ui, radius, crate::i18n::tr_label("from the rule"));
- });
+ choice_row(ui, "Bend Line Position", "sm_fold_pos", position, &FOLD_POSITION_LABELS);
+ enter |= expr_row(ui, "Angle", angle);
+ enter |= hint_row(ui, "Bend Radius", radius, crate::i18n::tr_label("from the rule"));
crate::ui_kit::options(ui, "sheet_options", &mut [("Flip", flip)]);
}
Sm::Unfold { .. } => {}
Sm::Convert { rule } => rule_combo(app, ui, "sm_conv_rule", rule),
Sm::Rules { pick, name, values, relief, active, loaded } => {
let rules = rule_list(app);
- let mut names: Vec<String> = rules.iter().map(|r| r.name.clone()).collect();
- names.push("New rule…".into());
- let refs: Vec<&str> = names.iter().map(String::as_str).collect();
- form_row(ui, "Rule", |ui| combo(ui, "sm_rules", &refs, pick));
- if *loaded != Some(*pick) {
- // Show the picked rule (a new one starts from the one shown before).
- let base = rules.get(*pick).cloned().unwrap_or_else(|| rules.first().cloned().unwrap_or_else(SheetRule::steel));
- *values = vec![
- base.thickness.clone(),
- base.k_factor.clone(),
- base.bend_radius.clone(),
- base.relief_width.clone(),
- base.relief_depth.clone(),
- base.corner_relief.clone(),
- base.hem_gap.clone(),
- base.gap.clone(),
- ];
- *relief = RELIEF_SHAPES.iter().position(|s| s.eq_ignore_ascii_case(base.corner_relief_shape.trim())).unwrap_or(0);
- *active = app.session.doc.sheet_rule(None).name == base.name || *pick >= rules.len();
- if *pick >= rules.len() {
- *name = format!("Rule{}", rules.len() + 1);
- }
- *loaded = Some(*pick);
- }
- if *pick >= rules.len() {
- form_row(ui, "Name", |ui| {
- crate::ui_kit::text_field(ui, name, "Name");
- });
- }
- for ((key, label), v) in RULE_FIELDS.iter().zip(values.iter_mut()) {
- if *key == "corner_relief" {
- // The shape goes with its size, the row below.
- form_row(ui, "Corner Relief Shape", |ui| combo(ui, "sm_relief_shape", &RELIEF_SHAPE_LABELS, relief));
+ crate::rule_editor::rule_editor! {
+ ui, "sm_rules", rules, pick, name, active, loaded;
+ new_name: format!("Rule{}", rules.len() + 1),
+ load: {
+ // A new rule starts from the first rule.
+ let base = rules.get(*pick).cloned().unwrap_or_else(|| rules.first().cloned().unwrap_or_else(SheetRule::steel));
+ *values = vec![
+ base.thickness.clone(),
+ base.k_factor.clone(),
+ base.bend_radius.clone(),
+ base.relief_width.clone(),
+ base.relief_depth.clone(),
+ base.corner_relief.clone(),
+ base.hem_gap.clone(),
+ base.gap.clone(),
+ ];
+ *relief = RELIEF_SHAPES.iter().position(|s| s.eq_ignore_ascii_case(base.corner_relief_shape.trim())).unwrap_or(0);
+ *active = app.session.doc.sheet_rule(None).name == base.name || *pick >= rules.len();
+ },
+ fields: {
+ for ((key, label), v) in RULE_FIELDS.iter().zip(values.iter_mut()) {
+ if *key == "corner_relief" {
+ // The shape goes with its size, the row below.
+ choice_row(ui, "Corner Relief Shape", "sm_relief_shape", relief, &RELIEF_SHAPE_LABELS);
+ }
+ enter |= expr_row(ui, label, v);
+ }
}
- form_row(ui, label, |ui| {
- enter |= field(ui, v);
- });
}
- form_row(ui, "Active rule", |ui| crate::ui_kit::checkbox(ui, "", active));
if *pick < rules.len()
&& !app.session.doc.sheet.rules.is_empty()
- && crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Delete rule")).clicked()
+ && crate::ui_kit::button(ui, crate::i18n::tr_label("Delete rule"), crate::ui_kit::Button::Normal).clicked()
{
let n = rules.get(*pick).map(|r| r.name.clone()).unwrap_or_default();
match app.run("sheet.manage_rules", json!({"name": n, "delete": true})) {
@@ -411,12 +376,12 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Sm, inputs: &mut [Sel
});
}
ui.vertical(|ui| {
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Export DXF…")).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Export DXF…"), crate::ui_kit::Button::Normal).clicked() {
*status = Some(export_flat(app, v["body"].as_str().unwrap_or(""), "dxf"));
}
});
ui.vertical(|ui| {
- if crate::ui_kit::secondary_button(ui, crate::i18n::tr_label("Export Bend Table…")).clicked() {
+ if crate::ui_kit::button(ui, crate::i18n::tr_label("Export Bend Table…"), crate::ui_kit::Button::Normal).clicked() {
*status = Some(export_flat(app, v["body"].as_str().unwrap_or(""), "csv"));
}
});
@@ -469,21 +434,13 @@ fn rule_value(app: &SolveApp, rule: usize) -> Option<String> {
rule.checked_sub(1).and_then(|i| rule_list(app).get(i).map(|r| r.name.clone()))
}
-fn items(inputs: &[SelInput], i: usize) -> &[Sel] {
- inputs.get(i).map(|x| x.items.as_slice()).unwrap_or(&[])
-}
-
-fn pt(v: Vec3) -> Value {
- json!([v.x, v.y, v.z])
-}
-
fn edge_points(inputs: &[SelInput]) -> Vec<Value> {
- items(inputs, 0).iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(pt(*point)) } else { None }).collect()
+ items(inputs, 0).edge_points().into_iter().map(pt).collect()
}
/// The picked edges' points.
fn edge_point_list(inputs: &[SelInput]) -> Vec<Vec3> {
- items(inputs, 0).iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(*point) } else { None }).collect()
+ items(inputs, 0).edge_points()
}
/// Where the own angle and height of the edge picked at `p` are kept (an empty entry on first use).
@@ -524,20 +481,15 @@ pub fn commands(app: &SolveApp, k: &Sm, inputs: &[SelInput], extra: &Map<String,
1 => {
let mut p = json!({"type": "edge", "edges": flange_edges(inputs, own), "height": height, "angle": angle,
"position": POSITIONS.get(*position).copied().unwrap_or("inside")});
- if !radius.trim().is_empty() {
- p["radius"] = json!(radius);
- }
+ put(&mut p, &[("radius", radius)]);
if let Some(shape) = relief.checked_sub(1).and_then(|i| RELIEF_SHAPES.get(i)) {
p["corner_relief_shape"] = json!(shape);
}
- if !relief_size.trim().is_empty() {
- p["corner_relief"] = json!(relief_size);
- }
+ put(&mut p, &[("corner_relief", relief_size)]);
p
}
2 => {
- let ids: Vec<String> =
- items(inputs, 0).iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect();
+ let ids: Vec<String> = items(inputs, 0).curve_ids();
let st = s.world_state();
let sketch = st
.sketches
@@ -549,10 +501,7 @@ pub fn commands(app: &SolveApp, k: &Sm, inputs: &[SelInput], extra: &Map<String,
json!({"type": "contour", "sketch": sketch, "curves": ids, "distance": distance, "reverse": reverse})
}
_ => {
- let ps: Vec<(u64, usize)> = items(inputs, 0)
- .iter()
- .filter_map(|x| if let Sel::Profile { sketch, index } = x { Some((*sketch, *index)) } else { None })
- .collect();
+ let ps: Vec<(u64, usize)> = items(inputs, 0).profiles();
let sketch = ps.first().map(|x| x.0).ok_or("select a profile, edges or sketch lines first")?;
let idx: Vec<usize> = ps.iter().filter(|x| x.0 == sketch).map(|x| x.1).collect();
json!({"type": "base", "sketch": sketch, "profiles": idx})
@@ -564,19 +513,17 @@ pub fn commands(app: &SolveApp, k: &Sm, inputs: &[SelInput], extra: &Map<String,
}
("sheet.flange", p)
}
- Sm::Hem { length, gap, flip } => {
+ Sm::Hem { gap, .. } => {
let edges = edge_points(inputs);
if edges.is_empty() {
return Err("select sheet edges first".into());
}
- let mut p = json!({"edges": edges, "length": length, "flip": flip});
- if !gap.trim().is_empty() {
- p["gap"] = json!(gap);
- }
+ let mut p = json!({"edges": edges});
+ put(&mut p, &[("gap", gap)]);
("sheet.hem", p)
}
- Sm::Fold { angle, radius, position, flip } => {
- let mut p = json!({"angle": angle, "position": FOLD_POSITIONS.get(*position).copied().unwrap_or("centerline"), "flip": flip});
+ Sm::Fold { radius, .. } => {
+ let mut p = json!({});
match items(inputs, 0).first() {
Some(Sel::SketchCurve { id }) => {
let st = s.world_state();
@@ -594,9 +541,7 @@ pub fn commands(app: &SolveApp, k: &Sm, inputs: &[SelInput], extra: &Map<String,
_ if extra.contains_key("points") => {}
_ => return Err("select the bend line (a sketch line) first".into()),
}
- if !radius.trim().is_empty() {
- p["radius"] = json!(radius);
- }
+ put(&mut p, &[("radius", radius)]);
if let Some(Sel::Face { point, .. }) = items(inputs, 1).first() {
p["fixed"] = pt(*point);
}
@@ -615,8 +560,7 @@ pub fn commands(app: &SolveApp, k: &Sm, inputs: &[SelInput], extra: &Map<String,
};
let mut p = json!({"body": body, "face": pt(*point)});
// The sharp edges of a solid or shelled body that become bends (a plate has none).
- let bends: Vec<Value> =
- items(inputs, 1).iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(pt(*point)) } else { None }).collect();
+ let bends: Vec<Value> = items(inputs, 1).edge_points().into_iter().map(pt).collect();
if !bends.is_empty() {
p["bends"] = json!(bends);
}
@@ -627,23 +571,14 @@ pub fn commands(app: &SolveApp, k: &Sm, inputs: &[SelInput], extra: &Map<String,
}
Sm::Rules { pick, name, values, relief, active, .. } => {
let rules = rule_list(app);
- let n = match rules.get(*pick) {
- Some(r) => r.name.clone(),
- None => name.trim().to_string(),
- };
- if n.is_empty() {
- return Err("give the rule a name".into());
- }
- let mut p = json!({"name": n, "active": active, "corner_relief_shape": RELIEF_SHAPES.get(*relief).copied().unwrap_or("notch")});
- for ((k, _), v) in RULE_FIELDS.iter().zip(values) {
- if !v.trim().is_empty() {
- p[*k] = json!(v);
- }
- }
+ let fields = RULE_FIELDS.iter().map(|(key, _)| *key).zip(values);
+ let mut p = crate::rule_editor::params(rules.get(*pick).map(|r| r.name.as_str()), name, *active, fields)?;
+ p["corner_relief_shape"] = json!(RELIEF_SHAPES.get(*relief).copied().unwrap_or("notch"));
("sheet.manage_rules", p)
}
Sm::FlatPattern { .. } => return Ok(Vec::new()),
};
+ k.fill_simple_params(&mut p);
if let Value::Object(m) = &mut p {
for (k, v) in extra {
m.entry(k.clone()).or_insert_with(|| v.clone());
@@ -715,25 +650,17 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind) -> Option<(Kind, Vec<SelI
};
(f, picked)
}
- FeatureKind::SheetHem { edges, length, gap, flip, body } => {
+ FeatureKind::SheetHem { edges, body, .. } => {
if let Some(b) = body {
extra.insert("body".into(), json!(b));
}
- (
- Sm::Hem { length: length.to_string(), gap: gap.as_deref().map(str::to_string).unwrap_or_default(), flip: *flip },
- edges.iter().filter_map(|p| edge_sel(s, p.0)).collect(),
- )
+ (Sm::simple_restore(kind)?, edges.iter().filter_map(|p| edge_sel(s, p.0)).collect())
}
- FeatureKind::SheetFold { curve, a, b, angle, radius, position, flip, fixed, body, .. } => {
+ FeatureKind::SheetFold { curve, a, b, fixed, body, .. } => {
if let Some(bd) = body {
extra.insert("body".into(), json!(bd));
}
- let k = Sm::Fold {
- angle: angle.to_string(),
- radius: radius.as_deref().map(str::to_string).unwrap_or_default(),
- position: FOLD_POSITIONS.iter().position(|x| x == position || (*x == "mould" && position == "mold")).unwrap_or(0),
- flip: *flip,
- };
+ let k = Sm::simple_restore(kind)?;
let (_, mut ins) = start(app, "sheet.fold")?;
match curve {
Some(c) => {
diff --git a/crates/ui-egui/src/dialogs_sheet_tests.rs b/crates/ui-egui/src/dialogs_sheet_tests.rs
index 6f0ddd909b..20811737a4 100644
--- a/crates/ui-egui/src/dialogs_sheet_tests.rs
+++ b/crates/ui-egui/src/dialogs_sheet_tests.rs
@@ -1,3 +1,4 @@
+use crate::test_support::run_all;
use serde_json::json;
use solidcraft_engine::Session;
@@ -16,12 +17,6 @@ fn plate(mode: crate::shell::LayoutMode) -> SolveApp {
app
}
-fn run_all(app: &mut SolveApp, c: Vec<(String, Value)>) {
- for (id, p) in c {
- app.run(&id, p).unwrap();
- }
-}
-
/// The picks decide the flange: a profile makes the base, edges then edge flanges with the
/// dialog's height, angle and bend position; Edit Feature brings the edges back.
#[test]
@@ -154,19 +149,11 @@ fn shallow_pocket_overlay_labels_depth_without_drawing_a_through_void() {
let Kind::Sheet(Sm::FlatPattern { data, .. }) = &mut dialog.kind else { panic!("flat dialog") };
*data = Some(Ok(flat));
let ctx = crate::fonts::test_context();
- let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Middle, egui::Id::new("flat-pocket-test")));
assert!(overlay(&mut app, &painter, Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 900.0)), &dialog));
});
- output.textures_delta.clear();
- let texts: Vec<&str> = output
- .shapes
- .iter()
- .filter_map(|s| match &s.shape {
- egui::Shape::Text(text) => Some(text.galley.text()),
- _ => None,
- })
- .collect();
+ let texts: Vec<_> = crate::test_support::text_shapes(&output).map(|text| text.galley.text()).collect();
assert!(texts.contains(&"Bottom pocket: 1.00 mm deep"));
assert!(texts.contains(&"Pocket boundary (material remains)"));
let paths: Vec<_> = output
@@ -217,12 +204,12 @@ fn flat_pattern_islands_fit_before_the_actual_command_panel() {
for _ in 0..3 {
output =
ctx.run_ui(egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 900.0))), ..Default::default() }, |ui| {
- crate::frame::docked("FLAT PATTERN", id, pos2(1400.0, 294.0), 540.0, crate::frame::Width::Normal).min_width(360.0).show(
- ui.ctx(),
- |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()
+ .show(ui.ctx(), |ui| {
ui.label("Flat size: 50 × 10 × 2.5 mm");
- },
- );
+ });
let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Background, egui::Id::new("island-fit")));
assert!(overlay(
&mut app,
@@ -274,19 +261,12 @@ fn coincident_top_and_bottom_pocket_depths_share_a_readable_annotation() {
let Kind::Sheet(Sm::FlatPattern { data, .. }) = &mut dialog.kind else { panic!("flat dialog") };
*data = Some(Ok(flat));
let ctx = crate::fonts::test_context();
- let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Middle, egui::Id::new("coincident-pocket-test")));
assert!(overlay(&mut app, &painter, Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 900.0)), &dialog));
});
- output.textures_delta.clear();
- let labels: Vec<_> = output
- .shapes
- .iter()
- .filter_map(|shape| match &shape.shape {
- egui::Shape::Text(text) if text.galley.text().contains("pocket:") => Some(text.galley.text()),
- _ => None,
- })
- .collect();
+ let labels: Vec<_> =
+ crate::test_support::text_shapes(&output).map(|text| text.galley.text()).filter(|text| text.contains("pocket:")).collect();
assert_eq!(labels.len(), 1, "coincident depths must not overwrite one another");
assert!(labels[0].contains("Top pocket: 1.00 mm deep"));
assert!(labels[0].contains("Bottom pocket: 0.50 mm deep"));
@@ -694,8 +674,7 @@ fn frame(app: &mut SolveApp, ctx: &egui::Context, time: &mut f64, mods: egui::Mo
events,
..Default::default()
};
- let mut out = ctx.run_ui(raw, |ui| crate::viewport::show(app, ui));
- out.textures_delta.clear();
+ crate::test_support::frame(ctx, raw, |ui| crate::viewport::show(app, ui));
}
/// The same pan and zoom input moves the flat pattern's view exactly as it moves the Design
diff --git a/crates/ui-egui/src/dialogs_surface.rs b/crates/ui-egui/src/dialogs_surface.rs
index ac21d062a5..c64ede7e91 100644
--- a/crates/ui-egui/src/dialogs_surface.rs
+++ b/crates/ui-egui/src/dialogs_surface.rs
@@ -2,6 +2,8 @@
//! Loft, Offset and Ruled Surface, Blend and Boundary Surface, Patch, Stitch, Thicken, Extend, Trim, Untrim
//! and Split Face. Each has a live preview and Edit Feature.
+use crate::dialogs::put;
+use crate::ui_kit::{choice_row, expr_row, hint_row};
use serde_json::{Map, Value, json};
use solidcraft_engine::Sel;
use solidcraft_engine::doc::expr::Kind as ValueKind;
@@ -9,87 +11,95 @@ use solidcraft_engine::doc::{AxisRef, Direction, FaceAt, FeatureKind, Mat, Plane
use solidcraft_engine::geom::Vec3;
use crate::SolveApp;
-use crate::dialogs::{Kind, OP_LABELS, OPS, combo, field, form_row, op_index};
-use crate::selection::{AXES, BODIES, CURVES, EDGES, FACES, PLANES, PROFILES, SelInput, VERTICES};
+use crate::dialogs::{Kind, OP_LABELS, OPS, combo, form_row, op_index};
+use crate::selection::{AXES, BODIES, CURVES, EDGES, FACES, PLANES, PROFILES, SelInput, SelectionExt as _, VERTICES, items, point_value as pt};
use crate::ui_kit;
-/// A surface tool dialog's values.
-#[derive(Clone, Debug, PartialEq)]
-pub enum Surf {
- /// `direction`: an index into [`EXTRUDE_SIDES`].
- Extrude {
- distance: String,
- direction: usize,
- },
- /// `axis`: a stored {origin, dir} axis, used while no axis is picked.
- Revolve {
- angle: String,
- symmetric: bool,
- axis: Option<Value>,
- },
- Sweep(crate::dialogs_sweep::SweepOpts),
- /// `rail_fit`: how the guide rails reshape the sections (an index into the sweep dialog's
- /// rail fits).
- Loft {
- rail_fit: usize,
- },
- /// `continuity`: an index into [`BLEND_CONTINUITY`] for each end, [from, to]; `bulge`: how
- /// full each end leaves (0 is the plain bridge); `stitch`: sew the blend onto both bodies.
- Blend {
- continuity: [usize; 2],
- bulge: [f64; 2],
- stitch: bool,
- },
- /// `continuity`: an index into [`PATCH_CONTINUITY`] (for a loop of sketch curves, how much of
- /// the sketch's plane each side repeats; for picked edges, how the surface meets the faces
- /// beside them); `join`: sew the surface into the body of its edges.
- Boundary {
- continuity: usize,
- join: bool,
- },
- /// `continuity`: an index into [`PATCH_CONTINUITY`] (how a patch on edges meets the faces
- /// beside its loop).
- Patch {
- continuity: usize,
- },
- Unstitch,
- ReverseNormal,
- Offset {
- distance: String,
- chain: bool,
- },
- /// `mode`: an index into [`RULED_MODES`].
- Ruled {
- distance: String,
- mode: usize,
- angle: String,
- flip: bool,
- round: bool,
- },
- Stitch {
- tolerance: String,
- },
- Thicken {
- thickness: String,
- symmetric: bool,
- operation: usize,
- },
- Extend {
- distance: String,
- },
- /// `direction`: the stored sweep direction of trimming curves (none: the sketch's normal).
- Trim {
- extend: bool,
- stitch: bool,
- direction: Option<Vec3>,
- },
- /// `holes`: an index into [`UNTRIM_HOLES`].
- Untrim {
- holes: usize,
- outer: bool,
- in_place: bool,
- },
- SplitFace,
+crate::dialog_descriptor::dialog_descriptors! {
+ /// A surface tool dialog's values.
+ #[derive(Clone, Debug, PartialEq)]
+ pub enum Surf {
+ Offset("surface.offset", "OFFSET SURFACE", [("Faces", FACES, true)],
+ FeatureKind::SurfaceOffset { distance, chain, .. }) {
+ distance: String = "2 mm".into() => distance.to_string(),
+ chain: bool = false => *chain,
+ } => json!({"distance": distance});
+ Stitch("surface.stitch", "STITCH", [("Surfaces", BODIES, true)],
+ FeatureKind::Stitch { tolerance, .. }) {
+ tolerance: String = String::new() => if tolerance.trim() == "0" { String::new() } else { tolerance.to_string() },
+ } => json!({});
+ Thicken("surface.thicken", "THICKEN", [("Surfaces", BODIES, true)],
+ FeatureKind::Thicken { thickness, symmetric, operation, .. }) {
+ thickness: String = "2 mm".into() => thickness.to_string(),
+ symmetric: bool = false => *symmetric,
+ operation: usize = 0 => op_index(operation),
+ } => json!({"thickness": thickness, "symmetric": symmetric, "operation": OPS.get(*operation).copied().unwrap_or("new")});
+ Extend("surface.extend", "EXTEND", [("Edges", EDGES, true)],
+ FeatureKind::SurfaceExtend { distance, .. }) {
+ distance: String = "10 mm".into() => distance.to_string(),
+ } => json!({"distance": distance});
+ ; custom {
+ /// `direction`: an index into [`EXTRUDE_SIDES`].
+ Extrude {
+ distance: String,
+ direction: usize,
+ },
+ /// `axis`: a stored {origin, dir} axis, used while no axis is picked.
+ Revolve {
+ angle: String,
+ symmetric: bool,
+ axis: Option<Value>,
+ },
+ Sweep(crate::dialogs_sweep::SweepOpts),
+ /// `rail_fit`: how the guide rails reshape the sections (an index into the sweep dialog's
+ /// rail fits).
+ Loft {
+ rail_fit: usize,
+ },
+ /// `continuity`: an index into [`BLEND_CONTINUITY`] for each end, [from, to]; `bulge`: how
+ /// full each end leaves (0 is the plain bridge); `stitch`: sew the blend onto both bodies.
+ Blend {
+ continuity: [usize; 2],
+ bulge: [f64; 2],
+ stitch: bool,
+ },
+ /// `continuity`: an index into [`PATCH_CONTINUITY`] (for a loop of sketch curves, how much of
+ /// the sketch's plane each side repeats; for picked edges, how the surface meets the faces
+ /// beside them); `join`: sew the surface into the body of its edges.
+ Boundary {
+ continuity: usize,
+ join: bool,
+ },
+ /// `continuity`: an index into [`PATCH_CONTINUITY`] (how a patch on edges meets the faces
+ /// beside its loop).
+ Patch {
+ continuity: usize,
+ },
+ Unstitch,
+ ReverseNormal,
+ /// `mode`: an index into [`RULED_MODES`].
+ Ruled {
+ distance: String,
+ mode: usize,
+ angle: String,
+ flip: bool,
+ round: bool,
+ },
+ /// `direction`: the stored sweep direction of trimming curves (none: the sketch's normal).
+ Trim {
+ extend: bool,
+ stitch: bool,
+ direction: Option<Vec3>,
+ },
+ /// `holes`: an index into [`UNTRIM_HOLES`].
+ Untrim {
+ holes: usize,
+ outer: bool,
+ in_place: bool,
+ },
+ SplitFace,
+ }
+ }
}
impl Surf {
@@ -104,14 +114,11 @@ impl Surf {
Surf::Patch { .. } => "PATCH",
Surf::Unstitch => "UNSTITCH",
Surf::ReverseNormal => "REVERSE NORMAL",
- Surf::Offset { .. } => "OFFSET SURFACE",
Surf::Ruled { .. } => "RULED SURFACE",
- Surf::Stitch { .. } => "STITCH",
- Surf::Thicken { .. } => "THICKEN",
- Surf::Extend { .. } => "EXTEND",
Surf::Trim { .. } => "TRIM",
Surf::Untrim { .. } => "UNTRIM",
Surf::SplitFace => "SPLIT FACE",
+ _ => self.simple_metadata().map_or("", |(_, title)| title),
}
}
@@ -171,13 +178,9 @@ fn inputs(k: &Surf) -> Vec<SelInput> {
Surf::Patch { .. } => vec![SelInput::new("Boundary", PROFILES | EDGES, true), SelInput::new("Pass through", VERTICES | FACES, true)],
Surf::Unstitch => vec![SelInput::new("Body, or faces to take out", BODIES | FACES, true)],
Surf::ReverseNormal => vec![SelInput::new("Surface, or faces to turn over", BODIES | FACES, true)],
- Surf::Offset { .. } => vec![SelInput::new("Faces", FACES, true)],
Surf::Ruled { .. } => {
vec![SelInput::new("Edges", EDGES, true), SelInput::new("Reference face", FACES, false), SelInput::new("Direction", AXES | EDGES, false)]
}
- Surf::Stitch { .. } => vec![SelInput::new("Surfaces", BODIES, true)],
- Surf::Thicken { .. } => vec![SelInput::new("Surfaces", BODIES, true)],
- Surf::Extend { .. } => vec![SelInput::new("Edges", EDGES, true)],
Surf::Trim { .. } => vec![
SelInput::new("Surface", BODIES, false),
SelInput::new("Trimming tool (plane, face or curves)", PLANES | FACES | CURVES, true),
@@ -187,6 +190,7 @@ fn inputs(k: &Surf) -> Vec<SelInput> {
],
Surf::Untrim { .. } => vec![SelInput::new("Face", FACES, false), SelInput::new("Holes (edges on them)", EDGES, true)],
Surf::SplitFace => vec![SelInput::new("Faces to split", FACES, true), SelInput::new("Splitting tool", PLANES | FACES, false)],
+ _ => k.simple_inputs(),
}
}
@@ -202,15 +206,11 @@ pub fn start(_app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
"surface.patch" => Surf::Patch { continuity: 0 },
"surface.unstitch" => Surf::Unstitch,
"surface.reverse_normal" => Surf::ReverseNormal,
- "surface.offset" => Surf::Offset { distance: "2 mm".into(), chain: false },
"surface.ruled" => Surf::Ruled { distance: "10 mm".into(), mode: 0, angle: "5 deg".into(), flip: false, round: false },
- "surface.stitch" => Surf::Stitch { tolerance: String::new() },
- "surface.thicken" => Surf::Thicken { thickness: "2 mm".into(), symmetric: false, operation: 0 },
- "surface.extend" => Surf::Extend { distance: "10 mm".into() },
"surface.trim" => Surf::Trim { extend: false, stitch: false, direction: None },
"surface.untrim" => Surf::Untrim { holes: 0, outer: false, in_place: false },
"solid.split_face" => Surf::SplitFace,
- _ => return None,
+ _ => Surf::simple_start(id)?.0,
};
let i = inputs(&k);
Some((Kind::Surface(k), i))
@@ -221,80 +221,58 @@ pub fn rows(ui: &mut egui::Ui, k: &mut Surf) -> bool {
let mut enter = false;
match k {
Surf::Stitch { tolerance } => {
- form_row(ui, "Tolerance", |ui| {
- enter |= crate::ui_kit::hint_field(ui, tolerance, "tight");
- });
+ enter |= hint_row(ui, "Tolerance", tolerance, "tight");
}
Surf::Thicken { thickness, symmetric, operation } => {
- form_row(ui, "Thickness", |ui| {
- enter |= field(ui, thickness);
- });
+ enter |= expr_row(ui, "Thickness", thickness);
form_row(ui, "Direction", |ui| {
let mut dir = usize::from(*symmetric);
- ui_kit::segmented(ui, &mut dir, &["One Side", "Symmetric"]);
+ ui_kit::segmented(ui, &mut dir, &["One Side", "Symmetric"], Default::default());
*symmetric = dir == 1;
});
- form_row(ui, "Operation", |ui| {
- combo(ui, "th_op", &OP_LABELS, operation);
- });
+ choice_row(ui, "Operation", "th_op", operation, &OP_LABELS);
}
Surf::Extend { distance } => {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, distance);
- });
+ enter |= expr_row(ui, "Distance", distance);
}
Surf::Revolve { angle, symmetric, .. } => {
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
+ enter |= expr_row(ui, "Angle", angle);
form_row(ui, "Direction", |ui| {
let mut dir = usize::from(*symmetric);
- ui_kit::segmented(ui, &mut dir, &["One Side", "Symmetric"]);
+ ui_kit::segmented(ui, &mut dir, &["One Side", "Symmetric"], Default::default());
*symmetric = dir == 1;
});
}
Surf::Offset { distance, chain } => {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, distance);
- });
+ enter |= expr_row(ui, "Distance", distance);
ui_kit::options(ui, "offset_options", &mut [("Tangent chain", chain)]);
}
Surf::Ruled { distance, mode, angle, flip, round } => {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, distance);
- });
- form_row(ui, "Type", |ui| {
- combo(ui, "ru_mode", &RULED_MODES.map(|(label, _)| label), mode);
- });
+ enter |= expr_row(ui, "Distance", distance);
+ choice_row(ui, "Type", "ru_mode", mode, &RULED_MODES.map(|(label, _)| label));
if RULED_MODES.get(*mode).is_some_and(|(_, m)| *m == "angle") {
- form_row(ui, "Angle", |ui| {
- enter |= field(ui, angle);
- });
+ enter |= expr_row(ui, "Angle", angle);
}
form_row(ui, "Corners", |ui| {
let mut corner = usize::from(*round);
- ui_kit::segmented(ui, &mut corner, &["Mitre", "Round"]);
+ ui_kit::segmented(ui, &mut corner, &["Mitre", "Round"], Default::default());
*round = corner == 1;
});
ui_kit::options(ui, "ruled_options", &mut [("Flip", flip)]);
}
Surf::Extrude { distance, direction } => {
- form_row(ui, "Distance", |ui| {
- enter |= field(ui, distance);
- });
+ enter |= expr_row(ui, "Distance", distance);
form_row(ui, "Direction", |ui| {
- ui_kit::segmented(ui, direction, &EXTRUDE_SIDES.map(|(label, _)| label));
+ ui_kit::segmented(ui, direction, &EXTRUDE_SIDES.map(|(label, _)| label), Default::default());
});
}
Surf::Untrim { holes, outer, in_place } => {
- form_row(ui, "Holes", |ui| {
- combo(ui, "ut_holes", &UNTRIM_HOLES, holes);
- });
+ choice_row(ui, "Holes", "ut_holes", holes, &UNTRIM_HOLES);
ui_kit::options(ui, "untrim_options", &mut [("Restore outer boundary", outer), ("In place (surfaces)", in_place)]);
}
Surf::Patch { continuity } => {
form_row(ui, "Continuity", |ui| {
- ui_kit::segmented(ui, continuity, &PATCH_CONTINUITY.map(|(label, _)| label));
+ ui_kit::segmented(ui, continuity, &PATCH_CONTINUITY.map(|(label, _)| label), Default::default());
});
}
Surf::Blend { continuity, bulge, stitch } => {
@@ -316,7 +294,7 @@ pub fn rows(ui: &mut egui::Ui, k: &mut Surf) -> bool {
}
Surf::Boundary { continuity, join } => {
form_row(ui, "Continuity", |ui| {
- ui_kit::segmented(ui, continuity, &PATCH_CONTINUITY.map(|(label, _)| label));
+ ui_kit::segmented(ui, continuity, &PATCH_CONTINUITY.map(|(label, _)| label), Default::default());
});
form_row(ui, "Operation", |ui| {
let mut op = usize::from(*join);
@@ -334,18 +312,6 @@ pub fn rows(ui: &mut egui::Ui, k: &mut Surf) -> bool {
enter
}
-fn items(inputs: &[SelInput], i: usize) -> &[Sel] {
- inputs.get(i).map(|x| x.items.as_slice()).unwrap_or(&[])
-}
-
-fn pt(v: Vec3) -> Value {
- json!([v.x, v.y, v.z])
-}
-
-fn bodies(inputs: &[SelInput], i: usize) -> Vec<String> {
- items(inputs, i).iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect()
-}
-
/// One body and points on the picked faces of it (none: a whole body picked).
fn body_and_faces(picks: &[Sel]) -> Result<(String, Vec<Value>), String> {
let body_of = |x: &Sel| match x {
@@ -356,7 +322,7 @@ fn body_and_faces(picks: &[Sel]) -> Result<(String, Vec<Value>), String> {
if picks.iter().any(|x| body_of(x).as_ref() != Some(&body)) {
return Err("pick faces of one body".into());
}
- let faces = picks.iter().filter_map(|x| if let Sel::Face { point, .. } = x { Some(pt(*point)) } else { None }).collect();
+ let faces = picks.face_points().into_iter().map(pt).collect();
Ok((body, faces))
}
@@ -373,9 +339,8 @@ fn body_and_edges(picks: &[Sel]) -> Result<(String, Vec<Value>), String> {
/// The sketch, profiles and curves of a surface builder's picks (all in one sketch).
fn sheet_picks(app: &SolveApp, picks: &[Sel]) -> Result<Value, String> {
- let profiles: Vec<(u64, usize)> =
- picks.iter().filter_map(|x| if let Sel::Profile { sketch, index } = x { Some((*sketch, *index)) } else { None }).collect();
- let curves: Vec<String> = picks.iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect();
+ let profiles: Vec<(u64, usize)> = picks.profiles();
+ let curves: Vec<String> = picks.curve_ids();
let sketch = match profiles.first() {
Some((sk, _)) => *sk,
None => crate::dialogs::curves_sketch(app, &curves, None).ok_or("the curves must be in one sketch")?,
@@ -538,8 +503,7 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
need(0, "profiles or curves to sweep")?;
need(1, "the path")?;
let mut p = sheet_picks(app, items(inputs, 0))?;
- let path: Vec<String> =
- items(inputs, 1).iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect();
+ let path: Vec<String> = items(inputs, 1).curve_ids();
p["path_sketch"] =
json!(crate::dialogs::curves_sketch(app, &path, p["sketch"].as_u64()).ok_or("the path curves must be in one other sketch")?);
p["path"] = json!(path);
@@ -600,8 +564,7 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
let word = PATCH_CONTINUITY.get(*continuity).map_or("g0", |(_, w)| *w);
let across = items(inputs, 1);
let picks = items(inputs, 0);
- let sketch_ids: Vec<String> =
- picks.iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect();
+ let sketch_ids: Vec<String> = picks.curve_ids();
// Two to four sketch curves of one sketch and nothing across: the loop patch.
let looped = across.is_empty() && !*join && sketch_ids.len() == picks.len() && (2..=4).contains(&picks.len());
match looped.then(|| crate::dialogs::curves_sketch(app, &sketch_ids, None)).flatten() {
@@ -639,14 +602,12 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
}
Surf::Patch { continuity } => {
need(0, "a boundary (sketch profiles or a loop of edges)")?;
- let profiles: Vec<(u64, usize)> =
- items(inputs, 0).iter().filter_map(|x| if let Sel::Profile { sketch, index } = x { Some((*sketch, *index)) } else { None }).collect();
+ let profiles: Vec<(u64, usize)> = items(inputs, 0).profiles();
if let Some((sk, _)) = profiles.first() {
let idx: Vec<usize> = profiles.iter().filter(|(s, _)| s == sk).map(|(_, i)| *i).collect();
("surface.patch", json!({"sketch": sk, "profiles": idx}))
} else {
- let edges: Vec<Value> =
- items(inputs, 0).iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(pt(*point)) } else { None }).collect();
+ let edges: Vec<Value> = items(inputs, 0).edge_points().into_iter().map(pt).collect();
let body = items(inputs, 0).iter().find_map(|x| if let Sel::Edge { body, .. } = x { Some(body.clone()) } else { None });
let mut p = json!({"edges": edges, "body": body});
if let Some((_, word)) = PATCH_CONTINUITY.get(*continuity).filter(|_| *continuity > 0) {
@@ -665,13 +626,13 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
("surface.patch", p)
}
}
- Surf::Offset { distance, chain } => {
+ Surf::Offset { chain, .. } => {
need(0, "the faces to offset")?;
let (body, faces) = body_and_faces(items(inputs, 0))?;
if faces.is_empty() {
return Err("pick faces to offset".into());
}
- let mut p = json!({"body": body, "faces": faces, "distance": distance});
+ let mut p = json!({"body": body, "faces": faces});
if *chain {
p["chain"] = json!(true);
}
@@ -718,31 +679,25 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
}
Surf::Stitch { tolerance } => {
need(0, "the surfaces to stitch")?;
- let mut p = json!({ "bodies": bodies(inputs, 0) });
- if !tolerance.trim().is_empty() {
- p["tolerance"] = json!(tolerance);
- }
+ let mut p = json!({ "bodies": items(inputs, 0).body_names() });
+ put(&mut p, &[("tolerance", tolerance)]);
("surface.stitch", p)
}
- Surf::Thicken { thickness, symmetric, operation } => {
+ Surf::Thicken { .. } => {
need(0, "the surfaces to thicken")?;
- (
- "surface.thicken",
- json!({"bodies": bodies(inputs, 0), "thickness": thickness, "symmetric": symmetric, "operation": OPS.get(*operation).copied().unwrap_or("new")}),
- )
+ ("surface.thicken", json!({"bodies": items(inputs, 0).body_names()}))
}
- Surf::Extend { distance } => {
+ Surf::Extend { .. } => {
need(0, "the edges to extend")?;
let body =
items(inputs, 0).iter().find_map(|x| if let Sel::Edge { body, .. } = x { Some(body.clone()) } else { None }).unwrap_or_default();
- let edges: Vec<Value> =
- items(inputs, 0).iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(pt(*point)) } else { None }).collect();
- ("surface.extend", json!({"body": body, "edges": edges, "distance": distance}))
+ let edges: Vec<Value> = items(inputs, 0).edge_points().into_iter().map(pt).collect();
+ ("surface.extend", json!({"body": body, "edges": edges}))
}
Surf::Trim { extend, stitch, direction } => {
need(0, "the surface to trim")?;
need(2, "what to keep (points on it)")?;
- let body = bodies(inputs, 0).into_iter().next().unwrap_or_default();
+ let body = items(inputs, 0).body_names().into_iter().next().unwrap_or_default();
// One point keeps its side, several the regions they pick.
let points = |i: usize| -> Option<Value> {
let pts: Vec<Value> =
@@ -754,7 +709,7 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
}
};
let mut p = json!({"body": body, "keep": points(2).ok_or("pick what to keep")?});
- if let Some(other) = bodies(inputs, 3).into_iter().next() {
+ if let Some(other) = items(inputs, 3).body_names().into_iter().next() {
need(4, "what to keep of the other surface")?;
p["with"] = json!(other);
p["keep_with"] = points(4).ok_or("pick what to keep of the other surface")?;
@@ -797,8 +752,7 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
match holes {
0 => p["holes"] = json!("all"),
1 => {
- let picked: Vec<Value> =
- items(inputs, 1).iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(pt(*point)) } else { None }).collect();
+ let picked: Vec<Value> = items(inputs, 1).edge_points().into_iter().map(pt).collect();
if picked.is_empty() {
return Err("pick edges of the holes to remove".into());
}
@@ -817,8 +771,7 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
Surf::SplitFace => {
need(0, "the faces to split")?;
need(1, "the splitting tool")?;
- let faces: Vec<Value> =
- items(inputs, 0).iter().filter_map(|x| if let Sel::Face { point, .. } = x { Some(pt(*point)) } else { None }).collect();
+ let faces: Vec<Value> = items(inputs, 0).face_points().into_iter().map(pt).collect();
let body = items(inputs, 0).iter().find_map(|x| if let Sel::Face { body, .. } = x { Some(body.clone()) } else { None });
let (key, t) = tool(app, items(inputs, 1).first())?;
let mut p = json!({"faces": faces, "body": body});
@@ -826,6 +779,7 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
("solid.split_face", p)
}
};
+ k.fill_simple_params(&mut p);
if let Value::Object(m) = &mut p {
// A ruled surface's kept direction is used above, or dropped with its mode.
for (k, v) in extra.iter().filter(|(k, _)| !(cmd == "surface.ruled" && k.as_str() == "direction")) {
@@ -993,10 +947,9 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind, frame: &Mat) -> Option<(K
}
return Some((Kind::Surface(k), ins, extra));
}
- FeatureKind::SurfaceOffset { faces, distance, chain, .. } => (
- Surf::Offset { distance: distance.to_string(), chain: *chain },
- vec![faces.iter().filter_map(|p| crate::dialogs::face_sel(s, p.0)).collect()],
- ),
+ FeatureKind::SurfaceOffset { faces, .. } => {
+ (Surf::simple_restore(kind)?, vec![faces.iter().filter_map(|p| crate::dialogs::face_sel(s, p.0)).collect()])
+ }
FeatureKind::SurfaceRuled { edges, distance, mode, angle, direction, flip, corners, face, .. } => {
let k = Surf::Ruled {
distance: distance.to_string(),
@@ -1029,15 +982,11 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind, frame: &Mat) -> Option<(K
};
(if matches!(kind, FeatureKind::Unstitch { .. }) { Surf::Unstitch } else { Surf::ReverseNormal }, vec![sels])
}
- FeatureKind::Stitch { bodies, tolerance } => (
- Surf::Stitch { tolerance: if tolerance.trim() == "0" { String::new() } else { tolerance.to_string() } },
- vec![bodies.iter().map(|n| Sel::Body { name: n.to_string() }).collect()],
- ),
- FeatureKind::Thicken { bodies, thickness, symmetric, operation, .. } => (
- Surf::Thicken { thickness: thickness.to_string(), symmetric: *symmetric, operation: op_index(operation) },
- vec![bodies.iter().map(|n| Sel::Body { name: n.to_string() }).collect()],
- ),
- FeatureKind::SurfaceExtend { edges, distance, mode, up_to, neighbours, .. } => {
+ FeatureKind::Stitch { bodies, .. } => (Surf::simple_restore(kind)?, vec![bodies.iter().map(|n| Sel::Body { name: n.to_string() }).collect()]),
+ FeatureKind::Thicken { bodies, .. } => {
+ (Surf::simple_restore(kind)?, vec![bodies.iter().map(|n| Sel::Body { name: n.to_string() }).collect()])
+ }
+ FeatureKind::SurfaceExtend { edges, mode, up_to, neighbours, .. } => {
// The dialog edits the edges and the distance; the rest is kept as it was.
let mut extra = Map::new();
if !mode.is_natural() {
@@ -1061,7 +1010,7 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind, frame: &Mat) -> Option<(K
}
_ => {}
}
- let k = Surf::Extend { distance: distance.to_string() };
+ let k = Surf::simple_restore(kind)?;
let mut ins = inputs(&k);
if let Some(inp) = ins.first_mut() {
inp.items = edges.iter().filter_map(edge).collect();
diff --git a/crates/ui-egui/src/dialogs_sweep.rs b/crates/ui-egui/src/dialogs_sweep.rs
index c05e4a9523..05c18c48b5 100644
--- a/crates/ui-egui/src/dialogs_sweep.rs
+++ b/crates/ui-egui/src/dialogs_sweep.rs
@@ -2,13 +2,14 @@
//! twist over the path's length, the profile's scale at the end, and guide rails with how they
//! reshape the profile. Loft and Surface Loft take the same guide rails (#201).
+use crate::selection::SelectionExt as _;
+use crate::ui_kit::{choice_row, expr_row};
use serde_json::{Value, json};
use solidcraft_engine::Sel;
use solidcraft_engine::doc::{Expr, Mat, RailFit, SweepOrientation, SweepRail};
use solidcraft_engine::geom::Vec3;
use crate::SolveApp;
-use crate::dialogs::{combo, field, form_row};
use crate::selection::{AXES, CURVES, EDGES, SelInput};
/// The orientation choices, in combo order: perpendicular, parallel, a direction.
@@ -107,17 +108,11 @@ pub fn rows(ui: &mut egui::Ui, o: &mut SweepOpts, id: &str) -> bool {
/// feature's own rows (such as its operation) stay above the section.
pub fn rows_with(ui: &mut egui::Ui, o: &mut SweepOpts, id: &str, between: impl FnOnce(&mut egui::Ui)) -> bool {
let mut enter = false;
- form_row(ui, "Orientation", |ui| {
- combo(ui, &format!("{id}_orient"), &ORIENTATIONS, &mut o.orientation);
- });
+ choice_row(ui, "Orientation", &format!("{id}_orient"), &mut o.orientation, &ORIENTATIONS);
between(ui);
crate::ui_kit::section(ui, id, "Advanced", false, |ui| {
- form_row(ui, "Twist", |ui| {
- enter |= field(ui, &mut o.twist);
- });
- form_row(ui, "End Scale", |ui| {
- enter |= field(ui, &mut o.scale);
- });
+ enter |= expr_row(ui, "Twist", &mut o.twist);
+ enter |= expr_row(ui, "End Scale", &mut o.scale);
rail_fit_row(ui, id, &mut o.rail_fit);
});
enter
@@ -125,9 +120,7 @@ pub fn rows_with(ui: &mut egui::Ui, o: &mut SweepOpts, id: &str, between: impl F
/// The Rail Fit row: `fit` an index into [`RAIL_FITS`].
pub fn rail_fit_row(ui: &mut egui::Ui, id: &str, fit: &mut usize) {
- form_row(ui, "Rail Fit", |ui| {
- combo(ui, &format!("{id}_rail_fit"), &RAIL_FITS, fit);
- });
+ choice_row(ui, "Rail Fit", &format!("{id}_rail_fit"), fit, &RAIL_FITS);
}
/// A stored rail fit as an index into [`RAIL_FITS`].
@@ -140,7 +133,7 @@ pub fn rail_fit_index(fit: RailFit) -> usize {
pub fn rail_params(app: &SolveApp, fit: usize, rails: [&[Sel]; 2], p: &mut Value) -> Result<bool, String> {
let mut given = Vec::new();
for sels in rails {
- let curves: Vec<String> = sels.iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect();
+ let curves: Vec<String> = sels.curve_ids();
if curves.is_empty() {
continue;
}
diff --git a/crates/ui-egui/src/dialogs_thread.rs b/crates/ui-egui/src/dialogs_thread.rs
index 8aa166602d..f765c4c3c3 100644
--- a/crates/ui-egui/src/dialogs_thread.rs
+++ b/crates/ui-egui/src/dialogs_thread.rs
@@ -5,6 +5,7 @@ use solidcraft_engine::doc::{metric_thread_sizes, parse_metric_thread};
use crate::dialogs::{combo, form_row};
use crate::i18n::tr;
+use crate::ui_kit::text_row;
/// Common pitch presets, not an exhaustive catalogue of standard diameter/pitch pairs.
/// The coarse and current pitches are included separately; custom pairs remain editable.
@@ -84,7 +85,7 @@ pub(crate) fn rows(ui: &mut egui::Ui, designation: &mut String, suggested: &mut
});
});
- let (enter, changed) = form_row(ui, "Designation", |ui| crate::ui_kit::text_field(ui, designation, tr("fits the face, e.g. M8")));
+ let (enter, changed) = text_row(ui, "Designation", designation, tr("fits the face, e.g. M8"));
if let Some(at) = crate::scenario::handle_at("dialog:Designation") {
crate::scenario::publish_handle("dialog:thread_size", at);
}
diff --git a/crates/ui-egui/src/dialogs_trace.rs b/crates/ui-egui/src/dialogs_trace.rs
index ef96cb3e29..c03457a94a 100644
--- a/crates/ui-egui/src/dialogs_trace.rs
+++ b/crates/ui-egui/src/dialogs_trace.rs
@@ -2,6 +2,7 @@
//! two values or a motion study plays. The path is computed on a scratch copy (`motion.trace`)
//! and drawn in the viewport; OK keeps it as a 3D sketch spline (`motion.trace.keep`).
+use crate::ui_kit::{choice_row, expr_row, text_row};
use egui::{Pos2, RichText, Stroke};
use serde_json::{Value, json};
use solidcraft_engine::doc::{IDENTITY, Mat, apply_point, mat_inverse, mat_mul};
@@ -9,7 +10,7 @@ use solidcraft_engine::geom::Vec3;
use solidcraft_engine::{Sel, Session};
use super::{Hover, body_of, capital, movable, num, pt, sel_items, snap_of};
-use crate::dialogs::{combo, field, form_row};
+use crate::dialogs::{combo, form_row};
use crate::selection::SelInput;
use crate::theme::Tokens;
use crate::viewport::Proj;
@@ -97,14 +98,15 @@ pub fn picked_point(s: &Session, inputs: &[SelInput]) -> Result<Value, String> {
}
/// Where and why the motion stopped short, ending the trace (`None`: it went all the way).
-fn stop_text(v: &Value) -> Option<String> {
+pub(crate) fn stop_text(v: &Value) -> Option<String> {
let at = v["stopped_at"].as_u64()?.to_string();
- let name = |x: &Value| x.as_str().unwrap_or_default().to_string();
+ // The values come from the engine: a missing key is an empty name, never a panic.
+ let name = |m: &serde_json::Map<String, Value>, key: &str| m.get(key).and_then(Value::as_str).unwrap_or_default().to_string();
if let Some(l) = v["stopped_by_loop"].as_object() {
- return Some(crate::i18n::format("trace.stopped_by_loop", &[("sample", &at), ("joint", &name(&l["joint"]))]));
+ return Some(crate::i18n::format("trace.stopped_by_loop", &[("sample", &at), ("joint", &name(l, "joint"))]));
}
let c = v["stopped_by_contact"].as_object()?;
- Some(crate::i18n::format("trace.stopped_by_contact", &[("sample", &at), ("a", &name(&c["a"])), ("b", &name(&c["b"]))]))
+ Some(crate::i18n::format("trace.stopped_by_contact", &[("sample", &at), ("a", &name(c, "a")), ("b", &name(c, "b"))]))
}
/// The dialog's rows; true when Enter was pressed in a value.
@@ -122,9 +124,7 @@ pub fn rows(app: &mut crate::SolveApp, ui: &mut egui::Ui, f: &mut TraceForm, inp
});
}
if f.by_study {
- form_row(ui, "Study", |ui| {
- combo(ui, "tr_study", &studies, &mut f.study);
- });
+ choice_row(ui, "Study", "tr_study", &mut f.study, &studies);
} else {
let list = movable(s);
if list.is_empty() {
@@ -135,9 +135,7 @@ pub fn rows(app: &mut crate::SolveApp, ui: &mut egui::Ui, f: &mut TraceForm, inp
}
let labels: Vec<&str> = list.iter().filter_map(|i| s.doc.assembly.joints.get(*i)).map(|j| j.name.as_str()).collect();
let mut pos = list.iter().position(|i| *i == f.joint).unwrap_or(0);
- form_row(ui, "Joint", |ui| {
- combo(ui, "tr_joint", &labels, &mut pos);
- });
+ choice_row(ui, "Joint", "tr_joint", &mut pos, &labels);
let joint = list.get(pos).copied().unwrap_or(0);
let dofs = s.doc.assembly.joints.get(joint).map(|j| j.kind.dofs()).unwrap_or(&[]);
let mut index = if joint == f.joint { f.index.min(dofs.len().saturating_sub(1)) } else { 0 };
@@ -152,20 +150,14 @@ pub fn rows(app: &mut crate::SolveApp, ui: &mut egui::Ui, f: &mut TraceForm, inp
(f.joint, f.index) = (joint, index);
(f.from, f.to) = range(s, joint, index);
}
- form_row(ui, "From", |ui| {
- enter |= field(ui, &mut f.from);
- });
- form_row(ui, "To", |ui| {
- enter |= field(ui, &mut f.to);
- });
+ enter |= expr_row(ui, "From", &mut f.from);
+ enter |= expr_row(ui, "To", &mut f.to);
}
let default = match s.doc.assembly.studies.get(f.study).filter(|_| f.by_study) {
Some(m) => (u64::from(m.steps) + 1).clamp(2, 500),
None => 100,
};
- form_row(ui, "Samples", |ui| {
- enter |= crate::ui_kit::text_field(ui, &mut f.samples, &default.to_string()).0;
- });
+ enter |= text_row(ui, "Samples", &mut f.samples, &default.to_string()).0;
// The preview, traced again when what it traces (or the design) changes.
let p = params(s, f, inputs);
let key = format!("{}:{p:?}", s.revision);
@@ -201,3 +193,38 @@ pub fn overlay(painter: &egui::Painter, proj: &Proj, f: &TraceForm) {
}
painter.add(egui::Shape::line(pts, Stroke::new(2.0, t.preview_sketch)));
}
+
+#[cfg(test)]
+mod shared_status_baseline_tests {
+ use super::*;
+
+ #[test]
+ fn stop_text_tolerates_missing_keys() {
+ for v in [
+ json!({"stopped_at":1,"stopped_by_contact":{}}),
+ json!({"stopped_at":1,"stopped_by_contact":{"a":"A"}}),
+ json!({"stopped_at":1,"stopped_by_loop":{}}),
+ ] {
+ assert!(stop_text(&v).is_some());
+ }
+ }
+
+ #[test]
+ fn stop_text_preserves_missing_values_and_loop_precedence() {
+ for v in [json!({}), json!({"stopped_at":-1}), json!({"stopped_at":2}), json!({"stopped_at":2.5,"stopped_by_loop":{}})] {
+ assert_eq!(stop_text(&v), None);
+ }
+ assert_eq!(
+ stop_text(&json!({"stopped_at":3,"stopped_by_loop":{"joint":"Hinge"},"stopped_by_contact":{"a":"A","b":"B"}})),
+ Some(crate::i18n::format("trace.stopped_by_loop", &[("sample", "3"), ("joint", "Hinge")]))
+ );
+ assert_eq!(
+ stop_text(&json!({"stopped_at":4,"stopped_by_contact":{"a":"A","b":"B"}})),
+ Some(crate::i18n::format("trace.stopped_by_contact", &[("sample", "4"), ("a", "A"), ("b", "B")]))
+ );
+ assert_eq!(
+ stop_text(&json!({"stopped_at":0,"stopped_by_contact":{"a":1,"b":null}})),
+ Some(crate::i18n::format("trace.stopped_by_contact", &[("sample", "0"), ("a", ""), ("b", "")]))
+ );
+ }
+}
diff --git a/crates/ui-egui/src/dialogs_view_dxf.rs b/crates/ui-egui/src/dialogs_view_dxf.rs
index 32aad8ba0b..1ad37d93a2 100644
--- a/crates/ui-egui/src/dialogs_view_dxf.rs
+++ b/crates/ui-egui/src/dialogs_view_dxf.rs
@@ -12,7 +12,7 @@ pub fn start(app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
}
pub fn rows(app: &SolveApp, ui: &mut egui::Ui, dashed: &mut bool, tolerance: &mut f64) {
- crate::ui_kit::note(ui, "hidden", app.tr_label("Hidden edges"));
+ crate::ui_kit::text(ui, app.tr_label("Hidden edges"), crate::ui_kit::Text::Note("hidden"));
for (value, key, label) in [(false, "omit", "Do not export hidden edges"), (true, "dashed", "Export hidden edges as dashed lines")] {
let r = crate::ui_kit::list_picker(ui, key, app.tr_label(label), *dashed == value);
crate::scenario::publish_handle(&format!("dialog:dxf:{key}"), r.rect.center());
@@ -24,12 +24,12 @@ pub fn rows(app: &SolveApp, ui: &mut egui::Ui, dashed: &mut bool, tolerance: &mu
let r = crate::ui_kit::number_field(ui, tolerance, 0.0001..=1.0, 0.001, " mm");
crate::scenario::publish_handle("dialog:dxf:tolerance", r.rect.center());
});
- crate::ui_kit::note(
+ crate::ui_kit::text(
ui,
- "projection",
app.tr_label(if app.cam.fov > 0.0 { "Current perspective view" } else { "Current orthographic view (1:1 mm)" }),
+ crate::ui_kit::Text::Note("projection"),
);
- crate::ui_kit::note(ui, "tolerance", app.tr_label("dxf.tolerance_help"));
+ crate::ui_kit::text(ui, app.tr_label("dxf.tolerance_help"), crate::ui_kit::Text::Note("tolerance"));
}
pub fn run(app: &mut SolveApp, dashed: bool, tolerance: f64) -> Result<(), String> {
diff --git a/crates/ui-egui/src/dim_view.rs b/crates/ui-egui/src/dim_view.rs
index 25c1a0b3da..2b0421c430 100644
--- a/crates/ui-egui/src/dim_view.rs
+++ b/crates/ui-egui/src/dim_view.rs
@@ -699,7 +699,7 @@ fn edit_box(app: &mut SolveApp, ctx: &egui::Context) {
egui::Frame::popup(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::inline_text(ui, &crate::i18n::format("dialog.dimension_name", &[("name", &e.param)]))
+ crate::ui_kit::text(ui, &crate::i18n::format("dialog.dimension_name", &[("name", &e.param)]), crate::ui_kit::Text::Inline)
.on_hover_text(crate::i18n::tr("dialog.dimension_insert_hint"));
let r = crate::ui_kit::cell_editor(ui, id, &mut e.expr, "", false);
crate::theme::TabAccent::number_focus(ui, &r);
@@ -714,7 +714,7 @@ fn edit_box(app: &mut SolveApp, ctx: &egui::Context) {
live.typed |= r.changed() || completed;
}
if let Some(error) = e.draft.as_ref().and_then(|d| d.error.as_ref()) {
- crate::ui_kit::text_block(ui, "dimension_error", error, true);
+ crate::ui_kit::text(ui, error, crate::ui_kit::Text::Report("dimension_error", true));
}
if e.fresh == FRESH {
// The whole value is selected, so typing replaces it.
diff --git a/crates/ui-egui/src/documents.rs b/crates/ui-egui/src/documents.rs
index 343c8ea013..9a1ebbdba4 100644
--- a/crates/ui-egui/src/documents.rs
+++ b/crates/ui-egui/src/documents.rs
@@ -393,8 +393,7 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {
let tr = Rect::from_min_size(pos2(x, r.top() + 4.0), vec2(w - 2.0, r.height() - 8.0));
let active = !app.home.open && (i == app.docs.active || app.docs.slots.is_empty());
let resp = ui.interact(tr, ui.id().with(("doc_tab", i)), Sense::click_and_drag());
- crate::scenario::publish_handle(&format!("tab:design:{i}"), tr.center());
- crate::scenario::publish_rect(&format!("tab:design:{i}"), tr);
+ crate::scenario::publish_target(&format!("tab:design:{i}"), tr);
// The tabs are part of the title bar: dragging one moves the window, a double click
// maximizes it.
if app.custom_titlebar || app.integrated_titlebar {
@@ -421,8 +420,7 @@ pub fn tabs(app: &mut SolveApp, ui: &mut egui::Ui, r: Rect, x0: f32, x1: f32) {
let xr = Rect::from_center_size(pos2(tr.right() - 13.0, tr.center().y), vec2(16.0, 16.0));
let show_close = active || resp.hovered() || ui.rect_contains_pointer(tr);
let xresp = ui.interact(xr, ui.id().with(("doc_close", i)), if show_close { Sense::click() } else { Sense::hover() });
- crate::scenario::publish_handle(&format!("tab:close:{i}"), xr.center());
- crate::scenario::publish_rect(&format!("tab:close:{i}"), xr);
+ crate::scenario::publish_target(&format!("tab:close:{i}"), xr);
if show_close && (xresp.hovered() || xresp.has_focus()) {
ui.painter().rect_filled(xr, 3.0, t.app_bar_hover_strong);
}
@@ -583,7 +581,11 @@ pub fn prompt(app: &mut SolveApp, ctx: &egui::Context) {
Answer::Cancel => ui_kit::Action::Cancel,
})
.show(ctx, true, |ui| {
- ui_kit::text_block(ui, "unsaved", &crate::i18n::format("document.unsaved_changes", &[("name", &name_display)]), false);
+ ui_kit::text(
+ ui,
+ &crate::i18n::format("document.unsaved_changes", &[("name", &name_display)]),
+ ui_kit::Text::Report("unsaved", false),
+ );
});
answer = match action {
ui_kit::Action::Ok => Some(Answer::Save),
diff --git a/crates/ui-egui/src/file_load.rs b/crates/ui-egui/src/file_load.rs
index 92c445eeb5..d6cb9def93 100644
--- a/crates/ui-egui/src/file_load.rs
+++ b/crates/ui-egui/src/file_load.rs
@@ -936,7 +936,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
.placed(egui::Align2::CENTER_TOP, top)
.actions("", crate::i18n::tr("ui.cancel"), None)
.show(ctx, true, |ui| {
- ui_kit::text_block(ui, "name", &format!("{name}…"), false);
+ ui_kit::text(ui, &format!("{name}…"), ui_kit::Text::Report("name", false));
if let Some(preview) = r.preview.as_ref().filter(|_| !cancelled) {
let w = ui.available_width();
ui.image((preview.id(), egui::vec2(w, w * 200.0 / 320.0)));
@@ -944,7 +944,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
Some(built) => crate::i18n::format("file_load.built", &[("built", &built.to_string()), ("total", &total.to_string())]),
None => crate::i18n::tr("file_load.preview_note").to_string(),
};
- ui_kit::note(ui, "preview", &note);
+ ui_kit::text(ui, &note, ui_kit::Text::Note("preview"));
}
let status = if cancelled && export {
crate::i18n::tr_label("dxf.cancel_wait").to_string()
@@ -967,7 +967,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
};
ui.horizontal(|ui| {
ui.spinner();
- ui_kit::text_block(ui, "status", &status, false);
+ ui_kit::text(ui, &status, ui_kit::Text::Report("status", false));
});
// Always there, so the card keeps its height as the phases change.
let fraction = if cancelled {
diff --git a/crates/ui-egui/src/frame.rs b/crates/ui-egui/src/frame.rs
index dacd1d309c..85903515ea 100644
--- a/crates/ui-egui/src/frame.rs
+++ b/crates/ui-egui/src/frame.rs
@@ -1,23 +1,11 @@
-//! The one place windows are made. Every command dialog, panel and pop-up window comes from
-//! here, so they all shrink to their content within the same width limits (a test checks that no
-//! other file creates an `egui::Window`, and that every dialog stays within the limits).
-//!
-//! - [`docked`]: command dialogs and command panels, flush to the right edge of the viewport.
-//! - [`docked_on`]: the same, against either edge ([`Side`]), with [`dock_frame`] for its
-//! chrome. A dialog opened while the Sketch Palette holds the right edge takes the left.
-//! - [`window`]: floating windows (Preferences, Parameters, prompts…), centred by default.
-//! - [`right_aligned`]: right-align a row's last items without widening the window (a
-//! right-to-left layout would stretch it to its maximum width).
-//! - [`heading`]: a panel's title row and its section headings, each on a band darker than the
-//! panel ([`Level`]), so every dialog marks them the same way.
+//! Shared dock dragging, bounded anchors and tokenised surfaces for `ui_kit::Panel`,
+//! plus bounded floating windows for BOM, Messages and 3D mouse calibration.
use egui::{Align2, Pos2, Ui, WidgetText, vec2};
/// Width limits of a docked command dialog.
pub const DIALOG_MIN_W: f32 = 260.0;
pub const DIALOG_MAX_W: f32 = 380.0;
-/// Docked dialogs holding a table (motion study, configurations, exploded views).
-pub const DIALOG_WIDE_MAX_W: f32 = 560.0;
/// Floating windows: prompts and panels, and those holding a table (Parameters, Keyboard
/// Shortcuts).
pub const WINDOW_MAX_W: f32 = 460.0;
@@ -63,35 +51,6 @@ pub fn dock_frame(ctx: &egui::Context, side: Side) -> egui::Frame {
.shadow(egui::Shadow { offset: [shadow_x, 2], blur: 8, spread: 0, color: egui::Color32::from_black_alpha(40) })
}
-/// A command dialog docked at `anchor` (its top right corner), shrink-wrapped to its content.
-pub fn docked<'a>(title: impl Into<WidgetText>, id: egui::Id, anchor: Pos2, max_height: f32, width: Width) -> egui::Window<'a> {
- docked_on(title, id, anchor, max_height, width, Side::Right)
-}
-
-/// A command dialog docked against `side` at `anchor` (its top corner on that side),
-/// shrink-wrapped to its content.
-pub fn docked_on<'a>(title: impl Into<WidgetText>, id: egui::Id, anchor: Pos2, max_height: f32, width: Width, side: Side) -> egui::Window<'a> {
- let max = match width {
- Width::Normal => DIALOG_MAX_W,
- Width::Wide => DIALOG_WIDE_MAX_W,
- };
- let pivot = match side {
- Side::Right => Align2::RIGHT_TOP,
- Side::Left => Align2::LEFT_TOP,
- };
- egui::Window::new(title)
- .enabled(!crate::issue_report::cad_input_blocked())
- .id(id)
- .title_bar(false)
- .pivot(pivot)
- .fixed_pos(anchor)
- .constrain(false)
- .auto_sized()
- .collapsible(false)
- .max_width(max)
- .max_height(max_height.max(120.0))
-}
-
/// 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 {
@@ -165,80 +124,11 @@ pub fn window<'a>(ctx: &egui::Context, title: impl Into<WidgetText>, width: Widt
.max_width(max)
}
-/// Add a button drawn with its own outline (`Button::stroke`) of `width`, keeping the same size
-/// in every state (#1335). egui sizes a button's padding as the spacing minus the *theme's*
-/// outline width for the state (none while idle, 1 px hovered), which keeps a themed button's
-/// size steady, but a button with its own outline then lost a pixel of padding each side on
-/// hover: it shrank, and the panel around it with it.
-pub fn add_outlined(ui: &mut Ui, button: egui::Button<'_>, width: f32) -> egui::Response {
- ui.scope(|ui| {
- let w = &mut ui.visuals_mut().widgets;
- for state in [&mut w.inactive, &mut w.hovered, &mut w.active, &mut w.open] {
- state.bg_stroke.width = width;
- }
- ui.add(button)
- })
- .inner
-}
-
/// 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())
}
-/// Heading levels inside a panel: its title, and the sections below it.
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-pub enum Level {
- /// The panel's title row (`Tokens::heading_bg`).
- Title,
- /// A section heading (`Tokens::subheading_bg`).
- Section,
-}
-
-/// Horizontal inner margin of a heading band, on each side.
-pub const HEADING_MARGIN: f32 = 4.0;
-
-/// A heading row drawn on a band `width` wide (a content width, so the band never widens the
-/// window); `add` lays out the row left to right in `width - 2 * HEADING_MARGIN`.
-pub fn heading<R>(ui: &mut Ui, level: Level, width: f32, add: impl FnOnce(&mut Ui) -> R) -> R {
- let t = crate::theme::Tokens::get();
- let fill = match level {
- Level::Title => t.heading_bg,
- Level::Section => t.subheading_bg,
- };
- let inner = (width - 2.0 * HEADING_MARGIN).max(0.0);
- egui::Frame::new()
- .fill(fill)
- .corner_radius(3)
- .inner_margin(egui::Margin::symmetric(HEADING_MARGIN as i8, 1))
- .show(ui, |ui| {
- ui.set_width(inner);
- ui.horizontal(add).inner
- })
- .inner
-}
-
-/// The width a window's content had last frame (at least `min`), for laying out rows that end at
-/// the right edge.
-pub fn content_width(ui: &Ui, key: egui::Id, min: f32) -> f32 {
- ui.ctx().data(|d| d.get_temp::<f32>(key)).unwrap_or(min).max(min)
-}
-
-/// Remember the content width for next frame (call at the end of the window's content).
-pub fn remember_width(ui: &Ui, key: egui::Id) {
- let w = ui.min_rect().width();
- ui.ctx().data_mut(|d| d.insert_temp(key, w));
-}
-
-/// In a horizontal row: push what `add` draws (`width` wide) to the right edge of a content
-/// `total` wide, without making the row any wider than that.
-pub fn right_aligned<R>(ui: &mut Ui, total: f32, width: f32, add: impl FnOnce(&mut Ui) -> R) -> R {
- let used = ui.min_rect().width();
- let gap = (total - used - width - ui.spacing().item_spacing.x).max(0.0);
- ui.add_space(gap);
- add(ui)
-}
-
/// Shared rounded surface for floating shell cards.
pub(crate) fn shell_card(fill: egui::Color32) -> egui::Frame {
let t = crate::theme::Tokens::get();
@@ -337,7 +227,7 @@ mod tests {
/// Windows are made in this file only, so none can skip the width limits.
#[test]
- fn windows_come_from_the_frame_helper() {
+ 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() {
@@ -349,6 +239,6 @@ mod tests {
}
}
}
- assert!(bad.is_empty(), "use crate::frame::{{docked, window}} instead of egui::Window::new in {bad:?}");
+ 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 9d4c73db20..87862a1d55 100644
--- a/crates/ui-egui/src/help.rs
+++ b/crates/ui-egui/src/help.rs
@@ -102,36 +102,38 @@ fn about(app: &mut SolveApp, ctx: &egui::Context) {
.cards(2.0)
.actions("", "Close", None)
.show(ctx, true, |ui| {
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "version",
&crate::i18n::format("help.build", &[("version", VERSION), ("commit", COMMIT), ("date", BUILD_DATE)]),
- false,
+ ui_kit::Text::Report("version", false),
);
- ui_kit::note(ui, "description", crate::i18n::tr_label("Open-source parametric 3D CAD in Rust. Licensed MIT OR Apache-2.0."));
- let copy = ui_kit::secondary_button(ui, crate::i18n::tr_label("Copy diagnostic information"));
- crate::scenario::publish_rect("about:copy_diagnostics", copy.rect);
- crate::scenario::publish_handle("about:copy_diagnostics", copy.rect.center());
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("Open-source parametric 3D CAD in Rust. Licensed MIT OR Apache-2.0."),
+ ui_kit::Text::Note("description"),
+ );
+ let copy = ui_kit::button(ui, crate::i18n::tr_label("Copy diagnostic information"), ui_kit::Button::Normal);
+ crate::scenario::publish_target("about:copy_diagnostics", copy.rect);
if copy.clicked() {
ctx.copy_text(diagnostics(app));
}
egui::ScrollArea::vertical().max_height(crate::theme::Tokens::get().control_height * 15.0).show(ui, |ui| {
ui_kit::section(ui, "attributions", crate::i18n::tr("help.attributions"), false, |ui| {
- ui_kit::text_block(ui, "attributions", ATTRIBUTION, false);
+ ui_kit::text(ui, ATTRIBUTION, ui_kit::Text::Report("attributions", false));
});
ui_kit::section(ui, "fonts", crate::i18n::tr("help.fonts"), false, |ui| {
- ui_kit::text_block(ui, "fonts", crate::i18n::tr("help.font_details"), false);
+ ui_kit::text(ui, crate::i18n::tr("help.font_details"), ui_kit::Text::Report("fonts", false));
});
ui_kit::section(ui, "licences", crate::i18n::tr("help.licences"), false, |ui| {
for (id, title, text) in
[("notice", "help.notice", NOTICE), ("mit", "help.mit", LICENSE_MIT), ("apache", "help.apache", LICENSE_APACHE)]
{
ui_kit::section(ui, id, crate::i18n::tr(title), false, |ui| {
- ui_kit::text_block(ui, id, text, false);
+ ui_kit::text(ui, text, ui_kit::Text::Report(id, false));
});
}
ui_kit::section(ui, "third_party", crate::i18n::tr("help.third_party"), false, |ui| {
- if ui_kit::secondary_button(ui, crate::i18n::tr_label("Copy all licences")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label("Copy all licences"), ui_kit::Button::Normal).clicked() {
ctx.copy_text(solidcraft_engine::licences::all());
}
ui_kit::text_lines(ui, "sc_third_party", THIRD_PARTY);
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index e3c630b717..6513419610 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -230,8 +230,7 @@ pub fn tr_name(text: &str) -> String {
mod tests {
use super::*;
- /// The languages are listed English first, then by id, so adding one doesn't edit the
- /// line another addition edits.
+ /// English first, then by id, so adding a locale edits only its own line.
#[test]
fn locales_are_listed_english_first_then_by_id() {
let ids: Vec<&str> = LOCALES.iter().map(|c| c.id).collect();
@@ -466,13 +465,8 @@ mod tests {
assert_eq!(it.format("ui.browser_bodies_other", &[("count", "2")]), "2 corpi");
}
- /// `label()`'s id fallback (an argument that matches no other entry's English text is
- /// looked up as an id directly) is how the Sketch Palette reaches `ui.palette_profile` and
- /// `ui.palette_points` without colliding with "Profile" / "Points" elsewhere (see the
- /// comment on `sketch_palette::TOGGLES`). Prove it resolves to each locale's own
- /// translation, not merely to something: a broken id would fall back to the English catalog
- /// silently (`Locale::text`'s own fallback chain), so a test that only checks "resolves to a
- /// non-empty string" would not catch that.
+ /// Stable IDs and source labels share the same translations. A broken ID must not
+ /// silently fall back to English in the sketch palette.
#[test]
fn id_labels_resolve_to_their_own_translation_not_an_english_fallback() {
for (lang, profile, points) in [
@@ -484,13 +478,10 @@ mod tests {
("uk", "Профіль", "Точки"),
] {
let locale = Locale::for_language(lang);
- assert_eq!(locale.label("ui.palette_profile"), profile, "{lang}");
- assert_eq!(locale.label("ui.palette_points"), points, "{lang}");
+ assert_eq!(locale.label("ui.profile"), profile, "{lang}");
+ assert_eq!(locale.label("ui.points"), points, "{lang}");
}
- // The literal English text "Profile" / "Points" must keep naming the pre-existing,
- // unrelated entries (the SelInput row labels in dialogs.rs, and "Show Profile" /
- // "Hide Profile" in context_menu.rs), not the palette's own ids: that separation is the
- // entire reason these two rows pass an id instead of their English text.
+ // Dialog source labels still reach the same shared messages.
assert_eq!(Locale::for_language("de").label("Profile"), Locale::for_language("de").text("ui.profile"));
assert_eq!(Locale::for_language("de").label("Points"), Locale::for_language("de").text("ui.points"));
}
diff --git a/crates/ui-egui/src/i18n_menu_tests.rs b/crates/ui-egui/src/i18n_menu_tests.rs
index 8640392616..87b2912d22 100644
--- a/crates/ui-egui/src/i18n_menu_tests.rs
+++ b/crates/ui-egui/src/i18n_menu_tests.rs
@@ -5,6 +5,7 @@
//! This reads every menu the app can open and fails on the ones it cannot
//! translate.
+use crate::test_support::sample_app;
use std::collections::BTreeSet;
use crate::browser;
@@ -13,12 +14,6 @@ use crate::{Services, SolveApp};
use serde_json::json;
use solidcraft_engine::Session;
-fn sample_app() -> SolveApp {
- let mut s = Session::default();
- s.run_script(&solidcraft_engine::sample::script()).expect("sample script");
- SolveApp::new(s, Services::default())
-}
-
/// Every English text `label()` can be asked to translate.
fn english_texts() -> BTreeSet<String> {
const EN: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../assets/locales/en.json"));
diff --git a/crates/ui-egui/src/i18n_ui_tests.rs b/crates/ui-egui/src/i18n_ui_tests.rs
index 08e58f3c4a..9c3871b587 100644
--- a/crates/ui-egui/src/i18n_ui_tests.rs
+++ b/crates/ui-egui/src/i18n_ui_tests.rs
@@ -41,11 +41,8 @@ fn italian_dialog_keeps_english_scenario_handles() {
#[test]
fn sketch_palette_profile_and_points_rows_show_their_own_translation() {
- // ui.palette_profile / ui.palette_points are reached by id, not by the usual English-text
- // lookup (see the comment on sketch_palette::TOGGLES, and
- // i18n::tests::id_labels_resolve_to_their_own_translation_not_an_english_fallback for the
- // lookup itself). A broken id falls back to English silently rather than failing loudly, so
- // check the word actually on screen in each locale, not just that something renders.
+ // The palette uses the shared profile/points IDs. Check the text actually on screen:
+ // a broken ID could silently fall back to English.
for (lang, profile, points) in [("de", "Profil", "Punkte"), ("ja", "プロファイル", "点"), ("ko", "프로파일", "점"), ("uk", "Профіль", "Точки")]
{
let mut h = Harness::new();
@@ -126,8 +123,7 @@ fn home_page_buttons_fit_their_translated_labels() {
h.app.home.show(rev);
h.frames(2);
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 1000.0));
- let mut out = h.ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| h.app.ui(ui));
- out.textures_delta.clear();
+ let out = crate::test_support::frame(&h.ctx, egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| h.app.ui(ui));
let (mut rects, mut texts) = (Vec::new(), Vec::new());
out.shapes.iter().for_each(|shape| collect(&shape.shape, &mut rects, &mut texts));
let locale = crate::i18n::Locale::for_language(catalog.id);
@@ -202,8 +198,7 @@ fn home_page_renders_in_the_active_language() {
h.app.home.show(rev);
h.frames(2);
let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 1000.0));
- let mut out = h.ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| h.app.ui(ui));
- out.textures_delta.clear();
+ let out = crate::test_support::frame(&h.ctx, egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| h.app.ui(ui));
let mut texts = Vec::new();
out.shapes.iter().for_each(|shape| painted(&shape.shape, &mut texts));
for word in words.into_iter().chain([missing_recent]) {
diff --git a/crates/ui-egui/src/icon_svg.rs b/crates/ui-egui/src/icon_svg.rs
index e80d0382e5..495b9e21c4 100644
--- a/crates/ui-egui/src/icon_svg.rs
+++ b/crates/ui-egui/src/icon_svg.rs
@@ -639,6 +639,7 @@ pub fn doc_for(master: &str, px: u32) -> Option<&'static Doc> {
}
/// Every master id (not the small variants), for tests and tooling.
+#[cfg(test)]
pub fn master_ids() -> Vec<&'static str> {
let mut v: Vec<_> = table().0.keys().copied().collect();
v.sort_unstable();
diff --git a/crates/ui-egui/src/install.rs b/crates/ui-egui/src/install.rs
index f106dc8f4c..53341152c9 100644
--- a/crates/ui-egui/src/install.rs
+++ b/crates/ui-egui/src/install.rs
@@ -91,11 +91,11 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let (closed, action) = ui_kit::Prompt::new(egui::Id::new("sc_install_steps"), "web", crate::i18n::tr("install.title"))
.actions("", crate::i18n::tr("install.done"), None)
.show(ctx, true, |ui| {
- ui_kit::text_block(ui, "intro", crate::i18n::tr("install.steps_intro"), false);
+ ui_kit::text(ui, crate::i18n::tr("install.steps_intro"), ui_kit::Text::Report("intro", false));
for (i, id) in lines.iter().enumerate() {
- ui_kit::text_block(ui, &format!("step:{i}"), &format!("{}. {}", i + 1, crate::i18n::tr(id)), false);
+ ui_kit::text(ui, &format!("{}. {}", i + 1, crate::i18n::tr(id)), ui_kit::Text::Report(&format!("step:{i}"), false));
}
- ui_kit::note(ui, "after", crate::i18n::tr(after));
+ ui_kit::text(ui, crate::i18n::tr(after), ui_kit::Text::Note("after"));
});
if closed || action != ui_kit::Action::None {
app.install_steps = None;
diff --git a/crates/ui-egui/src/issue_report.rs b/crates/ui-egui/src/issue_report.rs
index 942f4b50c7..e68e87dcf0 100644
--- a/crates/ui-egui/src/issue_report.rs
+++ b/crates/ui-egui/src/issue_report.rs
@@ -526,17 +526,25 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
// Only the review scrolls: the submission actions stay in the footer even when a
// screenshot or a long report needs more room.
egui::ScrollArea::vertical().id_salt("issue-report-review").max_height(scroll).auto_shrink([false, true]).show(ui, |ui| {
- ui_kit::text_block(ui, "review", crate::i18n::tr_label("Review the report and screenshot before opening GitHub."), false);
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("Review the report and screenshot before opening GitHub."),
+ ui_kit::Text::Report("review", false),
+ );
ui.horizontal_wrapped(|ui| {
- retake = ui_kit::secondary_button(ui, crate::i18n::tr_label("Retake screenshot")).clicked();
- if ui_kit::enabled_button(ui, "Copy screenshot", draft.image.is_some()).clicked()
+ retake = ui_kit::button(ui, crate::i18n::tr_label("Retake screenshot"), ui_kit::Button::Normal).clicked();
+ if ui_kit::button(ui, "Copy screenshot", ui_kit::Button::Enabled(draft.image.is_some())).clicked()
&& let Some(image) = draft.image.as_ref()
{
ctx.copy_image((**image).clone());
draft.note = crate::i18n::tr("issue.note_image_copied").into();
}
- if ui_kit::enabled_button(ui, crate::i18n::tr("issue.save_screenshot"), draft.image.is_some() && app.services.pick_save.is_some())
- .clicked()
+ if ui_kit::button(
+ ui,
+ crate::i18n::tr("issue.save_screenshot"),
+ ui_kit::Button::Enabled(draft.image.is_some() && app.services.pick_save.is_some()),
+ )
+ .clicked()
&& let Some(image) = draft.image.clone()
{
app.pick_save(&format!("solidcraft-issue-{}.png", app.shot_token), &["png"], move |app, path| {
@@ -551,7 +559,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
}
});
}
- if ui_kit::enabled_button(ui, "Remove screenshot", draft.image.is_some()).clicked() {
+ if ui_kit::button(ui, "Remove screenshot", ui_kit::Button::Enabled(draft.image.is_some())).clicked() {
draft.image = None;
draft.texture = None;
draft.note = crate::i18n::tr("issue.note_removed").into();
@@ -563,9 +571,9 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
});
truncate(&mut draft.title, 160);
truncate(&mut draft.body, MAX_BODY);
- ui_kit::note(ui, "private", crate::i18n::tr_label("Remove private design details or paths before sharing."));
+ ui_kit::text(ui, crate::i18n::tr_label("Remove private design details or paths before sharing."), ui_kit::Text::Note("private"));
if !draft.note.is_empty() {
- ui_kit::note(ui, "note", &draft.note);
+ ui_kit::text(ui, &draft.note, ui_kit::Text::Note("note"));
}
if let Some(image) = draft.image.as_ref() {
let texture =
@@ -577,26 +585,28 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
);
}
ui_kit::divider(ui, "send");
- ui_kit::text_block(ui, "send", crate::i18n::tr_label("Send your report on GitHub"), false);
+ ui_kit::text(ui, crate::i18n::tr_label("Send your report on GitHub"), ui_kit::Text::Report("send", false));
let (url, copy_needed) = draft_url(&draft.title, &draft.body);
link = Some((url, copy_needed));
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "step1",
crate::i18n::tr_label(if copy_needed {
"1. Open GitHub draft below, then paste the report copied to your clipboard."
} else {
"1. Open GitHub draft below. Your title and report will be filled in."
}),
- false,
+ ui_kit::Text::Report("step1", false),
);
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "step2",
crate::i18n::tr_label("2. Attach your screenshot: copy and paste it, or save and upload the PNG."),
- false,
+ ui_kit::Text::Report("step2", false),
+ );
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("3. Click Submit new issue on GitHub to send your report."),
+ ui_kit::Text::Report("step3", false),
);
- ui_kit::text_block(ui, "step3", crate::i18n::tr_label("3. Click Submit new issue on GitHub to send your report."), false);
});
});
let open = !(closed || action == ui_kit::Action::Cancel);
diff --git a/crates/ui-egui/src/joint_browser_tests.rs b/crates/ui-egui/src/joint_browser_tests.rs
index 7709eb8f2d..ce62dced33 100644
--- a/crates/ui-egui/src/joint_browser_tests.rs
+++ b/crates/ui-egui/src/joint_browser_tests.rs
@@ -8,19 +8,14 @@ use serde_json::json;
use crate::context_menu::{self, Target};
use crate::scenario::Harness;
+use crate::test_support::click;
/// Components A (grounded) and B joined by a revolute "Hinge", and C held by a rigid "Glue".
fn harness() -> Harness {
let mut h = Harness::new();
h.app.home.open = false;
h.app.ui.show_browser = true;
- for (name, x) in [("A", 0), ("B", 30), ("C", 60)] {
- h.app.run("component.activate", json!({"component": "root"})).unwrap();
- h.app.run("component.create", json!({ "name": name })).unwrap();
- h.app.run("solid.box", json!({"length": 20, "width": 20, "height": 10, "corner": [x, 0, 0]})).unwrap();
- }
- h.app.run("component.activate", json!({"component": "root"})).unwrap();
- h.app.run("occurrence.ground", json!({"occurrence": "A:1", "grounded": true})).unwrap();
+ crate::test_support::grounded_boxes(&[("A", 0), ("B", 30), ("C", 60)], |id, p| h.app.run(id, p).unwrap());
h.app
.run("joint.create", json!({"type": "revolute", "name": "Hinge", "a": {"occurrence": "A:1", "face": [10, 10, 10]}, "b": {"occurrence": "B:1", "face": [40, 10, 0]}}))
.unwrap();
@@ -35,12 +30,6 @@ fn id(h: &Harness, name: &str) -> u64 {
h.app.session.doc.assembly.joints.iter().find(|j| j.name == name).unwrap().id
}
-fn click(h: &mut Harness, handle: &str) {
- assert!(crate::scenario::handle_at(handle).is_some(), "{handle} is not drawn: {:?}", crate::scenario::handles(""));
- h.step(&json!({"click": {"handle": handle}})).unwrap();
- h.frames(3);
-}
-
fn drawn(h: &Harness) -> Vec<(u64, bool)> {
crate::dialogs_assembly::drawn_joints(&h.app)
}
diff --git a/crates/ui-egui/src/joint_drag.rs b/crates/ui-egui/src/joint_drag.rs
index 2b2929b153..bea0d15fb3 100644
--- a/crates/ui-egui/src/joint_drag.rs
+++ b/crates/ui-egui/src/joint_drag.rs
@@ -105,6 +105,7 @@ mod tests {
use solidcraft_engine::geom::Vec3;
use crate::scenario::Harness;
+ use crate::test_support::play;
fn run(h: &mut Harness, id: &str, p: Value) -> Value {
h.app.run(id, p.clone()).unwrap_or_else(|e| panic!("{id} {p}: {e}"))
@@ -146,13 +147,6 @@ mod tests {
(h, end, a, b)
}
- fn play(h: &mut Harness) {
- while !h.app.synthetic.is_empty() {
- h.frame();
- }
- h.frames(2);
- }
-
/// Press at `a` and move to `b` in 12 frames, holding the button there.
fn press_and_move(h: &mut Harness, a: egui::Pos2, b: egui::Pos2) {
h.app.synthetic.push(egui::Event::PointerMoved(a));
diff --git a/crates/ui-egui/src/keymap.rs b/crates/ui-egui/src/keymap.rs
index 183647de10..c1c1bd8a32 100644
--- a/crates/ui-egui/src/keymap.rs
+++ b/crates/ui-egui/src/keymap.rs
@@ -195,39 +195,37 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
ui_kit::scope(ui, |ui| {
let filter =
ui_kit::search_field(ui, egui::Id::new("sc_keymap_filter"), &mut app.keymap.filter, crate::i18n::tr_label("Filter commands or keys"));
- crate::scenario::publish_rect("keymap:filter", filter.rect);
- crate::scenario::publish_handle("keymap:filter", filter.rect.center());
+ crate::scenario::publish_target("keymap:filter", filter.rect);
ui.horizontal_wrapped(|ui| {
- if !app.keymap.read_only && ui_kit::secondary_button(ui, app.tr_label("Reset All")).clicked() {
+ if !app.keymap.read_only && ui_kit::button(ui, app.tr_label("Reset All"), ui_kit::Button::Normal).clicked() {
action = Some((String::new(), "reset_all"));
}
- if ui_kit::secondary_button(ui, app.tr_label("Export…"))
+ if ui_kit::button(ui, app.tr_label("Export…"), ui_kit::Button::Normal)
.on_hover_text(app.tr_label("Keys, S box favourites and the toolbar, as a file"))
.clicked()
{
action = Some((String::new(), "export"));
}
- if !app.keymap.read_only && ui_kit::secondary_button(ui, app.tr_label("Import…")).clicked() {
+ if !app.keymap.read_only && ui_kit::button(ui, app.tr_label("Import…"), ui_kit::Button::Normal).clicked() {
action = Some((String::new(), "import"));
}
});
if let Some(m) = &app.keymap.message {
- ui_kit::text_block(ui, "keymap_message", m, true);
+ ui_kit::text(ui, m, ui_kit::Text::Report("keymap_message", true));
}
if let Some((id, key, _)) = app.keymap.conflict.clone() {
ui.horizontal_wrapped(|ui| {
- let replace = ui_kit::secondary_button(ui, crate::i18n::format("keymap.use_anyway", &[("key", &key)]));
- crate::scenario::publish_rect("keymap:replace", replace.rect);
- crate::scenario::publish_handle("keymap:replace", replace.rect.center());
+ let replace = ui_kit::button(ui, crate::i18n::format("keymap.use_anyway", &[("key", &key)]), ui_kit::Button::Normal);
+ crate::scenario::publish_target("keymap:replace", replace.rect);
if replace.clicked() {
action = Some((format!("{id}\n{key}"), "replace"));
}
- if ui_kit::secondary_button(ui, app.tr_label("Cancel")).clicked() {
+ if ui_kit::button(ui, app.tr_label("Cancel"), ui_kit::Button::Normal).clicked() {
action = Some((String::new(), "cancel"));
}
});
}
- ui_kit::note(ui, "navigation", app.tr_label("Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation)."));
+ ui_kit::text(ui, app.tr_label("Select Other: hold the left button still on the model (or right-click › Select Other…) to list everything under the cursor; click again on the same spot to select the next thing there. Double-click the middle button to go Home (Preferences › Navigation)."), ui_kit::Text::Note("navigation"));
let q = app.keymap.filter.to_lowercase();
egui::ScrollArea::vertical()
.id_salt("sc_keymap_scroll")
@@ -235,10 +233,10 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
.auto_shrink([false, true])
.show(ui, |ui| {
let columns = [
- ui_kit::Column { label: "Command", width: 1.5 },
- ui_kit::Column { label: crate::i18n::tr("keymap.command_id"), width: 1.8 },
- ui_kit::Column { label: "Keyboard Shortcuts", width: 1.0 },
- ui_kit::Column { label: "", width: 1.2 },
+ ui_kit::Column::new("Command", 1.5),
+ ui_kit::Column::new(crate::i18n::tr("keymap.command_id"), 1.8),
+ ui_kit::Column::new("Keyboard Shortcuts", 1.0),
+ ui_kit::Column::new("", 1.2),
];
ui_kit::table(ui, "keymap", &columns, crate::i18n::tr("keymap.empty"), |ui, table| {
for c in command_specs() {
@@ -249,10 +247,10 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
}
table.row(ui, c.id, app.keymap.capturing.as_deref() == Some(c.id), |row| {
row.cell(|ui| {
- ui_kit::cell_text(ui, translated_label);
+ ui_kit::text(ui, translated_label, ui_kit::Text::Cell);
});
row.cell(|ui| {
- ui_kit::cell_text(ui, c.id);
+ ui_kit::text(ui, c.id, ui_kit::Text::Cell);
});
let capturing = app.keymap.capturing.as_deref() == Some(c.id);
let changed = app.keymap.custom.contains_key(c.id);
@@ -265,11 +263,11 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
};
row.cell(|ui| {
if app.keymap.read_only {
- ui_kit::cell_text(ui, &text);
+ ui_kit::text(ui, &text, ui_kit::Text::Cell);
} else {
- let capture = ui_kit::secondary_button(ui, &text).on_hover_text(app.tr_label("Click, then press the new key"));
- crate::scenario::publish_rect(&format!("keymap:capture:{}", c.id), capture.rect);
- crate::scenario::publish_handle(&format!("keymap:capture:{}", c.id), capture.rect.center());
+ let capture = ui_kit::button(ui, &text, ui_kit::Button::Normal)
+ .on_hover_text(app.tr_label("Click, then press the new key"));
+ crate::scenario::publish_target(&format!("keymap:capture:{}", c.id), capture.rect);
if capture.clicked() {
action = Some((c.id.to_string(), "capture"));
}
@@ -278,15 +276,13 @@ pub fn page(app: &mut SolveApp, ui: &mut egui::Ui) {
row.cell(|ui| {
if !app.keymap.read_only {
ui.horizontal(|ui| {
- let clear = ui_kit::enabled_button(ui, app.tr_label("Clear"), !key.is_empty());
- crate::scenario::publish_rect(&format!("keymap:clear:{}", c.id), clear.rect);
- crate::scenario::publish_handle(&format!("keymap:clear:{}", c.id), clear.rect.center());
+ let clear = ui_kit::button(ui, app.tr_label("Clear"), ui_kit::Button::Enabled(!key.is_empty()));
+ crate::scenario::publish_target(&format!("keymap:clear:{}", c.id), clear.rect);
if clear.clicked() {
action = Some((c.id.to_string(), "clear"));
}
- let reset = ui_kit::enabled_button(ui, app.tr_label("Reset"), changed);
- crate::scenario::publish_rect(&format!("keymap:reset:{}", c.id), reset.rect);
- crate::scenario::publish_handle(&format!("keymap:reset:{}", c.id), reset.rect.center());
+ let reset = ui_kit::button(ui, app.tr_label("Reset"), ui_kit::Button::Enabled(changed));
+ crate::scenario::publish_target(&format!("keymap:reset:{}", c.id), reset.rect);
if reset.clicked() {
action = Some((c.id.to_string(), "reset"));
}
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 0efbe019ae..e47eafd019 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -26,6 +26,7 @@ pub mod crash_ui;
pub mod deferred;
pub mod delete;
pub mod design_properties;
+mod dialog_descriptor;
pub mod dialogs;
pub mod dialogs_appearance;
pub mod dialogs_assembly;
@@ -162,6 +163,9 @@ pub mod render_workspace;
mod revolve_edit_tests;
#[cfg(test)]
mod revolve_manipulator_tests;
+mod rule_editor;
+#[cfg(test)]
+mod rule_editor_tests;
pub mod save_job;
pub mod scenario;
pub mod select_other;
@@ -1774,6 +1778,8 @@ pub fn now_ms() -> f64 {
#[cfg(test)]
mod picker_test_support;
+#[cfg(test)]
+mod test_support;
/// A SolidCraft design file (`.solidcraft`, or a design saved as JSON), as opposed to a STEP or
/// mesh file.
diff --git a/crates/ui-egui/src/manage_dialogs_tests.rs b/crates/ui-egui/src/manage_dialogs_tests.rs
index f36f3de9b5..9524247ac8 100644
--- a/crates/ui-egui/src/manage_dialogs_tests.rs
+++ b/crates/ui-egui/src/manage_dialogs_tests.rs
@@ -18,6 +18,93 @@ fn fixture() -> Harness {
h
}
+fn painted_frame(h: &mut Harness) -> egui::FullOutput {
+ let mut output = h.ctx.run_ui(egui::RawInput { screen_rect: Some(h.ctx.content_rect()), focused: true, ..Default::default() }, |ui| {
+ h.app.logic(ui.ctx());
+ h.app.ui(ui);
+ });
+ output.textures_delta.clear();
+ output
+}
+
+fn painted_text<'a>(output: &'a egui::FullOutput, text: &str, within: egui::Rect) -> &'a egui::epaint::TextShape {
+ fn find<'a>(shape: &'a egui::Shape, text: &str, within: egui::Rect) -> Option<&'a egui::epaint::TextShape> {
+ match shape {
+ egui::Shape::Text(shape) if shape.galley.job.text == text && within.contains(shape.pos) => Some(shape),
+ egui::Shape::Vec(shapes) => shapes.iter().find_map(|shape| find(shape, text, within)),
+ _ => None,
+ }
+ }
+ output.shapes.iter().find_map(|shape| find(&shape.shape, text, within)).unwrap_or_else(|| panic!("missing painted {text:?} in {within:?}"))
+}
+
+#[test]
+fn parameter_columns_fit_controls_and_headers_share_cell_left_edges() {
+ for layout in [LayoutMode::Docked, LayoutMode::Floating] {
+ let mut h = fixture();
+ h.call("ui.set", json!({"layout":layout}));
+ h.app.start("parameters.change");
+ h.frames(4);
+ let output = painted_frame(&mut h);
+ for label in ["Name", "Unit", "Expression", "Value", "Comment", "Actions"] {
+ let header = scenario::rect_of(&format!("dialog:column:user:{label}")).unwrap();
+ let cell = scenario::rect_of(&format!("dialog:table:user:width:cell:{label}")).unwrap();
+ assert_eq!(header.left(), cell.left(), "{label}: {layout:?}");
+ assert_eq!(header.width(), cell.width());
+ let text = painted_text(&output, label, header);
+ assert!((text.pos.x - cell.left()).abs() <= 0.5, "{label}: painted header starts at {:?}, cell {cell:?}", text.pos);
+ assert!(!text.galley.elided);
+ }
+ let unit = scenario::rect_of("dialog:table:user:width:cell:Unit").unwrap();
+ let mm = painted_text(&output, "mm", unit);
+ assert!(!mm.galley.elided, "mm must be painted without an ellipsis");
+ let spacing = egui::style::Spacing::default();
+ assert!(unit.width() >= mm.galley.size().x + 2.0 * Tokens::get().space_8 + spacing.icon_width + spacing.icon_spacing);
+ assert!(mm.pos.x + mm.galley.size().x + Tokens::get().space_8 + spacing.icon_width + spacing.icon_spacing <= unit.right());
+ let actions = scenario::rect_of("dialog:table:user:width:cell:Actions").unwrap();
+ let delete = painted_text(&output, "Delete", actions);
+ assert!(!delete.galley.elided, "Delete must be painted without an ellipsis");
+ assert!(actions.contains_rect(scenario::rect_of("dialog:button:Actions:Delete").unwrap()));
+ // More content widens the scroll area, never the card.
+ h.call("ui.resize", json!({"width":640,"height":1000}));
+ h.frames(4);
+ assert!(h.ctx.content_rect().contains_rect(scenario::rect_of("dialog:header").unwrap()));
+ assert_eq!(scenario::rect_of("dialog:column:user:Unit").unwrap().width(), unit.width());
+ }
+}
+
+#[test]
+fn configuration_columns_align_values_status_and_remove_actions() {
+ let mut h = fixture();
+ h.app.run("parameters.change", json!({"name":"width","expression":"80 mm"})).unwrap();
+ h.app.run("config.configure", json!({"params":["width"]})).unwrap();
+ h.app.start("config.table");
+ h.frames(4);
+ let output = painted_frame(&mut h);
+ for label in ["Configuration", "width", "Actions"] {
+ let header = scenario::rect_of(&format!("dialog:column:configuration_table:{label}")).unwrap();
+ for row in ["Default", "columns"] {
+ let cell = scenario::rect_of(&format!("dialog:table:configuration_table:{row}:cell:{label}")).unwrap();
+ assert_eq!(header.left(), cell.left());
+ assert_eq!(header.width(), cell.width());
+ }
+ assert!((painted_text(&output, label, header).pos.x - header.left()).abs() <= 0.5);
+ }
+ let name = scenario::rect_of("dialog:table:configuration_table:Default:cell:Configuration").unwrap();
+ let active = painted_text(&output, "Active", name);
+ assert!(!active.galley.elided);
+ assert!(active.pos.x + active.galley.size().x <= name.right());
+ let value = scenario::rect_of("dialog:table:configuration_table:Default:cell:width").unwrap();
+ assert!(!painted_text(&output, "80 mm", value).galley.elided);
+ let remove_cell = scenario::rect_of("dialog:table:configuration_table:columns:cell:width").unwrap();
+ let remove = scenario::rect_of("dialog:button:width:×").unwrap();
+ assert!(remove_cell.contains_rect(remove));
+ let action_label = scenario::rect_of("dialog:table:configuration_table:columns:cell:Configuration").unwrap();
+ assert!(!painted_text(&output, "Remove the column", action_label).galley.elided);
+ h.step(&json!({"click":[remove.center().x,remove.center().y]})).unwrap();
+ assert!(h.app.session.doc.configs.columns.is_empty(), "the column action remains interactive");
+}
+
fn chrome(h: &Harness) {
for key in ["dialog:close", "dialog:ok", "dialog:cancel"] {
assert!(scenario::handle_at(key).is_some(), "missing {key}");
diff --git a/crates/ui-egui/src/material_card_review.rs b/crates/ui-egui/src/material_card_review.rs
index bb09e9b267..1fcd4fcfc4 100644
--- a/crates/ui-egui/src/material_card_review.rs
+++ b/crates/ui-egui/src/material_card_review.rs
@@ -92,8 +92,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
false,
true,
|ui| {
- ui_kit::hint(ui, "manage", tr("ui.material_review.scope"));
- ui_kit::text_block(ui, "material_input_label", tr("ui.material_review.input"), false);
+ ui_kit::text(ui, tr("ui.material_review.scope"), ui_kit::Text::Hint("manage"));
+ ui_kit::text(ui, tr("ui.material_review.input"), ui_kit::Text::Report("material_input_label", false));
let response =
ui_kit::text_area(ui, tr("ui.material_review.input"), egui::Id::new("sc_material_card_input"), &mut window.input, 5, MAX_BYTES);
crate::scenario::publish_handle("review:input", response.rect.center());
@@ -101,11 +101,11 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
window.reviewed = None;
window.error = None;
}
- if ui_kit::secondary_button(ui, tr("ui.material_review.review")).clicked() {
+ if ui_kit::button(ui, tr("ui.material_review.review"), ui_kit::Button::Normal).clicked() {
window.review(app);
}
if let Some(error) = &window.error {
- ui_kit::text_block(ui, "material_error", error, true);
+ ui_kit::text(ui, error, ui_kit::Text::Report("material_error", true));
}
if let Some((card, report)) = &window.reviewed {
show_card(ui, card, report);
@@ -122,7 +122,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
fn value(ui: &mut egui::Ui, field: &str, value: Option<String>, unit: &str) {
let value = value.unwrap_or_else(|| tr("ui.material_review.unknown").to_string());
- ui_kit::text_block(ui, field, &format!("{field}: {value} {unit}"), false);
+ ui_kit::text(ui, &format!("{field}: {value} {unit}"), ui_kit::Text::Report(field, false));
}
fn numbers(ui: &mut egui::Ui, field: &str, values: &[f64], unit: &str) {
@@ -131,15 +131,15 @@ fn numbers(ui: &mut egui::Ui, field: &str, values: &[f64], unit: &str) {
fn show_card(ui: &mut egui::Ui, card: &MaterialCard, report: &Value) {
ui_kit::divider(ui, "material_card");
- ui_kit::text_block(ui, "designation", &card.designation, false);
+ ui_kit::text(ui, &card.designation, ui_kit::Text::Report("designation", false));
// Schema identifiers are inert metadata, not translated source claims or assigned body axes.
let family = serde_json::to_value(card.family).unwrap_or(Value::Null);
value(ui, "family", family.as_str().map(str::to_string), "");
- ui_kit::text_block(ui, "properties", tr("ui.material_review.properties"), false);
+ ui_kit::text(ui, tr("ui.material_review.properties"), ui_kit::Text::Report("properties", false));
for kind in KINDS {
let label = format!("ui.material_review.{kind}");
let Some(property) = card.properties.iter().find(|p| p.data.kind() == kind) else {
- ui_kit::text_block(ui, kind, &format!("{}: {}", tr(&label), tr("ui.material_review.unknown")), false);
+ ui_kit::text(ui, &format!("{}: {}", tr(&label), tr("ui.material_review.unknown")), ui_kit::Text::Report(kind, false));
continue;
};
ui_kit::section(ui, kind, tr(&label), true, |ui| {
@@ -150,9 +150,9 @@ fn show_card(ui: &mut egui::Ui, card: &MaterialCard, report: &Value) {
{
let axes = if axes == "wood_lrt" { "wood_lrt (1=L, 2=R, 3=T)".to_string() } else { axes };
value(ui, "axes", Some(axes), "");
- ui_kit::text_block(ui, "axes", tr("ui.material_review.axes"), false);
+ ui_kit::text(ui, tr("ui.material_review.axes"), ui_kit::Text::Report("axes", false));
}
- ui_kit::text_block(ui, "conditions", tr("ui.material_review.conditions"), false);
+ ui_kit::text(ui, tr("ui.material_review.conditions"), ui_kit::Text::Report("conditions", false));
let c = &property.conditions;
value(ui, "temperature_k", c.temperature_k.map(|v| v.to_string()), "K");
value(ui, "state", c.state.clone(), "");
@@ -162,9 +162,9 @@ fn show_card(ui: &mut egui::Ui, card: &MaterialCard, report: &Value) {
if card.family == Family::Polymer || c.strain_rate_per_s.is_some() {
value(ui, "strain_rate_per_s", c.strain_rate_per_s.map(|v| v.to_string()), "s⁻¹");
}
- ui_kit::text_block(ui, "source", tr("ui.material_review.source"), false);
+ ui_kit::text(ui, tr("ui.material_review.source"), ui_kit::Text::Report("source", false));
if let Some(source) = card.sources.iter().find(|s| s.id == property.source_id) {
- ui_kit::text_block(ui, "source_title", &source.title, false);
+ ui_kit::text(ui, &source.title, ui_kit::Text::Report("source_title", false));
value(ui, "source_id", Some(source.id.clone()), "");
value(ui, "kind", serde_json::to_value(source.kind).ok().and_then(|v| v.as_str().map(str::to_string)), "");
value(ui, "license", source.license.clone(), "");
@@ -173,12 +173,12 @@ fn show_card(ui: &mut egui::Ui, card: &MaterialCard, report: &Value) {
});
}
if let Some(moduli) = report.get("validation").and_then(|v| v.get("isotropic_moduli")).filter(|v| v.is_object()) {
- ui_kit::text_block(ui, "derived", tr("ui.material_review.derived"), false);
+ ui_kit::text(ui, tr("ui.material_review.derived"), ui_kit::Text::Report("derived", false));
for field in ["shear_pa", "bulk_pa"] {
value(ui, field, moduli.get(field).and_then(Value::as_f64).map(|v| format!("{v:e}")), "Pa");
}
}
- ui_kit::note(ui, "claims", tr("ui.material_review.claims"));
+ ui_kit::text(ui, tr("ui.material_review.claims"), ui_kit::Text::Note("claims"));
}
fn show_data(ui: &mut egui::Ui, data: &PropertyData) {
diff --git a/crates/ui-egui/src/menu_tests.rs b/crates/ui-egui/src/menu_tests.rs
index 2d9c1442db..f38dd17596 100644
--- a/crates/ui-egui/src/menu_tests.rs
+++ b/crates/ui-egui/src/menu_tests.rs
@@ -1,5 +1,6 @@
//! Context menu tests: what the menus offer for each target, and that their items act.
+use crate::test_support::sample_app;
use egui::pos2;
use serde_json::json;
use solidcraft_engine::Session;
@@ -7,12 +8,6 @@ use solidcraft_engine::Session;
use crate::context_menu::{self, Item, Target};
use crate::{Services, SolveApp};
-fn sample_app() -> SolveApp {
- let mut s = Session::default();
- s.run_script(&solidcraft_engine::sample::script()).unwrap();
- SolveApp::new(s, Services::default())
-}
-
#[test]
fn properties_leave_with_the_document_but_survive_a_failed_open() {
let mut app = sample_app();
diff --git a/crates/ui-egui/src/navigation_cube.rs b/crates/ui-egui/src/navigation_cube.rs
index 3c03df8985..22ee42b621 100644
--- a/crates/ui-egui/src/navigation_cube.rs
+++ b/crates/ui-egui/src/navigation_cube.rs
@@ -214,8 +214,7 @@ pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {
}
}
let home = Rect::from_center_size(c + vec2(-65.0, -65.0) * scale, vec2(26.0, 26.0) * scale);
- crate::scenario::publish_rect("axis_view:home", home);
- crate::scenario::publish_handle("axis_view:home", home.center());
+ 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);
diff --git a/crates/ui-egui/src/occurrence_ui_tests.rs b/crates/ui-egui/src/occurrence_ui_tests.rs
index 18e3df738a..3c2d9539fc 100644
--- a/crates/ui-egui/src/occurrence_ui_tests.rs
+++ b/crates/ui-egui/src/occurrence_ui_tests.rs
@@ -26,12 +26,7 @@ fn replaced_body_name_uses_evaluated_owner_in_browser_and_component_actions() {
}
fn fixture() -> (Harness, u64, u64, u64) {
- let mut h = Harness::new();
- let part = h.app.run("component.create", json!({"name":"Block"})).unwrap();
- let component = part["component"].as_u64().unwrap();
- let first = part["occurrence"].as_u64().unwrap();
- h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();
- h.app.run("component.activate", json!({"component":0})).unwrap();
+ let (mut h, component, first) = crate::test_support::component_box();
let second = h.app.run("occurrence.copy", json!({"occurrence":first,"translate":[50,0,0]})).unwrap()["occurrence"].as_u64().unwrap();
h.frames(3);
(h, component, first, second)
diff --git a/crates/ui-egui/src/params_dialog.rs b/crates/ui-egui/src/params_dialog.rs
index ea3f60f27a..20aeaded57 100644
--- a/crates/ui-egui/src/params_dialog.rs
+++ b/crates/ui-egui/src/params_dialog.rs
@@ -182,26 +182,26 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
false,
true,
|ui| {
- ui_kit::hint(ui, "manage", crate::i18n::tr("manage.parameters_hint"));
+ ui_kit::text(ui, crate::i18n::tr("manage.parameters_hint"), ui_kit::Text::Hint("manage"));
ui_kit::row(ui, "Filter", |ui| {
let id = ui.make_persistent_id("parameter_filter");
ui_kit::search_field(ui, id, &mut d.filter, "Filter");
});
ui.horizontal_wrapped(|ui| {
- if ui_kit::secondary_button(ui, crate::i18n::tr_label("Import…"))
+ if ui_kit::button(ui, crate::i18n::tr_label("Import…"), ui_kit::Button::Normal)
.on_hover_text(crate::i18n::tr_label("CSV or JSON: updates existing parameters, adds new ones"))
.clicked()
{
app.pick_open_command("parameters.import", json!({}), &[]);
}
for (label, ext) in [("Export CSV…", "csv"), ("Export JSON…", "json")] {
- if ui_kit::secondary_button(ui, crate::i18n::tr_label(label)).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label(label), ui_kit::Button::Normal).clicked() {
app.pick_save_command(&format!("parameters.{ext}"), &[ext], "parameters.export", json!({"format": ext}));
}
}
});
if let Some(error) = &d.error {
- ui_kit::text_block(ui, "parameters_error", error, true);
+ ui_kit::text(ui, error, ui_kit::Text::Report("parameters_error", true));
}
let filter = d.filter.to_ascii_lowercase();
let visible: Vec<_> = all
@@ -279,14 +279,15 @@ fn new_check(app: &mut SolveApp, d: &mut ParamsDialog, unit: &str) -> Result<Str
}
fn table(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog, rows: &[&Row], salt: &str) {
+ let units: Vec<_> = UNITS.iter().map(|unit| unit_label(unit)).collect();
let columns = [
- Column { label: "", width: 1.6 },
- Column { label: "Name", width: 1.1 },
- Column { label: "Unit", width: 0.65 },
- Column { label: "Expression", width: 1.6 },
- Column { label: "Value", width: 1.2 },
- Column { label: "Comment", width: 1.5 },
- Column { label: "Actions", width: 0.7 },
+ Column::new("", 1.6),
+ Column::new("Name", 1.1),
+ Column::new("Unit", 0.65).min_content_width(ui_kit::ContentWidth::dropdown(ui, &units)),
+ Column::new("Expression", 1.6),
+ Column::new("Value", 1.2),
+ Column::new("Comment", 1.5),
+ Column::new("Actions", 0.7).min_content_width(ui_kit::ContentWidth::button(ui, "Delete")),
];
ui_kit::table(ui, salt, &columns, crate::i18n::tr("manage.empty"), |ui, table| {
for (index, r) in rows.iter().enumerate() {
@@ -297,7 +298,7 @@ fn table(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog, rows: &[&R
table.row_visible(ui, &r.name, false, busy, |row| {
row.cell(|ui| {
let star = if r.favorite { "★" } else { "☆" };
- if ui_kit::small_button(ui, star).on_hover_text(crate::i18n::tr_label("Favourite")).clicked() {
+ if ui_kit::button(ui, star, ui_kit::Button::Small).on_hover_text(crate::i18n::tr_label("Favourite")).clicked() {
d.error = app.run("parameters.favorite", json!({"name": r.name, "favorite": !r.favorite})).err();
}
if salt == "user" {
@@ -305,7 +306,8 @@ fn table(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog, rows: &[&R
("▲", "Move up", index.checked_sub(1).and_then(|i| rows.get(i)), "before"),
("▼", "Move down", rows.get(index + 1), "after"),
] {
- let response = ui_kit::enabled_button(ui, glyph, neighbour.is_some()).on_hover_text(crate::i18n::tr_label(tip));
+ let response =
+ ui_kit::button(ui, glyph, ui_kit::Button::Enabled(neighbour.is_some())).on_hover_text(crate::i18n::tr_label(tip));
crate::scenario::publish_handle(&format!("param:{side}:{}", r.name), response.rect.center());
if response.clicked()
&& let Some(neighbour) = neighbour
@@ -332,7 +334,7 @@ fn table(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog, rows: &[&R
}
}
_ => {
- let response = ui_kit::cell_text(ui, &r.name).on_hover_text(crate::i18n::tr_label("Double-click to rename"));
+ let response = ui_kit::text(ui, &r.name, ui_kit::Text::Cell).on_hover_text(crate::i18n::tr_label("Double-click to rename"));
crate::scenario::publish_handle(&format!("param:name:{}", r.name), response.rect.center());
if response.double_clicked() {
d.renaming = Some((r.name.clone(), r.name.clone()));
@@ -343,15 +345,14 @@ fn table(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog, rows: &[&R
if r.source == "user" {
let mut selected = UNITS.iter().position(|u| *u == r.unit).unwrap_or(0);
let before = selected;
- let labels: Vec<_> = UNITS.iter().map(|u| unit_label(u)).collect();
- ui_kit::dropdown(ui, &format!("punit:{salt}:{}", r.name), &mut selected, &labels);
+ ui_kit::dropdown(ui, &format!("punit:{salt}:{}", r.name), &mut selected, &units);
if selected != before
&& let Some(unit) = UNITS.get(selected)
{
d.error = app.run("parameters.change", json!({"name":r.name,"expression":r.expression,"unit":unit})).err();
}
} else {
- ui_kit::cell_text(ui, unit_label(&r.unit));
+ ui_kit::text(ui, unit_label(&r.unit), ui_kit::Text::Cell);
}
});
let mut expression = d.editing.get(&r.name).cloned().unwrap_or_else(|| r.expression.clone());
@@ -393,7 +394,7 @@ fn table(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog, rows: &[&R
(Some(Ok(value)), _) => (value.clone(), false),
(None, None) => (show_value(r), false),
};
- ui_kit::text_block(ui, &format!("value:{}", r.name), &text, error).on_hover_text(&text);
+ ui_kit::text(ui, &text, ui_kit::Text::Report(&format!("value:{}", r.name), error)).on_hover_text(&text);
});
row.cell(|ui| {
let mut comment = d.comments.get(&r.name).cloned().unwrap_or_else(|| r.comment.clone());
@@ -412,7 +413,7 @@ fn table(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog, rows: &[&R
}
});
row.cell(|ui| {
- if r.source == "user" && ui_kit::small_button(ui, crate::i18n::tr_label("Delete")).clicked() {
+ if r.source == "user" && ui_kit::button(ui, crate::i18n::tr_label("Delete"), ui_kit::Button::Small).clicked() {
d.error = app.run("parameters.delete", json!({"name":r.name})).err();
}
});
@@ -465,13 +466,13 @@ fn add_row(app: &mut SolveApp, ui: &mut egui::Ui, d: &mut ParamsDialog) {
Ok(value) => (value, false),
Err(message) => (message, true),
};
- ui_kit::row(ui, "Value", |ui| ui_kit::text_block(ui, "new_value", text, error).on_hover_text(text));
+ ui_kit::row(ui, "Value", |ui| ui_kit::text(ui, text, ui_kit::Text::Report("new_value", error)).on_hover_text(text));
let comment = ui_kit::row(ui, "Comment", |ui| ui_kit::cell_editor(ui, comment_id, &mut d.new_comment, "Comment", false));
crate::scenario::publish_handle("param:new:comment", comment.rect.center());
// Enter from name/comment owns submission too, not the panel footer.
submit |= enter_for(ui, focused_id.is_some());
let valid = !d.new_name.trim().is_empty() && live.is_ok();
- if ui_kit::enabled_button(ui, "Add", valid).clicked() || submit {
+ if ui_kit::button(ui, "Add", ui_kit::Button::Enabled(valid)).clicked() || submit {
if let Err(error) = &live {
d.error = Some(error.clone());
if let Some(id) = focused_id {
@@ -554,6 +555,7 @@ pub(crate) fn word_before(text: &str, cursor: usize) -> (usize, String) {
}
/// Suggestions for the word being typed.
+#[cfg(test)]
pub fn suggestions(ctx: &egui::Context, word: &str) -> Vec<Suggestion> {
suggestions_for(ctx, word, false)
}
diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rs
index 8bbb2db779..350de46b4f 100644
--- a/crates/ui-egui/src/prefs.rs
+++ b/crates/ui-egui/src/prefs.rs
@@ -258,160 +258,219 @@ pub enum OrbitAround {
/// itself clamps what the user drags to its own range.
pub const DEFAULT_BROWSER_WIDTH: f32 = 250.0;
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-#[serde(default)]
-pub struct Prefs {
+// The stored fields, their defaults, page resets and simple form controls share this table.
+// Omitted pages keep fields such as grid_follows_view and added agents when restoring defaults.
+// Accepted control-channel ranges may differ from slider ranges (look_at_speed).
+macro_rules! preference_settings {
+ ($( $(#[$doc:meta])* $field:ident: $ty:ty = $default:expr $(, $page:expr)? $(, accept($accepted:expr))? $(=> $control:ident($($args:tt)*))? ;)*) => {
+ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
+ #[serde(default)]
+ pub struct Prefs { $($(#[$doc])* pub $field: $ty,)* }
+
+ impl Default for Prefs {
+ fn default() -> Self { Self { $($field: $default,)* } }
+ }
+
+ fn reset_preferences(p: &mut Prefs, page: usize) {
+ let d = Prefs::default();
+ $($(if page == $page { p.$field = d.$field; })?)*
+ }
+
+ mod accepted {
+ use super::*;
+ $($(pub(super) fn $field(p: &Prefs) -> bool { ($accepted).contains(&p.$field) })?)*
+ }
+
+ mod setting {
+ use super::*;
+ $($(pub(super) fn $field(app: &mut SolveApp, ui: &mut egui::Ui) -> egui::Response {
+ preference_settings!(@control app, ui, $field, $control($($args)*))
+ })?)*
+ }
+ };
+ (@control $app:ident, $ui:ident, $field:ident, check($label:literal $(, $help:literal)?)) => {
+ ui_kit::checkbox($ui, crate::i18n::tr_label($label), &mut $app.preferences.$field)
+ $(.on_hover_text(crate::i18n::tr_label($help)))?
+ };
+ (@control $app:ident, $ui:ident, $field:ident, check_tr($label:literal)) => {
+ ui_kit::checkbox($ui, crate::i18n::tr($label), &mut $app.preferences.$field)
+ };
+ (@control $app:ident, $ui:ident, $field:ident, check_id($label:literal)) => {
+ ui_kit::checkbox($ui, $app.tr($label), &mut $app.preferences.$field)
+ };
+ (@control $app:ident, $ui:ident, $field:ident, number($label:literal, $range:expr)) => {
+ ui_kit::row($ui, $app.tr($label), |ui| {
+ ui_kit::number_field(ui, &mut $app.preferences.$field, $range, 1.0, "")
+ })
+ };
+ (@control $app:ident, $ui:ident, $field:ident, enabled_slider($enabled:ident, $label:literal, $range:expr, $step:expr, $format:expr)) => {
+ ui_kit::row($ui, $app.tr_label($label), |ui| {
+ ui.add_enabled_ui($app.preferences.$enabled, |ui| {
+ ui_kit::formatted_slider(ui, &mut $app.preferences.$field, $range, $step, $format)
+ }).inner
+ })
+ };
+ (@control $app:ident, $ui:ident, $field:ident, slider($label:literal, $range:expr, $step:expr, $format:expr, $rect:literal)) => {
+ ui_kit::row($ui, $app.tr($label), |ui| {
+ let response = ui_kit::formatted_slider(ui, &mut $app.preferences.$field, $range, $step, $format);
+ crate::scenario::publish_rect($rect, response.rect);
+ response
+ })
+ };
+}
+
+preference_settings! {
/// Units of new designs.
- pub default_units: String,
+ default_units: String = "mm".into(), 0;
/// Mouse mapping: `fusion`, `solidworks` or `inventor`.
- pub nav: String,
+ nav: String = "fusion".into(), 1;
/// View orientation widget: original signed axes (default) or compact cube.
- pub navigator_style: NavigatorStyle,
+ navigator_style: NavigatorStyle = NavigatorStyle::default(), 1;
/// Show the radial ring and enable hold/flick gestures for viewport context menus.
- pub radial_context_menu: bool,
- /// Mouse gestures: a ring of tools on the right button (SolidWorks mouse mode only).
- pub mouse_gestures: crate::mouse_gesture::Config,
+ radial_context_menu: bool = false, 1 => check("Radial context menu");
+ /// Mouse gestures: a ring of tools on the right button.
+ mouse_gestures: crate::mouse_gesture::Config = Default::default(), 1;
/// The wheel zooms out when turned forward.
- pub zoom_reverse: bool,
+ zoom_reverse: bool = false, 1 => check("Reverse zoom direction");
/// What an orbit turns around.
- pub orbit_around: OrbitAround,
+ orbit_around: OrbitAround = OrbitAround::default(), 1;
/// The cursor preference as releases before the origin option saved it (`true` = the point
/// under the cursor). [`migrate`] folds it into `orbit_around` when saved preferences are
/// read, so an existing choice survives the upgrade; this version only writes `false`.
- pub orbit_cursor: bool,
+ orbit_cursor: bool = false, 1;
/// Whether a connected 3D mouse moves the view.
- pub space_mouse_enabled: bool,
+ space_mouse_enabled: bool = true, 1 => check("Navigate with SpaceNavigator / SpaceMouse");
/// Speed multiplier for 3D mouse navigation.
- pub space_mouse_speed: f32,
+ space_mouse_speed: f32 = 1.0, 1 => enabled_slider(space_mouse_enabled, "3D mouse speed", 0.25..=3.0, 0.05, |v| format!("{v:.2}×"));
/// Per physical axis of the cap (push X, Y, Z, then tilt X, Y, Z), whether it moves the view
/// the other way.
- pub space_mouse_reverse: [bool; 6],
+ space_mouse_reverse: [bool; 6] = [false; 6], 1;
/// Per physical axis of the cap, a multiplier on top of `space_mouse_speed`; 0 switches it off.
- pub space_mouse_axis_speed: [f32; 6],
+ space_mouse_axis_speed: [f32; 6] = [1.0; 6], 1;
/// Per 3D mouse (`space_mouse::Input::device`), the calibration that puts its axes on
- /// 3Dconnexion's. A device without one is read as it reports.
+ /// 3Dconnexion's. A device without one is read as it reports. Page resets keep calibrations.
#[serde(deserialize_with = "calibrations_that_read")]
- pub space_mouse_calibrations: std::collections::BTreeMap<String, solidcraft_space_mouse::Calibration>,
+ space_mouse_calibrations: std::collections::BTreeMap<String, solidcraft_space_mouse::Calibration> = Default::default();
/// Anti-aliasing samples (applies on restart).
- pub msaa: u32,
+ msaa: u32 = 4, PAGE_GRAPHICS;
/// Soft contact shading in the GPU viewport; optional and applied immediately.
- pub ambient_occlusion: bool,
+ ambient_occlusion: bool = false, PAGE_GRAPHICS;
/// The grid turns to the upright origin plane facing a side view (#1470). Off by default: the
/// grid stays on the ground plane (XY) whatever the view.
- pub grid_follows_view: bool,
+ grid_follows_view: bool = false => check("Grid follows the view", "Side views show the grid on the upright plane facing them instead of the ground");
/// How finely the viewport tessellates curved faces and edges: `coarse`, `normal`, `fine` or
/// `ultra` (#1287). Only the display plan the viewport draws; never the design or exports.
- pub display_quality: String,
+ display_quality: String = "normal".into(), PAGE_GRAPHICS;
/// Supersampling (#1288): the view drawn at this many times its pixels each way and filtered
/// down (1, 1.5 or 2; 1 is off).
- pub supersampling: f32,
+ supersampling: f32 = 1.0, PAGE_GRAPHICS;
/// Supersample only while the view holds still (full speed while orbiting).
- pub supersampling_adaptive: bool,
+ supersampling_adaptive: bool = true, PAGE_GRAPHICS => check_tr("ui.supersampling_adaptive");
/// Show the frame rate in the view's corner (the view then redraws every frame).
- pub show_frame_rate: bool,
+ show_frame_rate: bool = false, PAGE_GRAPHICS => check_id("ui.frame_rate");
/// Show world X/Y/Z component dimensions beside the total distance in Measure.
- pub measure_axis_distances: bool,
+ measure_axis_distances: bool = true, PAGE_GRAPHICS => check_id("settings.measure_axis_distances");
/// Decimals shown for lengths and angles.
- pub length_decimals: u8,
- pub angle_decimals: u8,
+ length_decimals: u8 = 2, 0 => number("ui.length_decimals", 0..=6);
+ angle_decimals: u8 = 1, 0 => number("ui.angle_decimals", 0..=6);
/// `dark`, `light` or `system` (follow the operating system), or a theme file's id: a
/// built-in one (`gruvbox-dark`, …) or one of `custom_themes` (#2255).
- pub theme: String,
+ theme: String = "dark".into(), 0;
/// Imported theme files (`theme_files`), kept here so they also work in the browser.
- pub custom_themes: Vec<crate::theme_files::ThemeFile>,
+ custom_themes: Vec<crate::theme_files::ThemeFile> = Vec::new();
/// Interface language (a registered locale ID).
- pub language: String,
+ language: String = "en".into(), 0;
/// Interface scale (1 = 100 %).
- pub ui_scale: f32,
+ 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
/// (#1290). Menus, dialogs and labels use it; glyphs it lacks fall back as before.
- pub ui_font: String,
+ ui_font: String = String::new(), 0;
/// Put the feature history above the parts browser in the left sidebar instead of along the
/// bottom of the viewport.
- pub timeline_left: bool,
+ timeline_left: bool = false, 0;
/// Height of the feature-history section when it shares the left sidebar with the browser.
- pub timeline_left_height: f32,
+ timeline_left_height: f32 = 360.0, 0;
/// Whether the browser below the left feature history is collapsed.
- pub timeline_left_browser_collapsed: bool,
+ timeline_left_browser_collapsed: bool = false, 0;
/// Width of the left sidebar holding the browser (and the feature history above it), which
/// the user drags wider or narrower at its right edge.
- pub browser_width: f32,
+ browser_width: f32 = DEFAULT_BROWSER_WIDTH, 0;
/// Draw the parts browser on a translucent card over the 3D view instead of a column of its
/// own, so the workspace keeps the whole window width.
- pub browser_float: bool,
+ browser_float: bool = false, 0 => check("Float it over the workspace");
/// The wheel zooms toward the point under the cursor (else toward the view's centre).
- pub zoom_to_cursor: bool,
+ zoom_to_cursor: bool = true, 1 => check("Zoom to the cursor", "The wheel zooms toward the point under the cursor (off: toward the view's centre)");
/// Spread discrete wheel input across frames (off: apply each event immediately).
- pub smooth_wheel_zoom: bool,
+ smooth_wheel_zoom: bool = true, 1 => check("Smooth wheel zoom", "Turn off to apply each wheel event immediately, without a smoothing tail");
/// Two-finger trackpad scroll pans (off: it zooms like the wheel); pinch always zooms.
- pub trackpad_pan: bool,
+ trackpad_pan: bool = true, 1;
/// Horizontal trackpad and thumb-wheel scrolling pans the view the other way (#2007).
- pub pan_reverse_x: bool,
+ pan_reverse_x: bool = false, 1 => check("Reverse horizontal pan direction", "Horizontal two-finger scrolling and the thumb wheel pan the other way");
/// View changes (axis view, Look At, Home) animate; `look_at_speed` scales how fast.
- pub look_at_anim: bool,
- pub look_at_speed: f32,
+ look_at_anim: bool = true, 1 => check("Animate view changes", "Axis view, Look At, Home and Fit");
+ look_at_speed: f32 = 1.0, 1, accept(0.25..=4.0) => enabled_slider(look_at_anim, "Animation speed", 0.5..=3.0, 0.25, |v| format!("{v:.2}×"));
/// Default modelling orientation: `z` (Z up) or `y` (Y up) (#3).
- pub up_axis: String,
+ up_axis: String = "z".into(), PAGE_DESIGN;
/// After a STEP or IGES file opens, offer to stand a Y-up part up (`stand_up`).
- pub offer_stand_up: bool,
+ offer_stand_up: bool = true, PAGE_DESIGN => check("Offer to stand up Y-up files", "After a STEP or IGES file opens with Z up, offer a quarter turn about X");
/// What a middle-button double-click in the view does: `home`, `fit` or `off`.
- pub middle_double_click: String,
+ middle_double_click: String = "home".into(), 1;
/// Colour vision mode (#778): `off`, `protan`, `deutan` or `tritan`.
- pub color_vision: crate::theme::ColorVision,
+ color_vision: crate::theme::ColorVision = crate::theme::ColorVision::Off, PAGE_GRAPHICS;
/// Check for updates at start and once a day (docs/updates.md).
- pub check_updates: bool,
+ check_updates: bool = true, 0;
/// When the last update check ran, and the versions skipped or put off (`update::Memo`).
- pub update: crate::update::Memo,
+ update: crate::update::Memo = crate::update::Memo::default();
/// Save as mesh: the last format (`stl` or `3mf`), whether it was sent to a slicer, which one
/// (an installed slicer's id or a program path), and the programs the user added (newest first).
- pub save_mesh_format: String,
+ save_mesh_format: String = "stl".into();
/// Hidden edges in the current-view DXF export (false: omit, true: dashed).
- pub view_dxf_dashed: bool,
+ view_dxf_dashed: bool = false;
/// Model-space chord tolerance for current-view DXF curves, in millimetres.
- pub view_dxf_tolerance: f64,
- pub save_mesh_send: bool,
- pub save_mesh_slicer: String,
- pub custom_slicers: Vec<String>,
+ view_dxf_tolerance: f64 = 0.01;
+ save_mesh_send: bool = false;
+ save_mesh_slicer: String = String::new();
+ custom_slicers: Vec<String> = Vec::new();
/// AI features (docs/agent-chat.md): the master switch. Off: no AI button, shortcut, menu
/// entry or panel, and nothing is looked for or started.
- pub ai_features: bool,
+ ai_features: bool = true, PAGE_AI;
/// The Assistant button in the application bar (the shortcut and View menu entry stay).
- pub ai_toolbar_button: bool,
+ ai_toolbar_button: bool = true, PAGE_AI;
/// Agents the user added (the installed ones are found by themselves). API keys are never
/// here: they live in the system keychain.
- pub agents: Vec<crate::agent_chat::agents::AgentConfig>,
+ agents: Vec<crate::agent_chat::agents::AgentConfig> = Vec::new();
/// The agent a new conversation starts with (an agent's id; empty: the first one available).
- pub agent_default: String,
+ agent_default: String = String::new();
/// How much the agent may do without asking (`ask`, `edits`, `all`), and per agent.
- pub ai_permissions: crate::agent_chat::agents::Mode,
- pub agent_permissions: std::collections::BTreeMap<String, crate::agent_chat::agents::Mode>,
+ ai_permissions: crate::agent_chat::agents::Mode = crate::agent_chat::agents::Mode::Edits, PAGE_AI;
+ agent_permissions: std::collections::BTreeMap<String, crate::agent_chat::agents::Mode> = Default::default(), PAGE_AI;
/// The model last chosen in the chat, per agent: put back when the agent offers it again.
- pub agent_models: std::collections::BTreeMap<String, String>,
+ agent_models: std::collections::BTreeMap<String, String> = Default::default();
/// "Always allow" answers: per agent, the tools it may use without asking.
- pub agent_always_allow: std::collections::BTreeMap<String, Vec<String>>,
+ agent_always_allow: std::collections::BTreeMap<String, Vec<String>> = Default::default();
/// The side the panel docks on (`left` or `right`), its width, and whether it is folded to a strip.
- pub agent_chat_side: String,
- pub agent_chat_width: f32,
- pub agent_chat_minimized: bool,
+ agent_chat_side: String = "right".into(), PAGE_AI;
+ agent_chat_width: f32 = 380.0, PAGE_AI;
+ agent_chat_minimized: bool = false, PAGE_AI;
/// Whether the chat is in its own window instead of the side panel, and that window's place
/// and size as the system last reported them (`[x, y, width, height]`, points; `x` can be
/// negative or past the main screen when the window sits on another one).
- pub agent_chat_popped: bool,
- pub agent_chat_window: Option<[f32; 4]>,
+ agent_chat_popped: bool = false, PAGE_AI;
+ agent_chat_window: Option<[f32; 4]> = None, PAGE_AI;
/// Changes the agent may make for one message.
- pub agent_chat_turn_limit: u32,
+ agent_chat_turn_limit: u32 = crate::agent_chat::gate::DEFAULT_TURN_LIMIT, PAGE_AI;
// ---- Sketch / selection modifier bindings (classic defaults; alternate mapping is opt-in) ----
/// Modifier that suppresses sketch auto-snap while drawing or dragging a sketch point.
/// Default: Alt/Option. Set to Ctrl/Cmd for the alternate mapping.
- pub suppress_sketch_snap: ModifierCombo,
+ suppress_sketch_snap: ModifierCombo = ModifierCombo::CTRL_ALT, 5;
/// Whether Alt/Option also frees gizmo / canvas manipulator arrows (Primary always does).
- pub manipulator_free_alt: bool,
+ manipulator_free_alt: bool = true, 5;
/// When true: Shift+click adds without removing; Primary toggles.
/// When false (default): Shift and Primary both toggle.
- pub selection_shift_add_only: bool,
+ selection_shift_add_only: bool = false, 6;
/// Plugin ids turned off (Preferences › Plugins). An installed plugin whose id is absent is on.
- pub disabled_plugins: std::collections::BTreeSet<String>,
+ disabled_plugins: std::collections::BTreeSet<String> = std::collections::BTreeSet::new(), PAGE_PLUGINS;
}
/// What a middle-button double-click in the view does.
@@ -442,82 +501,6 @@ impl MiddleDoubleClick {
}
}
-impl Default for Prefs {
- fn default() -> Self {
- Prefs {
- default_units: "mm".into(),
- nav: "fusion".into(),
- navigator_style: NavigatorStyle::default(),
- radial_context_menu: false,
- mouse_gestures: Default::default(),
- zoom_reverse: false,
- orbit_around: OrbitAround::default(),
- orbit_cursor: false,
- space_mouse_enabled: true,
- space_mouse_speed: 1.0,
- space_mouse_reverse: [false; 6],
- space_mouse_axis_speed: [1.0; 6],
- space_mouse_calibrations: Default::default(),
- msaa: 4,
- ambient_occlusion: false,
- grid_follows_view: false,
- display_quality: "normal".into(),
- supersampling: 1.0,
- supersampling_adaptive: true,
- show_frame_rate: false,
- measure_axis_distances: true,
- length_decimals: 2,
- angle_decimals: 1,
- theme: "dark".into(),
- custom_themes: Vec::new(),
- language: "en".into(),
- ui_scale: 1.0,
- ui_font: String::new(),
- timeline_left: false,
- timeline_left_height: 360.0,
- timeline_left_browser_collapsed: false,
- browser_width: DEFAULT_BROWSER_WIDTH,
- browser_float: false,
- zoom_to_cursor: true,
- smooth_wheel_zoom: true,
- trackpad_pan: true,
- pan_reverse_x: false,
- look_at_anim: true,
- look_at_speed: 1.0,
- up_axis: "z".into(),
- offer_stand_up: true,
- middle_double_click: "home".into(),
- color_vision: crate::theme::ColorVision::Off,
- check_updates: true,
- update: crate::update::Memo::default(),
- save_mesh_format: "stl".into(),
- view_dxf_dashed: false,
- view_dxf_tolerance: 0.01,
- save_mesh_send: false,
- save_mesh_slicer: String::new(),
- custom_slicers: Vec::new(),
- ai_features: true,
- ai_toolbar_button: true,
- agents: Vec::new(),
- agent_default: String::new(),
- ai_permissions: crate::agent_chat::agents::Mode::Edits,
- agent_permissions: Default::default(),
- agent_models: Default::default(),
- agent_always_allow: Default::default(),
- agent_chat_side: "right".into(),
- agent_chat_width: 380.0,
- agent_chat_minimized: false,
- agent_chat_popped: false,
- agent_chat_window: None,
- agent_chat_turn_limit: crate::agent_chat::gate::DEFAULT_TURN_LIMIT,
- suppress_sketch_snap: ModifierCombo::CTRL_ALT,
- manipulator_free_alt: true,
- selection_shift_add_only: false,
- disabled_plugins: std::collections::BTreeSet::new(),
- }
- }
-}
-
/// The preferences window.
#[derive(Default)]
pub struct PrefsWindow {
@@ -615,16 +598,21 @@ fn theme_row(app: &mut SolveApp, ui: &mut egui::Ui) {
crate::scenario::publish_handle("prefs:theme", combo.rect.center());
});
ui.horizontal_wrapped(|ui| {
- if ui_kit::secondary_button(ui, app.tr_label("Import…")).on_hover_text(app.tr_label("Add a theme file (.json) and use it")).clicked() {
+ if ui_kit::button(ui, app.tr_label("Import…"), ui_kit::Button::Normal)
+ .on_hover_text(app.tr_label("Add a theme file (.json) and use it"))
+ .clicked()
+ {
action = Some("import");
}
- if ui_kit::secondary_button(ui, app.tr_label("Export…"))
+ if ui_kit::button(ui, app.tr_label("Export…"), ui_kit::Button::Normal)
.on_hover_text(app.tr_label("Save the theme on now as a complete theme file, to start a new one from"))
.clicked()
{
action = Some("export");
}
- if imported && ui_kit::secondary_button(ui, app.tr_label("Remove")).on_hover_text(app.tr_label("Remove this imported theme")).clicked() {
+ if imported
+ && ui_kit::button(ui, app.tr_label("Remove"), ui_kit::Button::Normal).on_hover_text(app.tr_label("Remove this imported theme")).clicked()
+ {
action = Some("remove");
}
});
@@ -700,94 +688,31 @@ fn ui_font_row(app: &mut SolveApp, ui: &mut egui::Ui) {
/// Restore Defaults for one page.
fn defaults(app: &mut SolveApp, page: usize) {
- let d = Prefs::default();
- let p = &mut app.preferences;
+ let msaa = app.preferences.msaa;
+ reset_preferences(&mut app.preferences, page);
match page {
0 => {
- p.theme = d.theme;
- p.language = d.language;
- p.ui_scale = d.ui_scale;
- p.ui_font = d.ui_font;
- p.timeline_left = d.timeline_left;
- p.timeline_left_height = d.timeline_left_height;
- p.timeline_left_browser_collapsed = d.timeline_left_browser_collapsed;
- p.browser_width = d.browser_width;
- p.browser_float = d.browser_float;
- p.default_units = d.default_units;
- p.length_decimals = d.length_decimals;
- p.angle_decimals = d.angle_decimals;
- p.check_updates = d.check_updates;
app.ui.dark = true;
app.ui.agent_cursor = Default::default();
app.autosave_minutes = 5.0;
set_autosave(app);
}
- PAGE_PLUGINS => p.disabled_plugins.clear(),
- PAGE_AI => {
- // The agents the user added and their "always allow" answers stay.
- p.ai_features = d.ai_features;
- p.ai_toolbar_button = d.ai_toolbar_button;
- p.ai_permissions = d.ai_permissions;
- p.agent_permissions = d.agent_permissions;
- p.agent_chat_side = d.agent_chat_side;
- p.agent_chat_width = d.agent_chat_width;
- p.agent_chat_minimized = d.agent_chat_minimized;
- p.agent_chat_popped = d.agent_chat_popped;
- p.agent_chat_window = d.agent_chat_window;
- p.agent_chat_turn_limit = d.agent_chat_turn_limit;
- }
- 1 => {
- p.nav = d.nav;
- p.navigator_style = d.navigator_style;
- p.radial_context_menu = d.radial_context_menu;
- p.mouse_gestures = d.mouse_gestures;
- p.zoom_reverse = d.zoom_reverse;
- p.zoom_to_cursor = d.zoom_to_cursor;
- p.smooth_wheel_zoom = d.smooth_wheel_zoom;
- p.trackpad_pan = d.trackpad_pan;
- p.pan_reverse_x = d.pan_reverse_x;
- p.orbit_around = d.orbit_around;
- p.orbit_cursor = d.orbit_cursor;
- p.space_mouse_enabled = d.space_mouse_enabled;
- p.space_mouse_speed = d.space_mouse_speed;
- p.space_mouse_reverse = d.space_mouse_reverse;
- p.space_mouse_axis_speed = d.space_mouse_axis_speed;
- // The 3D mice the user calibrated stay: a calibration describes the device.
- p.look_at_anim = d.look_at_anim;
- p.look_at_speed = d.look_at_speed;
- p.middle_double_click = d.middle_double_click;
- }
+ 1 | PAGE_DESIGN | PAGE_AI => {}
PAGE_SHORTCUTS => crate::keymap::reset(app, None),
- PAGE_DESIGN => {
- p.up_axis = d.up_axis;
- p.offer_stand_up = d.offer_stand_up;
- }
PAGE_GRAPHICS => {
- let msaa = p.msaa != d.msaa;
- p.msaa = d.msaa;
- p.ambient_occlusion = d.ambient_occlusion;
- p.display_quality = d.display_quality;
- p.supersampling = d.supersampling;
- p.supersampling_adaptive = d.supersampling_adaptive;
- p.show_frame_rate = d.show_frame_rate;
- p.measure_axis_distances = d.measure_axis_distances;
- p.color_vision = d.color_vision;
app.ui.visual_style = 0;
app.ui.show_grid = true;
app.ui.ground_shadow = true;
app.ui.perspective = false;
- if msaa {
+ if app.preferences.msaa != msaa {
save_graphics(app);
}
}
5 => {
app.session.auto_project = true;
- p.suppress_sketch_snap = d.suppress_sketch_snap;
- p.manipulator_free_alt = d.manipulator_free_alt;
}
_ => {
app.ui.pick_bodies = false;
- p.selection_shift_add_only = d.selection_shift_add_only;
}
}
}
@@ -926,7 +851,6 @@ pub fn parse_number(text: &str) -> Option<f64> {
}
// Existing callers retain their numeric-editor API; kit owns the widget.
-pub use crate::ui_kit::length_drag;
/// A length typed into a field, in millimetres: a bare number is in the design's units (`scale`
/// units per millimetre); an explicit unit ("10 mm", "0.5 in", "2 cm + 3 mm") is honoured.
@@ -1063,8 +987,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
ui.set_width(t.form_label_width * 2.0);
for (i, title) in PAGES.iter().enumerate() {
let tab = ui_kit::list_picker(ui, title, app.tr_label(title), app.prefs_window.section == i);
- crate::scenario::publish_rect(&format!("prefs:page:{title}"), tab.rect);
- crate::scenario::publish_handle(&format!("prefs:page:{title}"), tab.rect.center());
+ crate::scenario::publish_target(&format!("prefs:page:{title}"), tab.rect);
if tab.clicked() {
app.prefs_window.section = i;
app.keymap.read_only = false;
@@ -1084,14 +1007,16 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
crate::scenario::publish_rect("prefs:page_body", scroll.inner_rect);
}
});
- if ui_kit::secondary_button(ui, app.tr("ui.restore_defaults")).on_hover_text(app.tr("ui.reset_the_settings_on_this_page")).clicked() {
+ if ui_kit::button(ui, app.tr("ui.restore_defaults"), ui_kit::Button::Normal)
+ .on_hover_text(app.tr("ui.reset_the_settings_on_this_page"))
+ .clicked()
+ {
button = Some("defaults");
}
});
for name in ["window", "footer", "ok", "apply", "cancel"] {
if let Some(rect) = crate::scenario::rect_of(&format!("dialog:{name}")) {
- crate::scenario::publish_rect(&format!("prefs:{name}"), rect);
- crate::scenario::publish_handle(&format!("prefs:{name}"), rect.center());
+ crate::scenario::publish_target(&format!("prefs:{name}"), rect);
}
}
crate::space_mouse_calibration::show(app, ctx);
@@ -1172,24 +1097,30 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
});
});
theme_row(app, ui);
- ui_kit::row(ui, app.tr("ui.ui_scale"), |ui| {
- let scale = ui_kit::formatted_slider(ui, &mut app.preferences.ui_scale, 0.5..=2.5, 0.05, |v| format!("{:.0} %", v * 100.0));
- crate::scenario::publish_rect("prefs:scale", scale.rect);
- });
+ 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));
}
ui_kit::row(ui, app.tr("ui.feature_history"), |ui| {
let mut selected = usize::from(app.preferences.timeline_left);
- if ui_kit::segmented(ui, &mut selected, &[crate::i18n::tr("ui.timeline_bottom"), crate::i18n::tr("ui.timeline_left_sidebar")]) {
+ if ui_kit::segmented(
+ ui,
+ &mut selected,
+ &[crate::i18n::tr("ui.timeline_bottom"), crate::i18n::tr("ui.timeline_left_sidebar")],
+ Default::default(),
+ ) {
app.preferences.timeline_left = selected == 1;
}
});
- ui_kit::note(ui, "timeline", app.tr("ui.timeline_left_note"));
+ 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| {
- ui_kit::checkbox(ui, crate::i18n::tr_label("Float it over the workspace"), &mut app.preferences.browser_float);
+ setting::browser_float(app, ui);
});
- ui_kit::note(ui, "browser", app.tr_label("The tree draws on a translucent card over the 3D view instead of a column of its own."));
+ ui_kit::text(
+ ui,
+ app.tr_label("The tree draws on a translucent card over the 3D view instead of a column of its own."),
+ ui_kit::Text::Note("browser"),
+ );
ui_kit::row(ui, app.tr("ui.units_of_new_designs"), |ui| {
let mut selected = UNITS.iter().position(|u| *u == app.preferences.default_units).unwrap_or(0);
ui_kit::dropdown(ui, "pref_units", &mut selected, &UNITS);
@@ -1202,13 +1133,9 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
set_autosave(app);
}
});
- ui_kit::note(ui, "autosave", crate::i18n::tr_label("0 turns it off"));
- ui_kit::row(ui, app.tr("ui.length_decimals"), |ui| {
- ui_kit::number_field(ui, &mut app.preferences.length_decimals, 0..=6, 1.0, "");
- });
- ui_kit::row(ui, app.tr("ui.angle_decimals"), |ui| {
- ui_kit::number_field(ui, &mut app.preferences.angle_decimals, 0..=6, 1.0, "");
- });
+ ui_kit::text(ui, crate::i18n::tr_label("0 turns it off"), ui_kit::Text::Note("autosave"));
+ setting::length_decimals(app, ui);
+ setting::angle_decimals(app, ui);
ui_kit::row(ui, app.tr("ui.agent_cursor"), |ui| {
ui_kit::checkbox(ui, crate::i18n::tr_label("Show the pointer an AI agent moves (#35)"), &mut app.ui.agent_cursor.show);
});
@@ -1234,16 +1161,16 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
});
});
if app.preferences.nav == TOUCHPAD_NAV {
- ui_kit::note(ui, "navigation", crate::i18n::tr("nav.touchpad.help"));
+ ui_kit::text(ui, crate::i18n::tr("nav.touchpad.help"), ui_kit::Text::Note("navigation"));
} else {
let snap_help = if app.preferences.nav == OPENSCAD_NAV { "" } else { "; hold Shift during orbit to snap" };
let raw_help = format!(
"{}; Ctrl+left drag on empty space orbits{snap_help}; hold Space to pan; the wheel zooms",
nav_preset(&app.preferences.nav).help
);
- ui_kit::note(ui, "navigation", crate::i18n::tr_label(&raw_help));
+ ui_kit::text(ui, crate::i18n::tr_label(&raw_help), ui_kit::Text::Note("navigation"));
}
- ui_kit::checkbox(ui, crate::i18n::tr_label("Radial context menu"), &mut app.preferences.radial_context_menu);
+ setting::radial_context_menu(app, ui);
crate::mouse_gesture::nav_rows(app, ui, t);
ui_kit::row(ui, app.tr_label("View navigator"), |ui| {
let picker =
@@ -1255,21 +1182,17 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
crate::i18n::tr_label(style.label()),
app.preferences.navigator_style == style,
);
- crate::scenario::publish_rect(&format!("prefs:navigator:{}", style.label()), r.rect);
- crate::scenario::publish_handle(&format!("prefs:navigator:{}", style.label()), r.rect.center());
+ crate::scenario::publish_target(&format!("prefs:navigator:{}", style.label()), r.rect);
if r.clicked() {
app.preferences.navigator_style = style;
}
}
});
- crate::scenario::publish_rect("prefs:navigator", picker.rect);
- crate::scenario::publish_handle("prefs:navigator", picker.rect.center());
+ crate::scenario::publish_target("prefs:navigator", picker.rect);
});
- ui_kit::checkbox(ui, crate::i18n::tr_label("Reverse zoom direction"), &mut app.preferences.zoom_reverse);
- ui_kit::checkbox(ui, crate::i18n::tr_label("Zoom to the cursor"), &mut app.preferences.zoom_to_cursor)
- .on_hover_text(crate::i18n::tr_label("The wheel zooms toward the point under the cursor (off: toward the view's centre)"));
- ui_kit::checkbox(ui, crate::i18n::tr_label("Smooth wheel zoom"), &mut app.preferences.smooth_wheel_zoom)
- .on_hover_text(crate::i18n::tr_label("Turn off to apply each wheel event immediately, without a smoothing tail"));
+ setting::zoom_reverse(app, ui);
+ setting::zoom_to_cursor(app, ui);
+ setting::smooth_wheel_zoom(app, ui);
let touchpad = app.preferences.nav == TOUCHPAD_NAV;
ui.add_enabled_ui(!touchpad, |ui| {
ui_kit::checkbox(ui, crate::i18n::tr_label("Two-finger scroll pans"), &mut app.preferences.trackpad_pan).on_hover_text(if touchpad {
@@ -1280,8 +1203,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
)
});
});
- ui_kit::checkbox(ui, crate::i18n::tr_label("Reverse horizontal pan direction"), &mut app.preferences.pan_reverse_x)
- .on_hover_text(crate::i18n::tr_label("Horizontal two-finger scrolling and the thumb wheel pan the other way"));
+ setting::pan_reverse_x(app, ui);
ui_kit::row(ui, app.tr_label("Orbit around"), |ui| {
let modes = [OrbitAround::Origin, OrbitAround::ViewCentre, OrbitAround::Cursor];
let mut selected = modes.iter().position(|m| *m == app.preferences.orbit_around).unwrap_or(1);
@@ -1289,6 +1211,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
ui,
&mut selected,
&[crate::i18n::tr_label("Origin"), crate::i18n::tr_label("View centre"), crate::i18n::tr_label("Point under the cursor")],
+ Default::default(),
) && let Some(mode) = modes.get(selected)
{
app.preferences.orbit_around = *mode;
@@ -1300,19 +1223,10 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
for (m, id, label) in MiddleDoubleClick::ALL { if ui_kit::list_picker(ui, id, crate::i18n::tr_label(label), current == m).clicked() { app.preferences.middle_double_click = id.into(); } }
}).on_hover_text(crate::i18n::tr_label("Double-clicking the middle button in the view: Home (the home view, framing what is shown), Fit (frame what is shown, keeping the orientation) or nothing"));
});
- ui_kit::checkbox(ui, crate::i18n::tr_label("Animate view changes"), &mut app.preferences.look_at_anim)
- .on_hover_text(crate::i18n::tr_label("Axis view, Look At, Home and Fit"));
- ui_kit::row(ui, app.tr_label("Animation speed"), |ui| {
- ui.add_enabled_ui(app.preferences.look_at_anim, |ui| {
- ui_kit::formatted_slider(ui, &mut app.preferences.look_at_speed, 0.5..=3.0, 0.25, |v| format!("{v:.2}×"));
- });
- });
- ui_kit::checkbox(ui, crate::i18n::tr_label("Navigate with SpaceNavigator / SpaceMouse"), &mut app.preferences.space_mouse_enabled);
- ui_kit::row(ui, app.tr_label("3D mouse speed"), |ui| {
- ui.add_enabled_ui(app.preferences.space_mouse_enabled, |ui| {
- ui_kit::formatted_slider(ui, &mut app.preferences.space_mouse_speed, 0.25..=3.0, 0.05, |v| format!("{v:.2}×"));
- });
- });
+ setting::look_at_anim(app, ui);
+ setting::look_at_speed(app, ui);
+ setting::space_mouse_enabled(app, ui);
+ setting::space_mouse_speed(app, ui);
for (axis, name) in SPACE_MOUSE_AXES.iter().enumerate() {
ui_kit::row(ui, crate::i18n::tr_label(name), |ui| {
ui.add_enabled_ui(app.preferences.space_mouse_enabled, |ui| {
@@ -1331,14 +1245,14 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
let device = app.space_mouse.device.clone();
let saved = device.as_ref().is_some_and(|device| app.preferences.space_mouse_calibrations.contains_key(device));
ui.add_enabled_ui(app.preferences.space_mouse_enabled && device.is_some(), |ui| {
- if ui_kit::secondary_button(ui, app.tr("ui.space_mouse_calibrate"))
+ if ui_kit::button(ui, app.tr("ui.space_mouse_calibrate"), ui_kit::Button::Normal)
.on_hover_text(app.tr("ui.space_mouse_calibrate_tip"))
.clicked()
{
crate::space_mouse_calibration::start(app);
}
if saved
- && ui_kit::secondary_button(ui, app.tr("ui.space_mouse_forget")).clicked()
+ && ui_kit::button(ui, app.tr("ui.space_mouse_forget"), ui_kit::Button::Normal).clicked()
&& let Some(device) = &device
{
app.preferences.space_mouse_calibrations.remove(device);
@@ -1349,7 +1263,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
(Some(device), true) => format!("{} ({device})", app.tr("ui.space_mouse_calibrated")),
(Some(device), false) => format!("{} ({device})", app.tr("ui.space_mouse_not_calibrated")),
};
- ui_kit::text_block(ui, "calibration_status", &status, false);
+ ui_kit::text(ui, &status, ui_kit::Text::Report("calibration_status", false));
});
let enabled = app.preferences.space_mouse_enabled;
let (label, tip) = (app.tr("ui.space_mouse_dead_zone").to_owned(), app.tr("ui.space_mouse_dead_zone_tip").to_owned());
@@ -1369,22 +1283,25 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
});
crate::space_mouse_calibration::dead_zone_pads(ui, calibration, raw);
}
- ui_kit::note(ui, "space_mouse", crate::i18n::tr_label("Move and rotate the view together; sketches use pan and zoom only."));
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("Move and rotate the view together; sketches use pan and zoom only."),
+ ui_kit::Text::Note("space_mouse"),
+ );
}
PAGE_DESIGN => {
ui_kit::row(ui, app.tr_label("Default modelling orientation"), |ui| {
let mut selected = usize::from(app.preferences.up_axis == "y");
- if ui_kit::segmented(ui, &mut selected, &[crate::i18n::tr_label("Z up"), crate::i18n::tr_label("Y up")]) {
+ if ui_kit::segmented(ui, &mut selected, &[crate::i18n::tr_label("Z up"), crate::i18n::tr_label("Y up")], Default::default()) {
app.preferences.up_axis = if selected == 1 { "y" } else { "z" }.into();
}
});
- ui_kit::note(
+ ui_kit::text(
ui,
- "orientation",
crate::i18n::tr_label("Which axis points up in the views (axis view, Home, Look At). Designs are unchanged."),
+ ui_kit::Text::Note("orientation"),
);
- ui_kit::checkbox(ui, crate::i18n::tr_label("Offer to stand up Y-up files"), &mut app.preferences.offer_stand_up)
- .on_hover_text(crate::i18n::tr_label("After a STEP or IGES file opens with Z up, offer a quarter turn about X"));
+ setting::offer_stand_up(app, ui);
}
PAGE_GRAPHICS => {
ui_kit::row(ui, app.tr("ui.graphics_preset"), |ui| graphics_preset_selector(app, ui));
@@ -1395,8 +1312,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
});
ui_kit::checkbox(ui, crate::i18n::tr_label("Grid"), &mut app.ui.show_grid);
ui.add_enabled_ui(app.ui.show_grid, |ui| {
- ui_kit::checkbox(ui, crate::i18n::tr_label("Grid follows the view"), &mut app.preferences.grid_follows_view)
- .on_hover_text(crate::i18n::tr_label("Side views show the grid on the upright plane facing them instead of the ground"));
+ setting::grid_follows_view(app, ui);
});
ui_kit::checkbox(ui, crate::i18n::tr_label("Ground shadow"), &mut app.ui.ground_shadow);
ambient_occlusion_checkbox(app, ui, "Ambient occlusion");
@@ -1419,9 +1335,9 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
if app.preferences.color_vision != mode {
ui.ctx().request_repaint();
}
- ui_kit::inline_text(ui, app.tr("ui.colour_vision_sample"));
+ ui_kit::text(ui, app.tr("ui.colour_vision_sample"), ui_kit::Text::Inline);
colour_vision_sample(ui, t);
- ui_kit::note(ui, "colour_vision", app.tr("ui.colour_vision_note"));
+ ui_kit::text(ui, app.tr("ui.colour_vision_note"), ui_kit::Text::Note("colour_vision"));
});
ui_kit::row(ui, app.tr("ui.anti_aliasing"), |ui| {
ui_kit::dropdown_menu(ui, "pref_msaa", &format!("{}×", app.preferences.msaa), |ui| {
@@ -1437,7 +1353,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
}
});
});
- ui_kit::note(ui, "msaa", app.tr("settings.msaa_applies_on_restart"));
+ ui_kit::text(ui, app.tr("settings.msaa_applies_on_restart"), ui_kit::Text::Note("msaa"));
ui_kit::row(ui, app.tr("ui.display_quality"), |ui| {
use solidcraft_engine::doc::display_quality::DisplayQuality;
let label = |q: DisplayQuality| crate::i18n::tr(&format!("ui.display_quality_{}", q.id())).to_string();
@@ -1450,7 +1366,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
}
});
});
- ui_kit::note(ui, "quality", app.tr("settings.display_quality_note"));
+ ui_kit::text(ui, app.tr("settings.display_quality_note"), ui_kit::Text::Note("quality"));
ui_kit::row(ui, app.tr("ui.supersampling"), |ui| {
let ss_label = |f: f32| if f > 1.0 { format!("{f}×") } else { crate::i18n::tr("ui.supersampling_off").into() };
ui_kit::dropdown_menu(ui, "pref_ssaa", &ss_label(app.preferences.supersampling), |ui| {
@@ -1462,22 +1378,22 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
});
});
ui.add_enabled_ui(app.preferences.supersampling > 1.0, |ui| {
- ui_kit::checkbox(ui, crate::i18n::tr("ui.supersampling_adaptive"), &mut app.preferences.supersampling_adaptive);
+ setting::supersampling_adaptive(app, ui);
});
- ui_kit::note(ui, "supersampling", app.tr("settings.supersampling_note"));
+ ui_kit::text(ui, app.tr("settings.supersampling_note"), ui_kit::Text::Note("supersampling"));
ui_kit::row(ui, app.tr_label("Renderer"), |ui| {
let renderer = match (&app.viewport.gpu, &app.help.gpu) {
(Some(_), Some(g)) => format!("GPU: {g}"),
(Some(_), None) => "GPU".into(),
_ => crate::i18n::tr("prefs.cpu").into(),
};
- ui_kit::inline_text(ui, &renderer);
+ ui_kit::text(ui, &renderer, ui_kit::Text::Inline);
});
- let response = ui_kit::checkbox(ui, app.tr("settings.measure_axis_distances"), &mut app.preferences.measure_axis_distances);
+ let response = setting::measure_axis_distances(app, ui);
crate::scenario::publish_rect("prefs:measure_axis_distances", response.rect);
response.on_hover_text(app.tr("settings.measure_axis_distances_help"));
- ui_kit::checkbox(ui, app.tr("ui.frame_rate"), &mut app.preferences.show_frame_rate);
- ui_kit::note(ui, "frame_rate", app.tr("settings.frame_rate_note"));
+ setting::show_frame_rate(app, ui);
+ ui_kit::text(ui, app.tr("settings.frame_rate_note"), ui_kit::Text::Note("frame_rate"));
}
5 => {
let mut auto = app.session.auto_project;
@@ -1495,7 +1411,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
}
});
});
- ui_kit::note(ui, "suppress_snap", crate::i18n::tr_label("ui.suppress_auto_snap_note"));
+ ui_kit::text(ui, crate::i18n::tr_label("ui.suppress_auto_snap_note"), ui_kit::Text::Note("suppress_snap"));
ui_kit::checkbox(ui, crate::i18n::tr_label("Manipulator free drag also on Alt/Option"), &mut app.preferences.manipulator_free_alt)
.on_hover_text(crate::i18n::tr_label(
"On: Alt/Option or Ctrl/Cmd on extrude / gizmo arrows disables value snapping. Off: Ctrl/Cmd only.",
@@ -1808,7 +1724,7 @@ pub fn set(app: &mut SolveApp, p: &serde_json::Value) -> Result<serde_json::Valu
if new.disabled_plugins.len() > crate::plugins::MAX_DISABLED || new.disabled_plugins.iter().any(|id| !crate::plugins::valid_id(id)) {
return Err(format!("`disabled_plugins` must be at most {} ids of lowercase letters, digits and hyphens", crate::plugins::MAX_DISABLED));
}
- if !(0.5..=2.5).contains(&new.ui_scale) || !(0.25..=4.0).contains(&new.look_at_speed) {
+ if !accepted::ui_scale(&new) || !accepted::look_at_speed(&new) {
return Err("`ui_scale` must be 0.5…2.5 and `look_at_speed` 0.25…4".into());
}
if solidcraft_engine::doc::display_quality::DisplayQuality::parse(&new.display_quality).is_none() {
diff --git a/crates/ui-egui/src/prefs_notice.rs b/crates/ui-egui/src/prefs_notice.rs
index 7cbc2607f5..96e47d8ac9 100644
--- a/crates/ui-egui/src/prefs_notice.rs
+++ b/crates/ui-egui/src/prefs_notice.rs
@@ -13,9 +13,9 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let (closed, action) = ui_kit::Prompt::new(egui::Id::new("sc_settings_reset"), "settings", app.tr("settings.reset_title"))
.actions(app.tr("ui.open_preferences"), app.tr("ui.heading_ok"), None)
.show(ctx, true, |ui| {
- ui_kit::text_block(ui, "intro", app.tr("settings.reset_intro"), false);
+ ui_kit::text(ui, app.tr("settings.reset_intro"), ui_kit::Text::Report("intro", false));
for (index, reset) in app.settings_reset.iter().enumerate() {
- ui_kit::text_block(ui, &format!("reset:{index}"), &format!("• {}", reset.message()), false);
+ ui_kit::text(ui, &format!("• {}", reset.message()), ui_kit::Text::Report(&format!("reset:{index}"), false));
}
});
if closed || action != ui_kit::Action::None {
diff --git a/crates/ui-egui/src/preselect_tests.rs b/crates/ui-egui/src/preselect_tests.rs
index 1feb8008e5..05ff9861af 100644
--- a/crates/ui-egui/src/preselect_tests.rs
+++ b/crates/ui-egui/src/preselect_tests.rs
@@ -1,6 +1,7 @@
//! Pre-selection fills every input of a command, each item going to the input that takes its
//! type, whether the command starts from a shortcut, the toolbar or a menu.
+use crate::test_support::app_with_script as app_with;
use serde_json::json;
use solidcraft_engine::doc::expr::Kind as ValueKind;
use solidcraft_engine::geom::Vec3;
@@ -51,8 +52,8 @@ fn confirming_coplanar_body_faces_uses_one_atomic_extrusion() {
assert!((volume - 11_968.0).abs() < 1e-5, "{volume}");
}
+use crate::SolveApp;
use crate::dialogs::{Dialog, Kind, apply_commands};
-use crate::{Services, SolveApp};
#[test]
fn feature_mirror_and_patterns_reopen_as_feature_replays_even_for_body_creators() {
@@ -473,12 +474,6 @@ fn cylinder_emboss_edit_retains_second_source_and_author_paths_and_all_profiles(
assert_eq!(h.app.session.active_component, 0);
}
-fn app_with(script: serde_json::Value) -> SolveApp {
- let mut s = Session::default();
- s.run_script(&script).unwrap();
- SolveApp::new(s, Services::default())
-}
-
#[test]
fn cylinder_emboss_profile_guide_uses_target_or_unique_foreign_sketch_frame() {
for target_owned in [true, false] {
diff --git a/crates/ui-egui/src/recovery_ui.rs b/crates/ui-egui/src/recovery_ui.rs
index 6a28e9b46a..957f370623 100644
--- a/crates/ui-egui/src/recovery_ui.rs
+++ b/crates/ui-egui/src/recovery_ui.rs
@@ -59,26 +59,25 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let (closed, action) = ui_kit::Prompt::new(egui::Id::new("sc_recover_prompt"), "restore", crate::i18n::tr_label("Recover unsaved design?"))
.actions("", crate::i18n::tr_label("Later"), None)
.show(ctx, true, |ui| {
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "intro",
crate::i18n::tr_label("SolidCraft closed before these designs were saved. Their last autosave can be opened."),
- false,
+ ui_kit::Text::Report("intro", false),
);
for (index, e) in app.recoverable.iter().take(20).enumerate() {
ui_kit::divider(ui, &format!("entry:{index}"));
ui_kit::label_actions(ui, &e.name, |ui| {
- if ui_kit::secondary_button(ui, crate::i18n::tr_label("Recover")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label("Recover"), ui_kit::Button::Normal).clicked() {
act = Some((e.clone(), true));
}
- if ui_kit::secondary_button(ui, crate::i18n::tr_label("Discard")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr_label("Discard"), ui_kit::Button::Normal).clicked() {
act = Some((e.clone(), false));
}
});
let file = e.path.clone().unwrap_or_else(|| crate::i18n::tr("recovery.never_saved").to_string());
let detail =
crate::i18n::format("recovery.detail", &[("file", &file), ("features", &e.features.to_string()), ("when", &ago(e.saved_at))]);
- ui_kit::note(ui, &format!("detail:{index}"), &detail);
+ ui_kit::text(ui, &detail, ui_kit::Text::Note(&format!("detail:{index}")));
}
});
let later = closed || action != ui_kit::Action::None;
diff --git a/crates/ui-egui/src/render_workspace.rs b/crates/ui-egui/src/render_workspace.rs
index 26e971f177..f654379d6a 100644
--- a/crates/ui-egui/src/render_workspace.rs
+++ b/crates/ui-egui/src/render_workspace.rs
@@ -211,20 +211,20 @@ pub fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {
app.cam.fov = if perspective { std::f64::consts::FRAC_PI_4 } else { 0.0 };
app.render_workspace.view.dirty = true;
}
- if crate::ui_kit::secondary_button(ui, app.tr("render.fit")).clicked() {
+ if crate::ui_kit::button(ui, app.tr("render.fit"), crate::ui_kit::Button::Normal).clicked() {
match solidcraft_engine::product_scene::extract(&app.session) {
Ok(scene) if !scene.bounds.is_empty() => app.cam.fit(&scene.bounds),
Err(e) => app.set_status(e.to_string(), true),
_ => {}
}
}
- if crate::ui_kit::secondary_button(ui, app.tr("render.restore_camera")).clicked() {
+ if crate::ui_kit::button(ui, app.tr("render.restore_camera"), crate::ui_kit::Button::Normal).clicked() {
let name = app.render_workspace.view.name.clone();
if app.run("render.settings.apply", json!({"name":name})).is_ok() {
app.follow_view_request(false);
}
}
- if crate::ui_kit::secondary_button(ui, app.tr("render.save_setup")).clicked() {
+ if crate::ui_kit::button(ui, app.tr("render.save_setup"), crate::ui_kit::Button::Normal).clicked() {
let name = app.render_workspace.view.name.clone();
let setup = RenderSetup { camera: app.cam, ..app.render_workspace.view.draft.clone() };
if app.run("render.settings.set", json!({"name":name,"set":setup})).is_ok() {
@@ -234,13 +234,13 @@ pub fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {
if app.render_workspace.view.dirty {
ui.label(app.tr("render.unsaved"));
}
- if crate::ui_kit::secondary_button(ui, app.tr("render.reload_settings")).clicked() {
+ if crate::ui_kit::button(ui, app.tr("render.reload_settings"), crate::ui_kit::Button::Normal).clicked() {
app.render_workspace.view.dirty = false;
app.render_workspace.revision = u64::MAX;
}
if app.render_workspace.view.draft.backend.as_str() != "builtin" || app.render_workspace.view.draft.mode != RenderMode::Preview {
ui.label(app.tr("render.unavailable_preview"));
- if crate::ui_kit::secondary_button(ui, app.tr("render.use_preview")).clicked() {
+ if crate::ui_kit::button(ui, app.tr("render.use_preview"), crate::ui_kit::Button::Normal).clicked() {
app.render_workspace.view.draft.backend = solidcraft_engine::render::builtin_backend().id;
app.render_workspace.view.draft.mode = RenderMode::Preview;
app.render_workspace.view.dirty = true;
@@ -250,7 +250,7 @@ pub fn panel(app: &mut SolveApp, ui: &mut egui::Ui) {
image_controls(app, ui);
ui.separator();
ui.small(app.tr("render.navigation_help"));
- if crate::ui_kit::secondary_button(ui, app.tr("render.return_design")).clicked()
+ if crate::ui_kit::button(ui, app.tr("render.return_design"), crate::ui_kit::Button::Normal).clicked()
&& let Err(e) = enter(app, false)
{
app.set_status(e, true);
@@ -279,7 +279,7 @@ fn image_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
&& (w, h) != size
{
ui.small(app.tr("render.image_too_large"));
- if crate::ui_kit::secondary_button(ui, format!("{} {w} × {h}", app.tr("render.image_use_largest"))).clicked() {
+ if crate::ui_kit::button(ui, format!("{} {w} × {h}", app.tr("render.image_use_largest")), crate::ui_kit::Button::Normal).clicked() {
app.render_workspace.view.draft.width = u32::try_from(w).unwrap_or(1);
app.render_workspace.view.draft.height = u32::try_from(h).unwrap_or(1);
app.render_workspace.view.dirty = true;
@@ -287,7 +287,7 @@ fn image_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
}
let transparent_label = app.tr("render.image_transparent").to_string();
crate::ui_kit::checkbox(ui, &transparent_label, &mut app.render_workspace.view.transparent);
- if crate::ui_kit::secondary_button(ui, app.tr("render.image_check")).clicked() {
+ if crate::ui_kit::button(ui, app.tr("cmd.render_preflight"), crate::ui_kit::Button::Normal).clicked() {
let settings = RenderSetup { camera: app.cam, ..app.render_workspace.view.draft.clone() };
if app.run("render.preflight", json!({"settings":settings,"transparent_background":app.render_workspace.view.transparent})).is_ok() {
app.set_status(app.tr("render.image_supported").to_string(), false);
@@ -324,7 +324,7 @@ fn image_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
let total = status["progress"]["total"].as_u64().unwrap_or(1).max(1);
crate::ui_kit::progress(ui, "render", (done as f64 / total as f64).clamp(0.0, 1.0) as f32);
ui.ctx().request_repaint();
- if crate::ui_kit::secondary_button(ui, app.tr("render.image_cancel")).clicked() {
+ if crate::ui_kit::button(ui, app.tr("cmd.render_cancel"), crate::ui_kit::Button::Normal).clicked() {
let _ = app.run("render.cancel", json!({"job":job}));
}
}
@@ -339,7 +339,7 @@ fn image_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
}
}
}
- if crate::ui_kit::enabled_button(ui, app.tr("render.image_start"), !busy).clicked() {
+ if crate::ui_kit::button(ui, app.tr("render.image_start"), crate::ui_kit::Button::Enabled(!busy)).clicked() {
let settings = RenderSetup { camera: app.cam, ..app.render_workspace.view.draft.clone() };
if let Ok(reply) = app.run("render.start", json!({"settings":settings,"transparent_background":app.render_workspace.view.transparent})) {
app.render_workspace.view.job = serde_json::from_value(reply["job"].clone()).ok();
@@ -348,7 +348,8 @@ fn image_controls(app: &mut SolveApp, ui: &mut egui::Ui) {
}
let overwrite_label = app.tr("render.image_overwrite").to_string();
crate::ui_kit::checkbox(ui, &overwrite_label, &mut app.render_workspace.view.overwrite);
- if crate::ui_kit::enabled_button(ui, app.tr("render.image_export"), app.render_workspace.view.completed.is_some()).clicked()
+ if crate::ui_kit::button(ui, app.tr("render.image_export"), crate::ui_kit::Button::Enabled(app.render_workspace.view.completed.is_some()))
+ .clicked()
&& let Some(job) = app.render_workspace.view.completed
{
export_image(app, job, app.render_workspace.view.overwrite);
diff --git a/crates/ui-egui/src/render_workspace_tests.rs b/crates/ui-egui/src/render_workspace_tests.rs
index 9d635854ad..23408069ad 100644
--- a/crates/ui-egui/src/render_workspace_tests.rs
+++ b/crates/ui-egui/src/render_workspace_tests.rs
@@ -146,10 +146,10 @@ fn clicked_image_controls_complete_cancel_and_export_without_dirtying_the_design
let mut h = Harness::new();
h.app.preferences.language = language.into();
h.frames(1);
- let check = h.app.tr("render.image_check").to_string();
+ let check = h.app.tr("cmd.render_preflight").to_string();
let start = h.app.tr("render.image_start").to_string();
let export = h.app.tr("render.image_export").to_string();
- let cancel = h.app.tr("render.image_cancel").to_string();
+ let cancel = h.app.tr("cmd.render_cancel").to_string();
h.call("ui.resize", json!({"width":1600,"height":1400}));
enter(&mut h.app, true).unwrap();
h.app.render_workspace.view.draft.width = 16;
diff --git a/crates/ui-egui/src/rule_editor.rs b/crates/ui-egui/src/rule_editor.rs
new file mode 100644
index 0000000000..ddef2676e2
--- /dev/null
+++ b/crates/ui-egui/src/rule_editor.rs
@@ -0,0 +1,46 @@
+//! Shared rule-manager lifecycle; families retain loading, field and deletion policy.
+// Hooks stay in the caller's scope, preserving widget IDs and completion/Enter ownership.
+macro_rules! rule_editor {
+ ($ui:expr, $id:literal, $rules:ident, $pick:ident, $name:ident, $active:ident, $loaded:ident;
+ new_name: $new_name:expr, load: $load:block, fields: $fields:block
+ ) => {{
+ let mut names: Vec<String> = $rules.iter().map(|r| r.name.clone()).collect();
+ names.push("New rule…".into());
+ let refs: Vec<&str> = names.iter().map(String::as_str).collect();
+ $crate::ui_kit::choice_row($ui, "Rule", $id, $pick, &refs);
+ if *$loaded != Some(*$pick) {
+ $load
+ if *$pick >= $rules.len() {
+ *$name = $new_name;
+ }
+ *$loaded = Some(*$pick);
+ }
+ if *$pick >= $rules.len() {
+ $crate::ui_kit::text_row($ui, "Name", $name, "Name");
+ }
+ $fields
+ $crate::ui_kit::row($ui, "Active rule", |ui| $crate::ui_kit::checkbox(ui, "", $active));
+ }};
+}
+
+pub(crate) use rule_editor;
+
+/// Both managers omit blank fields and trim only names supplied for a new rule.
+pub(crate) fn params<'a>(
+ selected_name: Option<&str>,
+ name: &str,
+ active: bool,
+ fields: impl IntoIterator<Item = (&'a str, &'a String)>,
+) -> Result<serde_json::Value, String> {
+ let name = selected_name.unwrap_or_else(|| name.trim());
+ if name.is_empty() {
+ return Err("give the rule a name".into());
+ }
+ let mut p = serde_json::json!({"name": name, "active": active});
+ for (key, value) in fields {
+ if !value.trim().is_empty() {
+ p[key] = serde_json::json!(value);
+ }
+ }
+ Ok(p)
+}
diff --git a/crates/ui-egui/src/rule_editor_tests.rs b/crates/ui-egui/src/rule_editor_tests.rs
new file mode 100644
index 0000000000..712dc5e7ab
--- /dev/null
+++ b/crates/ui-egui/src/rule_editor_tests.rs
@@ -0,0 +1,164 @@
+//! Freeze rule-manager commands, reload policy and published row/control identities.
+use crate::{SolveApp, dialogs::Kind, dialogs_plastic::Pl, dialogs_sheet::Sm, scenario, theme::Tokens};
+use serde_json::{Value, json};
+
+const SHEET_ROWS: &[&str] = &[
+ "Rule",
+ "Thickness",
+ "K Factor",
+ "Bend Radius",
+ "Relief Width",
+ "Relief Depth",
+ "Corner Relief Shape",
+ "Corner Relief",
+ "Hem Gap",
+ "Flange Gap",
+ "Active rule",
+];
+const PLASTIC_ROWS: &[&str] = &[
+ "Rule",
+ "Material",
+ "Thickness",
+ "Nominal Radius",
+ "Clearance",
+ "Knife Edge",
+ "Reveal Height",
+ "Thickness Variation",
+ "Draft",
+ "Max Thickness",
+ "Min Thickness",
+ "Min Draft",
+ "Active rule",
+];
+
+fn frame(app: &mut SolveApp, ctx: &egui::Context, kind: &mut Kind, labels: &[&str]) {
+ scenario::clear_handles();
+ let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
+ crate::ui_kit::scope(ui, |ui| match kind {
+ Kind::Sheet(k) => assert!(!crate::dialogs_sheet::rows(app, ui, k, &mut [])),
+ Kind::Plastic(k) => assert!(!crate::dialogs_plastic::rows(app, ui, k, &[])),
+ _ => panic!("rule dialog"),
+ });
+ });
+ output.textures_delta.clear();
+ let rows = scenario::rects("dialog:row:");
+ assert_eq!(rows.iter().map(|(name, _)| name.trim_start_matches("dialog:row:")).collect::<Vec<_>>(), labels);
+ for pair in rows.windows(2) {
+ assert_eq!(pair[1].1.top() - pair[0].1.top(), Tokens::get().control_height + Tokens::get().form_gap_y);
+ }
+ let expected: Vec<_> = labels.iter().flat_map(|label| [format!("dialog:{label}"), format!("dialog:row:{label}")]).collect();
+ assert_eq!(scenario::handles("dialog:").into_iter().map(|(name, _)| name).collect::<Vec<_>>(), expected);
+}
+
+fn commands(app: &SolveApp, kind: &Kind) -> Vec<(String, Value)> {
+ match kind {
+ Kind::Sheet(k) => crate::dialogs_sheet::commands(app, k, &[], &Default::default()).unwrap(),
+ Kind::Plastic(k) => crate::dialogs_plastic::commands(app, k, &[], &Default::default()).unwrap(),
+ _ => panic!("rule dialog"),
+ }
+}
+
+#[test]
+fn sheet_rule_editor_contract() {
+ let mut app = SolveApp::new(Default::default(), Default::default());
+ let ctx = crate::fonts::test_context();
+ let (mut kind, _) = crate::dialogs_sheet::start(&app, "sheet.manage_rules").unwrap();
+ frame(&mut app, &ctx, &mut kind, SHEET_ROWS);
+ let mut expected = json!({"name":"Steel (mm)","active":true,"corner_relief_shape":"notch","thickness":"2.5 mm","k_factor":"0.44",
+ "bend_radius":"Thickness","relief_width":"Thickness","relief_depth":"Thickness * 0.5","corner_relief":"Thickness * 4.0","hem_gap":"0.01 mm","gap":"Thickness"});
+ assert_eq!(commands(&app, &kind), vec![("sheet.manage_rules".into(), expected.clone())]);
+ let Kind::Sheet(Sm::Rules { pick, values, relief, .. }) = &mut kind else { panic!() };
+ *pick = 1;
+ values[0] = "99 mm".into();
+ *relief = 3;
+ let mut new_rows = SHEET_ROWS.to_vec();
+ new_rows.insert(1, "Name");
+ frame(&mut app, &ctx, &mut kind, &new_rows);
+ expected["name"] = json!("Rule2");
+ assert_eq!(commands(&app, &kind), vec![("sheet.manage_rules".into(), expected.clone())]);
+ let Kind::Sheet(Sm::Rules { name, values, relief, active, .. }) = &mut kind else { panic!() };
+ *name = " Custom ".into();
+ values[0] = "3 mm".into();
+ values[1] = " ".into();
+ *relief = 2;
+ *active = false;
+ frame(&mut app, &ctx, &mut kind, &new_rows);
+ expected["name"] = json!("Custom");
+ expected["thickness"] = json!("3 mm");
+ expected["corner_relief_shape"] = json!("rectangular");
+ expected["active"] = json!(false);
+ expected.as_object_mut().unwrap().remove("k_factor");
+ assert_eq!(commands(&app, &kind), vec![("sheet.manage_rules".into(), expected)]);
+ let Kind::Sheet(Sm::Rules { pick, .. }) = &mut kind else { panic!() };
+ *pick = 0;
+ frame(&mut app, &ctx, &mut kind, SHEET_ROWS);
+ assert_eq!(commands(&app, &kind)[0].1["thickness"], "2.5 mm");
+ assert_eq!(commands(&app, &kind)[0].1["active"], true);
+}
+
+#[test]
+fn plastic_rule_editor_contract() {
+ let mut app = SolveApp::new(Default::default(), Default::default());
+ let ctx = crate::fonts::test_context();
+ let (mut kind, _) = crate::dialogs_plastic::start(&app, "plastic.manage_rules").unwrap();
+ frame(&mut app, &ctx, &mut kind, PLASTIC_ROWS);
+ let mut expected = json!({"name":"ABS (1.5mm)","active":false,"material":"ABS Plastic","thickness":"1.5 mm","nominal_radius":"0.5 * Thickness",
+ "clearance":"0.1 mm","knife_edge":"1 mm","reveal_height":"0.5 mm","thickness_variation":"0.15 * Thickness","draft":"2 deg",
+ "max_thickness":"3.5 mm","min_thickness":"1.2 mm","min_draft":"0.5 deg"});
+ assert_eq!(commands(&app, &kind), vec![("plastic.manage_rules".into(), expected.clone())]);
+ app.session.execute("plastic.manage_rules", &json!({"name":"Nylon (PA6) (2.5mm)","active":true})).unwrap();
+ let Kind::Plastic(Pl::Rules { pick, .. }) = &mut kind else { panic!() };
+ *pick = 1;
+ frame(&mut app, &ctx, &mut kind, PLASTIC_ROWS);
+ expected["name"] = json!("Nylon (PA6) (2.5mm)");
+ expected["active"] = json!(true);
+ expected["material"] = json!("Nylon 6");
+ expected["thickness"] = json!("2.5 mm");
+ expected["max_thickness"] = json!("3 mm");
+ expected["min_thickness"] = json!("0.8 mm");
+ assert_eq!(commands(&app, &kind), vec![("plastic.manage_rules".into(), expected)]);
+ let Kind::Plastic(Pl::Rules { pick, .. }) = &mut kind else { panic!() };
+ *pick = app.session.doc.plastic_rules().len();
+ let mut new_rows = PLASTIC_ROWS.to_vec();
+ new_rows.insert(1, "Name");
+ frame(&mut app, &ctx, &mut kind, &new_rows);
+ let mut expected = json!({"name":"Plastic Rule1","active":false,"material":"ABS Plastic","thickness":"1.5 mm","nominal_radius":"0.5 * Thickness",
+ "clearance":"0.1 mm","knife_edge":"1 mm","reveal_height":"0.5 mm","thickness_variation":"0.15 * Thickness","draft":"2 deg",
+ "max_thickness":"3.5 mm","min_thickness":"1.2 mm","min_draft":"0.5 deg"});
+ assert_eq!(commands(&app, &kind), vec![("plastic.manage_rules".into(), expected.clone())]);
+ let Kind::Plastic(Pl::Rules { name, values, active, .. }) = &mut kind else { panic!() };
+ *name = " Custom ".into();
+ values[0] = " ".into();
+ values[1] = " ".into();
+ *active = true;
+ frame(&mut app, &ctx, &mut kind, &new_rows);
+ expected["name"] = json!("Custom");
+ expected["active"] = json!(true);
+ for key in ["material", "thickness"] {
+ expected.as_object_mut().unwrap().remove(key);
+ }
+ assert_eq!(commands(&app, &kind), vec![("plastic.manage_rules".into(), expected)]);
+}
+
+#[test]
+fn sheet_rule_editor_delete_reloads_and_plastic_has_no_delete() {
+ for layout in [crate::shell::LayoutMode::Docked, crate::shell::LayoutMode::Floating] {
+ let mut h = scenario::Harness::new();
+ h.app.home.open = false;
+ h.call("ui.set", json!({"layout":layout}));
+ h.app.session.execute("sheet.manage_rules", &json!({"name":"Custom","thickness":"3 mm","active":true})).unwrap();
+ h.app.start("sheet.manage_rules");
+ h.frames(4);
+ assert!(h.widget("Delete rule").is_some());
+ assert_eq!(crate::dialogs::apply_commands(&h.app, h.app.dialog.as_ref().unwrap()).unwrap()[0].1["name"], "Custom");
+ h.step(&json!({"widget":"Delete rule"})).unwrap();
+ h.frames(4);
+ assert!(h.app.session.doc.sheet.rules.is_empty());
+ assert!(h.widget("Delete rule").is_none());
+ assert_eq!(crate::dialogs::apply_commands(&h.app, h.app.dialog.as_ref().unwrap()).unwrap()[0].1["name"], "Steel (mm)");
+ h.app.dialog = None;
+ h.app.start("plastic.manage_rules");
+ h.frames(4);
+ assert!(h.widget("Delete rule").is_none());
+ }
+}
diff --git a/crates/ui-egui/src/scenario.rs b/crates/ui-egui/src/scenario.rs
index 238ea47574..1cbf622784 100644
--- a/crates/ui-egui/src/scenario.rs
+++ b/crates/ui-egui/src/scenario.rs
@@ -67,6 +67,17 @@ pub fn publish_handle(name: &str, at: egui::Pos2) {
HANDLES.with(|h| h.borrow_mut().push((name.to_string(), at)));
}
+/// Publish a rectangle and its centered interaction handle with the same explicit identity.
+pub(crate) fn publish_target(name: &str, rect: egui::Rect) {
+ publish_target_as(name, name, rect);
+}
+
+/// Publish centered geometry with explicit, independently named handle and rectangle aliases.
+pub(crate) fn publish_target_as(handle: &str, rect_name: &str, rect: egui::Rect) {
+ publish_handle(handle, rect.center());
+ publish_rect(rect_name, rect);
+}
+
/// Where a handle was drawn last frame.
pub fn handle_at(name: &str) -> Option<egui::Pos2> {
HANDLES.with(|h| h.borrow().iter().rfind(|(n, _)| n == name).map(|x| x.1))
@@ -86,6 +97,11 @@ pub fn rect_of(name: &str) -> Option<egui::Rect> {
RECTS.with(|h| h.borrow().iter().rfind(|(n, _)| n == name).map(|x| x.1))
}
+#[cfg(test)]
+pub(crate) fn rects(prefix: &str) -> Vec<(String, egui::Rect)> {
+ RECTS.with(|r| r.borrow().iter().filter(|(name, _)| name.starts_with(prefix)).cloned().collect())
+}
+
/// A number about this frame's drawing, by name ("axis_view_highlights": the axis view's highlighted tips).
pub fn publish_count(name: &str, v: f64) {
COUNTS.with(|h| h.borrow_mut().push((name.to_string(), v)));
@@ -1085,3 +1101,7 @@ pub fn check(h: &mut Harness, e: &Value) -> Result<(), String> {
}
Ok(())
}
+
+#[cfg(test)]
+#[path = "scenario_publication_tests.rs"]
+mod publication_tests;
diff --git a/crates/ui-egui/src/scenario_publication_tests.rs b/crates/ui-egui/src/scenario_publication_tests.rs
new file mode 100644
index 0000000000..2719727c52
--- /dev/null
+++ b/crates/ui-egui/src/scenario_publication_tests.rs
@@ -0,0 +1,20 @@
+use super::*;
+
+#[test]
+fn publication_keeps_order_aliases_and_last_value() {
+ clear_handles();
+ let first = egui::Rect::from_min_size(egui::pos2(10.0, 20.0), egui::vec2(30.0, 40.0));
+ let second = first.translate(egui::vec2(80.0, 90.0));
+ let at = first.left_center();
+ publish_target("target", first);
+ publish_rect("target", second);
+ publish_handle("target", at);
+ publish_target_as("alias_handle", "alias_rect", second);
+ assert_eq!(handles(""), vec![("target".into(), first.center()), ("target".into(), at), ("alias_handle".into(), second.center())]);
+ assert_eq!(rects(""), vec![("target".into(), first), ("target".into(), second), ("alias_rect".into(), second)]);
+ assert_eq!(handle_at("target"), Some(at));
+ assert_eq!(rect_of("target"), Some(second));
+ clear_handles();
+ assert!(handles("").is_empty());
+ assert!(rects("").is_empty());
+}
diff --git a/crates/ui-egui/src/section_browser_tests.rs b/crates/ui-egui/src/section_browser_tests.rs
index 4ba4adfd09..6d4d3162bc 100644
--- a/crates/ui-egui/src/section_browser_tests.rs
+++ b/crates/ui-egui/src/section_browser_tests.rs
@@ -6,6 +6,7 @@ use serde_json::json;
use crate::context_menu::{self, Target};
use crate::scenario::Harness;
+use crate::test_support::click;
fn harness() -> Harness {
let mut h = Harness::new();
@@ -15,12 +16,6 @@ fn harness() -> Harness {
h
}
-fn click(h: &mut Harness, handle: &str) {
- assert!(crate::scenario::handle_at(handle).is_some(), "{handle} is not drawn: {:?}", crate::scenario::handles(""));
- h.step(&json!({"click": {"handle": handle}})).unwrap();
- h.frames(3);
-}
-
fn menu(h: &mut Harness, label: &str) {
let items = context_menu::items(&h.app, &Target::Section);
let item = items.iter().find(|i| i.label == label).unwrap_or_else(|| panic!("no {label} in {items:?}")).clone();
diff --git a/crates/ui-egui/src/selection.rs b/crates/ui-egui/src/selection.rs
index e9f460f4bf..446cfbec2c 100644
--- a/crates/ui-egui/src/selection.rs
+++ b/crates/ui-egui/src/selection.rs
@@ -112,6 +112,54 @@ impl SelInput {
}
}
+/// Projections preserve pick order and repetitions; callers own any deduplication or frames.
+pub(crate) trait SelectionExt {
+ fn body_names(&self) -> Vec<String>;
+ fn curve_ids(&self) -> Vec<String>;
+ fn profiles(&self) -> Vec<(u64, usize)>;
+ fn edge_points(&self) -> Vec<Vec3>;
+ fn face_points(&self) -> Vec<Vec3>;
+}
+
+impl SelectionExt for [Sel] {
+ fn body_names(&self) -> Vec<String> {
+ self.iter().filter_map(|x| if let Sel::Body { name } = x { Some(name.clone()) } else { None }).collect()
+ }
+ fn curve_ids(&self) -> Vec<String> {
+ self.iter().filter_map(|x| if let Sel::SketchCurve { id } = x { Some(id.clone()) } else { None }).collect()
+ }
+ fn profiles(&self) -> Vec<(u64, usize)> {
+ self.iter().filter_map(|x| if let Sel::Profile { sketch, index } = x { Some((*sketch, *index)) } else { None }).collect()
+ }
+ fn edge_points(&self) -> Vec<Vec3> {
+ self.iter().filter_map(|x| if let Sel::Edge { point, .. } = x { Some(*point) } else { None }).collect()
+ }
+ fn face_points(&self) -> Vec<Vec3> {
+ self.iter().filter_map(|x| if let Sel::Face { point, .. } = x { Some(*point) } else { None }).collect()
+ }
+}
+
+pub(crate) fn items(inputs: &[SelInput], i: usize) -> &[Sel] {
+ inputs.get(i).map(|x| x.items.as_slice()).unwrap_or(&[])
+}
+
+pub(crate) fn point_value(v: Vec3) -> serde_json::Value {
+ serde_json::json!([v.x, v.y, v.z])
+}
+
+pub(crate) fn polyline_mid(pts: &[Vec3]) -> Vec3 {
+ let len: f64 = pts.windows(2).map(|w| w[0].dist(w[1])).sum();
+ let mut acc = 0.0;
+ for w in pts.windows(2) {
+ let l = w[0].dist(w[1]);
+ if acc + l >= len * 0.5 && l > 0.0 {
+ return w[0].lerp(w[1], (len * 0.5 - acc) / l);
+ }
+ acc += l;
+ }
+ pts.first().copied().unwrap_or_default()
+}
+
/// World size of the origin widget: a fixed fraction of the viewport height, whatever the zoom
/// (`half_height` is half the visible height in mm at the target).
pub fn origin_size(half_height: f64) -> f64 {
@@ -267,3 +315,19 @@ mod tests {
assert_eq!(one.items, vec![Sel::Plane { name: "YZ".into() }]);
}
}
+
+#[cfg(test)]
+mod shared_geometry_baseline_tests {
+ use super::*;
+
+ #[test]
+ fn polyline_mid_preserves_degenerate_and_unequal_segments() {
+ let p = Vec3::new(10.0, -3.0, 7.0);
+ assert_eq!(polyline_mid(&[]), Vec3::ZERO);
+ assert_eq!(polyline_mid(&[p]), p);
+ assert_eq!(polyline_mid(&[p, p, p]), p);
+ assert_eq!(polyline_mid(&[p, p + Vec3::X, p + Vec3::X * 10.0]), p + Vec3::X * 5.0);
+ assert_eq!(polyline_mid(&[p, p, p + Vec3::X * 2.0, p + Vec3::X * 2.0 + Vec3::Y * 6.0]), p + Vec3::X * 2.0 + Vec3::Y * 2.0);
+ assert_eq!(polyline_mid(&[p, Vec3::new(f64::NAN, 0.0, 0.0)]), p);
+ }
+}
diff --git a/crates/ui-egui/src/sketch_attachment_ui.rs b/crates/ui-egui/src/sketch_attachment_ui.rs
index 2a7a7fe2cd..19217a57a3 100644
--- a/crates/ui-egui/src/sketch_attachment_ui.rs
+++ b/crates/ui-egui/src/sketch_attachment_ui.rs
@@ -170,10 +170,10 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
draft.candidate.is_some() && app.preview.error.is_none(),
|ui| {
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);
- ui_kit::hint(
+ ui_kit::text(
ui,
- "tool",
crate::i18n::tr_label("Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates."),
+ ui_kit::Text::Hint("tool"),
);
let saved_plane = match &status {
FaceAttachmentStatus::Healthy { plane, target, path } => {
@@ -212,7 +212,9 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
let author = app.session.doc.feature(sketch).map(|feature| feature.component);
let available = author == Some(app.session.active_component);
if ui
- .add_enabled_ui(available, |ui| ui_kit::secondary_button(ui, crate::i18n::tr_label("Use active author placement")))
+ .add_enabled_ui(available, |ui| {
+ ui_kit::button(ui, crate::i18n::tr_label("Use active author placement"), ui_kit::Button::Normal)
+ })
.inner
.clicked()
{
@@ -225,7 +227,7 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
}
ui_kit::row(ui, "Plane", |ui| {
let text = if draft.candidate.is_some() { draft.label.as_str() } else { crate::i18n::tr("dialog.select") };
- let response = ui_kit::selection_field_state(ui, text, true, draft.candidate.is_some());
+ let response = ui_kit::selection_field(ui, text, ui_kit::Selection { active: true, filled: draft.candidate.is_some() });
if response
.on_hover_text(crate::i18n::tr_label(
"Choose a new plane. Sketch geometry and dimensions stay unchanged in its two-dimensional coordinates.",
@@ -239,18 +241,22 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
});
ui.horizontal_wrapped(|ui| {
for plane in ["XY", "XZ", "YZ"] {
- if ui_kit::secondary_button(ui, crate::i18n::format("sketch_panel.use_plane", &[("plane", plane)])).clicked() {
+ if ui_kit::button(ui, crate::i18n::format("sketch_panel.use_plane", &[("plane", plane)]), ui_kit::Button::Normal).clicked() {
draft.choose(json!(plane), plane.into());
}
}
});
for feature in &app.session.doc.features {
- if matches!(feature.kind, FeatureKind::ConstructionPlane { .. }) && ui_kit::secondary_button(ui, &feature.name).clicked() {
+ if matches!(feature.kind, FeatureKind::ConstructionPlane { .. })
+ && ui_kit::button(ui, &feature.name, ui_kit::Button::Normal).clicked()
+ {
draft.choose(json!(feature.name), feature.name.clone());
}
}
if ui
- .add_enabled_ui(selected.is_some(), |ui| ui_kit::secondary_button(ui, crate::i18n::tr_label("Reattach selected face")))
+ .add_enabled_ui(selected.is_some(), |ui| {
+ ui_kit::button(ui, crate::i18n::tr_label("Reattach selected face"), ui_kit::Button::Normal)
+ })
.inner
.clicked()
&& let Some(selection @ Sel::Face { .. }) = &selected
@@ -260,7 +266,9 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
draft.choose(plane, label);
}
if ui
- .add_enabled_ui(saved_plane.is_some(), |ui| ui_kit::secondary_button(ui, crate::i18n::tr_label("Use saved fixed plane")))
+ .add_enabled_ui(saved_plane.is_some(), |ui| {
+ ui_kit::button(ui, crate::i18n::tr_label("Use saved fixed plane"), ui_kit::Button::Normal)
+ })
.inner
.clicked()
&& let Some(plane) = saved_plane
@@ -269,7 +277,9 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
draft.error = Some(error);
}
if ui
- .add_enabled_ui(selected.is_some(), |ui| ui_kit::secondary_button(ui, crate::i18n::tr_label("Use selected face as fixed plane")))
+ .add_enabled_ui(selected.is_some(), |ui| {
+ ui_kit::button(ui, crate::i18n::tr_label("Use selected face as fixed plane"), ui_kit::Button::Normal)
+ })
.inner
.clicked()
&& let Some(selection) = &selected
diff --git a/crates/ui-egui/src/sketch_drag_ui_tests.rs b/crates/ui-egui/src/sketch_drag_ui_tests.rs
index 4a126d3967..965017aec3 100644
--- a/crates/ui-egui/src/sketch_drag_ui_tests.rs
+++ b/crates/ui-egui/src/sketch_drag_ui_tests.rs
@@ -6,6 +6,7 @@ use solidcraft_engine::Sel;
use solidcraft_engine::geom::Vec2;
use crate::scenario::Harness;
+use crate::test_support::play;
#[test]
fn text_move_drag_is_one_editable_unit_and_escape_restores_the_gesture() {
@@ -85,13 +86,6 @@ fn release(h: &mut Harness, at: egui::Pos2) {
play(h);
}
-fn play(h: &mut Harness) {
- while !h.app.synthetic.is_empty() {
- h.frame();
- }
- h.frames(2);
-}
-
/// Points from `a` to `b` in `n` equal moves (without `a`).
fn steps(a: egui::Pos2, b: egui::Pos2, n: usize) -> Vec<egui::Pos2> {
(1..=n).map(|k| a + (b - a) * (k as f32 / n as f32)).collect()
diff --git a/crates/ui-egui/src/sketch_edit_tests.rs b/crates/ui-egui/src/sketch_edit_tests.rs
index bbb9b6d1ba..47ba3a5c00 100644
--- a/crates/ui-egui/src/sketch_edit_tests.rs
+++ b/crates/ui-egui/src/sketch_edit_tests.rs
@@ -1,15 +1,9 @@
//! Regression tests: editing a sketch from the Browser or timeline can always be left again.
-use crate::{Services, SolveApp};
-use solidcraft_engine::Session;
+use crate::SolveApp;
+use crate::test_support::sample_app;
use solidcraft_engine::doc::FeatureKind;
-fn sample_app() -> SolveApp {
- let mut s = Session::default();
- s.run_script(&solidcraft_engine::sample::script()).unwrap();
- SolveApp::new(s, Services::default())
-}
-
fn first_sketch(app: &SolveApp) -> u64 {
app.session.doc.features.iter().find(|f| matches!(f.kind, FeatureKind::Sketch { .. })).map(|f| f.id).unwrap()
}
diff --git a/crates/ui-egui/src/sketch_modify_ui.rs b/crates/ui-egui/src/sketch_modify_ui.rs
index fbd739a86b..dcfba56361 100644
--- a/crates/ui-egui/src/sketch_modify_ui.rs
+++ b/crates/ui-egui/src/sketch_modify_ui.rs
@@ -348,10 +348,10 @@ fn alignment(ui: &mut egui::Ui, label: &str, alignment: &mut PatternAlignment, r
}
fn pattern_hint(ui: &mut egui::Ui) {
- ui_kit::note(
+ ui_kit::text(
ui,
- "pattern",
crate::i18n::tr_label("Counts include the original. Center balances copies; Flip chooses the extra side for even totals."),
+ ui_kit::Text::Note("pattern"),
);
}
@@ -376,7 +376,7 @@ pub fn rows(ui: &mut egui::Ui, k: &mut Mod) -> bool {
}
Mod::Mirror => {}
Mod::Move { x, y, angle, copy } => {
- enter |= ui_kit::value_pair_named(ui, "Position", [x, y], ["X", "Y"], ["X Distance", "Y Distance"]);
+ enter |= ui_kit::value_pair(ui, "Position", [x, y], ["X", "Y"], Some(["X Distance", "Y Distance"]));
enter |= number(ui, "Angle", angle);
ui_kit::options(ui, "move_options", &mut [("Create Copy", copy)]);
}
diff --git a/crates/ui-egui/src/sketch_palette.rs b/crates/ui-egui/src/sketch_palette.rs
index adb10e82e6..4b7994598e 100644
--- a/crates/ui-egui/src/sketch_palette.rs
+++ b/crates/ui-egui/src/sketch_palette.rs
@@ -23,14 +23,13 @@ thread_local! {
}
/// Option keys and existing localized labels. The five primary design rows are selected below;
-/// the remaining display options live in More. Dedicated point/profile ids avoid collisions
-/// with selection-field translations elsewhere in the UI.
+/// the remaining display options live in More. Point/profile labels share the dialog IDs.
pub const TOGGLES: [(&str, &str); 10] = [
("grid", "Sketch Grid"),
("snap", "Snap"),
("slice", "Slice"),
- ("show_profile", "ui.palette_profile"),
- ("show_points", "ui.palette_points"),
+ ("show_profile", "ui.profile"),
+ ("show_points", "ui.points"),
("show_dimensions", "Dimensions"),
("show_constraints", "Constraints"),
("show_projected", "Projected Geometries"),
@@ -388,7 +387,7 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
ui.horizontal(|ui| {
let text = crate::i18n::format("sketch.untied_ends", &[("count", &untied_ends.to_string())]);
ui.label(egui::RichText::new(text).size(t.font_small).color(t.warning)).on_hover_text(app.tr("ui.untied_ends_tip"));
- let button = crate::ui_kit::secondary_button(ui, "ui.tie_ends").on_hover_text(app.tr("ui.tie_ends_tip"));
+ let button = crate::ui_kit::button(ui, "ui.tie_ends", crate::ui_kit::Button::Normal).on_hover_text(app.tr("ui.tie_ends_tip"));
crate::scenario::publish_handle("sketch_palette:tie_ends", button.rect.center());
tie = button.clicked();
});
diff --git a/crates/ui-egui/src/sketch_text.rs b/crates/ui-egui/src/sketch_text.rs
index 2c5aff1b1f..26fd5d1654 100644
--- a/crates/ui-egui/src/sketch_text.rs
+++ b/crates/ui-egui/src/sketch_text.rs
@@ -472,7 +472,7 @@ pub(crate) fn rows(ui: &mut egui::Ui, k: &mut Tx, inputs: &mut [SelInput], activ
TextAlign::Right => 2,
};
let labels = ["sketch_text.align_left", "sketch_text.align_center", "sketch_text.align_right"].map(crate::i18n::tr);
- ui_kit::segmented_compact(ui, &mut selected, &labels);
+ ui_kit::segmented(ui, &mut selected, &labels, ui_kit::Segments { compact: true, ..Default::default() });
k.style.align = match selected {
1 => TextAlign::Center,
2 => TextAlign::Right,
@@ -488,7 +488,7 @@ pub(crate) fn rows(ui: &mut egui::Ui, k: &mut Tx, inputs: &mut [SelInput], activ
let on_path = k.style.path.is_some();
let (xy, rest) = k.values.split_at_mut(2);
if let [x, y] = xy {
- let response = ui.add_enabled_ui(!on_path, |ui| ui_kit::value_pair(ui, "Position", [x, y], ["X", "Y"]));
+ let response = ui.add_enabled_ui(!on_path, |ui| ui_kit::value_pair(ui, "Position", [x, y], ["X", "Y"], None));
enter |= response.inner;
if on_path {
response.response.on_disabled_hover_text(crate::i18n::tr("sketch_text.on_path"));
@@ -512,7 +512,8 @@ fn path_row(ui: &mut egui::Ui, k: &mut Tx, inputs: &mut [SelInput], active: &mut
ui_kit::row(ui, "Path", |ui| {
let on = k.style.path.is_some();
let text = if on { crate::i18n::format("dialog.selected_count", &[("count", "1")]) } else { crate::i18n::tr("dialog.select").into() };
- let chip = ui_kit::selection_field_state(ui, &text, k.picking, on).on_hover_text(crate::i18n::tr("sketch_text.path_hint"));
+ let chip = ui_kit::selection_field(ui, &text, ui_kit::Selection { active: k.picking, filled: on })
+ .on_hover_text(crate::i18n::tr("sketch_text.path_hint"));
let chip_rect = chip.rect;
crate::scenario::publish_handle("dialog:Path", chip.rect.center());
if chip.clicked() {
@@ -664,13 +665,7 @@ mod tests {
use crate::scenario::Harness;
fn setup() -> (Harness, String, String) {
- let mut h = Harness::new();
- h.app.home.open = false;
- h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();
- let result = h.app.run("sketch.text", json!({"text":"I","at":[0,0],"height":10})).unwrap();
- let link = result["link"].as_str().unwrap().to_owned();
- let curve = result["curves"][0].as_str().unwrap().to_owned();
- h.app.session.selection = vec![Sel::SketchCurve { id: curve.clone() }];
+ let (mut h, link, curve) = crate::test_support::selected_text("I", [0, 0]);
h.frames(3);
(h, link, curve)
}
diff --git a/crates/ui-egui/src/sketch_text_move.rs b/crates/ui-egui/src/sketch_text_move.rs
index 97c7c87831..c034e0c1b7 100644
--- a/crates/ui-egui/src/sketch_text_move.rs
+++ b/crates/ui-egui/src/sketch_text_move.rs
@@ -30,7 +30,7 @@ pub(crate) fn valid(app: &SolveApp, k: &TextMove) -> bool {
pub(crate) fn rows(ui: &mut egui::Ui, k: &mut TextMove) -> bool {
let [x, y, angle] = &mut k.values;
- let mut enter = crate::ui_kit::value_pair_named(ui, "Position", [x, y], ["X", "Y"], ["Distance X", "Distance Y"]);
+ let mut enter = crate::ui_kit::value_pair(ui, "Position", [x, y], ["X", "Y"], Some(["Distance X", "Distance Y"]));
enter |= crate::ui_kit::row(ui, "Angle", |ui| crate::ui_kit::field(ui, angle));
crate::ui_kit::options(ui, "text_move_options", &mut [("Create Copy", &mut k.copy)]);
enter
@@ -99,15 +99,11 @@ mod tests {
use solidcraft_engine::sketch::LinkSource;
fn setup() -> (Harness, String) {
- let mut h = Harness::new();
- h.app.home.open = false;
- h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();
- let result = h.app.run("sketch.text", json!({"text":"II","at":[3,4],"height":10})).unwrap();
- h.app.session.selection = vec![Sel::SketchCurve { id: result["curves"][0].as_str().unwrap().into() }];
+ let (mut h, link, _) = crate::test_support::selected_text("II", [3, 4]);
h.app.start("sketch.move");
h.frames(3);
assert!(matches!(h.app.dialog.as_ref().map(|d| &d.kind), Some(Kind::TextMove(_))));
- (h, result["link"].as_str().unwrap().into())
+ (h, link)
}
fn replace(h: &mut Harness, field: &str, value: &str) {
diff --git a/crates/ui-egui/src/stand_up.rs b/crates/ui-egui/src/stand_up.rs
index 61f374377f..0eb43e81c4 100644
--- a/crates/ui-egui/src/stand_up.rs
+++ b/crates/ui-egui/src/stand_up.rs
@@ -52,14 +52,17 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
.anchor(egui::Align2::CENTER_TOP, egui::vec2(0.0, 140.0))
.actions("Stand it up", "Leave it", Some("Don't ask again"))
.show(ctx, true, |ui| {
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "why",
crate::i18n::tr_label("Files from many CAD programs have Y up, so they open lying on their back here (Z up)."),
- false,
+ ui_kit::Text::Report("why", false),
);
- ui_kit::text_block(ui, "how", crate::i18n::tr_label("Stand it up: a quarter turn about X, as one Move feature you can undo."), false);
- ui_kit::note(ui, "never", crate::i18n::tr_label("Preferences › Design turns the offer back on"));
+ ui_kit::text(
+ ui,
+ crate::i18n::tr_label("Stand it up: a quarter turn about X, as one Move feature you can undo."),
+ ui_kit::Text::Report("how", false),
+ );
+ ui_kit::text(ui, crate::i18n::tr_label("Preferences › Design turns the offer back on"), ui_kit::Text::Note("never"));
});
for (handle, key) in [("stand_up:stand", "dialog:ok"), ("stand_up:never", "dialog:apply"), ("stand_up:leave", "dialog:cancel")] {
if let Some(at) = crate::scenario::handle_at(key) {
diff --git a/crates/ui-egui/src/test_support.rs b/crates/ui-egui/src/test_support.rs
new file mode 100644
index 0000000000..030367571e
--- /dev/null
+++ b/crates/ui-egui/src/test_support.rs
@@ -0,0 +1,99 @@
+//! Headless test fixtures. Callers retain frame counts, input and command parameters.
+use crate::{Services, SolveApp, scenario::Harness};
+use egui::{Event, FullOutput, RawInput, Shape, Ui};
+use serde_json::{Value, json};
+use solidcraft_engine::{Sel, Session};
+
+pub(crate) fn app_with_script(script: Value) -> SolveApp {
+ let mut session = Session::default();
+ session.run_script(&script).unwrap();
+ SolveApp::new(session, Services::default())
+}
+
+pub(crate) fn sample_app() -> SolveApp {
+ app_with_script(solidcraft_engine::sample::script())
+}
+
+pub(crate) fn run_all(app: &mut SolveApp, commands: Vec<(String, Value)>) {
+ for (id, params) in commands {
+ app.run(&id, params).unwrap();
+ }
+}
+
+pub(crate) fn play(h: &mut Harness) {
+ while !h.app.synthetic.is_empty() {
+ h.frame();
+ }
+ h.frames(2);
+}
+
+pub(crate) fn click(h: &mut Harness, handle: &str) {
+ assert!(crate::scenario::handle_at(handle).is_some(), "{handle} is not drawn: {:?}", crate::scenario::handles(""));
+ h.step(&json!({"click": {"handle": handle}})).unwrap();
+ h.frames(3);
+}
+
+/// One component named Block, with its original occurrence and the root active.
+pub(crate) fn component_box() -> (Harness, u64, u64) {
+ let mut h = Harness::new();
+ let part = h.app.run("component.create", json!({"name":"Block"})).unwrap();
+ let component = part["component"].as_u64().unwrap();
+ let occurrence = part["occurrence"].as_u64().unwrap();
+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10})).unwrap();
+ h.app.run("component.activate", json!({"component":0})).unwrap();
+ (h, component, occurrence)
+}
+
+/// Named 20 × 20 × 10 boxes with A grounded; preserve the caller's command entry point.
+pub(crate) fn grounded_boxes(parts: &[(&str, i32)], mut run: impl FnMut(&str, Value) -> Value) {
+ for (name, x) in parts {
+ run("component.activate", json!({"component":"root"}));
+ run("component.create", json!({"name":name}));
+ run("solid.box", json!({"length":20,"width":20,"height":10,"corner":[x,0,0]}));
+ }
+ run("component.activate", json!({"component":"root"}));
+ run("occurrence.ground", json!({"occurrence":"A:1","grounded":true}));
+}
+
+/// Text with its first outline selected; callers decide when to start tools and draw.
+pub(crate) fn selected_text(text: &str, at: [i32; 2]) -> (Harness, String, String) {
+ let mut h = Harness::new();
+ h.app.home.open = false;
+ h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();
+ let result = h.app.run("sketch.text", json!({"text":text,"at":at,"height":10})).unwrap();
+ let link = result["link"].as_str().unwrap().to_owned();
+ let curve = result["curves"][0].as_str().unwrap().to_owned();
+ h.app.session.selection = vec![Sel::SketchCurve { id: curve.clone() }];
+ (h, link, curve)
+}
+
+/// A frame without a renderer. Preserve all caller-supplied timing and viewport options.
+pub(crate) fn frame(ctx: &egui::Context, input: RawInput, add: impl FnMut(&mut Ui)) -> FullOutput {
+ let mut output = ctx.run_ui(input, add);
+ output.textures_delta.clear();
+ output
+}
+
+pub(crate) fn pointer(pos: egui::Pos2, pressed: bool) -> Vec<Event> {
+ vec![Event::PointerMoved(pos), Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }]
+}
+
+pub(crate) fn key(key: egui::Key) -> Vec<Event> {
+ vec![Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]
+}
+
+/// Top-level text shapes only, in their original paint order.
+pub(crate) fn text_shapes(output: &FullOutput) -> impl Iterator<Item = &egui::epaint::TextShape> {
+ output.shapes.iter().filter_map(|clipped| match &clipped.shape {
+ Shape::Text(text) => Some(text),
+ _ => None,
+ })
+}
+
+/// Every leaf of a shape list, in paint order.
+pub(crate) fn each_shape(shape: &Shape, visit: &mut impl FnMut(&Shape)) {
+ match shape {
+ Shape::Vec(shapes) => shapes.iter().for_each(|shape| each_shape(shape, visit)),
+ shape => visit(shape),
+ }
+}
diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs
index d4b02b8f63..a53faf6b72 100644
--- a/crates/ui-egui/src/theme.rs
+++ b/crates/ui-egui/src/theme.rs
@@ -636,48 +636,4 @@ mod tests {
assert!(luma(t.subheading_bg) < luma(t.dialog_bg), "{t:?}");
}
}
-
- #[test]
- fn active_movable_window_header_uses_theme_panel_header() {
- for dark in [false, true] {
- let ctx = crate::fonts::test_context();
- ctx.set_theme(if dark { egui::Theme::Dark } else { egui::Theme::Light });
- ctx.set_visuals(super::visuals(dark));
- let mut output = egui::FullOutput::default();
- for _ in 0..3 {
- let raw = egui::RawInput {
- screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 900.0))),
- ..Default::default()
- };
- output = ctx.run_ui(raw, |ui| {
- crate::frame::window(ui.ctx(), crate::i18n::tr_label("Parameters"), crate::frame::Width::Normal).fade_in(false).show(
- ui.ctx(),
- |ui| {
- ui.label(crate::i18n::tr_label("Parameter values"));
- },
- );
- });
- output.textures_delta.clear();
- }
- let title = output
- .shapes
- .iter()
- .find_map(|shape| match &shape.shape {
- egui::Shape::Text(text) if text.galley.text() == "Parameters" => Some(text.pos + text.galley.rect.center().to_vec2()),
- _ => None,
- })
- .expect("window title must be drawn");
- let header = output
- .shapes
- .iter()
- .filter_map(|shape| match &shape.shape {
- egui::Shape::Rect(rect) if rect.fill.a() > 0 && rect.rect.contains(title) => Some(rect),
- _ => None,
- })
- .min_by(|a, b| a.rect.area().total_cmp(&b.rect.area()))
- .expect("window header must be drawn behind its title");
- let expected = if dark { super::Tokens::dark() } else { super::Tokens::light() };
- assert_eq!(header.fill, expected.panel_header, "active title bar should follow the {dark} palette");
- }
- }
}
diff --git a/crates/ui-egui/src/timeline.rs b/crates/ui-egui/src/timeline.rs
index 95fa228ddc..3cd106f06b 100644
--- a/crates/ui-egui/src/timeline.rs
+++ b/crates/ui-egui/src/timeline.rs
@@ -207,6 +207,18 @@ pub(crate) fn clipboard_buttons(app: &mut SolveApp, ui: &mut egui::Ui, id: u64)
}
}
+/// The common prefix of a feature tooltip and its copied status message.
+pub(crate) fn status_text(name: &str, ty: &str, error: Option<&str>, warning: Option<&str>) -> String {
+ let mut text = format!("{name} ({ty})");
+ if let Some(error) = error {
+ text.push_str(&format!("\nError: {error}"));
+ }
+ if let Some(warning) = warning {
+ text.push_str(&format!("\nWarning: {warning}"));
+ }
+ text
+}
+
/// What a feature's error or warning mark says, as its tooltip shows it (name and type, then
/// the error and the warning), for the clipboard. `None` when it has neither.
pub(crate) fn feature_message(app: &SolveApp, id: u64) -> Option<String> {
@@ -215,14 +227,7 @@ pub(crate) fn feature_message(app: &SolveApp, id: u64) -> Option<String> {
return None;
}
let feature = app.session.doc.features.iter().find(|f| f.id == id)?;
- let mut text = format!("{} ({})", feature.name, feature.kind.type_name());
- if let Some(error) = &result.error {
- text.push_str(&format!("\nError: {error}"));
- }
- if let Some(warning) = &result.warning {
- text.push_str(&format!("\nWarning: {warning}"));
- }
- Some(text)
+ Some(status_text(&feature.name, feature.kind.type_name(), result.error.as_deref(), result.warning.as_deref()))
}
/// Copy Error Message (or Copy Warning Message) in the menu of a feature that has one.
@@ -414,13 +419,7 @@ fn timeline_contents(app: &mut SolveApp, ui: &mut egui::Ui, floating: bool) {
t.warning,
);
}
- let mut tip = format!("{name} ({ty})");
- if let Some(e) = &err {
- tip += &format!("\nError: {e}");
- }
- if let Some(w) = &warn {
- tip += &format!("\nWarning: {w}");
- }
+ let mut tip = status_text(name, ty, err.as_deref(), warn.as_deref());
if let Some(r) = res {
tip += &format!("\n{:.1} ms", r.ms);
}
diff --git a/crates/ui-egui/src/timeline_left.rs b/crates/ui-egui/src/timeline_left.rs
index 7301711aae..769e4a84d2 100644
--- a/crates/ui-egui/src/timeline_left.rs
+++ b/crates/ui-egui/src/timeline_left.rs
@@ -768,13 +768,7 @@ fn vertical_features(app: &mut SolveApp, ui: &mut egui::Ui) {
let origin_x = drag_press_x(&response, rect.center().x);
drag = Some(Drag::Items(selected_drag_items(app, origin_x, group_id)));
}
- let mut tip = format!("{name} ({ty})");
- if let Some(error) = &error {
- tip.push_str(&format!("\nError: {error}"));
- }
- if let Some(warning) = &warning {
- tip.push_str(&format!("\nWarning: {warning}"));
- }
+ let mut tip = crate::timeline::status_text(name, ty, error.as_deref(), warning.as_deref());
tip.push_str("\nDouble-click to edit · drag to reorder · right-click for more");
let response = response.on_hover_text(tip);
if response.clicked() && on_fold {
diff --git a/crates/ui-egui/src/timeline_marks_tests.rs b/crates/ui-egui/src/timeline_marks_tests.rs
index 1cce7c8b11..163ee50a31 100644
--- a/crates/ui-egui/src/timeline_marks_tests.rs
+++ b/crates/ui-egui/src/timeline_marks_tests.rs
@@ -7,13 +7,7 @@ use serde_json::json;
use crate::SolveApp;
-/// Every shape in `s`, the parts of a list of shapes too.
-fn each(s: &Shape, f: &mut impl FnMut(&Shape)) {
- match s {
- Shape::Vec(v) => v.iter().for_each(|s| each(s, f)),
- s => f(s),
- }
-}
+use crate::test_support::each_shape as each;
/// The sample with Fillet1 failing (the plate made narrower than its fillets).
fn failing_sample() -> SolveApp {
@@ -34,9 +28,7 @@ fn error_discs(app: &mut SolveApp, draw: fn(&mut SolveApp, &mut egui::Ui)) -> Ve
crate::scenario::clear_handles();
let ctx = crate::fonts::test_context();
let screen = Rect::from_min_size(Pos2::ZERO, vec2(1400.0, 900.0));
- let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| draw(app, ui));
- // Icons upload textures; dropping their deltas unapplied would panic.
- out.textures_delta.clear();
+ let out = crate::test_support::frame(&ctx, egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| draw(app, ui));
let mut found = Vec::new();
for clipped in &out.shapes {
each(&clipped.shape, &mut |s| {
diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs
index e2fb8ffc6f..022495a59d 100644
--- a/crates/ui-egui/src/toolbar.rs
+++ b/crates/ui-egui/src/toolbar.rs
@@ -246,8 +246,7 @@ pub(crate) fn offer_pill(
let response = ui.interact(rect, ui.id().with(("sc_offer_pill", handle)), Sense::click());
let name = label.map(|(text, _)| text).or(labels.first().copied()).unwrap_or_default().to_string();
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), &name));
- crate::scenario::publish_handle(handle, rect.center());
- crate::scenario::publish_rect(handle, rect);
+ crate::scenario::publish_target(handle, rect);
let hot = response.hovered() || response.has_focus();
let fill = if hot { t.app_bar_hover_button } else { t.accent };
let radius = PILL_HEIGHT / 2.0;
@@ -305,8 +304,7 @@ pub fn app_bar(app: &mut SolveApp, ui: &mut egui::Ui) {
crate::scenario::publish_handle("appbar:home", home.center());
crate::scenario::publish_handle("titlebar:home", home.center());
// Compatibility for scenarios that used the former Home tab.
- crate::scenario::publish_handle("tab:home", home.center());
- crate::scenario::publish_rect("titlebar:home", home);
+ crate::scenario::publish_target_as("tab:home", "titlebar:home", home);
crate::scenario::publish_rect("appbar:home", home);
if idle && (home_response.hovered() || home_response.has_focus()) {
ui.painter().rect_filled(home.shrink(3.0), t.radius_sm, t.app_bar_hover_button);
@@ -329,8 +327,7 @@ pub fn app_bar(app: &mut SolveApp, ui: &mut egui::Ui) {
let resp = ui.interact(br, ui.id().with(("ab", "file")), if idle { Sense::click() } else { Sense::hover() });
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, idle, &label));
crate::scenario::publish_handle("appbar:file", br.center());
- crate::scenario::publish_handle("appbar:folder", br.center());
- crate::scenario::publish_rect("appbar:file", br);
+ crate::scenario::publish_target_as("appbar:folder", "appbar:file", br);
let open = ui.ctx().data(|d| d.get_temp::<bool>(egui::Id::new("sc_file_menu")).unwrap_or(false));
if idle && (resp.hovered() || resp.has_focus() || open) {
ui.painter().rect_filled(br, t.radius_sm, t.app_bar_hover);
@@ -346,10 +343,8 @@ pub fn app_bar(app: &mut SolveApp, ui: &mut egui::Ui) {
let br = Rect::from_center_size(pos2(at, r.center().y), vec2(width, 32.0));
let resp = ui.interact(br, ui.id().with(("ab", icon)), if enabled { Sense::click() } else { Sense::hover() });
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, enabled, tip));
- crate::scenario::publish_handle(&format!("appbar:{icon}"), br.center());
- crate::scenario::publish_rect(&format!("appbar:{icon}"), br);
- crate::scenario::publish_handle(&format!("titlebar:{icon}"), br.center());
- crate::scenario::publish_rect(&format!("titlebar:{icon}"), br);
+ crate::scenario::publish_target(&format!("appbar:{icon}"), br);
+ crate::scenario::publish_target(&format!("titlebar:{icon}"), br);
if enabled && (resp.hovered() || resp.has_focus()) {
ui.painter().rect_filled(br.shrink(3.0), t.radius_sm, t.app_bar_hover_button);
}
@@ -424,8 +419,7 @@ pub fn app_bar(app: &mut SolveApp, ui: &mut egui::Ui) {
crate::documents::tabs(app, &mut tabs_ui, r, tabs_start, tabs_end);
let response = ui.interact(report, ui.id().with("sc_report_button"), Sense::click());
response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ui.is_enabled(), report_text));
- crate::scenario::publish_handle("titlebar:report", report.center());
- crate::scenario::publish_rect("titlebar:report", report);
+ crate::scenario::publish_target("titlebar:report", report);
ui.painter().rect_filled(report, t.radius_sm, if response.hovered() || response.has_focus() { t.app_bar_hover_button } else { t.app_bar });
ui.painter().rect_stroke(report, t.radius_sm, Stroke::new(1.0, t.app_bar_separator), egui::StrokeKind::Inside);
let icon = Rect::from_center_size(pos2(report.left() + 14.0, report.center().y), vec2(18.0, 18.0));
@@ -806,8 +800,7 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {
vec2(search_width, TAB_ROW_HEIGHT - 2.0 * inset),
);
let resp = ui.interact(search, ui.id().with("ribbon_search"), Sense::click());
- crate::scenario::publish_handle("ribbon:search", search.center());
- crate::scenario::publish_rect("ribbon:search", search);
+ crate::scenario::publish_target("ribbon:search", search);
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("sc_ribbon_search"), search));
ui.painter().rect(search, corner, t.field, Stroke::new(1.0, t.border), egui::StrokeKind::Inside);
// The existing zoom glyph is the icon system's magnifier; no new artwork.
@@ -885,8 +878,7 @@ fn ribbon_tabs(app: &mut SolveApp, ui: &mut egui::Ui, row: Rect) {
active || contextual,
);
if ui.clip_rect().contains(tr.center()) {
- crate::scenario::publish_handle(&format!("tab:{tab}"), tr.center());
- crate::scenario::publish_rect(&format!("tab:{tab}"), tr);
+ crate::scenario::publish_target(&format!("tab:{tab}"), tr);
crate::scenario::publish_rect(&format!("toolbar_tab:{tab}"), tr);
let aliases: &[&str] = match tab {
"MODEL" => &["SOLID", "PLASTIC"],
@@ -982,8 +974,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
}
crate::scenario::publish_rect("toolbar", r);
crate::scenario::publish_rect("workspace_switcher", ws);
- crate::scenario::publish_rect("ribbon:workspace", ws);
- crate::scenario::publish_handle("ribbon:workspace", ws.center());
+ crate::scenario::publish_target("ribbon:workspace", ws);
ribbon_tabs(app, ui, Rect::from_min_max(pos2(ribbon_left, r.top()), pos2(r.right(), r.top() + TAB_ROW_HEIGHT)));
// Panels.
let tab = app.ui.tab.clone();
@@ -1220,8 +1211,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
if info.enabled { 1.0 } else { 0.35 },
);
for prefix in ["toolbar", "button", "ribbon:constraint"] {
- crate::scenario::publish_handle(&format!("{prefix}:{}", c.id), cell.center());
- crate::scenario::publish_rect(&format!("{prefix}:{}", c.id), cell);
+ crate::scenario::publish_target(&format!("{prefix}:{}", c.id), cell);
}
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, info.enabled, app.tr_label(c.label)));
if resp.drag_started() {
@@ -1250,8 +1240,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
);
let lresp = ui.interact(lr, ui.id().with(("panel", panel)), Sense::click());
crate::scenario::publish_handle(&format!("panel:{tab}:{panel}"), lr.center());
- crate::scenario::publish_handle(&format!("ribbon:section:{tab}:{panel}"), lr.center());
- crate::scenario::publish_rect(&format!("ribbon:section:{tab}:{panel}"), lr);
+ crate::scenario::publish_target(&format!("ribbon:section:{tab}:{panel}"), lr);
let panel_open = ui.ctx().data(|d| d.get_temp::<egui::Id>(egui::Id::new("sc_panel_open"))) == Some(popup_id);
let accent = crate::theme::TabAccent::for_tab(&t, &tab);
let hot = lresp.hovered() && enabled_panel;
@@ -1414,8 +1403,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
});
}
});
- crate::scenario::publish_handle("toolbar:overflow", response.response.rect.center());
- crate::scenario::publish_rect("toolbar:overflow", response.response.rect);
+ crate::scenario::publish_target("toolbar:overflow", response.response.rect);
response.response.on_hover_text(crate::i18n::tr_label("More toolbar panels"));
});
}
@@ -1465,8 +1453,7 @@ 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_handle("titlebar:assistant", at.center());
- crate::scenario::publish_rect("titlebar:assistant", at);
+ 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));
diff --git a/crates/ui-egui/src/toolbar_custom.rs b/crates/ui-egui/src/toolbar_custom.rs
index 1a853ca8c7..54eda06fe9 100644
--- a/crates/ui-egui/src/toolbar_custom.rs
+++ b/crates/ui-egui/src/toolbar_custom.rs
@@ -285,7 +285,7 @@ pub fn window(app: &mut SolveApp, ctx: &egui::Context) {
.cards(2.0)
.actions("", "Close", None)
.show(ctx, true, |ui| {
- ui_kit::note(ui, "customize", &crate::i18n::format("toolbar.customize_note", &[("tab", app.tr_label(&tab))]));
+ ui_kit::text(ui, &crate::i18n::format("toolbar.customize_note", &[("tab", app.tr_label(&tab))]), ui_kit::Text::Note("customize"));
egui::ScrollArea::vertical()
.max_height(
(ctx.content_rect().height() - crate::theme::Tokens::get().control_height * 8.0)
@@ -309,9 +309,8 @@ pub fn window(app: &mut SolveApp, ctx: &egui::Context) {
});
}
});
- let reset = ui_kit::secondary_button(ui, crate::i18n::tr_label("Reset Toolbar"));
- crate::scenario::publish_rect("customize:reset", reset.rect);
- crate::scenario::publish_handle("customize:reset", reset.rect.center());
+ let reset = ui_kit::button(ui, crate::i18n::tr_label("Reset Toolbar"), ui_kit::Button::Normal);
+ crate::scenario::publish_target("customize:reset", reset.rect);
reset_tab |= reset.clicked();
});
for (id, on) in changes {
diff --git a/crates/ui-egui/src/ui_kit/actions.rs b/crates/ui-egui/src/ui_kit/actions.rs
index 2995cc2aeb..32327c8b19 100644
--- a/crates/ui-egui/src/ui_kit/actions.rs
+++ b/crates/ui-egui/src/ui_kit/actions.rs
@@ -4,7 +4,7 @@ use crate::{fonts::RichTextExt as _, scenario, theme::Tokens};
use egui::{Response, RichText, Ui, vec2};
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
-pub enum Action {
+pub(crate) enum Action {
#[default]
None,
Ok,
@@ -14,14 +14,14 @@ pub enum Action {
/// Every enabled button shows the pointing hand on hover, as the application's other clickable
/// chrome does. A disabled button stays inert and keeps the arrow.
-pub(crate) fn pointer_on_hover(ui: &Ui, response: &Response) {
+fn pointer_on_hover(ui: &Ui, response: &Response) {
if response.enabled() && response.hovered() {
ui.ctx().set_cursor_icon(egui::CursorIcon::PointingHand);
}
}
/// Icon action inside an existing rectangle. Tokens: `form_icon_inset, text, text_dim; icon palette`.
-pub fn icon_button_at(ui: &mut Ui, rect: egui::Rect, icon: &str, label: &str) -> Response {
+pub(crate) fn icon_button_at(ui: &mut Ui, rect: egui::Rect, icon: &str, label: &str) -> Response {
let t = Tokens::get();
let response = ui.interact(rect, ui.make_persistent_id(("icon_button", icon, label)), egui::Sense::click());
crate::icons::paint_ink(
@@ -36,7 +36,7 @@ pub fn icon_button_at(ui: &mut Ui, rect: egui::Rect, icon: &str, label: &str) ->
}
/// Esc cancels; unowned Enter submits only when valid. Tokens: `none`.
-pub fn keyboard(ctx: &egui::Context, ok_enabled: bool) -> Action {
+pub(crate) fn keyboard(ctx: &egui::Context, ok_enabled: bool) -> Action {
if ctx.input(|i| i.key_pressed(egui::Key::Escape)) {
Action::Cancel
} else if ok_enabled && ctx.memory(|m| m.focused().is_none()) && ctx.input(|i| i.key_pressed(egui::Key::Enter)) {
@@ -46,46 +46,16 @@ pub fn keyboard(ctx: &egui::Context, ok_enabled: bool) -> Action {
}
}
-/// Pinned OK / optional Apply / Cancel; returns Action. Tokens: `form_footer_height, form_button_height, dialog_footer/rule, radius_lg, control_*, accent, on_accent, font_label, space_6/10/12/16`.
-pub fn footer(ui: &mut Ui, ok_label: &str, cancel_label: &str, ok_enabled: bool, apply_label: Option<&str>) -> Action {
- footer_impl(ui, ok_label, cancel_label, ok_enabled, apply_label, None, None)
+/// Pinned actions with optional Apply, compute status and keyboard selection mark.
+#[derive(Default)]
+pub(crate) struct Footer<'a> {
+ pub apply: Option<&'a str>,
+ pub status: Option<&'a str>,
+ pub selected: Option<Action>,
}
-/// Footer whose `selected` action is marked (arrow keys move the mark in a prompt); an empty
-/// `ok_label` leaves out the OK action (a close-only card). Tokens: `footer tokens, selected_bg, accent`.
-pub(crate) fn footer_selected(
- ui: &mut Ui,
- ok_label: &str,
- cancel_label: &str,
- ok_enabled: bool,
- apply_label: Option<&str>,
- selected: Option<Action>,
-) -> Action {
- footer_impl(ui, ok_label, cancel_label, ok_enabled, apply_label, None, selected)
-}
-
-/// Footer with stable button IDs and compute text. Tokens: `footer tokens, text_dim, space_4/8`.
-pub(crate) fn footer_with_status(
- ui: &mut Ui,
- ok_label: &str,
- cancel_label: &str,
- ok_enabled: bool,
- apply_label: Option<&str>,
- status: Option<&str>,
-) -> Action {
- footer_impl(ui, ok_label, cancel_label, ok_enabled, apply_label, status, None)
-}
-
-/// Shared footer implementation. Tokens: `footer tokens`.
-fn footer_impl(
- ui: &mut Ui,
- ok_label: &str,
- cancel_label: &str,
- ok_enabled: bool,
- apply_label: Option<&str>,
- status: Option<&str>,
- selected: Option<Action>,
-) -> Action {
+pub(crate) fn footer(ui: &mut Ui, ok_label: &str, cancel_label: &str, ok_enabled: bool, options: Footer<'_>) -> Action {
+ let Footer { apply: apply_label, status, selected } = 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
@@ -144,8 +114,7 @@ fn footer_impl(
Action::Apply => "dialog:apply",
_ => "dialog:cancel",
};
- scenario::publish_handle(key, response.rect.center());
- scenario::publish_rect(key, response.rect);
+ scenario::publish_target(key, response.rect);
scenario::publish_handle(&format!("dialog:{label}"), response.rect.center());
if response.clicked() {
action = kind;
@@ -164,14 +133,14 @@ fn footer_impl(
}
/// One equal-width secondary action, with optional existing icon master.
-pub struct PairButton<'a> {
+pub(crate) struct PairButton<'a> {
pub key: &'a str,
pub label: &'a str,
pub icon: Option<&'a str>,
}
/// Equal-width secondary actions with optional icons and selected state. Tokens: `form_button_height, control_*, selected_bg, hover, font_label, text, icon/fill, accent, sketch_footer_icon_size, space_4/6/10`.
-pub fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], buttons: [PairButton<'_>; 2]) -> (bool, bool) {
+pub(crate) fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], buttons: [PairButton<'_>; 2]) -> (bool, bool) {
let t = Tokens::get();
ui.painter().hline(ui.max_rect().x_range(), ui.cursor().top(), egui::Stroke::new(1.0, t.dialog_rule));
let mut clicked = [false; 2];
@@ -216,8 +185,7 @@ pub fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], buttons: [Pa
painter.galley(egui::pos2(left + icon_width, rect.center().y - galley.size().y / 2.0), galley, t.text);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, ui.is_enabled(), on, label));
pointer_on_hover(ui, &response);
- crate::scenario::publish_handle(&format!("{key}:{}", button.key), rect.center());
- crate::scenario::publish_rect(&format!("{key}:{}", button.key), rect);
+ crate::scenario::publish_target(&format!("{key}:{}", button.key), rect);
if let Some(value) = clicked.get_mut(index) {
*value = response.on_hover_text(label).clicked();
}
@@ -227,40 +195,37 @@ pub fn button_pair(ui: &mut egui::Ui, key: &str, states: [bool; 2], buttons: [Pa
(clicked.first().copied().unwrap_or(false), clicked.get(1).copied().unwrap_or(false))
}
-/// Ordinary secondary action preserving native sizing. Tokens: `scope font/control/spacing tokens`.
-pub fn secondary_button(ui: &mut Ui, label: impl Into<egui::WidgetText>) -> Response {
+/// Secondary button variants preserve native sizing and enabled-button translation.
+pub(crate) enum Button {
+ Normal,
+ Small,
+ Enabled(bool),
+}
+
+pub(crate) fn button(ui: &mut Ui, label: impl Into<egui::WidgetText>, options: Button) -> Response {
let label = label.into();
let key = label.text().to_owned();
- let response = ui.button(label);
+ let draw = |ui: &mut Ui, label| match options {
+ Button::Small => ui.small_button(label),
+ _ => ui.button(label),
+ };
+ let response = match options {
+ Button::Enabled(enabled) => ui.add_enabled_ui(enabled, |ui| draw(ui, crate::i18n::tr_label(&key).into())).inner,
+ _ => draw(ui, label),
+ };
pointer_on_hover(ui, &response);
- publish_button(ui, &response, &key);
+ let key = if matches!(options, Button::Enabled(_)) { crate::i18n::tr_label(&key) } else { &key };
+ publish_button(ui, &response, key);
response
}
/// Accent action outside the footer. Tokens: `accent, on_accent; scope tokens`.
-pub fn primary_button(ui: &mut Ui, label: &str) -> Response {
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn primary_button(ui: &mut Ui, label: &str) -> Response {
let t = Tokens::get();
let response = ui.add(egui::Button::new(RichText::new(crate::i18n::tr_label(label)).color(t.on_accent)).fill(t.accent));
pointer_on_hover(ui, &response);
- scenario::publish_rect(&format!("dialog:button:{label}"), response.rect);
- scenario::publish_handle(&format!("dialog:button:{label}"), response.rect.center());
- response
-}
-
-/// Compact inline action preserving native sizing. Tokens: `scope font/control tokens`.
-pub fn small_button(ui: &mut Ui, label: &str) -> Response {
- let response = ui.small_button(label);
- pointer_on_hover(ui, &response);
- publish_button(ui, &response, label);
- response
-}
-
-/// Allocated control-height icon action. Tokens: `control_height; icon_button_at tokens`.
-pub fn icon_button(ui: &mut Ui, label: &str, icon: &str) -> Response {
- let (rect, _) = ui.allocate_exact_size(vec2(row_height(), row_height()), egui::Sense::hover());
- let response = icon_button_at(ui, rect, icon, label);
- scenario::publish_rect(&format!("dialog:button:{label}"), rect);
- scenario::publish_handle(&format!("dialog:button:{label}"), rect.center());
+ scenario::publish_target(&format!("dialog:button:{label}"), response.rect);
response
}
@@ -271,19 +236,12 @@ mod tests;
// Additional identities must never replace an existing field handle in compound rows.
fn publish_button(ui: &Ui, response: &Response, label: &str) {
let key = format!("dialog:button:{}:{label}", super::layout::label(ui));
- scenario::publish_handle(&key, response.rect.center());
- scenario::publish_rect(&key, response.rect);
-}
-
-/// Secondary action with caller-owned enabled state, retaining the native label.
-pub fn enabled_button(ui: &mut Ui, label: &str, enabled: bool) -> Response {
- ui.add_enabled_ui(enabled, |ui| secondary_button(ui, crate::i18n::tr_label(label))).inner
+ scenario::publish_target(&key, response.rect);
}
/// Nested action menu in a dense table. Tokens: scope control/font tokens.
-pub fn action_menu<R>(ui: &mut Ui, label: &str, add: impl FnOnce(&mut Ui) -> R) -> egui::InnerResponse<Option<R>> {
+pub(crate) fn action_menu<R>(ui: &mut Ui, label: &str, add: impl FnOnce(&mut Ui) -> R) -> egui::InnerResponse<Option<R>> {
let response = ui.menu_button(crate::i18n::tr_label(label), |ui| super::scope(ui, add));
- scenario::publish_rect(&format!("dialog:menu:{label}"), response.response.rect);
- scenario::publish_handle(&format!("dialog:menu:{label}"), response.response.rect.center());
+ scenario::publish_target(&format!("dialog:menu:{label}"), response.response.rect);
response
}
diff --git a/crates/ui-egui/src/ui_kit/actions_tests.rs b/crates/ui-egui/src/ui_kit/actions_tests.rs
index 6924c3a1c5..fe5f3f4f0a 100644
--- a/crates/ui-egui/src/ui_kit/actions_tests.rs
+++ b/crates/ui-egui/src/ui_kit/actions_tests.rs
@@ -10,7 +10,7 @@ fn footer_clicks_and_keyboard_respect_validation_and_editor_focus() {
let ctx = crate::fonts::test_context();
let mut action = Action::None;
let mut draw = |ui: &mut Ui| {
- action = footer(ui, "OK", "Cancel", enabled, None);
+ action = footer(ui, "OK", "Cancel", enabled, Footer::default());
};
frame(&ctx, vec![], &mut draw);
let pos = scenario::handle_at("dialog:ok").unwrap();
@@ -23,16 +23,16 @@ fn footer_clicks_and_keyboard_respect_validation_and_editor_focus() {
m.surrender_focus(id);
}
});
- frame(&ctx, key(egui::Key::Enter), |ui| action = footer(ui, "OK", "Cancel", enabled, None));
+ frame(&ctx, key(egui::Key::Enter), |ui| action = footer(ui, "OK", "Cancel", enabled, Footer::default()));
assert_eq!(action, if enabled { Action::Ok } else { Action::None });
- frame(&ctx, key(egui::Key::Escape), |ui| action = footer(ui, "OK", "Cancel", enabled, None));
+ frame(&ctx, key(egui::Key::Escape), |ui| action = footer(ui, "OK", "Cancel", enabled, Footer::default()));
assert_eq!(action, Action::Cancel);
frame(&ctx, vec![], |ui| {
- footer(ui, "OK", "Cancel", enabled, None);
+ footer(ui, "OK", "Cancel", enabled, Footer::default());
});
let cancel = scenario::handle_at("dialog:cancel").unwrap();
- frame(&ctx, pointer(cancel, true), |ui| action = footer(ui, "OK", "Cancel", enabled, None));
- frame(&ctx, pointer(cancel, false), |ui| action = footer(ui, "OK", "Cancel", enabled, None));
+ frame(&ctx, pointer(cancel, true), |ui| action = footer(ui, "OK", "Cancel", enabled, Footer::default()));
+ frame(&ctx, pointer(cancel, false), |ui| action = footer(ui, "OK", "Cancel", enabled, Footer::default()));
assert_eq!(action, Action::Cancel);
}
let ctx = crate::fonts::test_context();
@@ -41,11 +41,11 @@ fn footer_clicks_and_keyboard_respect_validation_and_editor_focus() {
frame(&ctx, vec![], |ui| {
let response = ui.text_edit_singleline(&mut text);
response.request_focus();
- footer(ui, "OK", "Cancel", true, None);
+ footer(ui, "OK", "Cancel", true, Footer::default());
});
frame(&ctx, key(egui::Key::Enter), |ui| {
ui.text_edit_singleline(&mut text).request_focus();
- action = footer(ui, "OK", "Cancel", true, None);
+ action = footer(ui, "OK", "Cancel", true, Footer::default());
});
// A text editor handles Enter itself; the footer cannot apply merely because it was pressed.
assert_eq!(action, Action::None);
@@ -56,7 +56,7 @@ fn enabled_buttons_show_the_pointing_hand_and_disabled_ones_do_not() {
for (enabled, expected) in [(true, egui::CursorIcon::PointingHand), (false, egui::CursorIcon::Default)] {
let ctx = crate::fonts::test_context();
let mut draw = |ui: &mut Ui| {
- footer(ui, "OK", "Cancel", enabled, Some("Apply"));
+ footer(ui, "OK", "Cancel", enabled, Footer { apply: Some("Apply"), ..Default::default() });
};
frame(&ctx, vec![], &mut draw);
let ok = scenario::handle_at("dialog:ok").unwrap();
diff --git a/crates/ui-egui/src/ui_kit/choice.rs b/crates/ui-egui/src/ui_kit/choice.rs
index eebdda6ca8..c500344b6b 100644
--- a/crates/ui-egui/src/ui_kit/choice.rs
+++ b/crates/ui-egui/src/ui_kit/choice.rs
@@ -8,27 +8,15 @@ use super::{
use crate::{scenario, theme::Tokens};
use egui::{Ui, vec2};
-/// Segments share the row equally. When the longest label would not fit its segment (several long
-/// choices in a narrow card), the choice is a dropdown instead of overlapping or clipped text.
-/// Equal text choices, falling back to dropdown when labels cannot fit. Tokens: `control_height, control_fill/border/radius, font_label, selected_bg/ink, hover, text, space_8`.
-pub fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str]) -> bool {
- segmented_states(ui, selected, options, &[])
+/// Text segments retain mixed states and optional compact clipping instead of dropdown fallback.
+#[derive(Default)]
+pub(crate) struct Segments<'a> {
+ pub states: &'a [bool],
+ pub compact: bool,
}
-/// Optional per-segment states preserve mixed selections in command-backed controls.
-/// Segmented choices with mixed per-choice state. Tokens: `same as segmented`.
-pub(crate) fn segmented_states(ui: &mut Ui, selected: &mut usize, options: &[&str], states: &[bool]) -> bool {
- segments(ui, selected, options, states, false)
-}
-
-/// Always-visible compact choices for short modes with established per-choice handles.
-/// Long translated labels clip within their segment and remain available as tooltips.
-/// Tokens: segmented tokens, space_4. Prefer segmented when dropdown fallback is appropriate.
-pub fn segmented_compact(ui: &mut Ui, selected: &mut usize, options: &[&str]) -> bool {
- segments(ui, selected, options, &[], true)
-}
-
-fn segments(ui: &mut Ui, selected: &mut usize, options: &[&str], states: &[bool], compact: bool) -> bool {
+pub(crate) fn segmented(ui: &mut Ui, selected: &mut usize, options: &[&str], config: Segments<'_>) -> bool {
+ let Segments { states, compact } = config;
let t = Tokens::get();
let segment_width = dimension(ui.available_width()) / options.len().max(1) as f32;
let widest = options
@@ -75,15 +63,14 @@ fn segments(ui: &mut Ui, selected: &mut usize, options: &[&str], states: &[bool]
}
}
ui.painter().rect_stroke(rect, t.control_radius, egui::Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
- scenario::publish_rect(&format!("dialog:segments:{}", label(ui)), rect);
- scenario::publish_handle(&format!("dialog:{}", label(ui)), rect.center());
+ scenario::publish_target_as(&format!("dialog:{}", label(ui)), &format!("dialog:segments:{}", label(ui)), rect);
clicked
}
/// One segment of [`segmented_icons`]: a stable key (also the accessible fallback text), the icon
/// master to draw and the hover text. The icon's colours come from the palette (its roles and the
/// accent assigned to its id in `palette.toml`), not from the caller.
-pub struct IconSegment {
+pub(crate) struct IconSegment {
pub key: &'static str,
pub icon: &'static str,
pub tip: String,
@@ -92,7 +79,7 @@ pub struct IconSegment {
/// A row of equal icon segments in the segmented control's frame. `states` says which segments are on
/// (several may be, for a mixed selection); without it `selected` is. True when a segment was clicked.
/// Equal icon choices with mixed state. Tokens: `segmented tokens, space_4/12, icon/fill, accent; icon palette`.
-pub fn segmented_icons(ui: &mut Ui, selected: &mut usize, options: &[IconSegment], states: &[bool]) -> bool {
+pub(crate) fn segmented_icons(ui: &mut Ui, selected: &mut usize, options: &[IconSegment], states: &[bool]) -> bool {
let t = Tokens::get();
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), row_height()), egui::Sense::hover());
ui.painter().rect_filled(rect, t.control_radius, t.control_fill);
@@ -127,13 +114,12 @@ pub fn segmented_icons(ui: &mut Ui, selected: &mut usize, options: &[IconSegment
}
}
ui.painter().rect_stroke(rect, t.control_radius, egui::Stroke::new(1.0, t.control_border), egui::StrokeKind::Inside);
- scenario::publish_rect(&format!("dialog:segments:{}", label(ui)), rect);
- scenario::publish_handle(&format!("dialog:{}", label(ui)), rect.center());
+ scenario::publish_target_as(&format!("dialog:{}", label(ui)), &format!("dialog:segments:{}", label(ui)), rect);
clicked
}
/// Compact checkbox options in bounded columns. Tokens: `form_checkbox_height, control_fill/border, radius_sm, accent, on_accent, font_body, text, space_2/3/6/8/14`.
-pub fn checkbox_grid(ui: &mut Ui, items: &mut [(&str, &mut bool)], columns: usize) {
+pub(crate) fn checkbox_grid(ui: &mut Ui, items: &mut [(&str, &mut bool)], columns: usize) {
let t = Tokens::get();
let columns = columns.clamp(1, items.len().max(1));
let width = ((dimension(ui.available_width()) - t.space_8 * columns.saturating_sub(1) as f32) / columns as f32).max(0.0);
@@ -166,8 +152,7 @@ pub fn checkbox_grid(ui: &mut Ui, items: &mut [(&str, &mut bool)], columns: usiz
let text_rect = egui::Rect::from_min_max(egui::pos2((square.right() + t.space_6).min(rect.right()), rect.top()), rect.max);
paint_text(ui, text_rect, text, egui::FontId::proportional(t.font_body), t.text, false);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), **value, translated));
- scenario::publish_handle(&format!("dialog:{label}"), rect.center());
- scenario::publish_rect(&format!("dialog:checkbox:{label}"), rect);
+ scenario::publish_target_as(&format!("dialog:{label}"), &format!("dialog:checkbox:{label}"), rect);
}
});
}
@@ -175,13 +160,13 @@ pub fn checkbox_grid(ui: &mut Ui, items: &mut [(&str, &mut bool)], columns: usiz
/// Shared expanded options band for feature dialogs.
/// Expanded two-column Options disclosure. Tokens: `section and checkbox_grid tokens`.
-pub fn options(ui: &mut Ui, id: &str, items: &mut [(&str, &mut bool)]) {
+pub(crate) fn options(ui: &mut Ui, id: &str, items: &mut [(&str, &mut bool)]) {
section(ui, id, "Options", true, |ui| checkbox_grid(ui, items, 2));
}
/// Entire row is the checkbox hit target, including its label on the left.
/// Full-row target with label left and box right; returns clicked. Tokens: `control_height, control_radius, hover, radius_sm, accent, control_fill/border, on_accent, font_label, text, space_2/3/6/14`.
-pub fn checkbox_row(ui: &mut egui::Ui, key: &str, label: &str, on: bool) -> bool {
+pub(crate) fn checkbox_row(ui: &mut egui::Ui, key: &str, label: &str, on: bool) -> bool {
let t = Tokens::get();
let (rect, response) = ui.allocate_exact_size(vec2(ui.available_width(), t.control_height), egui::Sense::click());
let square = egui::Rect::from_center_size(egui::pos2(rect.right() - t.space_14 / 2.0, rect.center().y), vec2(t.space_14, t.space_14));
@@ -206,15 +191,14 @@ pub fn checkbox_row(ui: &mut egui::Ui, key: &str, label: &str, on: bool) -> bool
.with_clip_rect(ui.clip_rect().intersect(egui::Rect::from_min_max(rect.min, egui::pos2(square.left() - t.space_6, rect.bottom()))));
painter.text(rect.left_center(), egui::Align2::LEFT_CENTER, label, egui::FontId::proportional(t.font_label), t.text);
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), on, label));
- crate::scenario::publish_handle(&format!("sketch_palette:toggle:{key}"), rect.center());
- crate::scenario::publish_rect(&format!("sketch_palette:toggle:{key}"), rect);
+ crate::scenario::publish_target(&format!("sketch_palette:toggle:{key}"), rect);
response.on_hover_text(label).clicked()
}
/// Standard inline checkbox; inherits scope's font_label, accent, control and text tokens.
/// Use checkbox_row for a full-width label-left/box-right palette option.
/// Inline native checkbox retaining existing accessibility and sizing. Tokens: `scope control/font/accent tokens`.
-pub fn checkbox(ui: &mut Ui, label: &str, value: &mut bool) -> egui::Response {
+pub(crate) fn checkbox(ui: &mut Ui, label: &str, value: &mut bool) -> egui::Response {
let response = ui.checkbox(value, label);
super::layout::publish_geometry(ui, &response);
response
@@ -222,7 +206,7 @@ pub fn checkbox(ui: &mut Ui, label: &str, value: &mut bool) -> egui::Response {
/// Compact bold/italic toggles for text. Tokens: scope font/control tokens.
/// The glyphs keep the familiar B/I treatment; accessible names use translated style names.
-pub fn text_emphasis(ui: &mut Ui, bold: &mut bool, italic: &mut bool) {
+pub(crate) fn text_emphasis(ui: &mut Ui, bold: &mut bool, italic: &mut bool) {
use crate::fonts::RichTextExt as _;
for (key, text, value, id) in [
("Bold", egui::RichText::new("B").semibold(), bold, "sketch_text.bold"),
@@ -230,13 +214,12 @@ pub fn text_emphasis(ui: &mut Ui, bold: &mut bool, italic: &mut bool) {
] {
let response = ui.toggle_value(value, text).on_hover_text(crate::i18n::tr(id));
response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::Button, ui.is_enabled(), *value, crate::i18n::tr(id)));
- scenario::publish_handle(&format!("dialog:{key}"), response.rect.center());
- scenario::publish_rect(&format!("dialog:emphasis:{key}"), response.rect);
+ scenario::publish_target_as(&format!("dialog:{key}"), &format!("dialog:emphasis:{key}"), response.rect);
}
}
/// A command variant supplied by the panel; the kit only draws and returns its key.
-pub struct ToolChoice<'a> {
+pub(crate) struct ToolChoice<'a> {
pub key: &'a str,
pub icon: &'a str,
pub label: &'a str,
@@ -245,7 +228,7 @@ pub struct ToolChoice<'a> {
/// Wrapped creation-mode icon choices. Tokens: sketch_mode_*, sketch_accent, control_*, icon, spacing.
/// Wrapped command-variant icons, supplied with enabled state. Tokens: `sketch_mode_size/radius/border/tint, sketch_accent, control_fill/border, icon/fill, space_4/6`.
-pub fn tool_choices<'a>(ui: &mut Ui, label: &str, current: &str, choices: &[ToolChoice<'a>]) -> Option<&'a str> {
+pub(crate) fn tool_choices<'a>(ui: &mut Ui, label: &str, current: &str, choices: &[ToolChoice<'a>]) -> Option<&'a str> {
let t = Tokens::get();
let mut start = None;
ui.label(label);
@@ -264,8 +247,7 @@ pub fn tool_choices<'a>(ui: &mut Ui, label: &str, current: &str, choices: &[Tool
.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);
- scenario::publish_handle(&format!("sketch_palette:feature:{}", choice.key), response.rect.center());
- scenario::publish_rect(&format!("sketch_palette:feature:{}", choice.key), response.rect);
+ 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 {
start = Some(choice.key);
@@ -277,7 +259,7 @@ pub fn tool_choices<'a>(ui: &mut Ui, label: &str, current: &str, choices: &[Tool
/// Independent selected icon action, used for pattern direction/centering.
/// Tokens: control_height, space_3/4/24, icon/fill, accent; inherited control surface tokens.
-pub fn toggle_icon(ui: &mut Ui, row: &str, label: &str, selected: &mut bool, icon: &str) -> egui::Response {
+pub(crate) fn toggle_icon(ui: &mut Ui, row: &str, label: &str, selected: &mut bool, icon: &str) -> egui::Response {
// Tab moves between value fields; Enter after a value edit applies the dialog.
let t = Tokens::get();
let response =
@@ -298,17 +280,16 @@ mod tests;
/// Selectable list item retaining checked state and full text as an accessible label.
/// Tokens: control_height and scope selection/control/font tokens.
-pub fn list_picker(ui: &mut Ui, key: &str, text: &str, selected: bool) -> egui::Response {
+pub(crate) fn list_picker(ui: &mut Ui, key: &str, text: &str, selected: bool) -> egui::Response {
let response =
ui.add_sized(egui::vec2(super::metrics::dimension(ui.available_width()), super::row_height()), egui::Button::selectable(selected, text));
- crate::scenario::publish_handle(&format!("dialog:list:{key}"), response.rect.center());
- crate::scenario::publish_rect(&format!("dialog:list:{key}"), response.rect);
+ crate::scenario::publish_target(&format!("dialog:list:{key}"), response.rect);
response
}
/// A reusable draggable document-colour sample; caller supplies the existing domain payload.
/// Tokens: control_height/radius, border, accent, hover.
-pub fn color_swatch<T: Send + Sync + 'static>(
+pub(crate) fn color_swatch<T: Send + Sync + 'static>(
ui: &mut Ui,
id: egui::Id,
color: egui::Color32,
@@ -343,7 +324,7 @@ pub fn color_swatch<T: Send + Sync + 'static>(
}
/// Wrapped samples with common token spacing. Keeps native drag-and-drop payloads intact.
-pub fn swatch_grid<T>(ui: &mut Ui, values: &[T], mut each: impl FnMut(&mut Ui, &T)) {
+pub(crate) fn swatch_grid<T>(ui: &mut Ui, values: &[T], mut each: impl FnMut(&mut Ui, &T)) {
let t = Tokens::get();
let columns = ((super::metrics::dimension(ui.available_width()) + t.space_4) / (t.control_height + t.space_4)).floor().clamp(1.0, 64.0) as usize;
ui.vertical(|ui| {
@@ -359,7 +340,7 @@ pub fn swatch_grid<T>(ui: &mut Ui, values: &[T], mut each: impl FnMut(&mut Ui, &
}
/// A completion/suggestion entry; text and detail are application-supplied data.
-pub struct PopupOption<'a> {
+pub(crate) struct PopupOption<'a> {
pub text: &'a str,
pub detail: &'a str,
pub color: egui::Color32,
@@ -367,7 +348,14 @@ pub struct PopupOption<'a> {
/// Focus-neutral suggestion popup. The owner handles navigation and completion semantics.
/// Tokens: space_2, form_label_width, control_height, text_dim, scope control/font tokens.
-pub fn popup_list(ctx: &egui::Context, id: egui::Id, anchor: egui::Rect, selected: usize, options: &[PopupOption<'_>], hint: &str) -> Option<usize> {
+pub(crate) fn popup_list(
+ ctx: &egui::Context,
+ id: egui::Id,
+ anchor: egui::Rect,
+ selected: usize,
+ options: &[PopupOption<'_>],
+ hint: &str,
+) -> Option<usize> {
let t = crate::theme::Tokens::get();
let mut chosen = None;
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| {
@@ -383,13 +371,13 @@ pub fn popup_list(ctx: &egui::Context, id: egui::Id, anchor: egui::Rect, selecte
.on_hover_text(option.detail);
crate::scenario::publish_handle(&format!("dialog:suggestion:{index}"), response.rect.center());
if index == selected {
- super::note(ui, "completion_detail", option.detail);
+ super::text(ui, option.detail, super::Text::Note("completion_detail"));
}
if response.clicked() {
chosen = Some(index);
}
}
- super::note(ui, "completion_hint", hint);
+ super::text(ui, hint, super::Text::Note("completion_hint"));
})
});
});
diff --git a/crates/ui-egui/src/ui_kit/choice_tests.rs b/crates/ui-egui/src/ui_kit/choice_tests.rs
index 869c7e4c01..913ee95d08 100644
--- a/crates/ui-egui/src/ui_kit/choice_tests.rs
+++ b/crates/ui-egui/src/ui_kit/choice_tests.rs
@@ -9,7 +9,7 @@ fn segmented_click_changes_selection_and_keeps_all_choices_visible() {
let ctx = crate::fonts::test_context();
let mut selected = 0;
let mut draw = |ui: &mut Ui| {
- row(ui, "Continuity", |ui| segmented(ui, &mut selected, &["G1", "G2", "G3"]));
+ row(ui, "Continuity", |ui| segmented(ui, &mut selected, &["G1", "G2", "G3"], Default::default()));
};
frame(&ctx, vec![], &mut draw);
let pos = scenario::handle_at("dialog:Continuity:G2").unwrap();
diff --git a/crates/ui-egui/src/ui_kit/fields.rs b/crates/ui-egui/src/ui_kit/fields.rs
index c201576ed8..eb14df9134 100644
--- a/crates/ui-egui/src/ui_kit/fields.rs
+++ b/crates/ui-egui/src/ui_kit/fields.rs
@@ -10,25 +10,25 @@ use egui::{Response, RichText, Ui, vec2};
/// Expression editor with the application's existing completion and number-focus behaviour.
/// Values carry their own unit text ("20 mm", "45 deg"): there is no unit suffix. Returns accepted Enter.
/// Tokens: `control_height, control_fill, form_inset, font_label, space_4; scope tokens`.
-pub fn field(ui: &mut Ui, value: &mut String) -> bool {
+pub(crate) fn field(ui: &mut Ui, value: &mut String) -> bool {
editor(ui, value, "", true).0
}
/// Expression editor with empty-value hint. Tokens: `same as field`.
-pub fn hint_field(ui: &mut Ui, value: &mut String, hint: &str) -> bool {
+pub(crate) fn hint_field(ui: &mut Ui, value: &mut String, hint: &str) -> bool {
editor(ui, value, hint, true).0
}
/// Names, thread designations and plain numeric counts do not accept expression completion.
/// Plain text editor without expression completion; returns (Enter, changed). Tokens: `same as field`.
-pub fn text_field(ui: &mut Ui, value: &mut String, hint: &str) -> (bool, bool) {
+pub(crate) fn text_field(ui: &mut Ui, value: &mut String, hint: &str) -> (bool, bool) {
let (enter, changed, _) = editor(ui, value, hint, false);
(enter, changed)
}
/// Expression field for a single-value popup which keeps ownership of keyboard focus.
/// Tokens: field tokens. Preserves the legacy Edit Dimension focus behavior.
-pub fn focused_field(ui: &mut Ui, value: &mut String) -> bool {
+pub(crate) fn focused_field(ui: &mut Ui, value: &mut String) -> bool {
let (enter, _, response) = editor(ui, value, "", true);
response.request_focus();
enter
@@ -36,7 +36,7 @@ pub fn focused_field(ui: &mut Ui, value: &mut String) -> bool {
/// Plain text editor which keeps keyboard focus (a name asked for in a one-field card); returns
/// accepted Enter. Tokens: `same as field`.
-pub fn focused_text_field(ui: &mut Ui, value: &mut String, hint: &str) -> bool {
+pub(crate) fn focused_text_field(ui: &mut Ui, value: &mut String, hint: &str) -> bool {
let (enter, _, response) = editor(ui, value, hint, false);
response.request_focus();
enter
@@ -44,7 +44,7 @@ pub fn focused_text_field(ui: &mut Ui, value: &mut String, hint: &str) -> bool {
/// Multiline plain text with a stable focus ID. The caller owns Enter/Shift+Enter routing.
/// Tokens: control_height, control_fill, form_inset and font_label.
-pub fn multiline_text_field(ui: &mut Ui, label: &str, id: egui::Id, value: &mut String) -> Response {
+pub(crate) fn multiline_text_field(ui: &mut Ui, label: &str, id: egui::Id, value: &mut String) -> Response {
super::layout::sized_row(ui, label, row_height() * 3.0, |ui| {
let t = Tokens::get();
let response = ui.add_sized(
@@ -62,7 +62,7 @@ pub fn multiline_text_field(ui: &mut Ui, label: &str, id: egui::Id, value: &mut
}
/// Supplied entry in a searchable dropdown. Handles are optional stable application aliases.
-pub struct SearchOption<'a> {
+pub(crate) struct SearchOption<'a> {
pub value: &'a str,
pub label: &'a str,
pub handle: Option<&'a str>,
@@ -71,7 +71,7 @@ pub struct SearchOption<'a> {
/// Searchable dropdown with an optional custom-value action and loading message.
/// Returns a chosen value; callers keep domain-specific validation and discovery.
/// Tokens: control_height, space_24, font_label and scope control tokens.
-pub fn searchable_dropdown(
+pub(crate) fn searchable_dropdown(
ui: &mut Ui,
id: &str,
current: &str,
@@ -157,8 +157,7 @@ fn editor(ui: &mut Ui, value: &mut String, hint: &str, completion: bool) -> (boo
info.current_text_value = Some(value.clone());
info
});
- scenario::publish_handle(&format!("dialog:{}", self::label(ui)), response.rect.center());
- scenario::publish_rect(&format!("dialog:widget:{}", self::label(ui)), response.rect);
+ super::layout::publish_geometry(ui, &response);
// A completion's Enter accepts the suggestion, rather than submitting the dialog.
let completed = completion && crate::params_dialog::complete(ui, &response, value);
(!completed && response.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter)), response.changed(), response)
@@ -170,7 +169,7 @@ fn dropdown_arrow(ui: &Ui, rect: egui::Rect, _visuals: &egui::style::WidgetVisua
}
/// Native dropdown with kit arrow and scenario option handles. Tokens: `text_dim; scope control/font tokens`.
-pub fn dropdown(ui: &mut Ui, id: &str, selected: &mut usize, options: &[&str]) -> Response {
+pub(crate) fn dropdown(ui: &mut Ui, id: &str, selected: &mut usize, options: &[&str]) -> Response {
let text = options.get(*selected).copied().map(crate::i18n::tr_label).unwrap_or("");
let row = label(ui).to_string();
dropdown_menu(ui, id, text, |ui| {
@@ -183,7 +182,7 @@ pub fn dropdown(ui: &mut Ui, id: &str, selected: &mut usize, options: &[&str]) -
/// Dropdown with caller-supplied kit choices/actions, including disabled entries and stable
/// application handles. Tokens: dropdown tokens. Use `dropdown` for a simple indexed list.
-pub fn dropdown_menu(ui: &mut Ui, id: impl egui::AsIdSalt, current: &str, add: impl FnOnce(&mut Ui)) -> Response {
+pub(crate) fn dropdown_menu(ui: &mut Ui, id: impl egui::AsIdSalt, current: &str, add: impl FnOnce(&mut Ui)) -> Response {
let response = egui::ComboBox::from_id_salt(id)
.width(dimension(ui.available_width()))
.height(Tokens::get().control_height * 14.0)
@@ -195,13 +194,14 @@ pub fn dropdown_menu(ui: &mut Ui, id: impl egui::AsIdSalt, current: &str, add: i
response
}
-/// Filled point/curve/edge selection target. Tokens: `control_height, control_radius, selected_bg/ink, accent, form_inset, space_24/8, font_label, text_dim`.
-pub fn selection_field(ui: &mut Ui, text: &str, active: bool) -> Response {
- selection_field_state(ui, text, active, true)
+/// Selection target state; filled targets retain their reserved trailing space.
+pub(crate) struct Selection {
+ pub active: bool,
+ pub filled: bool,
}
-/// Selection target with explicit filled state. Tokens: `same as selection_field`.
-pub fn selection_field_state(ui: &mut Ui, text: &str, active: bool, filled: bool) -> Response {
+pub(crate) fn selection_field(ui: &mut Ui, text: &str, options: Selection) -> Response {
+ let Selection { active, filled } = options;
let t = Tokens::get();
let (rect, response) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), row_height()), egui::Sense::CLICK);
ui.painter().rect(rect, t.control_radius, t.selected_bg, egui::Stroke::new(if active { 1.0 } else { 0.0 }, t.accent), egui::StrokeKind::Inside);
@@ -217,16 +217,9 @@ pub fn selection_field_state(ui: &mut Ui, text: &str, active: bool, filled: bool
response
}
-/// Two labelled expression values in one aligned row, e.g. X/Y. Returns accepted Enter.
-/// Tokens: row/label column metrics, space_8 and field's font/control tokens.
-/// Two labelled numeric fields in one row; returns accepted Enter. Tokens: `row/field tokens, space_8, dialog_label`.
-pub fn value_pair(ui: &mut Ui, label: &str, values: [&mut String; 2], axes: [&str; 2]) -> bool {
- value_pair_named(ui, label, values, axes, axes)
-}
-
-/// Paired values with compact axis captions and independent stable field names.
-/// Tokens: value_pair tokens. Use when existing scenario/accessibility names differ from X/Y.
-pub fn value_pair_named(ui: &mut Ui, label: &str, values: [&mut String; 2], axes: [&str; 2], names: [&str; 2]) -> bool {
+/// Paired values with compact captions and optional independent scenario/accessibility names.
+pub(crate) fn value_pair(ui: &mut Ui, label: &str, values: [&mut String; 2], axes: [&str; 2], names: Option<[&str; 2]>) -> bool {
+ let names = names.unwrap_or(axes);
let t = Tokens::get();
super::row(ui, label, |ui| {
let width = ((dimension(ui.available_width()) - t.space_8) / 2.0).max(0.0);
@@ -246,10 +239,9 @@ pub fn value_pair_named(ui: &mut Ui, label: &str, values: [&mut String; 2], axes
/// Variable-radius location editor. Tokens: scope's control and typography tokens.
/// Retains the established 0.01 step, fractional range and locale parser.
/// Locale-aware variable-radius position editor. Tokens: `scope control/font tokens`.
-pub fn fraction_field(ui: &mut Ui, value: &mut f64) -> Response {
+pub(crate) fn fraction_field(ui: &mut Ui, value: &mut f64) -> Response {
let response = ui.add(egui::DragValue::new(value).speed(0.01).range(0.01..=0.99).fixed_decimals(2).custom_parser(crate::prefs::parse_number));
- scenario::publish_rect(&format!("dialog:fraction:{}", label(ui)), response.rect);
- scenario::publish_handle(&format!("dialog:fraction:{}", label(ui)), response.rect.center());
+ scenario::publish_target(&format!("dialog:fraction:{}", label(ui)), response.rect);
response
}
@@ -259,12 +251,12 @@ 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 fn cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, invalid: bool) -> Response {
+pub(crate) 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)
}
/// Stable-ID cell/name editor with a caller-supplied character cap. Tokens: cell_editor tokens.
-pub fn bounded_cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, invalid: bool, limit: usize) -> Response {
+pub(crate) fn bounded_cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str, invalid: bool, limit: usize) -> Response {
let t = Tokens::get();
let response = ui.add_sized(
vec2(dimension(ui.available_width()), row_height()),
@@ -289,57 +281,52 @@ pub fn bounded_cell_editor(ui: &mut Ui, id: egui::Id, value: &mut String, hint:
}
/// Search input with native accessibility and a stable caller ID. Tokens: cell_editor tokens.
-pub fn search_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
+pub(crate) fn search_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
cell_editor(ui, id, value, hint, false)
}
/// Native colour chooser under the shared form styling. Colour is document data.
-pub fn color_field(ui: &mut Ui, rgb: &mut [u8; 3]) -> Response {
+pub(crate) fn color_field(ui: &mut Ui, rgb: &mut [u8; 3]) -> Response {
let response = ui.color_edit_button_srgb(rgb);
- scenario::publish_rect(&format!("dialog:color:{}", label(ui)), response.rect);
- scenario::publish_handle(&format!("dialog:color:{}", label(ui)), response.rect.center());
+ scenario::publish_target(&format!("dialog:color:{}", label(ui)), response.rect);
response
}
/// Continuous scalar control. Formatting never rounds saved values during drawing.
/// Tokens: control_height, space_24/4, scope control/font tokens.
-pub fn slider(ui: &mut Ui, value: &mut f64, range: std::ops::RangeInclusive<f64>) -> Response {
+pub(crate) fn slider(ui: &mut Ui, value: &mut f64, range: std::ops::RangeInclusive<f64>) -> Response {
let t = Tokens::get();
ui.spacing_mut().slider_width = dimension(ui.available_width() - t.space_24 - t.space_24 - t.space_4);
let response = ui.add(egui::Slider::new(value, range).max_decimals_opt(None).custom_formatter(|v, _| format!("{v:.2}")));
- scenario::publish_rect(&format!("dialog:slider:{}", label(ui)), response.rect);
- scenario::publish_handle(&format!("dialog:slider:{}", label(ui)), response.rect.center());
+ scenario::publish_target(&format!("dialog:slider:{}", label(ui)), response.rect);
response
}
/// Locale-aware bounded scalar field, used for dimensionless material properties.
-pub fn scalar_field(ui: &mut Ui, value: &mut f64, range: std::ops::RangeInclusive<f64>) -> Response {
+pub(crate) fn scalar_field(ui: &mut Ui, value: &mut f64, range: std::ops::RangeInclusive<f64>) -> Response {
let response = ui.add(egui::DragValue::new(value).range(range).speed(0.01).custom_parser(crate::prefs::parse_number));
- scenario::publish_rect(&format!("dialog:scalar:{}", label(ui)), response.rect);
- scenario::publish_handle(&format!("dialog:scalar:{}", label(ui)), response.rect.center());
+ scenario::publish_target(&format!("dialog:scalar:{}", label(ui)), response.rect);
response
}
/// Length held in millimetres, dragged or typed in the design's units ("0.5 in", "2 cm + 3 mm" parse).
/// Tokens: control_height, scope control/font tokens.
-pub fn length_field(ui: &mut Ui, value: &mut f64, units: &str, decimals: u8) -> Response {
+pub(crate) fn length_field(ui: &mut Ui, value: &mut f64, units: &str, decimals: u8) -> Response {
let response = ui.add(length_drag(value, units, decimals));
- scenario::publish_rect(&format!("dialog:length:{}", label(ui)), response.rect);
- scenario::publish_handle(&format!("dialog:length:{}", label(ui)), response.rect.center());
+ scenario::publish_target(&format!("dialog:length:{}", label(ui)), response.rect);
response
}
/// Angle in degrees, dragged or typed. Tokens: control_height, scope control/font tokens.
-pub fn angle_field(ui: &mut Ui, value: &mut f64) -> Response {
+pub(crate) fn angle_field(ui: &mut Ui, value: &mut f64) -> Response {
let response = ui.add(egui::DragValue::new(value).speed(1.0).suffix(" deg").custom_parser(crate::prefs::parse_number));
- scenario::publish_rect(&format!("dialog:angle:{}", label(ui)), response.rect);
- scenario::publish_handle(&format!("dialog:angle:{}", label(ui)), response.rect.center());
+ scenario::publish_target(&format!("dialog:angle:{}", label(ui)), response.rect);
response
}
/// Bounded multiline data input. Caller owns validation and keyboard semantics.
/// Tokens: control_height/fill, form_inset, font_label.
-pub fn text_area(ui: &mut Ui, label: &str, id: egui::Id, value: &mut String, rows: usize, limit: usize) -> Response {
+pub(crate) fn text_area(ui: &mut Ui, label: &str, id: egui::Id, value: &mut String, rows: usize, limit: usize) -> Response {
let t = Tokens::get();
let response = ui.add_sized(
vec2(dimension(ui.available_width()), row_height() * rows.clamp(1, 16) as f32),
@@ -361,7 +348,7 @@ pub fn text_area(ui: &mut Ui, label: &str, id: egui::Id, value: &mut String, row
/// Secret input with a stable ID. Never publishes its value in accessibility/scenario metadata.
/// Tokens: cell_editor tokens.
-pub fn password_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
+pub(crate) fn password_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
let t = Tokens::get();
let response = ui.add_sized(
vec2(dimension(ui.available_width()), row_height()),
@@ -379,7 +366,13 @@ pub fn password_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str)
/// Bounded integer or decimal preference with its original drag step and unit suffix.
/// Tokens: scope control/font tokens. Values and limits are caller data.
-pub fn number_field<T: egui::emath::Numeric>(ui: &mut Ui, value: &mut T, range: std::ops::RangeInclusive<T>, speed: f64, suffix: &str) -> Response {
+pub(crate) fn number_field<T: egui::emath::Numeric>(
+ ui: &mut Ui,
+ value: &mut T,
+ range: std::ops::RangeInclusive<T>,
+ speed: f64,
+ suffix: &str,
+) -> Response {
let response = ui.add(egui::DragValue::new(value).range(range).speed(speed).suffix(suffix).custom_parser(crate::prefs::parse_number));
response.widget_info(|| {
let mut info = egui::WidgetInfo::drag_value(ui.is_enabled(), value.to_f64());
@@ -392,7 +385,7 @@ pub fn number_field<T: egui::emath::Numeric>(ui: &mut Ui, value: &mut T, range:
/// Stepped slider retaining caller units/formatting (percent, multiplier, seconds).
/// Tokens: control_height, space_24/4, scope control/font tokens.
-pub fn formatted_slider<T: egui::emath::Numeric>(
+pub(crate) fn formatted_slider<T: egui::emath::Numeric>(
ui: &mut Ui,
value: &mut T,
range: std::ops::RangeInclusive<T>,
@@ -409,7 +402,8 @@ pub fn formatted_slider<T: egui::emath::Numeric>(
/// Growing plain-text message editor; its parent owns scrolling and Enter routing.
/// Tokens: control_fill, form_inset, font_label. Use text_area for bounded data input.
-pub fn message_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
+#[cfg(any(not(target_arch = "wasm32"), test))]
+pub(crate) fn message_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
let t = Tokens::get();
ui.add(
egui::TextEdit::multiline(value)
@@ -425,7 +419,7 @@ pub fn message_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str)
/// Edit a millimetre value through a control expressed in the current design units.
/// Keep the stored value untouched unless the user actually changes the field.
-pub fn length_drag<'a>(value: &'a mut f64, units: &str, decimals: u8) -> egui::DragValue<'a> {
+fn length_drag<'a>(value: &'a mut f64, units: &str, decimals: u8) -> egui::DragValue<'a> {
let (scale, unit) = crate::prefs::unit_scale(units);
egui::DragValue::new(value)
.speed(0.5)
@@ -436,7 +430,7 @@ pub fn length_drag<'a>(value: &'a mut f64, units: &str, decimals: u8) -> egui::D
/// Timeline/drive slider without a numeric editor; the owning surface shows its value.
/// Whole steps round only while manipulating a timeline. Tokens: control_height, space_4.
-pub fn timeline_slider(ui: &mut Ui, value: &mut f64, range: std::ops::RangeInclusive<f64>, whole_steps: bool) -> Response {
+pub(crate) fn timeline_slider(ui: &mut Ui, value: &mut f64, range: std::ops::RangeInclusive<f64>, whole_steps: bool) -> Response {
ui.spacing_mut().slider_width = dimension(ui.available_width() - Tokens::get().space_4);
let slider = egui::Slider::new(value, range).show_value(false);
let response = ui.add(if whole_steps { slider.integer() } else { slider });
@@ -447,7 +441,7 @@ pub fn timeline_slider(ui: &mut Ui, value: &mut f64, range: std::ops::RangeInclu
/// Placement editor whose owner routes Enter and Tab (including rejected expressions).
/// Completion remains with the caller. Tokens: cell_editor tokens.
-pub fn placement_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
+pub(crate) fn placement_field(ui: &mut Ui, id: egui::Id, value: &mut String, hint: &str) -> Response {
let t = Tokens::get();
let response = ui.add(
egui::TextEdit::singleline(value)
diff --git a/crates/ui-egui/src/ui_kit/gallery.rs b/crates/ui-egui/src/ui_kit/gallery.rs
index 2604016df7..136008e31c 100644
--- a/crates/ui-egui/src/ui_kit/gallery.rs
+++ b/crates/ui-egui/src/ui_kit/gallery.rs
@@ -1,426 +1,359 @@
-//! Layout/paint reference for every element in both themes. No window or GPU required.
+//! Table-driven layout/paint references in both themes. No window or GPU required.
use super::*;
use crate::{scenario, theme::Tokens};
use egui::{Ui, vec2};
-const ELEMENTS: &[&str] = &[
- "timeline_slider",
- "placement_field",
- "bounded_cell_editor",
- "password_field",
- "number_field",
- "formatted_slider",
- "dropdown_menu",
- "message_field",
- "text_lines",
- "inline_text",
- "label_actions",
- "table",
- "list_picker",
- "text_block",
- "search_field",
- "cell_editor",
- "color_field",
- "slider",
- "scalar_field",
- "length_field",
- "angle_field",
- "text_area",
- "color_swatch",
- "action_menu",
- "enabled_button",
- "collapsible_header",
- "header",
- "row",
- "caption",
- "hint",
- "note",
- "section",
- "divider",
- "field",
- "focused_field",
- "hint_field",
- "text_field",
- "focused_text_field",
- "multiline_text_field",
- "searchable_dropdown",
- "text_emphasis",
- "value_pair_named",
- "dropdown",
- "selection_field",
- "selection_field_state",
- "segmented",
- "segmented_compact",
- "segmented_states",
- "segmented_icons",
- "checkbox",
- "checkbox_row",
- "checkbox_grid",
- "options",
- "footer",
- "footer_apply",
- "footer_status",
- "button_pair",
- "primary",
- "secondary",
- "small",
- "icon",
- "list_row",
- "value_pair",
- "fraction",
- "status_header",
- "progress",
- "tool_choices",
- "toggle_icon",
-];
+struct Sample {
+ value: String,
+ second: String,
+ selected: usize,
+ checked: bool,
+}
-/// Each example publishes a named rect and at least one handle (except non-interactive dividers).
-fn example(ui: &mut Ui, name: &str) -> (&'static str, Option<&'static str>) {
- let mut value = "12 mm".to_owned();
- let mut second = "25 mm".to_owned();
- let mut selected = 0;
- let mut checked = true;
- match name {
- "timeline_slider"
- | "placement_field"
- | "bounded_cell_editor"
- | "password_field"
- | "number_field"
- | "formatted_slider"
- | "dropdown_menu"
- | "message_field"
- | "text_lines" => {
- let rect = ui
- .scope(|ui| match name {
- "timeline_slider" => {
- timeline_slider(ui, &mut 12.0, 0.0..=100.0, true);
- }
- "placement_field" => {
- placement_field(ui, ui.id().with("placement"), &mut value, "Distance");
- }
- "bounded_cell_editor" => {
- bounded_cell_editor(ui, ui.id().with("name"), &mut value, "Name", false, 128);
- }
- "password_field" => {
- password_field(ui, ui.id().with("secret"), &mut value, "API key");
- }
- "number_field" => {
- number_field(ui, &mut 3_u32, 1..=200, 1.0, "");
- }
- "formatted_slider" => {
- formatted_slider(ui, &mut 1.0, 0.5..=2.5, 0.05, |v| format!("{:.0} %", v * 100.0));
- }
- "dropdown_menu" => {
- dropdown_menu(ui, "gallery_menu", "Preset", |ui| {
- list_picker(ui, "preset", "Preset", true);
- });
- }
- "message_field" => {
- message_field(ui, ui.id().with("message"), &mut value, "Message");
- }
- "text_lines" => {
- text_lines(ui, "gallery", "Licence\nSecond line");
- }
- _ => {}
- })
- .response
- .rect;
- scenario::publish_rect("gallery:forms", rect);
- ("gallery:forms", None)
- }
+struct Element {
+ name: &'static str,
+ rect: &'static str,
+ handle: Option<&'static str>,
+ draw: fn(&mut Ui, &mut Sample),
+}
+
+macro_rules! element {
+ ($name:literal, $rect:literal, $handle:expr, $draw:expr) => {
+ Element { name: $name, rect: $rect, handle: $handle, draw: $draw }
+ };
+ ($name:literal, $draw:expr) => {
+ element!($name, "gallery:allocation", None, $draw)
+ };
+}
- "table" => {
- table(ui, "gallery", &[Column { label: "Name", width: 1.0 }, Column { label: "Expression", width: 1.5 }], "No rows", |ui, table| {
- table.row(ui, "row", true, |row| {
- row.cell(|ui| {
- cell_text(ui, "Width");
- });
- row.cell(|ui| {
- cell_editor(ui, ui.id().with("value"), &mut value, "", false);
- });
+// One entry per element/variant: names, rendering and geometry expectations stay together.
+const ELEMENTS: &[Element] = &[
+ element!("scope", |ui, _| {
+ scope(ui, |ui| {
+ ui.allocate_space(vec2(row_height(), row_height()));
+ });
+ }),
+ element!("row_height", |ui, _| {
+ ui.allocate_space(vec2(row_height(), row_height()));
+ }),
+ element!("header_height", |ui, _| {
+ ui.allocate_space(vec2(header_height(), header_height()));
+ }),
+ element!("timeline_slider", |ui, _| {
+ timeline_slider(ui, &mut 12.0, 0.0..=100.0, true);
+ }),
+ element!("placement_field", |ui, s| {
+ placement_field(ui, ui.id().with("placement"), &mut s.value, "Distance");
+ }),
+ element!("bounded_cell_editor", |ui, s| {
+ bounded_cell_editor(ui, ui.id().with("name"), &mut s.value, "Name", false, 128);
+ }),
+ element!("password_field", |ui, s| {
+ password_field(ui, ui.id().with("secret"), &mut s.value, "API key");
+ }),
+ element!("number_field", |ui, _| {
+ number_field(ui, &mut 3_u32, 1..=200, 1.0, "");
+ }),
+ element!("formatted_slider", |ui, _| {
+ formatted_slider(ui, &mut 1.0, 0.5..=2.5, 0.05, |v| format!("{:.0} %", v * 100.0));
+ }),
+ element!("dropdown_menu", |ui, _| {
+ dropdown_menu(ui, "gallery_menu", "Preset", |ui| {
+ list_picker(ui, "preset", "Preset", true);
+ });
+ }),
+ element!("message_field", |ui, s| {
+ message_field(ui, ui.id().with("message"), &mut s.value, "Message");
+ }),
+ element!("text_lines", |ui, _| {
+ text_lines(ui, "gallery", "Licence\nSecond line");
+ }),
+ element!("table", "dialog:table:gallery:row", None, |ui, s| {
+ table(ui, "gallery", &[Column::new("Name", 1.0), Column::new("Expression", 1.5)], "No rows", |ui, table| {
+ table.row(ui, "row", true, |row| {
+ row.cell(|ui| {
+ text(ui, "Width", Text::Cell);
+ });
+ row.cell(|ui| {
+ cell_editor(ui, ui.id().with("value"), &mut s.value, "", false);
});
});
- ("dialog:table:gallery:row", None)
- }
- "list_picker" => {
- list_picker(ui, "gallery", "Preset", true);
- ("dialog:list:gallery", Some("dialog:list:gallery"))
- }
- "inline_text" | "label_actions" => {
- let response = ui
- .scope(|ui| {
- if name == "inline_text" {
- inline_text(ui, "Active");
- } else {
- label_actions(ui, "Configuration", |ui| {
- secondary_button(ui, "Apply");
- });
- }
- })
- .response;
- scenario::publish_rect("gallery:inline", response.rect);
- ("gallery:inline", None)
- }
- "text_block" => {
- text_block(ui, "gallery", "Validation report with retained units: 10 mm", false);
- ("dialog:report:gallery", None)
- }
- "search_field" | "cell_editor" | "color_field" | "slider" | "scalar_field" | "length_field" | "angle_field" | "text_area"
- | "color_swatch" | "action_menu" | "enabled_button" => {
- let rect = ui
- .scope(|ui| match name {
- "search_field" => {
- search_field(ui, ui.id().with("search"), &mut value, "Search");
- }
- "cell_editor" => {
- cell_editor(ui, ui.id().with("cell"), &mut value, "Expression", true);
- }
- "color_field" => {
- color_field(ui, &mut [120, 150, 180]);
- }
- "slider" => {
- slider(ui, &mut 0.5, 0.0..=1.0);
- }
- "scalar_field" => {
- scalar_field(ui, &mut 0.5, 0.0..=1.0);
- }
- "length_field" => {
- length_field(ui, &mut 12.7, "in", 2);
- }
- "angle_field" => {
- angle_field(ui, &mut 45.0);
- }
- "text_area" => {
- text_area(ui, "Gallery", ui.id().with("area"), &mut value, 5, 1024);
- }
- "color_swatch" => {
- swatch_grid(ui, &[1], |ui, _| {
- color_swatch(ui, ui.id().with("swatch"), Tokens::get().accent, true, "Sample", 1);
- });
- }
- "action_menu" => {
- action_menu(ui, "Actions", |ui| {
- secondary_button(ui, "Add");
- });
- }
- "enabled_button" => {
- enabled_button(ui, "Add", true);
- }
- _ => {}
- })
- .response
- .rect;
- scenario::publish_rect("gallery:manage", rect);
- ("gallery:manage", None)
- }
+ });
+ }),
+ element!("list_picker", "dialog:list:gallery", Some("dialog:list:gallery"), |ui, _| {
+ list_picker(ui, "gallery", "Preset", true);
+ }),
+ element!("inline_text", "dialog:inline:Active", Some("dialog:inline:Active"), |ui, _| {
+ text(ui, "Active", Text::Inline);
+ }),
+ element!("cell_text", "dialog:cell:Width", Some("dialog:cell:Width"), |ui, _| {
+ text(ui, "Width", Text::Cell);
+ }),
+ element!("label_actions", |ui, _| {
+ label_actions(ui, "Configuration", |ui| {
+ button(ui, "Apply", Button::Normal);
+ });
+ }),
+ element!("text", "dialog:report:gallery", Some("dialog:report:gallery"), |ui, _| {
+ text(ui, "Validation report with retained units: 10 mm", Text::Report("gallery", false));
+ }),
+ element!("search_field", |ui, s| {
+ search_field(ui, ui.id().with("search"), &mut s.value, "Search");
+ }),
+ element!("cell_editor", |ui, s| {
+ cell_editor(ui, ui.id().with("cell"), &mut s.value, "Expression", true);
+ }),
+ element!("color_field", |ui, _| {
+ color_field(ui, &mut [120, 150, 180]);
+ }),
+ element!("slider", |ui, _| {
+ slider(ui, &mut 0.5, 0.0..=1.0);
+ }),
+ element!("scalar_field", |ui, _| {
+ scalar_field(ui, &mut 0.5, 0.0..=1.0);
+ }),
+ element!("length_field", |ui, _| {
+ length_field(ui, &mut 12.7, "in", 2);
+ }),
+ element!("angle_field", |ui, _| {
+ angle_field(ui, &mut 45.0);
+ }),
+ element!("text_area", |ui, s| {
+ text_area(ui, "Gallery", ui.id().with("area"), &mut s.value, 5, 1024);
+ }),
+ element!("color_swatch", |ui, _| {
+ color_swatch(ui, ui.id().with("swatch"), Tokens::get().accent, true, "Sample", 1);
+ }),
+ element!("swatch_grid", |ui, _| {
+ swatch_grid(ui, &[1, 2, 3], |ui, n| {
+ color_swatch(ui, ui.id().with(n), Tokens::get().accent, true, "Sample", *n);
+ });
+ }),
+ element!("action_menu", |ui, _| {
+ action_menu(ui, "Actions", |ui| {
+ button(ui, "Add", Button::Normal);
+ });
+ }),
+ element!("enabled_button", |ui, _| {
+ button(ui, "Add", Button::Enabled(true));
+ }),
+ element!("header", "dialog:header", Some("dialog:close"), |ui, _| {
+ header(ui, "fillet", "Fillet", || {});
+ }),
+ element!("collapsible_header", "dialog:header", Some("dialog:collapse"), |ui, _| {
+ collapsible_header(ui, "fillet", "Fillet", &mut false, || {});
+ }),
+ element!("row", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ field(ui, &mut s.value);
+ });
+ }),
+ element!("expr_row", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ expr_row(ui, "Gallery", &mut s.value);
+ }),
+ element!("hint_row", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ hint_row(ui, "Gallery", &mut s.value, "Value");
+ }),
+ element!("text_row", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ text_row(ui, "Gallery", &mut s.value, "Name");
+ }),
+ element!("choice_row", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ choice_row(ui, "Gallery", "gallery", &mut s.selected, &["One", "Two"]);
+ }),
+ element!("multiline_text_field", "dialog:widget:Gallery", Some("dialog:Gallery"), |ui, s| {
+ multiline_text_field(ui, "Gallery", ui.id().with("text"), &mut s.value);
+ }),
+ element!("searchable_dropdown", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, _| {
+ row(ui, "Gallery", |ui| {
+ searchable_dropdown(ui, "gallery", "One", &mut String::new(), &[SearchOption { value: "one", label: "One", handle: None }], None, None);
+ });
+ }),
+ element!("text_emphasis", "dialog:row:Gallery", Some("dialog:Bold"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ text_emphasis(ui, &mut s.checked, &mut false);
+ });
+ }),
+ element!("value_pair_named", "dialog:row:Position", Some("dialog:Distance X"), |ui, s| {
+ value_pair(ui, "Position", [&mut s.value, &mut s.second], ["X", "Y"], Some(["Distance X", "Distance Y"]));
+ }),
+ element!("field", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ field(ui, &mut s.value);
+ });
+ }),
+ element!("focused_field", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ focused_field(ui, &mut s.value);
+ });
+ }),
+ element!("hint_field", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ hint_field(ui, &mut s.value, "Length");
+ });
+ }),
+ element!("text_field", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ text_field(ui, &mut s.value, "Name");
+ });
+ }),
+ element!("focused_text_field", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ focused_text_field(ui, &mut s.value, "Name");
+ });
+ }),
+ element!("fraction_field", "dialog:row:Gallery", Some("dialog:fraction:Gallery"), |ui, _| {
+ row(ui, "Gallery", |ui| {
+ fraction_field(ui, &mut 0.5);
+ });
+ }),
+ element!("dropdown", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ dropdown(ui, "gallery", &mut s.selected, &["One", "Two"]);
+ });
+ }),
+ element!("selection_field", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, _| {
+ row(ui, "Gallery", |ui| {
+ selection_field(ui, "Point 1", Selection { active: true, filled: true });
+ });
+ }),
+ element!("selection_field_empty", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, _| {
+ row(ui, "Gallery", |ui| {
+ selection_field(ui, "Select", Selection { active: false, filled: false });
+ });
+ }),
+ element!("segmented", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ segmented(ui, &mut s.selected, &["One", "Two"], Segments::default());
+ });
+ }),
+ element!("segmented_compact", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ segmented(ui, &mut s.selected, &["Left", "Center", "Right"], Segments { compact: true, ..Default::default() });
+ });
+ }),
+ element!("segmented_states", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ segmented(ui, &mut s.selected, &["One", "Two"], Segments { states: &[true, true], ..Default::default() });
+ });
+ }),
+ element!("segmented_icons", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ segmented_icons(ui, &mut s.selected, &[IconSegment { key: "normal", icon: "normal", tip: "Normal".into() }], &[]);
+ });
+ }),
+ element!("checkbox", "dialog:row:Gallery", Some("dialog:Gallery"), |ui, s| {
+ row(ui, "Gallery", |ui| {
+ checkbox(ui, "Option", &mut s.checked);
+ });
+ }),
+ element!("primary_button", "dialog:row:Gallery", Some("dialog:button:Create"), |ui, _| {
+ row(ui, "Gallery", |ui| {
+ primary_button(ui, "Create");
+ });
+ }),
+ element!("button", "dialog:row:Gallery", Some("dialog:button:Gallery:Add"), |ui, _| {
+ row(ui, "Gallery", |ui| {
+ button(ui, "Add", Button::Normal);
+ });
+ }),
+ element!("small_button", "dialog:row:Gallery", Some("dialog:button:Gallery:×"), |ui, _| {
+ row(ui, "Gallery", |ui| {
+ button(ui, "×", Button::Small);
+ });
+ }),
+ element!("checkbox_row", "sketch_palette:toggle:gallery", Some("sketch_palette:toggle:gallery"), |ui, _| {
+ checkbox_row(ui, "gallery", "Option", true);
+ }),
+ element!("checkbox_grid", "dialog:checkbox:First", Some("dialog:First"), |ui, s| {
+ checkbox_grid(ui, &mut [("First", &mut s.checked), ("Second", &mut false)], 2);
+ }),
+ element!("options", "dialog:checkbox:First", Some("dialog:First"), |ui, s| {
+ options(ui, "gallery", &mut [("First", &mut s.checked), ("Second", &mut false)]);
+ }),
+ element!("footer", "dialog:footer", Some("dialog:ok"), |ui, _| {
+ footer(ui, "OK", "Cancel", true, Footer::default());
+ }),
+ element!("footer_apply", "dialog:footer", Some("dialog:apply"), |ui, _| {
+ footer(ui, "OK", "Cancel", true, Footer { apply: Some("Apply"), ..Default::default() });
+ }),
+ element!("footer_status", "dialog:footer", Some("dialog:ok"), |ui, _| {
+ footer(ui, "OK", "Cancel", true, Footer { status: Some("Computing…"), ..Default::default() });
+ }),
+ element!("button_pair", "sketch_palette:look_at", Some("sketch_palette:look_at"), |ui, _| {
+ button_pair(
+ ui,
+ "sketch_palette",
+ [false, true],
+ [PairButton { key: "look_at", label: "ui.look_at", icon: Some("lookat") }, PairButton { key: "slice", label: "Slice", icon: None }],
+ );
+ }),
+ element!("icon_button_at", |ui, _| {
+ let (rect, _) = ui.allocate_exact_size(vec2(row_height(), row_height()), egui::Sense::hover());
+ icon_button_at(ui, rect, "close", "Close");
+ }),
+ element!("keyboard", |ui, _| {
+ assert_eq!(keyboard(ui.ctx(), true), Action::None);
+ ui.allocate_space(vec2(row_height(), row_height()));
+ }),
+ element!("list_row", "dialog:list:picked", Some("dialog:list:picked:remove"), |ui, _| {
+ list_row(ui, "picked", "Point 1");
+ }),
+ element!("value_pair", "dialog:row:Position", Some("dialog:Y"), |ui, s| {
+ value_pair(ui, "Position", [&mut s.value, &mut s.second], ["X", "Y"], None);
+ }),
+ element!("toggle_icon", "dialog:Alignment:Center", Some("dialog:Alignment:Center"), |ui, s| {
+ toggle_icon(ui, "Alignment", "Center", &mut s.checked, "pattern_center");
+ }),
+ element!("tool_choices", "sketch_palette:feature:line", Some("sketch_palette:feature:line"), |ui, _| {
+ tool_choices(ui, "Line", "line", &[ToolChoice { key: "line", icon: "normal", label: "Line", enabled: true }]);
+ }),
+ element!("status_header", "sketch_palette:meter", None, |ui, _| {
+ ui.spacing_mut().item_spacing.y = 0.0;
+ status_header(
+ ui,
+ "sketch_palette",
+ "Sketch 1",
+ StatusHeader { icon: "sketch", text: "2 degrees of freedom", complete: false, fraction: 0.5 },
+ );
+ }),
+ element!("progress", "dialog:progress:gallery", None, |ui, _| {
+ progress(ui, "gallery", 0.4);
+ }),
+ element!("hint", "dialog:hint:gallery", Some("dialog:hint:gallery"), |ui, _| {
+ text(ui, "Pick a point", Text::Hint("gallery"));
+ }),
+ element!("note", "dialog:note:gallery", None, |ui, _| {
+ text(ui, "Counts include the original. Center balances copies; Flip chooses the extra side for even totals.", Text::Note("gallery"));
+ }),
+ element!("caption", "dialog:caption:Gallery", None, |ui, _| {
+ caption(ui, "Gallery", "Construction");
+ }),
+ element!("section", "dialog:section:Advanced", Some("dialog:section:Advanced"), |ui, _| {
+ section(ui, "gallery", "Advanced", false, |_| {});
+ }),
+ element!("divider", "dialog:divider:gallery", None, |ui, _| {
+ divider(ui, "gallery");
+ }),
+ element!("popup_list", |ui, _| {
+ let anchor = ui.allocate_space(vec2(100.0, row_height())).1;
+ popup_list(
+ ui.ctx(),
+ ui.id().with("popup"),
+ anchor,
+ 0,
+ &[PopupOption { text: "Width", detail: "10 mm", color: Tokens::get().text }],
+ "Choose",
+ );
+ // The popup is on a separate layer; reserve its painted allocation for the same checks.
+ ui.allocate_space(vec2(ui.available_width(), row_height() * 5.0));
+ }),
+];
- "header" | "collapsible_header" => {
- if name == "collapsible_header" {
- collapsible_header(ui, "fillet", "Fillet", &mut false, || {});
- } else {
- header(ui, "fillet", "Fillet", || {});
- }
- ("dialog:header", Some(if name == "collapsible_header" { "dialog:collapse" } else { "dialog:close" }))
- }
- "row" => {
- row(ui, "Gallery", |ui| {
- field(ui, &mut value);
- });
- ("dialog:row:Gallery", Some("dialog:Gallery"))
- }
- "caption" => {
- caption(ui, "Gallery", "Helper text");
- ("dialog:caption:Gallery", None)
- }
- "hint" => {
- hint(ui, "gallery", "Pick a point or curve");
- ("dialog:hint:gallery", Some("dialog:hint:gallery"))
- }
- "note" => {
- note(ui, "gallery", "Counts include the original. Center balances copies; Flip chooses the extra side for even totals.");
- ("dialog:note:gallery", None)
- }
- "section" => {
- section(ui, "gallery", "Options", true, |_| {});
- ("dialog:section:Options", Some("dialog:section:Options"))
- }
- "divider" => {
- divider(ui, "gallery");
- ("dialog:divider:gallery", None)
- }
- "multiline_text_field" => {
- multiline_text_field(ui, "Gallery", egui::Id::new("gallery_text"), &mut value);
- ("dialog:widget:Gallery", Some("dialog:Gallery"))
- }
- "searchable_dropdown" => {
- row(ui, "Gallery", |ui| {
- searchable_dropdown(
- ui,
- "gallery_search",
- "One",
- &mut String::new(),
- &[SearchOption { value: "one", label: "One", handle: None }],
- None,
- None,
- );
- });
- ("dialog:row:Gallery", Some("dialog:Gallery"))
- }
- "text_emphasis" => {
- row(ui, "Gallery", |ui| text_emphasis(ui, &mut checked, &mut false));
- ("dialog:row:Gallery", Some("dialog:Bold"))
- }
- "value_pair_named" => {
- value_pair_named(ui, "Position", [&mut value, &mut second], ["X", "Y"], ["Distance X", "Distance Y"]);
- ("dialog:row:Position", Some("dialog:Distance X"))
- }
- "field"
- | "focused_field"
- | "hint_field"
- | "text_field"
- | "focused_text_field"
- | "fraction"
- | "dropdown"
- | "selection_field"
- | "selection_field_state"
- | "segmented"
- | "segmented_compact"
- | "segmented_states"
- | "segmented_icons"
- | "checkbox"
- | "primary"
- | "secondary"
- | "small" => {
- row(ui, "Gallery", |ui| match name {
- "field" => {
- field(ui, &mut value);
- }
- "focused_field" => {
- focused_field(ui, &mut value);
- }
- "hint_field" => {
- hint_field(ui, &mut value, "Length");
- }
- "text_field" => {
- text_field(ui, &mut value, "Name");
- }
- "focused_text_field" => {
- focused_text_field(ui, &mut value, "Name");
- }
- "fraction" => {
- fraction_field(ui, &mut 0.5);
- }
- "dropdown" => {
- dropdown(ui, "gallery", &mut selected, &["One", "Two"]);
- }
- "selection_field" => {
- selection_field(ui, "Point 1", true);
- }
- "selection_field_state" => {
- selection_field_state(ui, "Select", false, false);
- }
- "segmented" => {
- segmented(ui, &mut selected, &["One", "Two"]);
- }
- "segmented_compact" => {
- segmented_compact(ui, &mut selected, &["Left", "Center", "Right"]);
- }
- "segmented_states" => {
- segmented_states(ui, &mut selected, &["One", "Two"], &[true, true]);
- }
- "segmented_icons" => {
- segmented_icons(ui, &mut selected, &[IconSegment { key: "normal", icon: "normal", tip: "Normal".into() }], &[]);
- }
- "checkbox" => {
- checkbox(ui, "Option", &mut checked);
- }
- "primary" => {
- primary_button(ui, "Create");
- }
- "secondary" => {
- secondary_button(ui, "Add");
- }
- "small" => {
- small_button(ui, "×");
- }
- _ => {}
- });
- let handle = match name {
- "primary" => "dialog:button:Create",
- "secondary" => "dialog:button:Gallery:Add",
- "small" => "dialog:button:Gallery:×",
- "fraction" => "dialog:fraction:Gallery",
- _ => "dialog:Gallery",
- };
- ("dialog:row:Gallery", Some(handle))
- }
- "checkbox_row" => {
- checkbox_row(ui, "gallery", "Option", true);
- ("sketch_palette:toggle:gallery", Some("sketch_palette:toggle:gallery"))
- }
- "checkbox_grid" | "options" => {
- let mut second = false;
- let mut items = [("First", &mut checked), ("Second", &mut second)];
- if name == "options" {
- options(ui, "gallery", &mut items);
- } else {
- checkbox_grid(ui, &mut items, 2);
- }
- ("dialog:checkbox:First", Some("dialog:First"))
- }
- "footer" | "footer_apply" | "footer_status" => {
- if name == "footer_status" {
- footer_with_status(ui, "OK", "Cancel", true, None, Some("Computing…"));
- } else {
- footer(ui, "OK", "Cancel", true, (name == "footer_apply").then_some("Apply"));
- }
- ("dialog:footer", Some(if name == "footer_apply" { "dialog:apply" } else { "dialog:ok" }))
- }
- "button_pair" => {
- button_pair(
- ui,
- "sketch_palette",
- [false, true],
- [PairButton { key: "look_at", label: "ui.look_at", icon: Some("lookat") }, PairButton { key: "slice", label: "Slice", icon: None }],
- );
- ("sketch_palette:look_at", Some("sketch_palette:look_at"))
- }
- "icon" => {
- icon_button(ui, "Remove", "close");
- ("dialog:button:Remove", Some("dialog:button:Remove"))
- }
- "list_row" => {
- list_row(ui, "picked", "Point 1");
- ("dialog:list:picked", Some("dialog:list:picked:remove"))
- }
- "value_pair" => {
- value_pair(ui, "Position", [&mut value, &mut second], ["X", "Y"]);
- ("dialog:row:Position", Some("dialog:Y"))
- }
- "toggle_icon" => {
- toggle_icon(ui, "Alignment", "Center", &mut checked, "pattern_center");
- ("dialog:Alignment:Center", Some("dialog:Alignment:Center"))
- }
- "tool_choices" => {
- tool_choices(ui, "Line", "line", &[ToolChoice { key: "line", icon: "normal", label: "Line", enabled: true }]);
- ("sketch_palette:feature:line", Some("sketch_palette:feature:line"))
- }
- "status_header" => {
- ui.spacing_mut().item_spacing.y = 0.0;
- status_header(
- ui,
- "sketch_palette",
- "Sketch 1",
- StatusHeader { icon: "sketch", text: "2 degrees of freedom", complete: false, fraction: 0.5 },
- );
- ("sketch_palette:meter", None)
- }
- "progress" => {
- progress(ui, "gallery", 0.4);
- ("dialog:progress:gallery", None)
- }
- _ => panic!("missing gallery example {name}"),
- }
+fn example(ui: &mut Ui, element: &Element) -> (&'static str, Option<&'static str>) {
+ let mut sample = Sample { value: "12 mm".into(), second: "25 mm".into(), selected: 0, checked: true };
+ let rect = ui.scope(|ui| (element.draw)(ui, &mut sample)).response.rect;
+ scenario::publish_rect("gallery:allocation", rect);
+ (element.rect, element.handle)
}
#[test]
@@ -428,7 +361,8 @@ fn every_element_has_geometry_and_stays_in_its_allocation_in_both_themes() {
let previous = crate::theme::is_dark();
for dark in [false, true] {
crate::theme::set_dark(dark);
- for &name in ELEMENTS {
+ for element in ELEMENTS {
+ let name = element.name;
let ctx = crate::fonts::test_context();
ctx.set_visuals(if dark { egui::Visuals::dark() } else { egui::Visuals::light() });
for _ in 0..3 {
@@ -442,7 +376,7 @@ fn every_element_has_geometry_and_stays_in_its_allocation_in_both_themes() {
allocation = ui
.scope(|ui| {
scope(ui, |ui| {
- published = example(ui, name);
+ published = example(ui, element);
})
})
.response
@@ -485,7 +419,7 @@ fn apply_does_not_submit_and_obeys_validation() {
let ctx = crate::fonts::test_context();
let mut action = Action::None;
let mut draw = |ui: &mut Ui| {
- action = footer(ui, "OK", "Cancel", enabled, Some("Apply"));
+ action = footer(ui, "OK", "Cancel", enabled, Footer { apply: Some("Apply"), ..Default::default() });
};
super::test_support::frame(&ctx, vec![], &mut draw);
let at = scenario::handle_at("dialog:apply").unwrap();
@@ -511,7 +445,7 @@ fn picked_item_remove_and_paired_values_have_independent_targets() {
let mut x = String::new();
let mut y = String::new();
let mut draw = |ui: &mut Ui| {
- value_pair(ui, "Position", [&mut x, &mut y], ["X", "Y"]);
+ value_pair(ui, "Position", [&mut x, &mut y], ["X", "Y"], None);
};
super::test_support::frame(&ctx, vec![], &mut draw);
let row = scenario::rect_of("dialog:row:Position").unwrap();
@@ -536,7 +470,7 @@ fn gallery_rows_share_a_label_column_after_measurement_in_both_themes() {
for _ in 0..3 {
super::test_support::frame(&ctx, vec![], |ui| {
row(ui, "Edges", |ui| {
- selection_field(ui, "Edge 1", true);
+ selection_field(ui, "Edge 1", Selection { active: true, filled: true });
});
row(ui, "Counterbore depth", |ui| {
field(ui, &mut value);
@@ -570,7 +504,7 @@ fn compound_row_actions_preserve_the_original_field_handle() {
},
);
expected = scenario::handle_at("dialog:Mid Radius");
- small_button(ui, "×");
+ button(ui, "×", Button::Small);
});
});
});
@@ -590,7 +524,12 @@ fn emphasis_and_compact_modes_keep_independent_actions_in_both_themes() {
let mut draw = |ui: &mut Ui| {
row(ui, "Style", |ui| text_emphasis(ui, &mut bold, &mut italic));
row(ui, "Alignment", |ui| {
- segmented_compact(ui, &mut selected, &["Long translated left", "Long translated centre", "Long translated right"]);
+ segmented(
+ ui,
+ &mut selected,
+ &["Long translated left", "Long translated centre", "Long translated right"],
+ Segments { compact: true, ..Default::default() },
+ );
});
};
super::test_support::frame(&ctx, vec![], &mut draw);
@@ -614,31 +553,25 @@ fn table_cells_keep_alignment_fixed_rows_editing_and_action_targets() {
let mut removed = false;
let mut draw = |ui: &mut Ui| {
scope(ui, |ui| {
- table(
- ui,
- "cells",
- &[Column { label: "Name", width: 1.0 }, Column { label: "Expression", width: 1.5 }, Column { label: "Actions", width: 0.7 }],
- "Empty",
- |ui, table| {
- for (name, value) in [("Width", &mut first), ("Height", &mut second)] {
- table.row(ui, name, name == "Height", |row| {
- row.cell(|ui| {
- cell_text(ui, name);
- });
- row.cell(|ui| {
- let response = cell_editor(ui, ui.id().with("expression"), value, "Expression", false);
- scenario::publish_handle(&format!("gallery:cell:{name}"), response.rect.center());
- scenario::publish_rect(&format!("gallery:cell:{name}"), response.rect);
- });
- row.cell(|ui| {
- if small_button(ui, "Delete").clicked() {
- removed = true;
- }
- });
+ table(ui, "cells", &[Column::new("Name", 1.0), Column::new("Expression", 1.5), Column::new("Actions", 0.7)], "Empty", |ui, table| {
+ for (name, value) in [("Width", &mut first), ("Height", &mut second)] {
+ table.row(ui, name, name == "Height", |row| {
+ row.cell(|ui| {
+ text(ui, name, Text::Cell);
});
- }
- },
- );
+ row.cell(|ui| {
+ let response = cell_editor(ui, ui.id().with("expression"), value, "Expression", false);
+ scenario::publish_handle(&format!("gallery:cell:{name}"), response.rect.center());
+ scenario::publish_rect(&format!("gallery:cell:{name}"), response.rect);
+ });
+ row.cell(|ui| {
+ if button(ui, "Delete", Button::Small).clicked() {
+ removed = true;
+ }
+ });
+ });
+ }
+ });
});
};
for _ in 0..3 {
@@ -725,3 +658,25 @@ fn many_draggable_samples_wrap_inside_the_available_width() {
assert!(rects.iter().all(|rect| rect.right() <= bounds.right() && rect.width() == Tokens::get().control_height));
assert!(rects.last().unwrap().top() > rects.first().unwrap().top(), "samples must wrap to additional rows");
}
+
+#[test]
+fn gallery_covers_every_inline_element() {
+ let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/ui_kit");
+ let names: std::collections::BTreeSet<_> = ELEMENTS.iter().map(|e| e.name).collect();
+ assert_eq!(names.len(), ELEMENTS.len(), "duplicate gallery entries");
+ for file in ["actions.rs", "choice.rs", "fields.rs", "layout.rs", "metrics.rs", "status.rs", "table.rs"] {
+ let source = std::fs::read_to_string(root.join(file)).unwrap();
+ let ast = syn::parse_file(&source).unwrap();
+ for item in ast.items {
+ if let syn::Item::Fn(item) = item
+ && matches!(&item.vis, syn::Visibility::Restricted(v) if v.path.is_ident("crate"))
+ {
+ let name = item.sig.ident.to_string();
+ // The inherited row label is metadata, not a renderable element.
+ if name != "label" {
+ assert!(names.contains(name.as_str()), "{file}: {name} needs a gallery entry");
+ }
+ }
+ }
+ }
+}
diff --git a/crates/ui-egui/src/ui_kit/layout.rs b/crates/ui-egui/src/ui_kit/layout.rs
index d4e6da4782..c90dc27c68 100644
--- a/crates/ui-egui/src/ui_kit/layout.rs
+++ b/crates/ui-egui/src/ui_kit/layout.rs
@@ -9,7 +9,7 @@ pub(super) const LABEL: &str = "sc_form_label";
/// Mark a form without global state: children inherit this tag through their UI stack.
/// Inherited form styling and label-column identity. Tokens: `space_4/8, form_gap_y, control_height, font_label, accent, selected_bg, dialog_rule, control_fill/border/radius, text`.
-pub fn scope<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R {
+pub(crate) fn scope<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R {
ui.scope_builder(egui::UiBuilder::new().ui_stack_info(egui::UiStackInfo::default().with_tag(FORM)), |ui| {
let t = Tokens::get();
ui.spacing_mut().item_spacing = vec2(t.space_4, t.form_gap_y);
@@ -35,13 +35,8 @@ pub fn scope<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R {
.inner
}
-/// Detect an inherited form scope. Tokens: `none`.
-pub(crate) fn contains(ui: &Ui) -> bool {
- ui.stack().iter().any(|node| node.tags().contains(FORM))
-}
-
/// Read the enclosing row accessibility label. Tokens: `none`.
-pub(super) fn label(ui: &Ui) -> &str {
+pub(crate) fn label(ui: &Ui) -> &str {
ui.stack().iter().find_map(|node| node.tags().get_downcast::<String>(LABEL)).map(String::as_str).unwrap_or("")
}
@@ -53,10 +48,30 @@ pub(super) fn publish(ui: &Ui, response: &Response, kind: egui::WidgetType) {
}
/// Aligned label/control row, 24 pt today. Tokens: `control_height, form_label_width, font_label, dialog_label, space_8`.
-pub fn row<R>(ui: &mut Ui, text: &str, control: impl FnOnce(&mut Ui) -> R) -> R {
+pub(crate) fn row<R>(ui: &mut Ui, text: &str, control: impl FnOnce(&mut Ui) -> R) -> R {
sized_row(ui, text, row_height(), control)
}
+/// Declarative expression row; retains the field's completion and accepted Enter. Tokens: `row, field`.
+pub(crate) fn expr_row(ui: &mut Ui, label: &str, value: &mut String) -> bool {
+ row(ui, label, |ui| super::field(ui, value))
+}
+
+/// Expression row with an empty-value hint. Tokens: `row, hint_field`.
+pub(crate) fn hint_row(ui: &mut Ui, label: &str, value: &mut String, hint: &str) -> bool {
+ row(ui, label, |ui| super::hint_field(ui, value, hint))
+}
+
+/// Plain text row; the caller retains Enter/change ownership. Tokens: `row, text_field`.
+pub(crate) fn text_row(ui: &mut Ui, label: &str, value: &mut String, hint: &str) -> (bool, bool) {
+ row(ui, label, |ui| super::text_field(ui, value, hint))
+}
+
+/// Indexed choice row with the caller's unchanged dropdown ID. Tokens: `row, dropdown`.
+pub(crate) fn choice_row(ui: &mut Ui, label: &str, id: &str, selected: &mut usize, options: &[&str]) -> Response {
+ row(ui, label, |ui| super::dropdown(ui, id, selected, options))
+}
+
/// Internal form geometry for controls which need several lines (e.g. text areas).
pub(super) fn sized_row<R>(ui: &mut Ui, text: &str, height: f32, control: impl FnOnce(&mut Ui) -> R) -> R {
let t = Tokens::get();
@@ -94,7 +109,7 @@ pub(super) fn sized_row<R>(ui: &mut Ui, text: &str, height: f32, control: impl F
/// A dim one-line caption in the control column of the row labelled `aligned_to`, directly under that
/// row's control. It says in words what a colour or an icon shows, so colour is never the only cue.
/// Dim helper beneath a row control. Tokens: `form_icon_size, font_small, text_dim, space_8; label-column tokens`.
-pub fn caption(ui: &mut Ui, aligned_to: &str, text: &str) {
+pub(crate) fn caption(ui: &mut Ui, aligned_to: &str, text: &str) {
let t = Tokens::get();
let width = dimension(ui.available_width());
let (rect, _) = ui.allocate_exact_size(vec2(width, t.form_icon_size), egui::Sense::hover());
@@ -106,7 +121,7 @@ pub fn caption(ui: &mut Ui, aligned_to: &str, text: &str) {
/// Memory belongs to the enclosing dialog ID; animation is avoided so each row keeps its fixed height.
/// Persisted disclosure with a rule and uppercase title. Tokens: `control_height, space_2, radius_sm, hover, dialog_rule, form_section_icon_size, form_gap_y, font_caption, font_section_tracking, text_dim`.
-pub fn section<R>(ui: &mut Ui, id: impl egui::AsIdSalt, title: &str, default_open: bool, add: impl FnOnce(&mut Ui) -> R) -> Option<R> {
+pub(crate) fn section<R>(ui: &mut Ui, id: impl egui::AsIdSalt, title: &str, default_open: bool, add: impl FnOnce(&mut Ui) -> R) -> Option<R> {
let t = Tokens::get();
ui.add_space(t.space_2);
let id = ui.make_persistent_id(id);
@@ -134,34 +149,10 @@ pub fn section<R>(ui: &mut Ui, id: impl egui::AsIdSalt, title: &str, default_ope
open.then(|| ui.push_id(id, add).inner)
}
-/// Dim helper line beneath a header. Tokens: control_height, font_small and text_dim.
-/// Helper text below a card header. Tokens: `control_height, font_small, text_dim`.
-pub fn hint(ui: &mut Ui, key: &str, text: &str) -> Response {
- let (rect, response) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), row_height()), egui::Sense::hover());
- paint_text(ui, rect, text, egui::FontId::proportional(Tokens::get().font_small), Tokens::get().text_dim, false);
- response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), text));
- scenario::publish_rect(&format!("dialog:hint:{key}"), rect);
- scenario::publish_handle(&format!("dialog:hint:{key}"), rect.center());
- response.on_hover_text(text)
-}
-
-/// Wrapping explanatory text for a card's body (a rule or a caveat too long for the single-line `hint`).
-/// Tokens: `font_small, text_dim, space_4`.
-pub fn note(ui: &mut Ui, key: &str, text: &str) -> Response {
- let t = Tokens::get();
- let width = dimension(ui.available_width());
- let galley = ui.painter().layout(text.to_string(), egui::FontId::proportional(t.font_small), t.text_dim, width);
- let (rect, response) = ui.allocate_exact_size(vec2(width, galley.size().y + t.space_4 * 2.0), egui::Sense::hover());
- ui.painter().galley(egui::pos2(rect.left(), rect.top() + t.space_4), galley, t.text_dim);
- response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), text));
- scenario::publish_rect(&format!("dialog:note:{key}"), rect);
- response
-}
-
/// Picked-item list entry with a remove action. Returns that action's Response.
/// Tokens: control_height, space_8, font_label, text and icon-button tokens.
/// Picked-item row with a remove action. Tokens: `control_height, space_8, font_label, text; icon-button tokens`.
-pub fn list_row(ui: &mut Ui, key: &str, text: &str) -> Response {
+pub(crate) fn list_row(ui: &mut Ui, key: &str, text: &str) -> Response {
let t = Tokens::get();
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), row_height()), egui::Sense::hover());
let remove = egui::Rect::from_min_max(egui::pos2((rect.right() - row_height()).max(rect.left()), rect.top()), rect.max);
@@ -175,7 +166,7 @@ pub fn list_row(ui: &mut Ui, key: &str, text: &str) -> Response {
/// Full-width rule; Tokens: dialog_rule. Use between groups without extra padding.
/// Full-width rule without extra padding. Tokens: `dialog_rule`.
-pub fn divider(ui: &mut Ui, key: &str) {
+pub(crate) fn divider(ui: &mut Ui, key: &str) {
let (rect, _) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), 1.0), egui::Sense::hover());
ui.painter().hline(rect.x_range(), rect.top(), egui::Stroke::new(1.0, Tokens::get().dialog_rule));
scenario::publish_rect(&format!("dialog:divider:{key}"), rect);
@@ -191,36 +182,16 @@ pub(super) fn named_control<R>(ui: &mut Ui, label: &str, add: impl FnOnce(&mut U
/// Publish geometry without replacing native accessibility. Tokens: `none`.
pub(super) fn publish_geometry(ui: &Ui, response: &Response) {
let label = label(ui);
- scenario::publish_handle(&format!("dialog:{label}"), response.rect.center());
- scenario::publish_rect(&format!("dialog:widget:{label}"), response.rect);
+ scenario::publish_target_as(&format!("dialog:{label}"), &format!("dialog:widget:{label}"), response.rect);
}
#[cfg(test)]
#[path = "layout_tests.rs"]
mod tests;
-/// Read-only, wrapping report text. Tokens: font_label, text/error, space_4.
-pub fn text_block(ui: &mut Ui, id: &str, text: &str, error: bool) -> Response {
- let t = Tokens::get();
- let response = ui
- .add(egui::Label::new(RichText::new(text).font(egui::FontId::proportional(t.font_label)).color(if error { t.error } else { t.text })).wrap());
- scenario::publish_rect(&format!("dialog:report:{id}"), response.rect);
- scenario::publish_handle(&format!("dialog:report:{id}"), response.rect.center());
- response
-}
-
-/// Inline read-only text beside actions. Tokens: font_label, text.
-pub fn inline_text(ui: &mut Ui, text: &str) -> Response {
- let response =
- ui.add(egui::Label::new(RichText::new(text).font(egui::FontId::proportional(Tokens::get().font_label)).color(Tokens::get().text)).truncate());
- scenario::publish_rect(&format!("dialog:inline:{text}"), response.rect);
- scenario::publish_handle(&format!("dialog:inline:{text}"), response.rect.center());
- response
-}
-
/// Large read-only licence/report with equal-height virtualized lines and horizontal overflow.
/// Tokens: font_small, text, control_height. Only visible lines are laid out.
-pub fn text_lines(ui: &mut Ui, id: &str, text: &str) {
+pub(crate) fn text_lines(ui: &mut Ui, id: &str, text: &str) {
let t = Tokens::get();
let lines: Vec<_> = text.lines().collect();
let font = egui::FontId::monospace(t.font_small);
@@ -232,3 +203,55 @@ pub fn text_lines(ui: &mut Ui, id: &str, text: &str) {
});
scenario::publish_rect(&format!("dialog:lines:{id}"), response.inner_rect);
}
+
+/// Read-only text variants retain their original wrapping, allocation and scenario identities.
+pub(crate) enum Text<'a> {
+ Hint(&'a str),
+ Note(&'a str),
+ Report(&'a str, bool),
+ Inline,
+ Cell,
+}
+
+pub(crate) fn text(ui: &mut Ui, text: &str, style: Text<'_>) -> Response {
+ let t = Tokens::get();
+ let fixed = matches!(style, Text::Hint(_) | Text::Cell);
+ let ink = match style {
+ Text::Hint(_) | Text::Note(_) => t.text_dim,
+ Text::Report(_, true) => t.error,
+ _ => t.text,
+ };
+ let font = egui::FontId::proportional(if matches!(style, Text::Hint(_) | Text::Note(_)) { t.font_small } else { t.font_label });
+ let response = if fixed {
+ let (rect, response) = ui.allocate_exact_size(
+ vec2(dimension(ui.available_width()), row_height()),
+ if matches!(style, Text::Cell) { egui::Sense::click() } else { egui::Sense::hover() },
+ );
+ paint_text(ui, rect, text, font, ink, false);
+ response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), text));
+ response.on_hover_text(text)
+ } else if matches!(style, Text::Note(_)) {
+ let width = dimension(ui.available_width());
+ let galley = ui.painter().layout(text.to_owned(), font, ink, width);
+ let (rect, response) = ui.allocate_exact_size(vec2(width, galley.size().y + t.space_4 * 2.0), egui::Sense::hover());
+ ui.painter().galley(egui::pos2(rect.left(), rect.top() + t.space_4), galley, ink);
+ response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), text));
+ response
+ } else {
+ let label = egui::Label::new(RichText::new(text).font(font).color(ink));
+ ui.add(if matches!(style, Text::Inline) { label.truncate() } else { label.wrap() })
+ };
+ let (kind, key) = match style {
+ Text::Hint(key) => ("hint", key),
+ Text::Note(key) => ("note", key),
+ Text::Report(key, _) => ("report", key),
+ Text::Inline => ("inline", text),
+ Text::Cell => ("cell", text),
+ };
+ let id = format!("dialog:{kind}:{key}");
+ scenario::publish_rect(&id, response.rect);
+ if !matches!(style, Text::Note(_)) {
+ scenario::publish_handle(&id, response.rect.center());
+ }
+ response
+}
diff --git a/crates/ui-egui/src/ui_kit/metrics.rs b/crates/ui-egui/src/ui_kit/metrics.rs
index 69ecb3ec75..c1b5bab1c5 100644
--- a/crates/ui-egui/src/ui_kit/metrics.rs
+++ b/crates/ui-egui/src/ui_kit/metrics.rs
@@ -4,12 +4,12 @@ use crate::theme::Tokens;
use egui::Ui;
/// Row height for controls. Tokens: `control_height`.
-pub fn row_height() -> f32 {
+pub(crate) fn row_height() -> f32 {
Tokens::get().control_height
}
/// Feature heading height. Tokens: `form_header_height`.
-pub fn header_height() -> f32 {
+pub(crate) fn header_height() -> f32 {
Tokens::get().form_header_height
}
@@ -28,17 +28,40 @@ pub(super) const LABEL_ACTIONS_SHARE: f32 = 0.45;
const LABEL_COLUMN_MAX: f32 = 1.6;
/// Measured width of a label in the form label font. Tokens: `font_label, dialog_label`.
-fn natural_label_width(ui: &Ui, text: &str) -> f32 {
+pub(super) fn label_width(ui: &Ui, text: &str) -> f32 {
let t = Tokens::get();
ui.painter().layout_no_wrap(crate::i18n::tr_label(text).to_string(), egui::FontId::proportional(t.font_label), t.dialog_label).size().x.ceil()
}
+/// Minimum content widths for table controls, including their token/native control metrics.
+pub(crate) struct ContentWidth;
+
+impl ContentWidth {
+ pub(crate) fn label(ui: &Ui, text: &str) -> f32 {
+ label_width(ui, text)
+ }
+
+ pub(crate) fn button(ui: &Ui, label: &str) -> f32 {
+ label_width(ui, label) + 2.0 * ui.spacing().button_padding.x
+ }
+
+ pub(crate) fn dropdown(ui: &Ui, options: &[&str]) -> f32 {
+ let text = options.iter().map(|text| label_width(ui, text)).fold(0.0, f32::max);
+ text + 2.0 * ui.spacing().button_padding.x + ui.spacing().icon_width + ui.spacing().icon_spacing
+ }
+
+ pub(crate) fn editor(ui: &Ui, value: &str) -> f32 {
+ let t = Tokens::get();
+ ui.painter().layout_no_wrap(value.to_owned(), egui::FontId::monospace(t.font_label), t.text).size().x.ceil() + 2.0 * t.form_inset
+ }
+}
+
/// Width of a table header column, measured directly: it never touches the form's shared label-column state.
/// Tokens: `form_label_width, font_label, dialog_label, space_4`.
pub(super) fn header_column(ui: &Ui, text: &str) -> f32 {
let t = Tokens::get();
let base = t.form_label_width;
- (natural_label_width(ui, text) + t.space_4).clamp(base, base * LABEL_COLUMN_MAX).min(base * TABLE_COLUMN_BASIS * 0.5)
+ (label_width(ui, text) + t.space_4).clamp(base, base * LABEL_COLUMN_MAX).min(base * TABLE_COLUMN_BASIS * 0.5)
}
/// Allocate exactly one control-height row. Long labels elide; controls cannot widen the card.
@@ -50,7 +73,7 @@ pub(super) fn header_column(ui: &Ui, text: &str) -> f32 {
pub(super) fn label_column(ui: &Ui, text: &str, row_width: f32) -> f32 {
let t = Tokens::get();
let base = t.form_label_width;
- let natural = natural_label_width(ui, text);
+ let natural = label_width(ui, text);
let widest = match ui.stack().iter().find(|node| node.tags().contains(FORM)).map(|node| node.id) {
Some(form) => {
let key = form.with("label_column");
diff --git a/crates/ui-egui/src/ui_kit/mod.rs b/crates/ui-egui/src/ui_kit/mod.rs
index d8c550bd46..4c801aa7a2 100644
--- a/crates/ui-egui/src/ui_kit/mod.rs
+++ b/crates/ui-egui/src/ui_kit/mod.rs
@@ -1,28 +1,31 @@
//! Tokenised dense card library. Import elements through `crate::ui_kit`.
//! `Panel` owns card composition; rows own aligned label/control columns and retain egui focus.
//! Geometry, typography and colours come from `theme::Tokens`. See `docs/ui-kit.md`.
-pub mod actions;
-pub mod choice;
-pub mod fields;
-pub mod layout;
-pub mod metrics;
+mod actions;
+mod choice;
+mod fields;
+mod layout;
+mod metrics;
pub(crate) mod panel;
-pub mod status;
-pub mod table;
-pub mod text;
+mod status;
+mod table;
+mod text;
-pub use actions::*;
-pub use choice::*;
-pub use fields::*;
-pub use layout::*;
-pub use metrics::{header_height, row_height};
+pub(crate) use actions::*;
+pub(crate) use choice::*;
+pub(crate) use fields::*;
+pub(crate) use layout::*;
+pub(crate) use metrics::{ContentWidth, header_height, row_height};
pub(crate) use panel::{ComputeStatus, FeatureOptions, Panel, Part, Prompt};
-pub use panel::{collapsible_header, header};
-pub use status::*;
-pub use table::*;
+#[cfg(test)]
+pub(crate) use panel::{collapsible_header, header};
+pub(crate) use status::*;
+pub(crate) use table::*;
#[cfg(test)]
mod gallery;
#[cfg(test)]
#[path = "test_support_tests.rs"]
mod test_support;
+
+pub(crate) use layout::label as row_label;
diff --git a/crates/ui-egui/src/ui_kit/panel.rs b/crates/ui-egui/src/ui_kit/panel.rs
index 1108e3dfcd..1497a3eeb1 100644
--- a/crates/ui-egui/src/ui_kit/panel.rs
+++ b/crates/ui-egui/src/ui_kit/panel.rs
@@ -4,13 +4,13 @@ use crate::{scenario, theme::Tokens};
use egui::{Ui, vec2};
/// Feature title/icon/close band. Tokens: `form_header_height, form_icon_size, form_close_size, form_inset, font_label, text, dialog_rule, space_8/10; icon_button_at tokens`.
-pub fn header(ui: &mut Ui, icon: &str, title: &str, on_close: impl FnOnce()) {
+pub(crate) fn header(ui: &mut Ui, icon: &str, title: &str, on_close: impl FnOnce()) {
header_impl(ui, icon, title, None, on_close);
}
/// Optional fold action for managers which historically hide their inputs without losing edits.
/// Tokens: header tokens and space_4; retains the legacy chevron accessibility identities.
-pub fn collapsible_header(ui: &mut Ui, icon: &str, title: &str, collapsed: &mut bool, on_close: impl FnOnce()) {
+pub(crate) fn collapsible_header(ui: &mut Ui, icon: &str, title: &str, collapsed: &mut bool, on_close: impl FnOnce()) {
header_impl(ui, icon, title, Some(collapsed), on_close);
}
@@ -257,7 +257,13 @@ impl<'a> Panel<'a> {
})
.inner
};
- let action = super::footer_with_status(ui, self.ok, self.cancel, valid && !state.applying, heading.apply_label, state.text.as_deref());
+ let action = super::footer(
+ ui,
+ self.ok,
+ self.cancel,
+ valid && !state.applying,
+ super::Footer { apply: heading.apply_label, status: state.text.as_deref(), selected: None },
+ );
if state.busy {
let rect = egui::Rect::from_min_size(
egui::pos2(ui.min_rect().left(), ui.min_rect().bottom() - super::row_height()),
@@ -443,7 +449,8 @@ impl<'a> Prompt<'a> {
if !self.escape_closes {
ui.ctx().input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Escape));
}
- let action = super::footer_selected(ui, self.ok, self.cancel, valid, self.apply, self.selected);
+ let action =
+ super::footer(ui, self.ok, self.cancel, valid, super::Footer { apply: self.apply, status: None, selected: self.selected });
(close, action)
})
});
diff --git a/crates/ui-egui/src/ui_kit/panel_tests.rs b/crates/ui-egui/src/ui_kit/panel_tests.rs
index bb14b45bc0..2847fdbe62 100644
--- a/crates/ui-egui/src/ui_kit/panel_tests.rs
+++ b/crates/ui-egui/src/ui_kit/panel_tests.rs
@@ -47,11 +47,6 @@ fn heading_weight_field_surfaces_and_disclosures_follow_tokens_in_both_themes()
egui::Shape::Rect(rect) if rect.fill == t.control_fill && rect.stroke.width == 1.0 && rect.stroke.color == t.control_border => {
*fields += 1
}
- egui::Shape::Vec(shapes) => {
- for shape in shapes {
- inspect(shape, t, title, section, fields);
- }
- }
_ => {}
}
}
@@ -61,7 +56,7 @@ fn heading_weight_field_surfaces_and_disclosures_follow_tokens_in_both_themes()
let ctx = crate::fonts::test_context();
ctx.set_visuals(if dark { egui::Visuals::dark() } else { egui::Visuals::light() });
let mut value = "3 mm".to_string();
- let mut output = ctx.run_ui(egui::RawInput::default(), |ui| {
+ let output = crate::test_support::frame(&ctx, egui::RawInput::default(), |ui| {
ui.set_width(300.0);
scope(ui, |ui| {
header(ui, "fillet", "Fillet", || {});
@@ -71,10 +66,9 @@ fn heading_weight_field_surfaces_and_disclosures_follow_tokens_in_both_themes()
section(ui, "options", "Options", true, |_| {});
});
});
- output.textures_delta.clear();
let (mut title, mut section, mut fields) = (0, 0, 0);
for shape in &output.shapes {
- inspect(&shape.shape, Tokens::get(), &mut title, &mut section, &mut fields);
+ crate::test_support::each_shape(&shape.shape, &mut |shape| inspect(shape, Tokens::get(), &mut title, &mut section, &mut fields));
}
assert_eq!(scenario::rect_of("dialog:header").unwrap().height(), Tokens::get().form_header_height);
assert_eq!(title, 1, "the semibold heading is painted once");
@@ -91,7 +85,7 @@ fn panel_keeps_actions_and_body_geometry_in_both_layouts() {
let vp = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(640.0, 480.0));
for _ in 0..3 {
scenario::clear_handles();
- let mut output = ctx.run_ui(egui::RawInput { screen_rect: Some(vp), ..Default::default() }, |_| {
+ crate::test_support::frame(&ctx, egui::RawInput { screen_rect: Some(vp), ..Default::default() }, |_| {
let side = crate::frame::Side::Right;
let frame = Panel::feature_frame(&ctx, layout, side);
let anchor = egui::pos2(vp.right() - crate::shell::SHELL_GAP, vp.top());
@@ -119,7 +113,6 @@ fn panel_keeps_actions_and_body_geometry_in_both_layouts() {
);
});
});
- output.textures_delta.clear();
}
let header = scenario::rect_of("dialog:header").unwrap();
let body = scenario::rect_of("dialog:row:Radius").unwrap();
@@ -143,7 +136,7 @@ fn palette_scrolls_short_views_and_retains_its_status_and_action_handles() {
let vp = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(640.0, height));
for _ in 0..3 {
scenario::clear_handles();
- let mut output = ctx.run_ui(egui::RawInput { screen_rect: Some(vp), ..Default::default() }, |_| {
+ crate::test_support::frame(&ctx, egui::RawInput { screen_rect: Some(vp), ..Default::default() }, |_| {
let frame = Panel::palette_frame(&ctx, layout);
let bottom = vp.bottom() - crate::shell::SHELL_GAP;
let panel = Panel::new(
@@ -181,7 +174,6 @@ fn palette_scrolls_short_views_and_retains_its_status_and_action_handles() {
});
});
});
- output.textures_delta.clear();
}
let scroll = scenario::rect_of("sketch_palette:options").unwrap();
assert!(scroll.is_finite() && scroll.is_positive());
@@ -201,7 +193,7 @@ fn wide_tables_remain_bounded_with_pinned_actions_on_small_viewports() {
let viewport = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(width, 360.0));
for _ in 0..3 {
scenario::clear_handles();
- let mut output = ctx.run_ui(egui::RawInput { screen_rect: Some(viewport), ..Default::default() }, |_| {
+ crate::test_support::frame(&ctx, egui::RawInput { screen_rect: Some(viewport), ..Default::default() }, |_| {
let side = crate::frame::Side::Right;
let anchor = viewport.right_top();
let panel = Panel::new("Table", egui::Id::new("wide"), anchor, viewport, side, Panel::feature_frame(&ctx, layout, side)).wide();
@@ -220,14 +212,13 @@ fn wide_tables_remain_bounded_with_pinned_actions_on_small_viewports() {
true,
|ui| {
for _ in 0..30 {
- note(ui, "row", "Table body");
+ text(ui, "Table body", Text::Note("row"));
}
ComputeStatus { text: None, busy: false, applying: false }
},
);
});
});
- output.textures_delta.clear();
}
let header = scenario::rect_of("dialog:header").unwrap();
let footer = scenario::rect_of("dialog:footer").unwrap();
@@ -247,7 +238,8 @@ fn prompt_is_one_and_a_half_cards_wide_with_its_actions_in_both_themes() {
let mut action = Action::None;
for _ in 0..3 {
scenario::clear_handles();
- let mut output = ctx.run_ui(
+ crate::test_support::frame(
+ &ctx,
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0))),
focused: true,
@@ -258,12 +250,11 @@ fn prompt_is_one_and_a_half_cards_wide_with_its_actions_in_both_themes() {
.actions("Delete", "Cancel", Some("Keep"))
.selected(Action::Apply)
.show(ui.ctx(), true, |ui| {
- text_block(ui, "body", "Three features go with it.", false);
+ text(ui, "Three features go with it.", Text::Report("body", false));
})
.1;
},
);
- output.textures_delta.clear();
}
assert_eq!(action, Action::None);
let header = scenario::rect_of("dialog:header").unwrap();
@@ -287,7 +278,8 @@ fn escape_closes_a_prompt_unless_it_keeps_the_card_open() {
let mut action = Action::None;
for frame in 0..3 {
let events = if frame == 2 { crate::ui_kit::test_support::key(egui::Key::Escape) } else { Vec::new() };
- let mut output = ctx.run_ui(
+ crate::test_support::frame(
+ &ctx,
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0))),
focused: true,
@@ -299,12 +291,11 @@ fn escape_closes_a_prompt_unless_it_keeps_the_card_open() {
let prompt = if keep { prompt.keep_open_on_escape() } else { prompt };
action = prompt
.show(ui.ctx(), true, |ui| {
- text_block(ui, "body", "A long text the user is editing.", false);
+ text(ui, "A long text the user is editing.", Text::Report("body", false));
})
.1;
},
);
- output.textures_delta.clear();
}
assert_eq!(action, if keep { Action::None } else { Action::Cancel }, "keep_open_on_escape={keep}");
}
diff --git a/crates/ui-egui/src/ui_kit/status.rs b/crates/ui-egui/src/ui_kit/status.rs
index c23490e007..1ebf102d60 100644
--- a/crates/ui-egui/src/ui_kit/status.rs
+++ b/crates/ui-egui/src/ui_kit/status.rs
@@ -3,7 +3,7 @@ use crate::{fonts::RichTextExt as _, theme::Tokens};
use egui::{RichText, Stroke, vec2};
/// Status content for a named card. `key` is the scenario namespace, `fraction` is clamped.
-pub struct StatusHeader<'a> {
+pub(crate) struct StatusHeader<'a> {
pub icon: &'a str,
pub text: &'a str,
pub complete: bool,
@@ -13,7 +13,7 @@ pub struct StatusHeader<'a> {
/// Card identity, status dot/text and progress meter; use for solver/selection state.
/// Tokens: font_label, text/dim, accent, dialog_rule, sketch_accent, form_icon_size, spacing.
/// Name, status dot/text and meter for a card. Tokens: `font_label, text/dim, accent, dialog_rule, sketch_accent, form_icon_size, space_3/4/6/8/10`.
-pub fn status_header(ui: &mut egui::Ui, key: &str, name: &str, status: StatusHeader<'_>) -> egui::Response {
+pub(crate) fn status_header(ui: &mut egui::Ui, key: &str, name: &str, status: StatusHeader<'_>) -> egui::Response {
let fraction = if status.fraction.is_finite() { status.fraction.clamp(0.0, 1.0) } else { 0.0 };
let t = Tokens::get();
let response = egui::Frame::NONE
@@ -41,15 +41,14 @@ pub fn status_header(ui: &mut egui::Ui, key: &str, name: &str, status: StatusHea
})
.response;
ui.painter().hline(ui.max_rect().x_range(), ui.cursor().top(), Stroke::new(1.0, t.dialog_rule));
- crate::scenario::publish_rect(&format!("{key}:status_header"), response.rect);
- crate::scenario::publish_handle(&format!("{key}:status_header"), response.rect.center());
+ crate::scenario::publish_target(&format!("{key}:status_header"), response.rect);
response
}
/// Determinate progress bar for a running operation (a download, a file load), full width and
/// `space_6` tall; `fraction` is clamped (non-finite counts as zero). Pair it with a `text_block`
/// that names the step. Tokens: `space_3/6, dialog_rule, accent`.
-pub fn progress(ui: &mut egui::Ui, key: &str, fraction: f32) -> egui::Response {
+pub(crate) fn progress(ui: &mut egui::Ui, key: &str, fraction: f32) -> egui::Response {
let t = Tokens::get();
let fraction = if fraction.is_finite() { fraction.clamp(0.0, 1.0) } else { 0.0 };
let (bar, response) = ui.allocate_exact_size(vec2(ui.available_width().max(0.0), t.space_6), egui::Sense::hover());
diff --git a/crates/ui-egui/src/ui_kit/table.rs b/crates/ui-egui/src/ui_kit/table.rs
index 6a8052ab06..c4c0a6c031 100644
--- a/crates/ui-egui/src/ui_kit/table.rs
+++ b/crates/ui-egui/src/ui_kit/table.rs
@@ -1,15 +1,28 @@
//! Dense editable tables. Geometry and typography share the form label-column tokens.
-use super::{metrics::*, text::paint_text};
+use super::metrics::*;
use crate::{scenario, theme::Tokens};
use egui::{Response, Ui, vec2};
/// A column's minimum width is a multiple of the measured form label column.
-pub struct Column<'a> {
- pub label: &'a str,
- pub width: f32,
+pub(crate) struct Column<'a> {
+ label: &'a str,
+ width: f32,
+ min_content_width: f32,
}
-pub struct Table<'a> {
+impl<'a> Column<'a> {
+ pub(crate) fn new(label: &'a str, width: f32) -> Self {
+ Self { label, width, min_content_width: 0.0 }
+ }
+
+ /// Keep enough room for the measured cell controls, even in a narrow scrolling card.
+ pub(crate) fn min_content_width(mut self, width: f32) -> Self {
+ self.min_content_width = dimension(width);
+ self
+ }
+}
+
+pub(crate) struct Table<'a> {
columns: &'a [Column<'a>],
widths: Vec<f32>,
id: String,
@@ -18,9 +31,10 @@ pub struct Table<'a> {
/// Header, horizontally scrolling body and empty state. Rows are exactly control_height.
/// Tokens: form_label_width, font_label, dialog_label, space_4/8, dialog_rule, text/dim, selected_bg.
-pub fn table<R>(ui: &mut Ui, id: &str, columns: &[Column<'_>], empty: &str, add: impl FnOnce(&mut Ui, &mut Table<'_>) -> R) -> R {
+pub(crate) fn table<R>(ui: &mut Ui, id: &str, columns: &[Column<'_>], empty: &str, add: impl FnOnce(&mut Ui, &mut Table<'_>) -> R) -> R {
let t = Tokens::get();
- let widths: Vec<_> = columns.iter().map(|c| header_column(ui, c.label) * dimension(c.width)).collect();
+ let widths: Vec<_> =
+ columns.iter().map(|c| (header_column(ui, c.label) * dimension(c.width)).max(label_width(ui, c.label)).max(c.min_content_width)).collect();
let mut table = Table { columns, widths, id: id.to_owned(), rows: 0 };
egui::ScrollArea::horizontal()
.id_salt(id)
@@ -31,15 +45,20 @@ pub fn table<R>(ui: &mut Ui, id: &str, columns: &[Column<'_>], empty: &str, add:
let mut left = rect.left();
for (column, width) in table.columns.iter().zip(&table.widths) {
let cell = egui::Rect::from_min_size(egui::pos2(left, rect.top()), vec2(*width, rect.height()));
- let response = ui.put(cell, egui::Label::new(egui::RichText::new(crate::i18n::tr_label(column.label)).color(t.text_dim)).truncate());
- response.on_hover_text(crate::i18n::tr_label(column.label));
+ ui.scope_builder(egui::UiBuilder::new().max_rect(cell).layout(egui::Layout::left_to_right(egui::Align::Center)), |ui| {
+ ui.set_clip_rect(ui.clip_rect().intersect(cell));
+ ui.add(
+ egui::Label::new(egui::RichText::new(crate::i18n::tr_label(column.label)).size(t.font_label).color(t.text_dim)).truncate(),
+ )
+ .on_hover_text(crate::i18n::tr_label(column.label));
+ });
scenario::publish_rect(&format!("dialog:column:{id}:{}", column.label), cell);
left = cell.right() + t.space_8;
}
ui.painter().hline(rect.x_range(), rect.bottom(), egui::Stroke::new(1.0, t.dialog_rule));
let result = add(ui, &mut table);
if table.rows == 0 {
- super::note(ui, id, empty);
+ super::text(ui, empty, super::Text::Note(id));
}
result
})
@@ -52,45 +71,71 @@ impl Table<'_> {
}
/// A selectable row with independently interactive cells and actions.
- pub fn row(&mut self, ui: &mut Ui, key: &str, selected: bool, add: impl FnOnce(&mut TableRow<'_>)) -> Response {
+ pub(crate) fn row(&mut self, ui: &mut Ui, key: &str, selected: bool, add: impl FnOnce(&mut TableRow<'_>)) -> Response {
self.row_visible(ui, key, selected, true, add)
}
/// Keep off-screen rows' space without building their cells. Force active drafts to stay live.
- pub fn row_visible(&mut self, ui: &mut Ui, key: &str, selected: bool, force: bool, add: impl FnOnce(&mut TableRow<'_>)) -> Response {
- let t = Tokens::get();
- let (rect, response) = ui.allocate_exact_size(vec2(self.width(), row_height()), egui::Sense::click());
+ pub(crate) fn row_visible(&mut self, ui: &mut Ui, key: &str, selected: bool, force: bool, add: impl FnOnce(&mut TableRow<'_>)) -> Response {
+ let response = self.row_content(ui, key, Some(selected), force, add);
self.rows += 1;
+ response
+ }
+
+ /// A non-selectable column-action band attached to the header, using the same cell grid.
+ pub(crate) fn column_actions(&mut self, ui: &mut Ui, add: impl FnOnce(&mut TableRow<'_>)) {
+ self.row_content(ui, "columns", None, true, add);
+ }
+
+ fn row_content(&self, ui: &mut Ui, key: &str, selected: Option<bool>, force: bool, add: impl FnOnce(&mut TableRow<'_>)) -> Response {
+ let t = Tokens::get();
+ let sense = if selected.is_some() { egui::Sense::click() } else { egui::Sense::hover() };
+ let (rect, response) = ui.allocate_exact_size(vec2(self.width(), row_height()), sense);
if !force && !ui.is_rect_visible(rect) {
return response;
}
- if selected || response.hovered() {
- ui.painter().rect_filled(rect, t.control_radius, if selected { t.selected_bg } else { t.hover });
+ if let Some(selected) = selected {
+ if selected || response.hovered() {
+ ui.painter().rect_filled(rect, t.control_radius, if selected { t.selected_bg } else { t.hover });
+ }
+ response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, ui.is_enabled(), selected, key));
+ } else {
+ ui.painter().rect_filled(rect, 0.0, t.dialog_footer);
+ ui.painter().hline(rect.x_range(), rect.bottom(), egui::Stroke::new(1.0, t.dialog_rule));
}
- response.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::SelectableLabel, ui.is_enabled(), selected, key));
scenario::publish_rect(&format!("dialog:table:{}:{key}", self.id), rect);
ui.push_id((&self.id, key), |ui| {
- add(&mut TableRow { ui, widths: &self.widths, columns: self.columns, rect, column: 0, left: rect.left() });
+ add(&mut TableRow {
+ ui,
+ widths: &self.widths,
+ columns: self.columns,
+ rect,
+ column: 0,
+ left: rect.left(),
+ id: format!("dialog:table:{}:{key}", self.id),
+ });
});
response
}
}
-pub struct TableRow<'a> {
+pub(crate) struct TableRow<'a> {
ui: &'a mut Ui,
widths: &'a [f32],
columns: &'a [Column<'a>],
rect: egui::Rect,
column: usize,
left: f32,
+ id: String,
}
impl TableRow<'_> {
/// Place an inline field, text, choice or row actions in the next clipped cell.
- pub fn cell<R>(&mut self, add: impl FnOnce(&mut Ui) -> R) -> R {
+ pub(crate) fn cell<R>(&mut self, add: impl FnOnce(&mut Ui) -> R) -> R {
let width = self.widths.get(self.column).copied().unwrap_or(0.0);
let label = self.columns.get(self.column).map_or("", |c| c.label);
let rect = egui::Rect::from_min_size(egui::pos2(self.left, self.rect.top()), vec2(width, self.rect.height()));
+ scenario::publish_rect(&format!("{}:cell:{label}", self.id), rect);
self.column += 1;
self.left += width + Tokens::get().space_8;
self.ui
@@ -110,22 +155,11 @@ impl TableRow<'_> {
}
}
-/// Read-only clipped cell retaining a full tooltip and accessible label. Tokens: font_label, text.
-pub fn cell_text(ui: &mut Ui, text: &str) -> Response {
- let t = Tokens::get();
- let (rect, response) = ui.allocate_exact_size(vec2(dimension(ui.available_width()), row_height()), egui::Sense::click());
- paint_text(ui, rect, text, egui::FontId::proportional(t.font_label), t.text, false);
- response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Label, ui.is_enabled(), text));
- scenario::publish_rect(&format!("dialog:cell:{text}"), rect);
- scenario::publish_handle(&format!("dialog:cell:{text}"), rect.center());
- response.on_hover_text(text)
-}
-
/// Clipped row name beside compact actions. Tokens: control_height and scope font/spacing.
-pub fn label_actions(ui: &mut Ui, text: &str, add: impl FnOnce(&mut Ui)) {
+pub(crate) fn label_actions(ui: &mut Ui, text: &str, add: impl FnOnce(&mut Ui)) {
let width = dimension(ui.available_width());
ui.allocate_ui_with_layout(vec2(width * LABEL_ACTIONS_SHARE, row_height()), egui::Layout::left_to_right(egui::Align::Center), |ui| {
- cell_text(ui, text);
+ super::text(ui, text, super::Text::Cell);
});
add(ui);
}
diff --git a/crates/ui-egui/src/ui_kit/test_support_tests.rs b/crates/ui-egui/src/ui_kit/test_support_tests.rs
index add28dd195..216894e924 100644
--- a/crates/ui-egui/src/ui_kit/test_support_tests.rs
+++ b/crates/ui-egui/src/ui_kit/test_support_tests.rs
@@ -2,9 +2,12 @@ use super::*;
use crate::scenario;
use egui::{Ui, vec2};
-pub(crate) fn frame(ctx: &egui::Context, events: Vec<egui::Event>, mut add: impl FnMut(&mut Ui)) {
+pub(crate) use crate::test_support::{key, pointer};
+
+fn draw_frame(ctx: &egui::Context, events: Vec<egui::Event>, mut add: impl FnMut(&mut Ui)) -> egui::FullOutput {
scenario::clear_handles();
- let mut output = ctx.run_ui(
+ crate::test_support::frame(
+ ctx,
egui::RawInput {
screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, vec2(320.0, 400.0))),
events,
@@ -15,37 +18,14 @@ pub(crate) fn frame(ctx: &egui::Context, events: Vec<egui::Event>, mut add: impl
ui.set_width(280.0);
scope(ui, &mut add);
},
- );
- // These tests exercise layout/input without a renderer.
- output.textures_delta.clear();
-}
-
-pub(crate) fn pointer(pos: egui::Pos2, pressed: bool) -> Vec<egui::Event> {
- vec![
- egui::Event::PointerMoved(pos),
- egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() },
- ]
+ )
}
-pub(crate) fn key(key: egui::Key) -> Vec<egui::Event> {
- vec![egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]
+pub(crate) fn frame(ctx: &egui::Context, events: Vec<egui::Event>, add: impl FnMut(&mut Ui)) {
+ draw_frame(ctx, events, add);
}
/// The cursor the frame asks the platform for: the pointer is at `pos` for the whole frame.
-pub(crate) fn frame_cursor(ctx: &egui::Context, pos: egui::Pos2, mut add: impl FnMut(&mut Ui)) -> egui::CursorIcon {
- scenario::clear_handles();
- let mut output = ctx.run_ui(
- egui::RawInput {
- screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, vec2(320.0, 400.0))),
- events: vec![egui::Event::PointerMoved(pos)],
- focused: true,
- ..Default::default()
- },
- |ui| {
- ui.set_width(280.0);
- scope(ui, &mut add);
- },
- );
- output.textures_delta.clear();
- output.platform_output.cursor_icon
+pub(crate) fn frame_cursor(ctx: &egui::Context, pos: egui::Pos2, add: impl FnMut(&mut Ui)) -> egui::CursorIcon {
+ draw_frame(ctx, vec![egui::Event::PointerMoved(pos)], add).platform_output.cursor_icon
}
diff --git a/crates/ui-egui/src/ui_kit_guard_tests.rs b/crates/ui-egui/src/ui_kit_guard_tests.rs
index 8c0da5799e..6111bb1586 100644
--- a/crates/ui-egui/src/ui_kit_guard_tests.rs
+++ b/crates/ui-egui/src/ui_kit_guard_tests.rs
@@ -1,8 +1,8 @@
-//! Dense panels compose kit elements. Legacy, non-dense paths have bounded allowances.
+//! Kit callers use shared controls; removed legacy implementations must stay removed.
use std::path::Path;
use syn::visit::{self, Visit};
-/// Counts may shrink; additions need a specific reason. Dense-only files have no allowance.
+/// No caller may bypass the kit for a matching control.
const ALLOWED: &[(&str, usize, &str)] = &[];
#[derive(Default)]
@@ -29,7 +29,15 @@ impl<'ast> Visit<'ast> for Guard {
fn visit_expr_method_call(&mut self, call: &'ast syn::ExprMethodCall) {
if matches!(
call.method.to_string().as_str(),
- "checkbox" | "button" | "small_button" | "selectable_label" | "selectable_value" | "radio_value" | "toggle_value"
+ "checkbox"
+ | "button"
+ | "small_button"
+ | "selectable_label"
+ | "selectable_value"
+ | "radio_value"
+ | "toggle_value"
+ | "text_edit_singleline"
+ | "text_edit_multiline"
) {
self.found.push(format!(".{}", call.method));
}
@@ -39,7 +47,16 @@ impl<'ast> Visit<'ast> for Guard {
fn visit_expr_call(&mut self, call: &'ast syn::ExprCall) {
if let syn::Expr::Path(path) = call.func.as_ref() {
let names: Vec<_> = path.path.segments.iter().map(|s| s.ident.to_string()).collect();
- if names.iter().any(|n| matches!(n.as_str(), "ComboBox" | "Button" | "Slider" | "Checkbox" | "RadioButton") || self.aliases.contains(n)) {
+ // Loading an editor's cursor/focus state does not create a raw widget.
+ let state_access = names.last().is_some_and(|n| matches!(n.as_str(), "load_state" | "store_state"));
+ let kit_options = names.iter().any(|n| n == "ui_kit");
+ if !state_access
+ && !kit_options
+ && names.iter().any(|n| {
+ matches!(n.as_str(), "ComboBox" | "Button" | "Slider" | "Checkbox" | "RadioButton" | "TextEdit" | "DragValue" | "ProgressBar")
+ || self.aliases.contains(n)
+ })
+ {
self.found.push(names.join("::"));
}
}
@@ -56,7 +73,12 @@ fn violations(source: &str) -> Vec<String> {
aliases(tree, out);
}
}
- syn::UseTree::Rename(r) if matches!(r.ident.to_string().as_str(), "ComboBox" | "Button" | "Slider" | "Checkbox" | "RadioButton") => {
+ syn::UseTree::Rename(r)
+ if matches!(
+ r.ident.to_string().as_str(),
+ "ComboBox" | "Button" | "Slider" | "Checkbox" | "RadioButton" | "TextEdit" | "DragValue" | "ProgressBar"
+ ) =>
+ {
out.push(r.rename.to_string())
}
_ => {}
@@ -105,7 +127,7 @@ fn dense_panels_use_ui_kit_elements() {
}
scan(&root, "", &mut failures);
failures.sort();
- assert!(failures.is_empty(), "Use crate::ui_kit, or document a bounded legacy-path allowance:\n{}", failures.join("\n"));
+ assert!(failures.is_empty(), "Use crate::ui_kit controls:\n{}", failures.join("\n"));
}
#[test]
@@ -133,3 +155,90 @@ fn guard_detects_multiline_and_aliased_widget_calls_but_skips_tests() {
8
);
}
+
+// Declaration checks catch reintroduced implementations even before a caller reaches them.
+fn legacy_declarations(source: &str, removed: &[&str]) -> Vec<String> {
+ struct Declarations<'a> {
+ removed: &'a [&'a str],
+ found: Vec<String>,
+ }
+ impl<'ast> Visit<'ast> for Declarations<'_> {
+ fn visit_item_fn(&mut self, item: &'ast syn::ItemFn) {
+ let name = item.sig.ident.to_string();
+ if self.removed.contains(&name.as_str()) {
+ self.found.push(name);
+ }
+ visit::visit_item_fn(self, item);
+ }
+ }
+ let mut guard = Declarations { removed, found: Vec::new() };
+ guard.visit_file(&syn::parse_file(source).unwrap());
+ guard.found
+}
+
+#[test]
+fn removed_legacy_helpers_stay_removed() {
+ let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
+ let files: &[(&str, &[&str])] = &[
+ ("frame.rs", &["docked", "docked_on", "heading", "add_outlined", "content_width", "remember_width", "right_aligned"]),
+ ("dialogs.rs", &["form_row", "publish_row"]),
+ ("dialogs_appearance.rs", &["swatch", "swatch_rows"]),
+ (
+ "ui_kit/actions.rs",
+ &["secondary_button", "small_button", "enabled_button", "footer_impl", "footer_with_status", "footer_selected", "icon_button"],
+ ),
+ ("ui_kit/choice.rs", &["segments", "segmented_states", "segmented_compact"]),
+ ("ui_kit/fields.rs", &["selection_field_state", "value_pair_named"]),
+ ("ui_kit/layout.rs", &["hint", "note", "text_block", "inline_text", "contains"]),
+ ("ui_kit/table.rs", &["cell_text"]),
+ ];
+ for (file, removed) in files {
+ let source = std::fs::read_to_string(root.join(file)).unwrap();
+ assert!(legacy_declarations(&source, removed).is_empty(), "{file}: removed helper reintroduced");
+ }
+ assert!(ALLOWED.is_empty(), "raw-control allowance table must stay empty");
+}
+
+// Main added these floating windows after the panels branch. The helper is live for them;
+// keep the bounded constructor until they migrate, and reject any new legacy callers.
+#[test]
+fn floating_window_helper_has_only_its_live_consumers() {
+ let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("src");
+ let frame = std::fs::read_to_string(root.join("frame.rs")).unwrap();
+ assert_eq!(legacy_declarations(&frame, &["window"]), ["window"]);
+ let mut callers = Vec::new();
+ for entry in std::fs::read_dir(&root).unwrap() {
+ let path = entry.unwrap().path();
+ if path.extension().is_some_and(|e| e == "rs") {
+ let source = std::fs::read_to_string(&path).unwrap();
+ // The guard's own expected-call string is test code.
+ if path.file_name().unwrap() != "ui_kit_guard_tests.rs" && source.contains("crate::frame::window(") {
+ callers.push(path.file_name().unwrap().to_str().unwrap().to_owned());
+ }
+ }
+ }
+ callers.sort();
+ assert_eq!(callers, ["bom_panel.rs", "messages.rs", "palette.rs", "space_mouse_calibration.rs"]);
+}
+
+#[test]
+fn guard_detects_editor_constructors_aliases_and_legacy_declarations() {
+ assert_eq!(
+ violations(
+ r#"
+ use egui::TextEdit as Edit;
+ fn draw(ui: &mut Ui) {
+ ui.add(Edit::singleline(value));
+ ui.add(egui::TextEdit::multiline(value));
+ ui.add(egui::DragValue::new(value));
+ ui.add(egui::ProgressBar::new(0.5));
+ ui.text_edit_singleline(value);
+ egui::TextEdit::load_state(ctx, id);
+ }
+ "#
+ )
+ .len(),
+ 5
+ );
+ assert_eq!(legacy_declarations("fn docked_on() {}", &["docked_on"]), ["docked_on"]);
+}
diff --git a/crates/ui-egui/src/update.rs b/crates/ui-egui/src/update.rs
index c87bcd38b6..9cdb1b31a9 100644
--- a/crates/ui-egui/src/update.rs
+++ b/crates/ui-egui/src/update.rs
@@ -773,7 +773,7 @@ pub fn button(app: &mut SolveApp, ui: &mut egui::Ui, span: egui::Rect, labeled:
let full = crate::i18n::format("update.button_version", &[("version", &version)]);
let labels = [full.as_str(), crate::i18n::tr("update.button")];
let (rect, response) = crate::toolbar::offer_pill(ui, span, labeled, &labels, TAB_ROOM, "update", "titlebar:update")?;
- if response.on_hover_text(crate::i18n::format("update.button_tip", &[("version", &version)])).clicked() {
+ if response.on_hover_text(crate::i18n::format("update.available", &[("version", &version)])).clicked() {
app.updater.open = !app.updater.open;
}
Some(rect)
@@ -818,13 +818,13 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
let mut also_download = false;
let (closed, answer) =
ui_kit::Prompt::new(id, "update", crate::i18n::tr("update.title")).cards(1.7).actions(ok, cancel, apply).show(ctx, true, |ui| {
- ui_kit::text_block(ui, "available", &crate::i18n::format("update.available", &[("version", release.version())]), false);
- ui_kit::note(ui, "have", &crate::i18n::format("update.you_have", &[("version", current_version())]));
+ ui_kit::text(ui, &crate::i18n::format("update.available", &[("version", release.version())]), ui_kit::Text::Report("available", false));
+ ui_kit::text(ui, &crate::i18n::format("update.you_have", &[("version", current_version())]), ui_kit::Text::Note("have"));
egui::Frame::group(ui.style()).show(ui, |ui| {
ui.set_width(ui.available_width());
egui::ScrollArea::vertical().max_height(260.0).auto_shrink([false, true]).show(ui, |ui| {
if release.notes.trim().is_empty() {
- ui_kit::note(ui, "no_notes", crate::i18n::tr("update.no_notes"));
+ ui_kit::text(ui, crate::i18n::tr("update.no_notes"), ui_kit::Text::Note("no_notes"));
} else {
markdown(ui, &release.notes, &t);
}
@@ -836,46 +836,49 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
InstallKind::Deb | InstallKind::Rpm | InstallKind::Snap { store: false } => "update.package_hint",
_ => "update.system_hint",
};
- ui_kit::text_block(ui, "how", &crate::i18n::format(how, &[("kind", kind.label())]), false);
+ ui_kit::text(ui, &crate::i18n::format(how, &[("kind", kind.label())]), ui_kit::Text::Report("how", false));
ui_kit::label_actions(ui, &cmd, |ui| {
- if ui_kit::small_button(ui, crate::i18n::tr("update.copy")).clicked() {
+ if ui_kit::button(ui, crate::i18n::tr("update.copy"), ui_kit::Button::Small).clicked() {
ui.ctx().copy_text(cmd.clone());
}
});
} else if let Some(name) = asset.as_ref().filter(|_| app.updater.installed.as_ref().is_none_or(|r| r.is_err())) {
- ui_kit::note(ui, "file", &crate::i18n::format("update.file", &[("file", name)]));
+ ui_kit::text(ui, &crate::i18n::format("update.file", &[("file", name)]), ui_kit::Text::Note("file"));
}
match (&state, &app.updater.installed, &app.updater.job) {
(State::Downloading, _, Some((_, progress))) => {
let done = progress.done.load(std::sync::atomic::Ordering::Relaxed);
let total = progress.total.load(std::sync::atomic::Ordering::Relaxed).max(1);
let mb = |b: u64| format!("{:.1}", b as f64 / 1_048_576.0);
- ui_kit::text_block(
+ ui_kit::text(
ui,
- "downloading",
&crate::i18n::format("update.downloading", &[("done", &mb(done)), ("total", &mb(total))]),
- false,
+ ui_kit::Text::Report("downloading", false),
);
ui_kit::progress(ui, "download", done as f32 / total as f32);
ui.ctx().request_repaint_after(std::time::Duration::from_millis(100));
}
(State::Restart, ..) => {
- ui_kit::text_block(ui, "installed", &crate::i18n::format("update.installed", &[("version", release.version())]), false);
+ ui_kit::text(
+ ui,
+ &crate::i18n::format("update.installed", &[("version", release.version())]),
+ ui_kit::Text::Report("installed", false),
+ );
}
(_, Some(Ok(install::Outcome::Installer(..))), _) => {
- ui_kit::text_block(ui, "installer", crate::i18n::tr("update.installer_started"), false);
+ ui_kit::text(ui, crate::i18n::tr("update.installer_started"), ui_kit::Text::Report("installer", false));
}
(_, Some(Ok(install::Outcome::Opened(_))), _) => {
- ui_kit::text_block(ui, "dmg", crate::i18n::tr("update.dmg_opened"), false);
+ ui_kit::text(ui, crate::i18n::tr("update.dmg_opened"), ui_kit::Text::Report("dmg", false));
}
(_, Some(Err(e)), _) => {
- ui_kit::text_block(ui, "failed", &crate::i18n::format("update.install_failed", &[("error", e)]), true);
+ ui_kit::text(ui, &crate::i18n::format("update.install_failed", &[("error", e)]), ui_kit::Text::Report("failed", true));
}
_ => {}
}
// With a one-click install the footer's main action installs; the download stays one click away.
if state == State::Offer && one_click {
- also_download = ui_kit::secondary_button(ui, download).clicked();
+ also_download = ui_kit::button(ui, download, ui_kit::Button::Normal).clicked();
}
});
if let Some(area) = ctx.memory(|m| m.area_rect(id)) {
@@ -942,7 +945,7 @@ pub fn prefs_rows(app: &mut SolveApp, ui: &mut egui::Ui) {
});
ui.horizontal(|ui| {
let busy = app.updater.status == Status::Checking;
- let r = ui_kit::enabled_button(ui, crate::i18n::tr("update.check_now"), can && !busy);
+ let r = ui_kit::button(ui, crate::i18n::tr("update.check_now"), ui_kit::Button::Enabled(can && !busy));
crate::scenario::publish_rect("prefs:check_now", r.rect);
if r.clicked() {
let ctx = ui.ctx().clone();
@@ -957,7 +960,7 @@ pub fn prefs_rows(app: &mut SolveApp, ui: &mut egui::Ui) {
(Status::Idle, None) => String::new(),
};
if !status.is_empty() {
- ui_kit::inline_text(ui, &status);
+ ui_kit::text(ui, &status, ui_kit::Text::Inline);
}
});
let note = if can {
@@ -967,10 +970,10 @@ pub fn prefs_rows(app: &mut SolveApp, ui: &mut egui::Ui) {
} else {
crate::i18n::format("update.prefs_dev", &[("version", current_version())])
};
- ui_kit::note(ui, "updates", &note);
+ ui_kit::text(ui, &note, ui_kit::Text::Note("updates"));
if let Some(v) = offered_or_newer(app)
&& offered(app).is_none()
- && ui_kit::secondary_button(ui, crate::i18n::format("update.show", &[("version", &v)])).clicked()
+ && ui_kit::button(ui, crate::i18n::format("update.show", &[("version", &v)]), ui_kit::Button::Normal).clicked()
{
app.updater.open = true;
}
diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs
index 2c243e2ee3..1098f5bef3 100644
--- a/crates/ui-egui/src/viewport.rs
+++ b/crates/ui-egui/src/viewport.rs
@@ -1666,7 +1666,7 @@ fn analysis_legend(app: &SolveApp, painter: &egui::Painter, rect: Rect) {
tr("Curvature Map Analysis"),
None,
vec![
- (col(a.curvature[0]), tr("Flat").to_string(), false),
+ (col(a.curvature[0]), tr("ui.flat").to_string(), false),
(col(a.curvature[1]), format!("{} {}", tr("Radius"), crate::prefs::show_mm(app, 2.0 * radius, 1)), false),
(col(a.curvature[2]), format!("{} ≤ {}", tr("Radius"), crate::prefs::show_mm(app, radius, 1)), false),
],
@@ -3710,8 +3710,7 @@ fn signed_axis_view(app: &mut SolveApp, ui: &mut egui::Ui, rect: Rect) {
}
}
let home = Rect::from_center_size(pos2(c.x - 37.0, c.y - 37.0), vec2(18.0, 18.0));
- crate::scenario::publish_rect("axis_view:home", home);
- crate::scenario::publish_handle("axis_view:home", home.center());
+ crate::scenario::publish_target("axis_view:home", home);
let hr = ui.interact(home, ui.id().with("axis_view_home"), Sense::click());
// The home button sits in its own small round chip.
painter.circle(home.center(), 12.0, t.overlay.gamma_multiply(if hr.hovered() { 0.9 } else { 0.5 }), Stroke::new(1.0, t.border));
diff --git a/crates/ui-egui/tests/coincident_lines.rs b/crates/ui-egui/tests/coincident_lines.rs
index 4d4e430ac5..8c2cf6aab6 100644
--- a/crates/ui-egui/tests/coincident_lines.rs
+++ b/crates/ui-egui/tests/coincident_lines.rs
@@ -1,19 +1,13 @@
//! Coincident accepts clicked line bodies as well as explicit sketch points.
+mod support;
+
use serde_json::json;
use solidcraft_engine::sketch::ConstraintKind;
use solidcraft_ui_egui::scenario::Harness;
fn setup() -> Harness {
- let mut h = Harness::new();
- h.run(&json!([
- {"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
- {"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[10,10],[30,10]],"infer":false,"connect":false}}},
- {"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[35,15],[35,40]],"infer":false,"connect":false}}},
- {"call":"ui.view","params":{"view":"top"}}
- ]))
- .unwrap();
- h
+ support::sketch_lines(&[[[10, 10], [30, 10]], [[35, 15], [35, 40]]], Some(false))
}
#[test]
diff --git a/crates/ui-egui/tests/constraint_preselection.rs b/crates/ui-egui/tests/constraint_preselection.rs
index e7cb82368b..5baca2f6a3 100644
--- a/crates/ui-egui/tests/constraint_preselection.rs
+++ b/crates/ui-egui/tests/constraint_preselection.rs
@@ -1,19 +1,13 @@
//! Constraint tools accept a selected curve pair as well as tool-first clicks.
+mod support;
+
use serde_json::json;
use solidcraft_engine::{Sel, sketch::ConstraintKind};
use solidcraft_ui_egui::scenario::Harness;
fn lines() -> Harness {
- let mut h = Harness::new();
- h.run(&json!([
- {"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
- {"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[10,10],[40,10]],"infer":false}}},
- {"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[10,30],[40,35]],"infer":false}}},
- {"call":"ui.view","params":{"view":"top"}}
- ]))
- .unwrap();
- h
+ support::sketch_lines(&[[[10, 10], [40, 10]], [[10, 30], [40, 35]]], None)
}
fn select_lines(h: &mut Harness) {
diff --git a/crates/ui-egui/tests/support/mod.rs b/crates/ui-egui/tests/support/mod.rs
new file mode 100644
index 0000000000..7f9c0635a0
--- /dev/null
+++ b/crates/ui-egui/tests/support/mod.rs
@@ -0,0 +1,18 @@
+use serde_json::json;
+use solidcraft_ui_egui::scenario::Harness;
+
+/// Identical tool-first line fixtures, retaining optional connect and scenario frame timing.
+pub fn sketch_lines(points: &[[[i32; 2]; 2]], connect: Option<bool>) -> Harness {
+ let mut h = Harness::new();
+ let mut steps = vec![json!({"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}})];
+ for points in points {
+ let mut params = json!({"points":points,"infer":false});
+ if let Some(connect) = connect {
+ params["connect"] = json!(connect);
+ }
+ steps.push(json!({"call":"engine.execute","params":{"command":"sketch.line","params":params}}));
+ }
+ steps.push(json!({"call":"ui.view","params":{"view":"top"}}));
+ h.run(&json!(steps)).unwrap();
+ h
+}
diff --git a/crates/ui-egui/tests/window_widths.rs b/crates/ui-egui/tests/window_widths.rs
index 1bb3731b8d..d6047b4110 100644
--- a/crates/ui-egui/tests/window_widths.rs
+++ b/crates/ui-egui/tests/window_widths.rs
@@ -2,7 +2,11 @@
//! through the control channel (the toolbar's way) and measured as drawn.
use serde_json::json;
-use solidcraft_ui_egui::frame::{DIALOG_MAX_W, DIALOG_MIN_W, DIALOG_WIDE_MAX_W, WINDOW_WIDE_MAX_W};
+use solidcraft_ui_egui::frame::{DIALOG_MAX_W, DIALOG_MIN_W};
+
+// Preserve the established acceptance bounds after retiring the old window helpers.
+const DIALOG_WIDE_MAX_W: f32 = 560.0;
+const WINDOW_WIDE_MAX_W: f32 = 760.0;
use solidcraft_ui_egui::scenario::Harness;
/// Widths of the windows on screen (their areas in the middle layer).
diff --git a/docs/manage-ui-kit-audit.md b/docs/manage-ui-kit-audit.md
index 96cf2e0a22..7efdc385e7 100644
--- a/docs/manage-ui-kit-audit.md
+++ b/docs/manage-ui-kit-audit.md
@@ -1,153 +1,31 @@
-# Manage popup audit
+# UI kit coverage boundaries
-Source inventory for `ui/shared-ui-kit`, before the Manage port. No native application
-was launched. Control recipes below are source-derived; screenshots need owner verification.
-Send each start as `{"id":1,"method":"ui.start","params":{"command":"COMMAND"}}`
-with the launch token on the connection's first request. Engine setup calls use
-`{"method":"engine.execute","params":{"command":"COMMAND","params":{...}}}`.
+Feature dialogs, manager cards, settings/help/customisation windows, confirmations
+and matching inline controls now compose `ui_kit`. The raw-control allowance table
+is empty. The cleanup removes unused frame chrome, row-publication state, appearance
+wrappers and the plastic editor fallback. Shared controls and their options are
+listed in [the kit reference](ui-kit.md).
-| Manage entry | Before: source and surface | Existing fields, actions and nested surfaces | Recipe/setup |
-| --- | --- | --- | --- |
-| `parameters.change` | `params_dialog.rs`, custom PARAMETERS window, not kit | Filter; Import; Export CSV/JSON; Favorites, User Parameters, grouped Model Parameters. Columns: favorite/order, name (double-click rename), unit, expression, evaluated value/error, comment, delete. Add name/unit/expression/comment. Unit dropdowns; expression completion. Native import/save sheets; validation errors inline. | Start directly; optionally `parameters.add {"name":"width","expression":"10 mm"}` first. |
-| `parameters.graph` | `lib.rs::start` falls through to engine, **no popup** | Returns dependency graph JSON. | `ui.start` opens nothing; `engine.execute parameters.graph {}` returns the graph JSON. |
-| `parameters.move` | Same, **no popup** | Missing arguments report an error. Ordering UI is the Parameters window's arrows. | Open `parameters.change`; click `param:before:NAME` or `param:after:NAME`. |
-| `parameters.import`, `parameters.export` | Same, **no popup** from ribbon | Actual UI is Parameters window buttons and host-native file picker (`file_picker.rs`). No import/export option panel or additional egui confirmation exists. | Open `parameters.change`; Import… / Export CSV… / Export JSON…. |
-| `config.table`, `config.configure` | `dialogs_motion.rs`, legacy CONFIGURATIONS Dialog | Horizontal table: Configuration, dynamic parameter/suppression/material/appearance columns, remove column, active/Activate/Apply, inline cell fields, Delete row. New configuration, Add Row, Add Column menu with Face Appearance → Faces on BODY submenus; per-cell Library menu. Structured rule editor and preview below table. | Start either; optionally `parameters.add {"name":"width","expression":"10 mm"}`, then `config.configure {"params":["width"]}`. |
-| `config.rules`, `config.preview` | `lib.rs::start` falls through, **no dedicated popup** | Rules returns data; preview requires a row. Existing UI lives below configuration table: ordered enabled rules, Edit/up/down/Delete, Add or edit rule disclosure (name, units, recursive condition, effect, Save Rule), row dropdown/Preview Row and report disclosure. | Open `config.table`; Add or edit rule / Preview Row. |
-| `material.assign` | `dialogs.rs`, legacy PHYSICAL MATERIAL Dialog | Bodies selection, Material dropdown, OK/Cancel; includes document-created materials. | `solid.box {"length":10,"width":10,"height":10}`, then start; select Body1 in viewport/browser. |
-| `appearance.assign` | `dialogs_appearance.rs`, legacy APPEARANCE Dialog | Objects selection; Apply To bodies/faces/component; Colour popup; Opacity; PBR toggle and metallic/roughness/IOR; Apply to selection/Remove override; local library path/open/load/search/select/apply/export and overwrite checkbox; In This Design swatches; Library category/search/swatches; drag/drop. Inline status. | Same box setup, then start. |
-| `material.properties.validate` | `material_card_review.rs`, independent legacy review window | JSON multiline input, Review, validation error, card properties/conditions/sources/derived moduli disclosures and read-only report, Close. | Start directly, paste a supported candidate card. |
-| `library.inspect`, `library.export`, `library.apply` | `lib.rs::start` falls through, **no dedicated popup** | Require arguments. Existing local-library UI is inside Appearance (`dialogs_library.rs`); native Open/Save sheets; overwrite is explicit checkbox, errors inline. | Start `appearance.assign`; use library:path/load/search/entry:N/apply/export handles. |
-| `sheet.manage_rules` | `dialogs_sheet.rs`, legacy MANAGE RULES Dialog | Rule dropdown including New rule; conditional name; thickness, K factor, bend radius, relief width/depth, corner relief shape/size, hem gap/gap; Active rule; Delete rule; OK/Cancel. No separate deletion confirmation. | Start directly. |
-| `plastic.manage_rules` | `dialogs_plastic.rs`, legacy MANAGE PLASTIC RULES Dialog | Rule dropdown including New rule; conditional name; material and rule expression fields; Active rule; OK/Cancel. | Start directly. |
-| `plastic.assign_rule` | `dialogs_plastic.rs`, **already kit** | Bodies selection, Rule dropdown, OK/Cancel. | Box setup above, then start. |
-| `document.units` | `lib.rs::start` falls through, **no popup** | Missing units argument reports an error. Existing unit choices are browser context menu commands. | `engine.execute` with `{"units":"in"}` changes units directly. |
-| `timeline.compute_all`, `edit.checkpoint` | `lib.rs::start`, **immediate commands** | Recompute / create checkpoint, no dialog. | Start directly. |
-| `edit.restore_checkpoint` | `lib.rs::start` falls through, **no popup** | Requires checkpoint id; no checkpoint picker exists. | `edit.checkpoint {}` returns id; `edit.restore_checkpoint {"checkpoint":ID}` restores directly. |
+These specialised surfaces remain in their owners:
-Native Open/Save boundaries need separate acceptance decisions if “all
-popups on the library” includes OS-provided windows. The existing file-picking continuation
-and platform behavior must remain intact; replacing those is not a paint-only port.
-
-## Other surfaces still outside the kit (source inventory)
-
-This list includes windows, floating panels and menus; it does not claim runtime screenshot verification.
-
-| Surface | Source |
+| Surface / source | Why it remains outside the kit |
| --- | --- |
-| Home page (full-page start surface: painted tiles, thumbnail cards, links; no kit element fits) | `home.rs` |
-| Assistant transcript/composer layout, image gallery and docking chrome (specialised conversation/media surfaces; matching controls use the kit) | `agent_chat/panel.rs` |
-| Host-native file/program pickers (no egui surface; the load/progress card is ported) | `file_picker.rs`; host services in `apps/solidcraft/src/main.rs` and `apps/solidcraft-web/src/main.rs` |
-| Help action menu and shortcut command-result list/pin painting (menus/search results, not property forms; the search field uses the kit) | `help.rs`, `shortcut_box.rs` |
-| Ribbon overflow/recent/family menus and context menus | `toolbar.rs`, `context_menu.rs`, `timeline_left.rs` |
-| Motion transport controls, key strips and analysis chart; generated part thumbnails | `dialogs_motion.rs`, `dialogs_motion_plot.rs`, `dialogs_parts.rs` (matching form controls are ported) |
-| Joint-browser/timeline rows and glyphs; flat-pattern canvas | `dialogs_assembly.rs`, `dialogs_sheet.rs` (dialogs and export actions are ported) |
-| Slicer program icons and painted popup entries; native program picking | `dialogs_save_mesh.rs` (format, checkbox and dropdown shell are ported) |
-| Canvas/decal insertion and dimension placement/geometry painting | `dim_view.rs`, `sketch_dims.rs`, `canvas.rs` (dimension text editors are ported) |
-| Select Other popup and viewport display controls | `select_other.rs`, `viewport.rs` |
-| Tab-strip painting and popup placement; render canvas | `documents.rs`, `render_workspace.rs` (overflow choices and matching settings controls are ported) |
-
-## Port implementation and boundaries
-
-The port replaces the renderers listed above; it does not add a new interaction for
-ribbon entries that currently execute immediately. No command id or engine implementation
-is changed. Existing import/export callbacks, overwrite handling, local-library identity
-checks, parameter validation/undo/order, appearance selection/drag payloads, opacity/PBR
-precision, configuration rule ordering and non-mutating preview are retained.
-
-Kit additions are documented in `docs/ui-kit.md`: table columns/rows/cells and empty state,
-wide bounded Panel and optional manager folding, stable cell/search editors, multiline data input, read-only reports,
-selectable lists, colour/scalar controls, swatches, dense nested action menus and suggestion
-popup rendering. Existing expression-completion keyboard routing stays in its original
-module; drawing now goes through the kit. Native file sheets are unchanged. The colour
-chooser is owned by the kit's `color_field`, which still delegates its internal HSV/RGB
-popover to egui. No tabs/progress row was added because these Manage surfaces do not use one.
-
-User-visible layout changes: standard kit header/hint/footer; fixed 24 pt table rows;
-horizontal overflow for wide tables; the Add Parameter form uses labelled rows below the
-user table; model groups use kit disclosures; review closes via standard OK/Cancel or ×.
-Closing Parameters/Configurations still leaves edits already applied by their per-row
-commands, as before. New catalog entries exist in every locale; new helper text currently
-uses English fallback values in non-English catalogs and needs translation review.
-
-Family 4 removes the remaining raw-widget allowances for legacy window chrome/selection controls,
-Drive Joint and flat-pattern exports. Appearance RGB data and library swatch
-colours retain the pre-existing colour-data exemptions; no new allowance is added.
-
-## Ready-to-send starts for the ported cards
-
-A small common setup (run once in a fresh design) gives assignment targets and one
-configuration column. Repeat the `select.set` line before each assignment card; opening a selection card consumes the preselection.
-Close each card through `dialog:close` (Parameters also retains `params:close`) before
-opening the next one. Library actions are inside Appearance; configuration rules/preview
-are inside Config Table. The host must authenticate the first request as described above.
-
-```json
-{"id":10,"method":"engine.execute","params":{"command":"solid.box","params":{"length":10,"width":10,"height":10}}}
-{"id":11,"method":"engine.execute","params":{"command":"parameters.add","params":{"name":"width","expression":"10 mm"}}}
-{"id":12,"method":"engine.execute","params":{"command":"config.configure","params":{"params":["width"]}}}
-{"id":13,"method":"engine.execute","params":{"command":"select.set","params":{"items":[{"type":"body","name":"Body1"}]}}}
-{"id":20,"method":"ui.start","params":{"command":"parameters.change"}}
-{"id":21,"method":"ui.start","params":{"command":"config.table"}}
-{"id":22,"method":"ui.start","params":{"command":"config.configure"}}
-{"id":23,"method":"ui.start","params":{"command":"material.assign"}}
-{"id":24,"method":"ui.start","params":{"command":"appearance.assign"}}
-{"id":25,"method":"ui.start","params":{"command":"material.properties.validate"}}
-{"id":26,"method":"ui.start","params":{"command":"sheet.manage_rules"}}
-{"id":27,"method":"ui.start","params":{"command":"plastic.manage_rules"}}
-{"id":28,"method":"ui.start","params":{"command":"plastic.assign_rule"}}
-```
-
-Useful nested handles: `dialog:Unit:cm` after `param:new:unit`; `dialog:section:Add or edit rule`;
-`dialog:When:Parameter` / `dialog:Then:Range` after their dropdowns; `dialog:section:Local library`;
-`library:path`, `library:load`, `library:search`, `library:entry:0`, `library:apply`, `library:export`;
-`appearance:pbr`, `appearance:metallic`, `appearance:roughness`, `appearance:ior`; `review:input`.
-Use `ui.at {"handle":"HANDLE"}` to resolve these into coordinates for `ui.click`/`ui.text`.
-
-Manager cards retain their fold/unfold behavior through the kit header (`dialog:collapse`), preserving drafts and picked inputs. Rule actions also publish `config:save_rule`, `config:preview_row`, `config:rule:ID:up` and `config:preview:param:NAME` for scrolling and automation.
-
-Wide manager cards reserve the active Sketch Palette’s space when both panels fit; tables scroll horizontally within that width.
-
-## Family 3: settings, help and customisation
-
-Source inventory before porting:
-
-| Surface | Inventory and disposition | Open it |
-| --- | --- | --- |
-| AI settings | Master/toolbar toggles; installed/added agent cards, Test/Default/Remove, global/per-agent permissions, remembered grants, side and turn limit. Ported to kit rows, disclosures, choices, notes and actions. | Preferences → AI (`ui.prefs {"open":"AI"}`); enable AI features. |
-| Add agent | Installed/custom/API choices, discovery/preset dropdowns, name/command/URL/model/key, connection test/error, Add and close. Ported to Prompt; secret remains masked and disabled without a keychain. | AI settings → Add agent, or Assistant agent selector → Add agent. |
-| Assistant controls | Agent/mode/model selectors, connection/authentication, new-conversation confirmation, approval actions, attachments and queue actions use matching kit elements. Transcript, growing bottom composer container, docking/drag chrome and image gallery keep their specialised layouts. No generic property card replaces them. | Enable AI, then View → Assistant or Cmd/Ctrl+Shift+A (`ui.agent_chat {"features":true,"open":true}`). |
-| About | Build identity, diagnostic copy, attribution/font/licence disclosures and virtualized third-party text. Ported to close-only Prompt. Help's action menu is a menu, not a form card. | Help (?) → About SolidCraft (`ui.help {"item":"about"}`). |
-| Shortcut search | Search editor ported, retaining its focus ID and one-time focus request. Result ranking, JSON execution, keyboard selection, pins, row context menus and painted command list remain their specialised search layout. | S, or the application-bar search button. |
-| Keyboard Shortcuts | Search, reset/import/export, conflict actions, command/key table, capture/clear/reset. Ported to kit table/fields/actions. Read-only Help entry remains read-only. | Preferences → Keyboard Shortcuts, File/Help → Keyboard Shortcuts (`ui.prefs {"open":"Keyboard Shortcuts"}`). |
-| Toolbar customisation | Tab guidance, panel command checkboxes and Reset Toolbar. Ported to close-only Prompt. Drag/reorder menus remain in their existing toolbar surfaces. | Right-click toolbar → Customize Toolbar… (menu item `ui.toolbarCustomize`; this is a UI menu action, not an engine command). |
-| Preferences | All eight page selectors and form controls use the kit. Theme/font discovery and native import/export callbacks, Cancel/Apply snapshots, scale drag deferral, unsupported MSAA choices and command-backed auto-projection are retained. Colour-vision sample is a painted preview, not a form control. Update/cursor preference controls use kit drawing through their existing helpers. | File → Preferences, gear, Cmd/Ctrl+, (`ui.prefs {"open":"General"}`). |
-
-No guard allowance was added. Deleted the legacy settings section/note painters, About window/licence renderer, toolbar window and keymap grid, and Preferences window/grid/footers. Kit additions are documented in `ui-kit.md` and exercised in the light/dark gallery. New catalogue messages have English placeholders in other locales.
-
-## Family 4: remaining dialogs and matching inline controls
-
-Inventory and disposition, in port order:
-
-| Surface | Result and retained boundary | Open it |
-| --- | --- | --- |
-| Contact sets | Kit Panel, name, enable checkbox, set actions and collision report. Commands and preselection remain unchanged. | `ui.start {"command":"contact.create"}`; create components with bodies to populate sets. |
-| Motion Study / analysis | Kit wide Panel, study/name/steps, loop/speed, step slider, joint/key controls, plot/quantity/duration and collision actions. Transport icons, key strips and the interactive chart retain their specialised painting. Preview moves, playback, collision navigation, GIF export and restoration remain owned by the existing code. | `ui.start {"command":"motion.study"}`; create a movable joint first. To edit: include `"params":{"study":"NAME"}`. Plot and collision controls are inside this card. |
-| Exploded View | Kit name and continuous scale slider; preview and cancel restoration retained. | `ui.start {"command":"explode.create"}` with assembly components. |
-| Standard parts / Insert Part | Kit Panel, family/size/length/name and table-value controls. The generated part thumbnail remains an image, with its existing cache. | `ui.start {"command":"parts.insert"}` or `parts.fastener`; optionally preselect a hole wall/rim. |
-| Legacy dispatcher | Deleted the independent window, grid, header, footer, width measurements and raw field/combo/selection fallbacks. Every Dialog kind now composes the kit. Save/Send and Export DXF labels and aliases are retained. | All command dialogs. |
-| Drive Joint / Interference | Kit Panel, joint selector, stable focus expression editor, continuous slider, range/stopped text and compute actions. Browser/timeline joint rows, glyphs and context-menu containers retain their existing specialised rendering. | `ui.start {"command":"joint.drive"}` after creating a movable joint; `inspect.interference` for analysis. Browser → Joints → double-click edits a joint; its menu offers Drive Joint. |
-| Save as mesh | Kit Panel, format, Send checkbox and slicer dropdown shell. Installed-program icons and popup rows remain painter-based; Delete/custom-program picking and host-native file continuations are retained. | Preselect bodies, then `ui.start {"command":"file.save_mesh"}`. Slicer controls require native program-picker services. |
-| Current View as DXF | Kit choices, tolerance and projection/help text; remembered options and asynchronous native save retained. | `ui.start {"command":"file.export_view_dxf"}` with visible bodies. |
-| Flat Pattern controls | Kit Panel, dimensions/bends and DXF/bend-table export actions. The flat-pattern canvas and navigation remain specialised. | `ui.start {"command":"sheet.flat_pattern"}` after making sheet metal. |
-| Dimension editor | Kit stable-ID editor, heading and validation report. Reference insertion, selection ranges, completion and draft commit/cancel remain in their owner. | Sketch → Dimension; place a dimension, or double-click an existing driving dimension. |
-| Placement fields | Kit placement editor retains drawing-tool Enter/Tab/completion ownership. Floating field positioning and canvas geometry remain specialised. | Start a sketch shape (line, circle, rectangle, etc.); type into its live dimension fields. |
-| Select Other | Skipped: the entire popup is painter-based, including entity icons, hover highlighting and hit targets; there is no separate form control to replace cleanly. | Hold left-click over overlapping geometry, viewport menu → Select Other, or `ui.selectOther {"x":X,"y":Y}`. |
-| Document-tab overflow | Kit selectable entries; tab-strip painting and popup placement/outside-click handling retained. | Open enough designs to overflow the tab strip, then click `tab:overflow`. |
-| Render setup selector | Kit dropdown and capped name editor; the remaining matching buttons, checkboxes, dimensions, colour and progress controls also use the kit so the file needs no raw-control allowance. Render canvas and navigation remain specialised. | Enter the Render workspace (`ui.workspace {"workspace":"render"}`); setup selector is at the top of its settings panel. |
-
-The raw-control allowance table is empty (previously 10 in `dialogs.rs`, 6 in
-`dialogs_assembly.rs`, 2 in `dialogs_sheet.rs`). Native file sheets, context menus,
-canvases, browser rows and painter-based controls above are retained. Kit additions
-are listed under “Inline placement and motion controls” in `ui-kit.md` and in the
-light/dark gallery. No command IDs or engine behavior are changed.
+| Start page: `home.rs` | Painted start tiles, thumbnails and links rather than form cards |
+| Assistant transcript/composer containers, gallery and docking: `agent_chat/panel.rs` | Conversation/media layout, rich selectable content, drag/docking behavior; matching controls use the kit |
+| Native file/program pickers: `file_picker.rs`, host services | Host-native sheets have no egui control surface; load/progress cards use the kit |
+| Help menu and command-result ranking/list/pins: `help.rs`, `shortcut_box.rs` | Menu/search layout; search editor uses the kit |
+| Ribbon, browser/timeline rows, context menus: `toolbar.rs`, `browser.rs`, `context_menu.rs`, `timeline_left.rs` | Specialised navigation, painting, menus and inline rename interactions |
+| Motion transport, key strips and chart: `dialogs_motion.rs`, `dialogs_motion_plot.rs` | Playback/chart interaction; matching form controls use the kit |
+| Generated part thumbnails: `dialogs_parts.rs` | Cached images rather than controls |
+| Joint-browser glyphs and flat-pattern canvas: `dialogs_assembly.rs`, `dialogs_sheet.rs` | Model navigation and geometry; dialog/export actions use the kit |
+| Slicer program popup entries: `dialogs_save_mesh.rs` | Painted installed-program icons/entries and native program picking; dropdown shell uses the kit |
+| Dimension/placement geometry: `dim_view.rs`, `sketch_dims.rs`, `canvas.rs` | Canvas positioning, completion ownership and geometry painting; matching dimension/placement editors use the kit |
+| Select Other and viewport display controls: `select_other.rs`, `viewport.rs` | Painter-based entity icons, hit testing and hover highlighting |
+| Document tabs and render canvas: `documents.rs`, `render_workspace.rs` | Tab-strip/canvas painting and popup positioning; overflow choices/settings controls use the kit |
+| Native colour chooser inside `color_field` | Kit owns the field; egui owns its HSV/RGB popup internals |
+
+Immediate commands such as `parameters.graph`, `parameters.move`, `config.rules`,
+`config.preview` and `library.*` keep their existing JSON execution behavior. Their
+related controls live in Parameters, Configurations and Appearance; the kit creates
+no extra command dialogs. Command IDs, model operations and scenario handles are
+unchanged by cleanup.
diff --git a/docs/ui-kit.md b/docs/ui-kit.md
index ccb52d9d14..dada43c091 100644
--- a/docs/ui-kit.md
+++ b/docs/ui-kit.md
@@ -1,159 +1,117 @@
# SolidCraft UI kit
-`crates/ui-egui/src/ui_kit/` is the tokenised library used to assemble dense feature dialogs, preferences, property/prompt cards and the sketch palette. This extraction preserves their existing layout, painting, focus, accessibility labels and scenario identities. Sketch tool panels use the same composition and elements.
-
-## Module tree
-
-```text
-ui_kit/
- mod.rs overview and the one caller import path
- metrics.rs row/header dimensions, sanitising and label-column maths
- table.rs measured columns, headers, fixed-height selectable rows and cells
- text.rs weighted, clipped, pixel-snapped text
- layout.rs form scope, aligned rows, captions, hints, notes, sections, dividers, picked lists, text_block, inline_text
- panel.rs bounded windows, surfaces, feature/palette composition and compute status
- fields.rs expressions, plain text, cell/search editors, dropdowns, selections, paired values, colour/scalar/slider
- choice.rs text/icon segments, checkboxes, wrapped modes, icon toggles, popup_list, swatches and list_picker
- actions.rs buttons, equal secondary pairs, keyboard and OK/Apply/Cancel footers
- status.rs supplied name/status/icon, constraint meter and progress bar
- gallery.rs test-only light/dark element examples and geometry/interaction checks
- *_tests.rs moved concern tests, Panel regressions and shared test input helpers
-```
-
-## Rules
-
-- Use one caller import path: `crate::ui_kit::{...}`. Implementation modules are organised by concern; panels do not import their internals.
-- Colours, fonts, dimensions and spacing come from `theme::Tokens`. No local font sizes, families, colours or design metrics.
-- Rows use `control_height` (24 pt today). A shared label column starts at `form_label_width`, widens to at most 1.6 times that value and never exceeds half the row. Label measurements settle across frames.
-- Build cards with `Panel`. Right-hand feature cards keep `space_8` clearance from the viewport edge. It owns the bounded window, feature header/drag target, scrolling body padding, pinned actions, compute status and keyboard routing. Its palette composition retains the existing palette padding and whole-card scrolling on short viewports. Supply `FeatureOptions::apply_label` for a tool card that also needs Apply. Use `feature_frame` or `palette_frame` for the existing docked/floating surfaces.
-- Panels use kit elements instead of raw egui controls. Application logic supplies values, command metadata and enabled state; it receives responses/actions and runs the existing commands.
-- Arguments put `ui` first, then the label/key (when not inherited from `row`), then the value and options. Buttons/targets return `Response`; choices report clicks; expression editors report accepted Enter (`text_field` additionally returns changed). Containers return their closure result. Existing Enter semantics intentionally distinguish completion from submission.
-- Scenario names and accessibility labels are API: preserve them. New elements publish geometry without overwriting the native accessible label or checked state. `Prompt` publishes `dialog:window`; the footer also publishes `dialog:footer:actions` for its padded action bounds. Callers may publish stable surface aliases for those rectangles.
-- `footer(..., None)` retains the original OK/Cancel layout. `Some("Apply")` adds the third action and returns `Action::Apply`; the panel decides whether to keep the operation open.
+`crates/ui-egui/src/ui_kit/` contains the tokenised controls used by feature dialogs,
+preferences, manager cards, prompts and the sketch palette. Import through
+`crate::ui_kit::{...}`. The API is crate-visible; implementation modules are private.
+
+## Composition and rules
+
+- Colours, typography, dimensions and spacing come from `theme::Tokens`.
+- `scope(ui, add)` supplies form styling. `row(ui, label, add)` aligns labels and
+ controls at `control_height` (24 pt today). Labels widen from `form_label_width`
+ to at most 1.6 times that width and never exceed half the row.
+- `expr_row`, `hint_row`, `text_row` and `choice_row` compose `row` with the existing
+ expression, hinted expression, plain text and dropdown controls. They preserve row order,
+ labels, focus IDs and completion; callers keep Enter/change ownership and explicit dropdown IDs.
+- `Panel` owns bounded windows, feature/palette composition, scrolling bodies,
+ pinned actions, compute status and keyboard routing. `wide()` uses three card
+ widths. `feature_frame` and `palette_frame` retain docked/floating surfaces.
+ `FeatureOptions::apply_label` adds Apply; `Panel::actions` supplies custom labels.
+- `Prompt` owns floating confirmation/property cards. Use `actions(ok, cancel,
+ apply)`, `anchor`/`placed`, `cards`, `selected`, `fields` and
+ `keep_open_on_escape` for existing prompt behavior. Empty `ok` omits the primary
+ action. It returns `(close_pressed, Action)`.
+- Callers supply data and enabled state, then dispatch existing commands. Editors
+ leave their established completion, Enter, Tab and commit ownership unchanged.
+- Scenario handles and accessible labels are API. Consolidated options preserve
+ the former geometry, wrapping, native metadata and publication keys.
## Elements
-All calls below use `crate::ui_kit::`; snippets assume local values and normal enclosing form scope. `control_*` means `control_fill`, `control_border` and/or `control_radius` as used by that element.
-
-| Module / element | Purpose | Tokens | Example |
-| --- | --- | --- | --- |
-| `metrics::row_height` | Row height for controls | `control_height` | `row_height()` |
-| `metrics::header_height` | Feature heading height | `form_header_height` | `header_height()` |
-| `layout::scope` | Inherited form styling and label-column identity | `space_4/8, form_gap_y, control_height, font_label, accent, selected_bg, dialog_rule, control_fill/border/radius, text` | `scope(ui, \|ui\| { /* elements */ })` |
-| `layout::row` | Aligned label/control row, 24 pt today | `control_height, form_label_width, font_label, dialog_label, space_8` | `row(ui, "Radius", \|ui\| field(ui, &mut radius))` |
-| `layout::caption` | Dim helper beneath a row control | `form_icon_size, font_small, text_dim, space_8; label-column tokens` | `caption(ui, "Line Type", "Construction")` |
-| `layout::section` | Persisted disclosure with a rule and uppercase title | `control_height, space_2, radius_sm, hover, dialog_rule, form_section_icon_size, form_gap_y, font_caption, font_section_tracking, text_dim` | `section(ui, "advanced", "Advanced", false, \|ui\| {})` |
-| `layout::hint` | Helper text below a card header | `control_height, font_small, text_dim` | `hint(ui, "pick", "Pick a point")` |
-| `layout::note` | Wrapping explanatory text in a card body, for rules or caveats too long for a hint | `font_small, text_dim, space_4` | `note(ui, "pattern", "Counts include the original.")` |
-| `layout::list_row` | Picked-item row with a remove action | `control_height, space_8, font_label, text; icon-button tokens` | `list_row(ui, "point-1", "Point 1").clicked()` |
-| `layout::divider` | Full-width rule without extra padding | `dialog_rule` | `divider(ui, "group")` |
-| `collapsible_header`, `Panel::feature_collapsible` | Optional manager fold action retaining inputs, the common header/footer and legacy chevron labels | header tokens, `space_4` | `collapsible_header(ui, icon, title, &mut collapsed, close)` |
-| `panel::header` | Feature title/icon/close band | `form_header_height, form_icon_size, form_close_size, form_inset, font_label, text, dialog_rule, space_8/10; icon_button_at tokens` | `header(ui, "fillet", "Fillet", || {})` |
-| `fields::field` | Expression editor; the value carries its unit text ("20 mm", "45 deg"), there is no unit suffix; returns accepted Enter | `control_height, control_fill, form_inset, font_label, text_dim, space_4; scope tokens` | `field(ui, &mut expression)` |
-| `fields::focused_field` | Single-value expression popup retaining keyboard focus | `field tokens` | `focused_field(ui, &mut expression)` |
-| `fields::hint_field` | Expression editor with empty-value hint | `same as field` | `hint_field(ui, &mut depth, "To the next face")` |
-| `dropdown_menu` | Dropdown with caller-supplied kit choices/actions, disabled entries and stable aliases; use `dropdown` for indexed lists | dropdown tokens | `dropdown_menu(ui, "msaa", current, \|ui\| { /* enabled list_picker choices */ })` |
-| `password_field` | Stable-ID secret input; never publishes the secret in scenario/accessibility metadata | `control_height/fill`, `form_inset`, `font_label` | `password_field(ui, id, &mut key, hint)` |
-| `number_field` | Integer/decimal field retaining the caller's range, drag step and unit suffix | scope control/font tokens | `number_field(ui, &mut minutes, 0.0..=120.0, 0.5, " min")` |
-| `formatted_slider` | Stepped preference slider retaining percent/multiplier formatting and numeric accessibility value | `control_height`, `space_24/4`, scope control/font tokens | `formatted_slider(ui, &mut scale, 0.5..=2.5, 0.05, \|v\| format!("{:.0} %", v * 100.0))` |
-| `message_field` | Growing plain-text message editor; parent retains scroll container and Enter routing | `control_fill`, `form_inset`, `font_label`, `space_4` | `message_field(ui, id, &mut message, hint)` |
-| `text_lines` | Virtualized read-only licence/report lines with horizontal overflow; only visible lines are laid out | `font_small`, `text`, `control_height` | `text_lines(ui, "licences", report)` |
-| `fields::text_field` | Plain text editor without expression completion; returns (Enter, changed) | `same as field` | `text_field(ui, &mut name, "Name")` |
-| `fields::multiline_text_field` | Three-line plain-text row with stable focus ID; caller routes Enter | `control_height, control_fill, form_inset, font_label; row tokens` | `multiline_text_field(ui, "Text", id, &mut text)` |
-| `fields::searchable_dropdown`, `SearchOption` | Search/list dropdown with optional custom-value action and loading message | `control_height, space_24, font_label; scope control tokens` | `searchable_dropdown(ui, "font", current, &mut filter, &choices, custom, pending)` |
-| `fields::value_pair_named` | Paired X/Y captions retaining independent accessible/scenario names | `value_pair tokens` | `value_pair_named(ui, "Position", [&mut x, &mut y], ["X", "Y"], ["Distance X", "Distance Y"])` |
-| `choice::text_emphasis` | Compact bold/italic toggles with localized accessible names | `scope font/control tokens` | `text_emphasis(ui, &mut bold, &mut italic)` |
-| `fields::dropdown` | Native dropdown with kit arrow and scenario option handles | `text_dim; scope control/font tokens` | `dropdown(ui, "operation", &mut operation, &["Join", "Cut"])` |
-| `fields::selection_field` | Filled point/curve/edge selection target | `control_height, control_radius, selected_bg/ink, accent, form_inset, space_24/8, font_label, text_dim` | `selection_field(ui, "Point 1", active)` |
-| `fields::selection_field_state` | Selection target with explicit filled state | `same as selection_field` | `selection_field_state(ui, "Select", active, false)` |
-| `fields::value_pair` | Two labelled numeric fields in one row; returns accepted Enter | `row/field tokens, space_8, dialog_label` | `value_pair(ui, "Position", [&mut x, &mut y], ["X", "Y"])` |
-| `fields::fraction_field` | Locale-aware variable-radius position editor | `scope control/font tokens` | `fraction_field(ui, &mut position)` |
-| `choice::segmented` | Equal text choices, falling back to dropdown when labels cannot fit | `control_height, control_fill/border/radius, font_label, selected_bg/ink, hover, text, space_8` | `segmented(ui, &mut mode, &["One", "Two"])` |
-| `choice::segmented_compact` | Always-visible short choices; long translations clip and retain tooltips and per-choice handles | `segmented tokens, space_4` | `segmented_compact(ui, &mut alignment, &labels)` |
-| `choice::segmented_states` | Segmented choices with mixed per-choice state | `same as segmented` | `segmented_states(ui, &mut mode, &["One", "Two"], &states)` |
-| `choice::segmented_icons` | Equal icon choices with mixed state | `segmented tokens, space_4/12, icon/fill, accent; icon palette` | `segmented_icons(ui, &mut mode, &icons, &states)` |
-| `choice::checkbox_grid` | Compact checkbox options in bounded columns | `form_checkbox_height, control_fill/border, radius_sm, accent, on_accent, font_body, text, space_2/3/6/8/14` | `checkbox_grid(ui, &mut [("Flip", &mut flip)], 2)` |
-| `choice::options` | Expanded two-column Options disclosure | `section and checkbox_grid tokens` | `options(ui, "options", &mut [("Flip", &mut flip)])` |
-| `choice::checkbox_row` | Full-row target with label left and box right; returns clicked | `control_height, control_radius, hover, radius_sm, accent, control_fill/border, on_accent, font_label, text, space_2/3/6/14` | `checkbox_row(ui, "snap", "Snap", snap)` |
-| `choice::checkbox` | Inline native checkbox retaining existing accessibility and sizing | `scope control/font/accent tokens` | `checkbox(ui, "Flip", &mut flip)` |
-| `choice::tool_choices` | Wrapped command-variant icons, supplied with enabled state | `sketch_mode_size/radius/border/tint, sketch_accent, control_fill/border, icon/fill, space_4/6` | `tool_choices(ui, "Line", current, &choices)` |
-| `actions::icon_button_at` | Icon action inside an existing rectangle | `form_icon_inset, text, text_dim; icon palette` | `icon_button_at(ui, rect, "close", "Close")` |
-| `actions::keyboard` | Esc cancels; unowned Enter submits only when valid | `none` | `keyboard(ui.ctx(), valid)` |
-| `actions::footer` | Pinned OK / optional Apply / Cancel; returns Action | `form_footer_height, form_button_height, dialog_footer/rule, radius_lg, control_*, accent, on_accent, font_label, space_6/10/12/16` | `footer(ui, "OK", "Cancel", valid, Some("Apply"))` |
-| `actions::footer_with_status` | Footer with stable button IDs and compute text | `footer tokens, text_dim, space_4/8` | `footer_with_status(ui, "OK", "Cancel", valid, None, status)` |
-| `actions::button_pair` | Equal-width secondary actions with optional icons and selected state | `form_button_height, control_*, selected_bg, hover, font_label, text, icon/fill, accent, sketch_footer_icon_size, space_4/6/10` | `button_pair(ui, "card", states, buttons)` |
-| `actions::secondary_button` | Ordinary secondary action preserving native sizing | `scope font/control/spacing tokens` | `secondary_button(ui, "Add")` |
-| `actions::primary_button` | Accent action outside the footer | `accent, on_accent; scope tokens` | `primary_button(ui, "Create")` |
-| `actions::small_button` | Compact inline action preserving native sizing | `scope font/control tokens` | `small_button(ui, "×")` |
-| `actions::icon_button` | Allocated control-height icon action | `control_height; icon_button_at tokens` | `icon_button(ui, "Remove", "close")` |
-| `status::status_header` | Name, status dot/text and meter for a card | `font_label, text/dim, accent, dialog_rule, sketch_accent, form_icon_size, space_3/4/6/8/10` | `status_header(ui, "card", "Sketch 1", status)` |
-| `table`, `Column`, `Table::row`, `TableRow::cell` | Horizontal table with measured column widths, header, 24 pt selectable body rows, inline controls/actions and empty state; compose an Add action after it | `form_label_width`, label-column maths, `control_height`, `font_label`, `dialog_label/rule`, `space_4/8`, `text/dim`, `selected_bg`, `hover` | `table(ui, "parameters", &columns, empty, \|ui, table\| table.row(ui, "width", false, \|row\| row.cell(\|ui\| field(ui, &mut value))))` |
-| `inline_text` | Read-only text beside compact actions | `font_label, text` | `inline_text(ui, "Active")` |
-| `label_actions` | Clipped row name beside compact actions | `control_height`, scope font/spacing tokens | `label_actions(ui, name, \|ui\| {})` |
-| `PopupOption`, `popup_list` | Focus-neutral completion/suggestion popup; owner retains keyboard routing | `space_2, form_label_width, control_height, text_dim`, scope tokens | `popup_list(ctx, id, anchor, selected, &items, hint)` |
-| `cell_text` | Read-only clipped table value with full tooltip/accessibility label | `control_height, font_label, text` | `cell_text(ui, name)` |
-| `cell_editor` | Stable-ID inline editor; caller owns completion and commit/blur semantics | `control_height/fill, form_inset, font_label, text/error` | `cell_editor(ui, id, &mut value, "Expression", invalid)` |
-| `search_field` | Stable-ID search input | `cell_editor` tokens | `search_field(ui, id, &mut query, "Filter")` |
-| `text_area` | Bounded multiline JSON/data input, caller owns keyboard and validation | `control_height/fill, form_inset, font_label` | `text_area(ui, label, id, &mut json, 5, 262144)` |
-| `text_block` | Wrapping read-only report or validation error; values include their units | `font_label, text/error` | `text_block(ui, "validation", report, invalid)` |
-| `list_picker` | Selectable list row with native checked state and caller identity | `control_height`, scope control/font/selection tokens | `list_picker(ui, id, name, selected)` |
-| `color_field` | Document RGB chooser under form styling (the internal native egui chooser remains) | scope colour/font tokens; RGB is document data | `color_field(ui, &mut rgb)` |
-| `slider`, `scalar_field` | Continuous (display only, two decimals; the stored value is never rounded) / locale-aware bounded dimensionless values | `control_height`, scope control/font tokens | `slider(ui, &mut opacity, 0.0..=1.0)` |
-| `color_swatch`, `swatch_grid` | Wrapped draggable document-colour samples retaining caller payload | `control_height/radius, border, accent, hover, space_4` | `color_swatch(ui, id, color, picked, tip, payload)` |
-| `enabled_button`, `action_menu` | Enabled secondary action (`label`, then `enabled`) and nested dense action menu | scope control/font tokens | `enabled_button(ui, "Add", valid)`, `action_menu(ui, "Add Column", \|ui\| {})` |
-| `panel::Prompt` | Floating card (1.5 card widths) for confirmations, offers, notices and short property forms: header, padded body, pinned footer with up to three actions (`actions(ok, cancel, apply)`; an empty `ok` leaves the primary one out), `anchor` / `placed` position, `selected` mark for the action Enter gives, `fields()` when Enter belongs to editable fields; returns (close pressed, `Action`) | `form_card_width` (x1.5, `cards(n)` for other widths), `dialog_body`, header/footer tokens, `space_6/8/10` | `Prompt::new(id, "delete", title).actions("Delete", "Cancel", None).show(ctx, true, \|ui\| text_block(ui, "why", text, false))` |
-| `status::progress` | Determinate progress bar (a download, a file load), full width, `space_6` tall; fraction clamped; pair with a `text_block` naming the step | `space_3/6, dialog_rule, accent` | `progress(ui, "download", 0.4)` |
-| `panel::Panel::actions` | Footer primary/closing labels of a docked card when they are not OK/Cancel ("Delete"/"Cancel"; `"", "Close"` for a card that only closes) | footer tokens | `Panel::new(..).actions("", "Close")` |
-| `panel::Prompt::keep_open_on_escape` | Esc does not close the card (header close and the closing action still do): for a card holding a long text being edited (issue report) | footer tokens | `Prompt::new(..).fields().keep_open_on_escape()` |
-| `actions::footer_selected` | Footer marking one action as the one Enter gives (used by `Prompt`) | footer tokens, `selected_bg`, `accent` | `footer_selected(ui, "Save", "Cancel", true, Some("Don't Save"), Some(Action::Apply))` |
-| `fields::focused_text_field` | Plain text editor keeping keyboard focus, for a one-name card (Rename); returns accepted Enter | `field` tokens | `focused_text_field(ui, &mut name, "")` |
-| `fields::length_field`, `fields::angle_field` | Draggable/typeable length held in millimetres (shown in the design's units) and angle in degrees | `control_height`, scope control/font tokens | `length_field(ui, &mut x, "in", 2)`, `angle_field(ui, &mut deg)` |
-| `panel::Panel` | Docked/floating window and both card compositions | `form_card_width` (`wide()` uses three card widths), frame/header/body/footer tokens above | `Panel::new(title, id, anchor, viewport, side, frame).window()` |
-| `choice::toggle_icon` | Independent pattern direction/centering icon | `control_height`, `space_3/4/24`, `icon/fill`, `accent`, scope tokens | `toggle_icon(ui, "Alignment", "Center", &mut on, "pattern_center")` |
-| `choice::IconSegment`, `ToolChoice` | Supplied icon/command-choice metadata | Read by their drawing element | `IconSegment { key, icon, tip }` |
-| `actions::Action`, `PairButton` | Footer result and equal-action metadata | Read by their drawing element | `Action::Apply` |
-| `status::StatusHeader` | Supplied icon, status text, completeness and meter fraction | Read by `status_header` | `StatusHeader { icon, text, complete, fraction }` |
-
-## Adding an element
-
-1. Add its one implementation to the appropriate concern file. Document what it is, when to use it and the tokens it reads. Re-export it from `mod.rs`; keep panel callers on the single import path.
-2. Add a light/dark example to `gallery.rs`, with stable scenario geometry/handles. Cover row height, label alignment and effective paint bounds, plus interaction if the element introduces an action. The moved regression tests live beside each concern in `*_tests.rs`.
-3. Add an element-table row here. Reuse existing artwork; any new file asset needs an exact `ATTRIBUTION.md` row and the asset authoring workflow.
-4. Run the gallery and widget/font/colour guards. The font metric guard scans the entire kit; the colour guard scans subdirectories too. The panel guard discovers sources that use the kit, including new Panel callers. Allowances are only for documented legacy non-dense paths; a new dense element needs no guard allowance because its raw implementation lives inside the kit.
-
-## Remaining legacy raw controls
-
-The bounded allowances in `ui_kit_guard_tests.rs` cover:
-
-| Source | Maximum calls | Reason |
-| --- | ---: | --- |
-| `dialogs.rs` | 10 | Retired window controls, legacy selection chips, the legacy combo and its choices, and guarded legacy checkboxes. Dense error actions and pattern toggles now use kit elements; Measure, Section Analysis, Rename and the feature deletion dialog are dense cards. |
-| `dialogs_assembly.rs` | 6 | Non-dense Drive Joint slider, Motion Study compute action and joint-browser actions. |
-| `dialogs_sheet.rs` | 2 | Flat-pattern exports remain outside this Manage port. |
-
-Other retired non-sketch dialog sources keep their existing raw controls; they are outside this dense-panel port. Sketch modify, text, text move and attachment panels have no raw-control allowance. Dense adapters, the sketch palette and future sources using the kit are scanned recursively. Kit implementations themselves own the raw widgets and require no allowances. Guarded legacy text editors in `dialogs.rs` and `dialogs_plastic.rs` also remain for the old path.
-
-## Verification and legacy boundaries
-
-`ui_kit::gallery` renders every element in light and dark without a native window. Moved tests cover geometry, labels, field focus/completion, disclosures and actions. Panel tests cover both card layouts and short-height scrolling. `ui_kit_guard_tests` rejects raw controls in dense sources; the small allowance table names the remaining retired dialog paths. Standard font/colour guards, clippy, wasm, assets and layers still apply.
-
-## Manage cards
-
-Parameters, configurations (including rules and preview), physical material, appearance
-(including local library), sheet/plastic rule managers and material-card review compose
-these elements through `Panel`. Editable tables use `wide()` and horizontal scrolling
-when columns exceed the bounded viewport. No tabs or progress rows are needed by these
-existing workflows. Read [the Manage audit](manage-ui-kit-audit.md) for command recipes,
-the initial inventory, immediate command entries and the remaining application surfaces.
+Module names below describe implementation locations, not caller import paths.
+Every inline element/variant has one entry in the light/dark `gallery::ELEMENTS`
+table. Panel/Prompt compositions also have dedicated geometry and interaction tests.
+
+| Module / element | Use and options | Main tokens |
+| --- | --- | --- |
+| metrics: `row_height`, `header_height` | Shared control/header heights | `control_height`, `form_header_height` |
+| layout: `scope`, `row` | Form styling and aligned label/control columns | `form_label_width`, `form_gap_y`, `control_*`, `font_label`, `dialog_label`, `space_4/8` |
+| `caption` | Dim caption aligned beneath a control | `font_small`, `text_dim`, label-column tokens |
+| `section`, `divider` | Persisted disclosure and full-width rule | `control_height`, `dialog_rule`, `font_caption`, tracking, spacing |
+| `list_row` | Picked item with a remove target | `control_height`, `font_label`, icon/spacing tokens |
+| `text`, `Text` | Hint, note, report, inline or cell text; see variants below | `font_small/label`, `text/dim/error`, `control_height`, `space_4` |
+| `text_lines` | Virtualized read-only licence/report lines, horizontal overflow | `font_small`, `text`, `control_height` |
+| fields: `field`, `hint_field`, `focused_field` | Expression editors, optional empty hint or retained focus; returns accepted Enter | `control_height/fill`, `form_inset`, `font_label` |
+| `text_field`, `focused_text_field` | Plain name editor, optionally retaining focus | field tokens |
+| `multiline_text_field` | Three-line plain-text row with stable focus ID | field/row tokens |
+| `password_field` | Stable secret editor; excludes the secret from scenario/accessibility metadata | field tokens |
+| `message_field` | Growing message editor; owner retains scroll and Enter routing | field tokens |
+| `cell_editor`, `bounded_cell_editor`, `search_field` | Stable-ID inline/search editors; bounded variant caps Unicode characters | field tokens, `text/error` |
+| `text_area` | Bounded multiline JSON/data editor | field tokens |
+| `dropdown`, `dropdown_menu` | Indexed choices or caller-supplied menu controls | `control_height`, `text_dim`, form tokens |
+| `searchable_dropdown`, `SearchOption` | Filtered choices, custom-value action and pending message | dropdown tokens |
+| `selection_field`, `Selection` | Selection chip with explicit `active` and `filled` state | `selected_bg/ink`, `accent`, `control_*`, `form_inset`, `space_8/24` |
+| `value_pair` | Paired captions/expressions; optional independent field names | row/field tokens, `space_8` |
+| `fraction_field`, `scalar_field` | Locale-aware bounded dimensionless values | form control/font tokens |
+| `number_field` | Integer/decimal field with caller range, drag speed and suffix | form control/font tokens |
+| `length_field`, `angle_field` | Length in design units, angle in degrees | form control/font tokens |
+| `slider`, `formatted_slider` | Continuous slider or stepped preference slider with caller formatting | `control_height`, form control/font tokens |
+| `timeline_slider` | Slider without editor; optional whole-step manipulation | `control_height`, `space_4` |
+| `placement_field` | Stable focus ID; drawing tool owns Enter/Tab validation and completion | `control_fill`, `font_body`, `text`, `control_height`, spacing |
+| `color_field` | Document RGB chooser, retaining egui's internal HSV/RGB popup | form control/font tokens |
+| choice: `segmented`, `Segments` | Equal text choices; `states` supplies mixed selection, `compact` clips instead of falling back to a dropdown | `control_*`, `selected_bg/ink`, `font_label`, `space_4/8` |
+| `segmented_icons`, `IconSegment` | Equal icon choices and mixed states | segment tokens, icon palette |
+| `checkbox`, `checkbox_row`, `checkbox_grid`, `options` | Inline, full-row, bounded-column or disclosed checkbox choices | `control_*`, `accent`, `on_accent`, typography/spacing |
+| `text_emphasis` | Bold/italic with translated accessible names | form control/font tokens |
+| `tool_choices`, `ToolChoice`, `toggle_icon` | Wrapped command modes or independent icon toggles | sketch mode/icon tokens, `accent` |
+| `list_picker` | Selectable row with caller identity and native checked state | `control_height`, form selection tokens |
+| `popup_list`, `PopupOption` | Focus-neutral suggestions; owner retains keyboard routing | `space_2`, `form_label_width`, `control_height`, form tokens |
+| `color_swatch`, `swatch_grid` | Wrapped draggable document colours with caller payloads | `control_height/radius`, `border`, `accent`, `hover`, `space_4` |
+| actions: `button`, `Button` | Secondary action: `Normal`, `Small`, or `Enabled(bool)` | native sizing, form font/control tokens |
+| `primary_button` | Accent action outside a footer | `accent`, `on_accent`, form tokens |
+| `icon_button_at` | Icon action inside a supplied rectangle | `form_icon_inset`, `text/dim`, icon palette |
+| `button_pair`, `PairButton` | Equal secondary actions, optional icons and selected state | `form_button_height`, control/selection/icon tokens |
+| `footer`, `Footer`, `Action` | OK/Cancel with optional Apply, compute status or selected action | `form_footer/button_height`, `dialog_footer/rule`, `control_*`, `accent`, spacing |
+| `keyboard` | Esc cancels, unowned Enter submits when valid | none |
+| `action_menu` | Nested dense action menu | form control/font tokens |
+| table: `table`, `Column`, `Table::row`, `Table::column_actions`, `TableRow::cell` | Left-aligned headers/cells, horizontal overflow, selectable rows, attached column-action band and empty state; `Column::new(label, width)` uses label-column multiples, `min_content_width(points)` reserves measured control content | label-column tokens, `control_height`, `dialog_rule/footer`, `selected_bg`, spacing |
+| `label_actions` | Clipped row name beside compact actions | `control_height`, form font/spacing tokens |
+| status: `status_header`, `StatusHeader` | Supplied icon/name/status and constraint meter | `font_label`, `text/dim`, `accent`, sketch/header tokens |
+| `progress` | Clamped determinate progress | `space_3/6`, `dialog_rule`, `accent` |
+
+`text(ui, text, options)` preserves five existing text behaviors:
+
+| Option | Layout and scenario publication |
+| --- | --- |
+| `Text::Hint(key)` | One fixed row; tooltip, rect and handle `dialog:hint:KEY` |
+| `Text::Note(key)` | Wrapping small dim text with vertical padding; rect `dialog:note:KEY` |
+| `Text::Report(key, error)` | Native wrapping label, optional error colour; rect/handle `dialog:report:KEY` |
+| `Text::Inline` | Native truncated label; rect/handle `dialog:inline:TEXT` |
+| `Text::Cell` | Fixed-height clipped clickable cell with tooltip; rect/handle `dialog:cell:TEXT` |
+
+Examples:
+
+```rust
+segmented(ui, &mut mode, &["One", "Two"], Segments::default());
+selection_field(ui, "Select", Selection { active: true, filled: false });
+value_pair(ui, "Position", [&mut x, &mut y], ["X", "Y"], Some(["Distance X", "Distance Y"]));
+button(ui, "Add", Button::Enabled(valid));
+footer(ui, "OK", "Cancel", valid, Footer { apply: Some("Apply"), ..Default::default() });
+text(ui, report, Text::Report("validation", invalid));
+```
-Host-native Open/Save sheets remain in the host service. Expression completion and the
-colour chooser retain their shared popup behavior; the latter is owned by `color_field`
-but its internal HSV/RGB controls still use egui's built-in picker.
+## Extending and checking the kit
-## Inline placement and motion controls
+Add one implementation, document its tokens/options here, re-export it through
+`mod.rs`, and add one table entry in `gallery::ELEMENTS`. Keep implementation-only
+helpers private. Add interaction tests when the element introduces an action.
-- `timeline_slider(ui, value, range, whole_steps)` draws a slider without a numeric editor. Motion timelines supply `true` for integer steps; Drive Joint supplies `false` and retains its expression editor and range caption. Tokens: `control_height`, `space_4`. Values are rounded only by manipulation, never just by rendering.
-- `placement_field(ui, id, value, hint)` retains the caller's focus ID and leaves Enter and Tab with the drawing tool, so rejecting an expression keeps the field available for correction. Completion stays with the caller. Tokens: `control_fill`, `text`, `font_body`, `control_height`, `space_2/4/6`. The floating canvas container and placement calculation remain outside the kit.
-- `bounded_cell_editor(ui, id, value, hint, invalid, limit)` is the stable cell editor with a Unicode character cap, used for render setup names (128 characters). Tokens: `cell_editor` tokens. `cell_editor` uses the same implementation without an additional cap.
+The gallery checks geometry, label alignment, handles and effective paint bounds in
+both themes. Field/footer/panel tests retain focus, completion and action coverage.
+`ui_kit_guard_tests` scans kit callers recursively, rejects raw control constructors
+and methods (including aliases), and rejects removed legacy helpers. The raw-control
+allowance table is empty and guarded against additions. Standard colour/font guards,
+Clippy, wasm, i18n, assets, icons and layers still apply.
-All three have light/dark gallery examples; keyboard and character-cap checks cover the two editors.
+See [remaining coverage boundaries](manage-ui-kit-audit.md) for specialised surfaces
+that remain outside the kit and why.