* Preferences: preserve Sketch redesign alongside Graphics * Preferences: share hinted and unhinted blocks across independent panels * Tests: wait for preference search scrolling before checking visible targets * Tests: locate preference search results by their indexed rows
This commit is contained in:
@@ -0,0 +1,272 @@
|
||||
{
|
||||
"ar": {
|
||||
"prefs.sketch.align_points": "المحاذاة مع نقاط الرسم الأخرى",
|
||||
"prefs.sketch.align_points_note": "تتحاذى الخطوط أثناء الرسم مع النقاط على المحورين معًا.",
|
||||
"prefs.sketch.auto_dimensions": "إضافة كل الأبعاد للأشكال الجديدة",
|
||||
"prefs.sketch.auto_dimensions_note": "القيم المدخلة وكل بُعد يثبّت الشكل.",
|
||||
"prefs.sketch.auto_locate": "التحديد انطلاقًا من أصل الرسم",
|
||||
"prefs.sketch.auto_locate_note": "مع إضافة كل الأبعاد.",
|
||||
"prefs.sketch.center_arc": "قوس المركز يتبع المؤشر",
|
||||
"prefs.sketch.click_selects": "النقر يحدد",
|
||||
"prefs.sketch.conflict_colour": "لون التعارض",
|
||||
"prefs.sketch.drawing": "الرسم",
|
||||
"prefs.sketch.exit_keep": "إبقاء",
|
||||
"prefs.sketch.exit_previous": "العودة إلى العرض السابق",
|
||||
"prefs.sketch.exit_unless_rotated": "إلا إذا تم التدوير",
|
||||
"prefs.sketch.faces_edges": "الأوجه والحواف",
|
||||
"prefs.sketch.hide_glyphs": "إخفاء الرموز عند التصغير",
|
||||
"prefs.sketch.marks": "العلامات في الرسم",
|
||||
"prefs.sketch.note": "الرسم والالتقاط والتحديد.",
|
||||
"prefs.sketch.opening_closing": "الفتح والإغلاق",
|
||||
"prefs.sketch.prefer_free_points": "تفضيل النقاط القابلة للتحريك عند تداخلها",
|
||||
"prefs.sketch.project_options": "السؤال عن خيارات الإسقاط أولًا",
|
||||
"prefs.sketch.recent_snap": "الالتقاط عند تقاطع دليلين",
|
||||
"prefs.sketch.select_other_hidden": "اختيار آخر يشمل الهندسة المخفية",
|
||||
"prefs.sketch.shortcut_cycles_modes": "الاختصار مجددًا يبدّل الوضع",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "عند الإيقاف: تبدأ الأداة مجددًا.",
|
||||
"prefs.sketch.snapping_guides": "الالتقاط والأدلة",
|
||||
"prefs.sketch.state_icons": "أيقونات الحالة",
|
||||
"prefs.sketch.tracking_guides": "أدلة المراكز ونقاط المنتصف",
|
||||
"prefs.sketch.tracking_guides_note": "أدلة أفقية وعمودية مؤقتة من المراكز ونقاط منتصف الحواف عند التحويم.",
|
||||
"prefs.sketch.tracking_points": "أدلة من نقاط الرسم أيضًا",
|
||||
"prefs.sketch.unless_turned_note": "العودة إذا لم يتم التدوير",
|
||||
"prefs.sketch.whole_bodies": "الأجسام كاملة"
|
||||
},
|
||||
"de": {
|
||||
"prefs.sketch.align_points": "An anderen Skizzenpunkten ausrichten",
|
||||
"prefs.sketch.align_points_note": "Beim Zeichnen richten sich Linien gleichzeitig an Punkten auf beiden Achsen aus.",
|
||||
"prefs.sketch.auto_dimensions": "Neue Formen vollständig bemaßen",
|
||||
"prefs.sketch.auto_dimensions_note": "Eingegebene Werte und alle Maße, die die Form festlegen.",
|
||||
"prefs.sketch.auto_locate": "Vom Skizzenursprung aus positionieren",
|
||||
"prefs.sketch.auto_locate_note": "Mit vollständiger Bemaßung.",
|
||||
"prefs.sketch.center_arc": "Mittelpunktbogen folgt dem Zeiger",
|
||||
"prefs.sketch.click_selects": "Klick wählt",
|
||||
"prefs.sketch.conflict_colour": "Konfliktfarbe",
|
||||
"prefs.sketch.drawing": "Zeichnen",
|
||||
"prefs.sketch.exit_keep": "Beibehalten",
|
||||
"prefs.sketch.exit_previous": "Zur Ansicht davor zurückkehren",
|
||||
"prefs.sketch.exit_unless_rotated": "Außer bei Drehung",
|
||||
"prefs.sketch.faces_edges": "Flächen und Kanten",
|
||||
"prefs.sketch.hide_glyphs": "Symbole beim Herauszoomen ausblenden",
|
||||
"prefs.sketch.marks": "Markierungen in der Skizze",
|
||||
"prefs.sketch.note": "Zeichnen, Fangen und Auswählen.",
|
||||
"prefs.sketch.opening_closing": "Öffnen und Schließen",
|
||||
"prefs.sketch.prefer_free_points": "Bei Überlappung bewegliche Punkte bevorzugen",
|
||||
"prefs.sketch.project_options": "Zuerst Projektionsoptionen abfragen",
|
||||
"prefs.sketch.recent_snap": "Am Schnittpunkt zweier Hilfslinien fangen",
|
||||
"prefs.sketch.select_other_hidden": "Andere auswählen erfasst verdeckte Geometrie",
|
||||
"prefs.sketch.shortcut_cycles_modes": "Erneuter Kurzbefehl wechselt den Modus",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "Aus: Das Werkzeug startet erneut.",
|
||||
"prefs.sketch.snapping_guides": "Fangen und Hilfslinien",
|
||||
"prefs.sketch.state_icons": "Statussymbole",
|
||||
"prefs.sketch.tracking_guides": "Hilfslinien für Mittelpunkte und Kantenmitten",
|
||||
"prefs.sketch.tracking_guides_note": "Temporäre waagerechte und senkrechte Hilfslinien von überfahrenen Mittelpunkten und Kantenmitten.",
|
||||
"prefs.sketch.tracking_points": "Hilfslinien auch von Skizzenpunkten",
|
||||
"prefs.sketch.unless_turned_note": "zurück, wenn nicht gedreht",
|
||||
"prefs.sketch.whole_bodies": "Ganze Körper"
|
||||
},
|
||||
"en": {
|
||||
"prefs.sketch.align_points": "Line up with other sketch points",
|
||||
"prefs.sketch.align_points_note": "Drawing lines align with points on both axes at once.",
|
||||
"prefs.sketch.auto_dimensions": "Dimension new shapes fully",
|
||||
"prefs.sketch.auto_dimensions_note": "Typed values plus every dimension that fixes the shape.",
|
||||
"prefs.sketch.auto_locate": "Place from the sketch origin",
|
||||
"prefs.sketch.auto_locate_note": "With full dimensions.",
|
||||
"prefs.sketch.center_arc": "Center-point arc follows the cursor",
|
||||
"prefs.sketch.click_selects": "Click selects",
|
||||
"prefs.sketch.conflict_colour": "Conflict color",
|
||||
"prefs.sketch.drawing": "Drawing",
|
||||
"prefs.sketch.exit_keep": "Keep",
|
||||
"prefs.sketch.exit_previous": "Return to the view before",
|
||||
"prefs.sketch.exit_unless_rotated": "Unless turned",
|
||||
"prefs.sketch.faces_edges": "Faces and edges",
|
||||
"prefs.sketch.hide_glyphs": "Hide glyphs zoomed out",
|
||||
"prefs.sketch.marks": "Marks in the sketch",
|
||||
"prefs.sketch.note": "Drawing, snapping and selecting.",
|
||||
"prefs.sketch.opening_closing": "Opening and closing",
|
||||
"prefs.sketch.prefer_free_points": "Prefer movable points where they overlap",
|
||||
"prefs.sketch.project_options": "Ask for Project options first",
|
||||
"prefs.sketch.recent_snap": "Snap to where two guides cross",
|
||||
"prefs.sketch.select_other_hidden": "Select Other reaches hidden geometry",
|
||||
"prefs.sketch.shortcut_cycles_modes": "Shortcut again switches mode",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "Off: it starts the tool again.",
|
||||
"prefs.sketch.snapping_guides": "Snapping and guides",
|
||||
"prefs.sketch.state_icons": "State icons",
|
||||
"prefs.sketch.tracking_guides": "Center and midpoint guides",
|
||||
"prefs.sketch.tracking_guides_note": "Temporary horizontal and vertical guides from hovered centers and edge midpoints.",
|
||||
"prefs.sketch.tracking_points": "Guides from sketch points too",
|
||||
"prefs.sketch.unless_turned_note": "return if not rotated",
|
||||
"prefs.sketch.whole_bodies": "Whole bodies"
|
||||
},
|
||||
"en-GB": {
|
||||
"prefs.sketch.center_arc": "Centre-point arc follows the cursor",
|
||||
"prefs.sketch.conflict_colour": "Conflict colour",
|
||||
"prefs.sketch.tracking_guides": "Centre and midpoint guides",
|
||||
"prefs.sketch.tracking_guides_note": "Temporary horizontal and vertical guides from hovered centres and edge midpoints."
|
||||
},
|
||||
"he": {
|
||||
"prefs.sketch.align_points": "יישור עם נקודות אחרות בסקיצה",
|
||||
"prefs.sketch.align_points_note": "קווים בשרטוט מיושרים עם נקודות בשני הצירים בו־זמנית.",
|
||||
"prefs.sketch.auto_dimensions": "הוספת כל המידות לצורות חדשות",
|
||||
"prefs.sketch.auto_dimensions_note": "ערכים מוקלדים וכל מידה שמקבעת את הצורה.",
|
||||
"prefs.sketch.auto_locate": "מיקום ביחס לראשית הסקיצה",
|
||||
"prefs.sketch.auto_locate_note": "עם כל המידות.",
|
||||
"prefs.sketch.center_arc": "קשת מנקודת מרכז עוקבת אחר הסמן",
|
||||
"prefs.sketch.click_selects": "לחיצה בוחרת",
|
||||
"prefs.sketch.conflict_colour": "צבע התנגשות",
|
||||
"prefs.sketch.drawing": "שרטוט",
|
||||
"prefs.sketch.exit_keep": "שמירה",
|
||||
"prefs.sketch.exit_previous": "חזרה לתצוגה הקודמת",
|
||||
"prefs.sketch.exit_unless_rotated": "אלא אם סובבה",
|
||||
"prefs.sketch.faces_edges": "פאות וקצוות",
|
||||
"prefs.sketch.hide_glyphs": "הסתרת סמלים בהתרחקות",
|
||||
"prefs.sketch.marks": "סימונים בסקיצה",
|
||||
"prefs.sketch.note": "שרטוט, הצמדה ובחירה.",
|
||||
"prefs.sketch.opening_closing": "פתיחה וסגירה",
|
||||
"prefs.sketch.prefer_free_points": "העדפת נקודות ניתנות להזזה כשהן חופפות",
|
||||
"prefs.sketch.project_options": "בקשת אפשרויות ההיטל תחילה",
|
||||
"prefs.sketch.recent_snap": "הצמדה למפגש שני קווי עזר",
|
||||
"prefs.sketch.select_other_hidden": "בחירת אחר כוללת גאומטריה מוסתרת",
|
||||
"prefs.sketch.shortcut_cycles_modes": "לחיצה חוזרת על קיצור מחליפה מצב",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "כבוי: הכלי מתחיל מחדש.",
|
||||
"prefs.sketch.snapping_guides": "הצמדה וקווי עזר",
|
||||
"prefs.sketch.state_icons": "סמלי מצב",
|
||||
"prefs.sketch.tracking_guides": "קווי עזר למרכזים ולנקודות אמצע",
|
||||
"prefs.sketch.tracking_guides_note": "קווי עזר אופקיים ואנכיים זמניים ממרכזים ומנקודות אמצע של קצוות בעת ריחוף.",
|
||||
"prefs.sketch.tracking_points": "קווי עזר גם מנקודות הסקיצה",
|
||||
"prefs.sketch.unless_turned_note": "חזרה אם לא סובבה",
|
||||
"prefs.sketch.whole_bodies": "גופים שלמים"
|
||||
},
|
||||
"ja": {
|
||||
"prefs.sketch.align_points": "他のスケッチ点に整列",
|
||||
"prefs.sketch.align_points_note": "作図中の線を両軸の点に同時に整列します。",
|
||||
"prefs.sketch.auto_dimensions": "新しい形状にすべての寸法を付ける",
|
||||
"prefs.sketch.auto_dimensions_note": "入力値と、形状を確定するすべての寸法。",
|
||||
"prefs.sketch.auto_locate": "スケッチ原点を基準に配置",
|
||||
"prefs.sketch.auto_locate_note": "すべての寸法を付ける場合。",
|
||||
"prefs.sketch.center_arc": "中心点指定の円弧がカーソルに追従",
|
||||
"prefs.sketch.click_selects": "クリックで選択",
|
||||
"prefs.sketch.conflict_colour": "競合色",
|
||||
"prefs.sketch.drawing": "作図",
|
||||
"prefs.sketch.exit_keep": "維持",
|
||||
"prefs.sketch.exit_previous": "開始前のビューに戻る",
|
||||
"prefs.sketch.exit_unless_rotated": "回転した場合を除く",
|
||||
"prefs.sketch.faces_edges": "面とエッジ",
|
||||
"prefs.sketch.hide_glyphs": "ズームアウト時に記号を非表示",
|
||||
"prefs.sketch.marks": "スケッチ内のマーク",
|
||||
"prefs.sketch.note": "作図、スナップ、選択。",
|
||||
"prefs.sketch.opening_closing": "開始と終了",
|
||||
"prefs.sketch.prefer_free_points": "重なる場合は移動可能な点を優先",
|
||||
"prefs.sketch.project_options": "投影オプションを先に確認",
|
||||
"prefs.sketch.recent_snap": "2本のガイドの交点にスナップ",
|
||||
"prefs.sketch.select_other_hidden": "他を選択で非表示のジオメトリも対象に",
|
||||
"prefs.sketch.shortcut_cycles_modes": "ショートカットの再入力でモード切替",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "オフの場合はツールを再起動します。",
|
||||
"prefs.sketch.snapping_guides": "スナップとガイド",
|
||||
"prefs.sketch.state_icons": "状態アイコン",
|
||||
"prefs.sketch.tracking_guides": "中心と中点のガイド",
|
||||
"prefs.sketch.tracking_guides_note": "ホバーした中心やエッジの中点から、一時的な水平・垂直ガイドを表示します。",
|
||||
"prefs.sketch.tracking_points": "スケッチ点からもガイドを表示",
|
||||
"prefs.sketch.unless_turned_note": "回転していなければ戻る",
|
||||
"prefs.sketch.whole_bodies": "ボディ全体"
|
||||
},
|
||||
"ko": {
|
||||
"prefs.sketch.align_points": "다른 스케치 점에 정렬",
|
||||
"prefs.sketch.align_points_note": "그리는 선을 두 축의 점에 동시에 정렬합니다.",
|
||||
"prefs.sketch.auto_dimensions": "새 도형에 모든 치수 지정",
|
||||
"prefs.sketch.auto_dimensions_note": "입력한 값과 도형을 고정하는 모든 치수.",
|
||||
"prefs.sketch.auto_locate": "스케치 원점에서 배치",
|
||||
"prefs.sketch.auto_locate_note": "모든 치수 지정 시 적용.",
|
||||
"prefs.sketch.center_arc": "중심점 호가 커서를 따라감",
|
||||
"prefs.sketch.click_selects": "클릭으로 선택",
|
||||
"prefs.sketch.conflict_colour": "충돌 색상",
|
||||
"prefs.sketch.drawing": "그리기",
|
||||
"prefs.sketch.exit_keep": "유지",
|
||||
"prefs.sketch.exit_previous": "이전 뷰로 돌아가기",
|
||||
"prefs.sketch.exit_unless_rotated": "회전하지 않았다면",
|
||||
"prefs.sketch.faces_edges": "면과 모서리",
|
||||
"prefs.sketch.hide_glyphs": "축소 시 기호 숨기기",
|
||||
"prefs.sketch.marks": "스케치의 표시",
|
||||
"prefs.sketch.note": "그리기, 스냅 및 선택.",
|
||||
"prefs.sketch.opening_closing": "열기 및 닫기",
|
||||
"prefs.sketch.prefer_free_points": "겹치는 곳에서는 이동 가능한 점 우선",
|
||||
"prefs.sketch.project_options": "투영 옵션을 먼저 묻기",
|
||||
"prefs.sketch.recent_snap": "두 안내선의 교차점에 스냅",
|
||||
"prefs.sketch.select_other_hidden": "다른 항목 선택에 숨겨진 형상 포함",
|
||||
"prefs.sketch.shortcut_cycles_modes": "단축키를 다시 누르면 모드 전환",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "끄면 도구를 다시 시작합니다.",
|
||||
"prefs.sketch.snapping_guides": "스냅 및 안내선",
|
||||
"prefs.sketch.state_icons": "상태 아이콘",
|
||||
"prefs.sketch.tracking_guides": "중심 및 중점 안내선",
|
||||
"prefs.sketch.tracking_guides_note": "마우스를 올린 중심과 모서리 중점에서 임시 가로 및 세로 안내선을 표시합니다.",
|
||||
"prefs.sketch.tracking_points": "스케치 점에서도 안내선 표시",
|
||||
"prefs.sketch.unless_turned_note": "회전하지 않았으면 복귀",
|
||||
"prefs.sketch.whole_bodies": "전체 바디"
|
||||
},
|
||||
"vi": {
|
||||
"prefs.sketch.align_points": "Căn theo các điểm phác thảo khác",
|
||||
"prefs.sketch.align_points_note": "Đường đang vẽ căn theo các điểm trên cả hai trục cùng lúc.",
|
||||
"prefs.sketch.auto_dimensions": "Ghi đầy đủ kích thước cho hình mới",
|
||||
"prefs.sketch.auto_dimensions_note": "Giá trị đã nhập cùng mọi kích thước xác định hình dạng.",
|
||||
"prefs.sketch.auto_locate": "Định vị từ gốc phác thảo",
|
||||
"prefs.sketch.auto_locate_note": "Khi ghi đầy đủ kích thước.",
|
||||
"prefs.sketch.center_arc": "Cung theo tâm đi theo con trỏ",
|
||||
"prefs.sketch.click_selects": "Nhấp để chọn",
|
||||
"prefs.sketch.conflict_colour": "Màu xung đột",
|
||||
"prefs.sketch.drawing": "Vẽ",
|
||||
"prefs.sketch.exit_keep": "Giữ nguyên",
|
||||
"prefs.sketch.exit_previous": "Trở về góc nhìn trước đó",
|
||||
"prefs.sketch.exit_unless_rotated": "Trừ khi đã xoay",
|
||||
"prefs.sketch.faces_edges": "Mặt và cạnh",
|
||||
"prefs.sketch.hide_glyphs": "Ẩn ký hiệu khi thu nhỏ",
|
||||
"prefs.sketch.marks": "Dấu trong phác thảo",
|
||||
"prefs.sketch.note": "Vẽ, bắt điểm và chọn.",
|
||||
"prefs.sketch.opening_closing": "Mở và đóng",
|
||||
"prefs.sketch.prefer_free_points": "Ưu tiên điểm di chuyển được khi chồng nhau",
|
||||
"prefs.sketch.project_options": "Hỏi tùy chọn Chiếu trước",
|
||||
"prefs.sketch.recent_snap": "Bắt vào giao điểm của hai đường dẫn",
|
||||
"prefs.sketch.select_other_hidden": "Chọn đối tượng khác bao gồm hình học bị ẩn",
|
||||
"prefs.sketch.shortcut_cycles_modes": "Nhấn lại phím tắt để đổi chế độ",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "Tắt: khởi động lại công cụ.",
|
||||
"prefs.sketch.snapping_guides": "Bắt điểm và đường dẫn",
|
||||
"prefs.sketch.state_icons": "Biểu tượng trạng thái",
|
||||
"prefs.sketch.tracking_guides": "Đường dẫn qua tâm và trung điểm",
|
||||
"prefs.sketch.tracking_guides_note": "Đường dẫn ngang và dọc tạm thời từ tâm và trung điểm cạnh khi rê chuột qua.",
|
||||
"prefs.sketch.tracking_points": "Đường dẫn từ cả các điểm phác thảo",
|
||||
"prefs.sketch.unless_turned_note": "trở về nếu chưa xoay",
|
||||
"prefs.sketch.whole_bodies": "Toàn bộ khối"
|
||||
},
|
||||
"zh": {
|
||||
"prefs.sketch.align_points": "与其他草图点对齐",
|
||||
"prefs.sketch.align_points_note": "绘制的线同时与两个轴上的点对齐。",
|
||||
"prefs.sketch.auto_dimensions": "为新形状标注全部尺寸",
|
||||
"prefs.sketch.auto_dimensions_note": "输入的数值以及确定形状所需的所有尺寸。",
|
||||
"prefs.sketch.auto_locate": "相对草图原点定位",
|
||||
"prefs.sketch.auto_locate_note": "启用全部尺寸标注时。",
|
||||
"prefs.sketch.center_arc": "圆心圆弧跟随光标",
|
||||
"prefs.sketch.click_selects": "单击选择",
|
||||
"prefs.sketch.conflict_colour": "冲突颜色",
|
||||
"prefs.sketch.drawing": "绘制",
|
||||
"prefs.sketch.exit_keep": "保持",
|
||||
"prefs.sketch.exit_previous": "返回之前的视图",
|
||||
"prefs.sketch.exit_unless_rotated": "除非已旋转",
|
||||
"prefs.sketch.faces_edges": "面和边",
|
||||
"prefs.sketch.hide_glyphs": "缩小时隐藏符号",
|
||||
"prefs.sketch.marks": "草图中的标记",
|
||||
"prefs.sketch.note": "绘制、捕捉和选择。",
|
||||
"prefs.sketch.opening_closing": "打开和关闭",
|
||||
"prefs.sketch.prefer_free_points": "重叠时优先选择可移动点",
|
||||
"prefs.sketch.project_options": "先询问投影选项",
|
||||
"prefs.sketch.recent_snap": "捕捉两条辅助线的交点",
|
||||
"prefs.sketch.select_other_hidden": "选择其他对象可选中隐藏几何体",
|
||||
"prefs.sketch.shortcut_cycles_modes": "再次按快捷键切换模式",
|
||||
"prefs.sketch.shortcut_cycles_modes_tip": "关闭时:重新启动工具。",
|
||||
"prefs.sketch.snapping_guides": "捕捉和辅助线",
|
||||
"prefs.sketch.state_icons": "状态图标",
|
||||
"prefs.sketch.tracking_guides": "圆心和中点辅助线",
|
||||
"prefs.sketch.tracking_guides_note": "从悬停的圆心和边中点显示临时水平和垂直辅助线。",
|
||||
"prefs.sketch.tracking_points": "也从草图点显示辅助线",
|
||||
"prefs.sketch.unless_turned_note": "未旋转时返回",
|
||||
"prefs.sketch.whole_bodies": "整个实体"
|
||||
}
|
||||
}
|
||||
+204
-17
@@ -1522,22 +1522,22 @@ preference_settings! {
|
||||
manipulator_free_alt: bool = true, PAGE_SKETCH;
|
||||
/// A sketch's icon in History and the browser takes the colour of its solve state, and its
|
||||
/// tooltip names the state (#7245). Off: every sketch has the same icon, as before.
|
||||
sketch_state_icons: bool = true, PAGE_SKETCH => check_id("prefs.sketch_state_icons");
|
||||
sketch_state_icons: bool = true, PAGE_SKETCH;
|
||||
/// Show the construction-line family in Sketch CREATE; off restores the earlier menu.
|
||||
sketch_construction_lines: bool = true, PAGE_SKETCH => check_id("prefs.sketch_construction_lines");
|
||||
sketch_construction_lines: bool = true, PAGE_SKETCH;
|
||||
/// A sketch tool's shortcut pressed again before the first point steps to the tool's next
|
||||
/// creation mode (#2459). Off (the default): the key starts the tool again, as it always has.
|
||||
shortcut_cycles_modes: bool = false, PAGE_SKETCH;
|
||||
/// A click on the ribbon button of the sketch tool that is running ends the tool, so clicks
|
||||
/// in the view select again (#10151). Off: the click starts the tool again, as before.
|
||||
ribbon_click_ends_tool: bool = true, PAGE_SKETCH => check_id("prefs.ribbon_click_ends_tool");
|
||||
ribbon_click_ends_tool: bool = true, PAGE_SKETCH;
|
||||
/// Opening or editing a sketch turns the view to face it (the default). Off: the view stays as
|
||||
/// it is, and Look At faces the sketch when asked.
|
||||
sketch_open_look_at: bool = true, PAGE_SKETCH;
|
||||
/// A sketch started on a face of a body in another component than the active one activates
|
||||
/// that component first, so the sketch belongs to it (`sketch.create` `activate_part`,
|
||||
/// #10215). Off (the default): the sketch belongs to the active component, as before.
|
||||
sketch_face_activates_part: bool = false, PAGE_SKETCH => check_id("prefs.sketch_face_activates_part");
|
||||
sketch_face_activates_part: bool = false, PAGE_SKETCH;
|
||||
/// While a sketch is open, only sketch keys and keys that work everywhere run; a model
|
||||
/// command's key (E, F) does nothing. Off (the default): a model key pressed in a sketch
|
||||
/// runs its command, and one that builds a feature finishes the sketch first (#2815).
|
||||
@@ -1547,30 +1547,24 @@ preference_settings! {
|
||||
/// A shape drawn in a sketch gets all its dimensions at once: the typed values, and every
|
||||
/// other size the shape has at its size as drawn (`sketch.draw.dimensioned` with `as_drawn`).
|
||||
/// Shapes `solidcraft_engine::dimension_roles` doesn't list are drawn as before.
|
||||
sketch_auto_dimensions: bool = false, PAGE_SKETCH => check(
|
||||
"Dimension new shapes",
|
||||
"Each shape you draw gets all its dimensions, at the sizes you drew (typed values win). A size the sketch already sets is left out."
|
||||
);
|
||||
sketch_auto_dimensions: bool = false, PAGE_SKETCH;
|
||||
/// With `sketch_auto_dimensions`: new shapes are also placed from the sketch origin until they
|
||||
/// are fully constrained (`sketch.draw.dimensioned` with `locate`). A shape already anchored to
|
||||
/// the origin or to placed geometry gets nothing more.
|
||||
sketch_auto_locate: bool = false, PAGE_SKETCH => check(
|
||||
"Also place them from the origin (fully constrained)",
|
||||
"Each new shape is also dimensioned from the sketch origin until nothing of it is left free. A shape already attached to the origin or to placed geometry gets none."
|
||||
);
|
||||
sketch_auto_locate: bool = false, PAGE_SKETCH;
|
||||
/// A centre-point arc runs the way the cursor goes round its centre from the start (#6645).
|
||||
/// Off: it always runs counter-clockwise from the start, as it did before.
|
||||
center_arc_follows_cursor: bool = true, PAGE_SKETCH;
|
||||
/// In the Line tool, a press, a drag and the release draw one line from the press to the
|
||||
/// release and end there (#7247); clicks still draw a chain. Off (the default): a drag is a
|
||||
/// click that moved on the way, placing a point where it is let go (#2448).
|
||||
line_drag_draws_one: bool = false, PAGE_SKETCH => check_id("prefs.line_drag_draws_one");
|
||||
line_drag_draws_one: bool = false, PAGE_SKETCH;
|
||||
/// In the Line tool, leaving the chain's last point and resting back on it switches to a
|
||||
/// tangent arc, and the same again back to lines (#9489). Off (the default): resting there
|
||||
/// does nothing, and tangent arcs are the Arc tool's.
|
||||
line_hover_tangent_arc: bool = false, PAGE_SKETCH => check_id("prefs.line_hover_tangent_arc");
|
||||
line_hover_tangent_arc: bool = false, PAGE_SKETCH;
|
||||
/// Include hidden geometry and a small pointer neighbourhood in Select Other.
|
||||
select_other_hidden: bool = true, PAGE_SKETCH => check_id("prefs.select_other_hidden");
|
||||
select_other_hidden: bool = true, PAGE_SKETCH;
|
||||
/// When true: Shift+click adds without removing; Primary toggles.
|
||||
/// When false (default): Shift and Primary both toggle.
|
||||
selection_shift_add_only: bool = false, PAGE_SKETCH;
|
||||
@@ -1579,11 +1573,11 @@ preference_settings! {
|
||||
/// While the open sketch's constraints conflict, the curves and points a failing constraint
|
||||
/// holds, and its glyph or dimension, are drawn in `sketch_conflict` (#7244). Off: only the
|
||||
/// glyphs and dimensions are red, in `error`, as before.
|
||||
sketch_conflict_colour: bool = true, PAGE_SKETCH => check_id("prefs.sketch_conflict_colour");
|
||||
sketch_conflict_colour: bool = true, PAGE_SKETCH;
|
||||
/// Hide constraint glyphs when the sketch is zoomed out so far that a millimetre of the plane
|
||||
/// is smaller than `sketch_tools::MIN_GLYPH_PX_PER_MM` on screen (#8980). Off: glyphs stay at a
|
||||
/// fixed screen size at every zoom, as before.
|
||||
hide_constraint_glyphs_zoomed_out: bool = true, PAGE_SKETCH => check_id("prefs.hide_constraint_glyphs_zoomed_out");
|
||||
hide_constraint_glyphs_zoomed_out: bool = true, PAGE_SKETCH;
|
||||
/// Drive Joints shows the moved parts' old place as a ghost (its Show ghost box, #5905).
|
||||
drive_joints_ghost: bool = true, PAGE_TOOLS => check_tr("prefs.design_tools.ghost");
|
||||
/// Plugin ids turned off (Preferences › Plugins). An installed plugin whose id is absent is on.
|
||||
@@ -7349,6 +7343,199 @@ mod tests {
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sketch_checkbox_bindings_edit_only_their_own_fields() {
|
||||
for theme in ["light", "dark"] {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.call("ui.prefs", json!({"language":"en","theme":theme}));
|
||||
h.call("ui.prefs", json!({"open":"Sketch"}));
|
||||
let original = h.app.preferences.clone();
|
||||
let session = (h.app.session.auto_project, h.app.ui.pick_bodies);
|
||||
let mut expected = serde_json::to_value(&original).unwrap();
|
||||
for (field, label) in [
|
||||
("sketch_tracking_points", "prefs.sketch.tracking_points"),
|
||||
("sketch_tracking_guides", "prefs.sketch.tracking_guides"),
|
||||
("sketch_recent_snap", "prefs.sketch.recent_snap"),
|
||||
("sketch_align_points", "prefs.sketch.align_points"),
|
||||
("line_drag_draws_one", "prefs.line_drag_draws_one"),
|
||||
("line_hover_tangent_arc", "prefs.line_hover_tangent_arc"),
|
||||
("center_arc_follows_cursor", "prefs.sketch.center_arc"),
|
||||
("sketch_construction_lines", "prefs.sketch_construction_lines"),
|
||||
("sketch_auto_dimensions", "prefs.sketch.auto_dimensions"),
|
||||
("sketch_auto_locate", "prefs.sketch.auto_locate"),
|
||||
("shortcut_cycles_modes", "prefs.sketch.shortcut_cycles_modes"),
|
||||
("ribbon_click_ends_tool", "prefs.ribbon_click_ends_tool"),
|
||||
("project_options_dialog", "prefs.sketch.project_options"),
|
||||
("sketch_face_activates_part", "prefs.sketch_face_activates_part"),
|
||||
("sketch_open_look_at", "prefs.sketch_open_look_at"),
|
||||
("selection_shift_add_only", "prefs.shift_add_ctrl_toggle"),
|
||||
("prefer_free_sketch_points", "prefs.sketch.prefer_free_points"),
|
||||
("select_other_hidden", "prefs.sketch.select_other_hidden"),
|
||||
("manipulator_free_alt", "prefs.alt_frees_manipulators"),
|
||||
] {
|
||||
h.app.prefs_window.filter = h.app.tr(label).into();
|
||||
h.frames(5);
|
||||
let handle = format!("prefs:{field}");
|
||||
super::reveal_preference(&mut h, &handle);
|
||||
let legacy = match field {
|
||||
"sketch_auto_dimensions" => Some("Dimension new shapes"),
|
||||
"sketch_auto_locate" => Some("Also place them from the origin (fully constrained)"),
|
||||
"select_other_hidden" => Some("Select hidden geometry with Select Other"),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(legacy) = legacy {
|
||||
assert_eq!(crate::scenario::rect_of(&format!("dialog:{legacy}")), crate::scenario::rect_of(&handle));
|
||||
}
|
||||
h.step(&json!({"click":{"handle":handle}})).unwrap();
|
||||
expected[field] = json!(!expected[field].as_bool().unwrap());
|
||||
assert_eq!(serde_json::to_value(&h.app.preferences).unwrap(), expected, "{theme}: {field}");
|
||||
assert_eq!((h.app.session.auto_project, h.app.ui.pick_bodies), session, "{field} leaves session values alone");
|
||||
}
|
||||
h.call("ui.prefs", json!({"button":"cancel"}));
|
||||
assert_eq!(h.app.preferences, original);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sketch_cards_tiles_and_session_controls_preserve_apply_defaults_and_cancel() {
|
||||
for theme in ["light", "dark"] {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.call("ui.prefs", json!({"language":"en","theme":theme,"quick_measure":true}));
|
||||
// Opening the page must retain a non-default session, too.
|
||||
h.app.session.auto_project = false;
|
||||
h.app.ui.pick_bodies = true;
|
||||
let original = Snapshot::take(&h.app);
|
||||
h.call("ui.prefs", json!({"open":"Sketch"}));
|
||||
assert!(original.matches(&h.app));
|
||||
let mut expected = serde_json::to_value(&h.app.preferences).unwrap();
|
||||
for (key, choice) in
|
||||
[("previous", SketchExitView::Previous), ("keep", SketchExitView::Keep), ("unless_rotated", SketchExitView::UnlessRotated)]
|
||||
{
|
||||
h.app.prefs_window.filter = h.app.tr("prefs.sketch_exit_view").into();
|
||||
h.frames(5);
|
||||
let handle = format!("prefs:sketch_exit_view:{key}");
|
||||
super::reveal_preference(&mut h, &handle);
|
||||
h.step(&json!({"click":{"handle":handle}})).unwrap();
|
||||
expected["sketch_exit_view"] = serde_json::to_value(choice).unwrap();
|
||||
assert_eq!(h.app.preferences.sketch_exit_view, choice);
|
||||
assert_eq!(serde_json::to_value(&h.app.preferences).unwrap(), expected, "only the exit enum changes");
|
||||
}
|
||||
for (key, label) in [
|
||||
("sketch_state_icons", "prefs.sketch.state_icons"),
|
||||
("sketch_conflict_colour", "prefs.sketch.conflict_colour"),
|
||||
("hide_constraint_glyphs_zoomed_out", "prefs.sketch.hide_glyphs"),
|
||||
] {
|
||||
h.app.prefs_window.filter = h.app.tr(label).into();
|
||||
h.frames(5);
|
||||
let handle = format!("prefs:{key}");
|
||||
super::reveal_preference(&mut h, &handle);
|
||||
h.step(&json!({"click":{"handle":handle}})).unwrap();
|
||||
expected[key] = json!(false);
|
||||
assert_eq!(serde_json::to_value(&h.app.preferences).unwrap(), expected, "{key} changes only its field");
|
||||
}
|
||||
for (key, bodies) in [("faces_edges", false), ("bodies", true), ("faces_edges", false)] {
|
||||
h.app.prefs_window.filter = h.app.tr("prefs.sketch.click_selects").into();
|
||||
h.frames(5);
|
||||
let handle = format!("prefs:pick_bodies:{key}");
|
||||
super::reveal_preference(&mut h, &handle);
|
||||
h.step(&json!({"click":{"handle":handle}})).unwrap();
|
||||
assert_eq!(h.app.ui.pick_bodies, bodies);
|
||||
assert!(!h.app.session.auto_project);
|
||||
assert_eq!(serde_json::to_value(&h.app.preferences).unwrap(), expected);
|
||||
}
|
||||
h.app.prefs_window.filter = h.app.tr("ui.project_face_edges_sketch").into();
|
||||
h.frames(5);
|
||||
super::reveal_preference(&mut h, "prefs:auto_project");
|
||||
h.step(&json!({"click":{"handle":"prefs:auto_project"}})).unwrap();
|
||||
assert!(h.app.session.auto_project);
|
||||
assert!(!h.app.ui.pick_bodies);
|
||||
assert_eq!(serde_json::to_value(&h.app.preferences).unwrap(), expected);
|
||||
assert_eq!(saved_prefs(&h.app)["preferences"], serde_json::to_value(&original.prefs).unwrap(), "unapplied tile choices are held back");
|
||||
h.call("ui.prefs", json!({"button":"apply"}));
|
||||
let applied = Snapshot::take(&h.app);
|
||||
let mut reloaded = SolveApp::new(Default::default(), Default::default());
|
||||
reloaded.load_prefs(&h.app.prefs());
|
||||
assert_eq!(reloaded.preferences, h.app.preferences, "card and tile values survive the existing saved representation");
|
||||
|
||||
h.call("ui.prefs", json!({"button":"defaults"}));
|
||||
let reset = serde_json::to_value(&h.app.preferences).unwrap();
|
||||
let defaults = serde_json::to_value(Prefs::default()).unwrap();
|
||||
for (field, owner) in FIELD_PAGES {
|
||||
assert_eq!(
|
||||
&reset[*field],
|
||||
if *owner == Some(PAGE_SKETCH) { &defaults[*field] } else { &expected[*field] },
|
||||
"{field}: only Sketch resets"
|
||||
);
|
||||
}
|
||||
assert_eq!((h.app.session.auto_project, h.app.ui.pick_bodies), (true, false));
|
||||
h.call("ui.prefs", json!({"button":"cancel"}));
|
||||
assert!(applied.matches(&h.app), "Cancel after Defaults returns to Apply");
|
||||
|
||||
// The session fields also roll back when the page was opened with the opposite values.
|
||||
original.clone().restore(&mut h.app);
|
||||
h.call("ui.prefs", json!({"open":"Sketch","button":"defaults"}));
|
||||
assert_eq!((h.app.session.auto_project, h.app.ui.pick_bodies), (true, false));
|
||||
h.call("ui.prefs", json!({"button":"cancel"}));
|
||||
assert!(original.matches(&h.app));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sketch_disabled_dependencies_keep_their_stored_choices() {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.call("ui.prefs", json!({"language":"en","open":"Sketch","sketch_auto_locate":true}));
|
||||
for (query, parent, child) in [
|
||||
("prefs.sketch.drawing", "sketch_auto_dimensions", "sketch_auto_locate"),
|
||||
("prefs.sketch.snapping_guides", "sketch_tracking_guides", "sketch_tracking_points"),
|
||||
] {
|
||||
h.app.prefs_window.filter = h.app.tr(query).into();
|
||||
h.frames(5);
|
||||
for enabled in [false, true, false] {
|
||||
set(&mut h.app, &json!({(parent):enabled, (child):true})).unwrap();
|
||||
h.frames(5);
|
||||
let handle = format!("prefs:{child}");
|
||||
super::reveal_preference(&mut h, &handle);
|
||||
h.step(&json!({"click":{"handle":handle}})).unwrap();
|
||||
let prefs = serde_json::to_value(&h.app.preferences).unwrap();
|
||||
assert_eq!(prefs[parent], enabled);
|
||||
assert_eq!(prefs[child], !enabled, "a disabled {child} retains true; an enabled one toggles");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sketch_shift_legend_updates_in_the_checkbox_release_frame() {
|
||||
for theme in ["light", "dark"] {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.call("ui.prefs", json!({"language":"en","theme":theme,"open":"Sketch"}));
|
||||
h.app.prefs_window.filter = h.app.tr("prefs.selecting").into();
|
||||
h.frames(5);
|
||||
super::reveal_preference(&mut h, "prefs:selection_shift_add_only");
|
||||
for enabled in [true, false] {
|
||||
let at = crate::scenario::rect_of("prefs:selection_shift_add_only").unwrap().center();
|
||||
h.frame_with(crate::test_support::pointer(at, true));
|
||||
h.frame_with(crate::test_support::pointer(at, false));
|
||||
assert_eq!(h.app.preferences.selection_shift_add_only, enabled);
|
||||
let mut actions = Vec::new();
|
||||
for shape in &h.shapes {
|
||||
crate::test_support::each_shape(&shape.shape, &mut |shape| {
|
||||
if let egui::Shape::Text(text) = shape {
|
||||
actions.push(text.galley.job.text.clone());
|
||||
}
|
||||
});
|
||||
}
|
||||
assert_eq!(actions.iter().filter(|text| text.as_str() == h.app.tr("prefs.add_item")).count(), usize::from(enabled));
|
||||
assert_eq!(actions.iter().filter(|text| text.as_str() == h.app.tr("prefs.toggle_item")).count(), if enabled { 1 } else { 2 });
|
||||
let primary = crate::tool_modifiers::ctrl_name_for(crate::tool_modifiers::Platform::of(&h.ctx));
|
||||
assert!(actions.iter().any(|text| text == primary), "the live platform keycap remains visible");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn theme_options_raw_values_default_while_theme_api_clamps() {
|
||||
use crate::theme_files::{OptionNotice, OptionNoticeKind, OptionValue};
|
||||
|
||||
+471
-106
@@ -1,117 +1,482 @@
|
||||
//! Sketch and selection preferences with their live modifier legend.
|
||||
//! Sketch and selection preferences with shared figures and the live modifier legend.
|
||||
use super::*;
|
||||
|
||||
pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
ui_kit::settings_page(ui, |ui| {
|
||||
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);
|
||||
ui_kit::settings_heading_with_tag(ui, app.tr("prefs.structure.sketch"), app.tr("prefs.sketch.note"), Some(crate::settings_profiles::tag));
|
||||
snapping(app, ui);
|
||||
drawing(app, ui);
|
||||
opening(app, ui);
|
||||
marks(app, ui);
|
||||
selecting(app, ui);
|
||||
});
|
||||
}
|
||||
|
||||
fn snapping(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
ui_kit::settings_heading_with_tag(
|
||||
ui,
|
||||
app.tr("prefs.structure.sketch"),
|
||||
app.tr("prefs.sketch_selection_note"),
|
||||
Some(crate::settings_profiles::tag),
|
||||
);
|
||||
ui_kit::settings_section(ui, "sketch", app.tr("prefs.sketching"), |ui| {
|
||||
ui_kit::checkbox(ui, app.tr("prefs.sketch_tracking_guides"), &mut app.preferences.sketch_tracking_guides)
|
||||
.on_hover_text(app.tr("prefs.sketch_tracking_guides_note"));
|
||||
ui.add_enabled_ui(app.preferences.sketch_tracking_guides, |ui| {
|
||||
ui_kit::checkbox(ui, app.tr("prefs.sketch_tracking_points"), &mut app.preferences.sketch_tracking_points)
|
||||
.on_hover_text(app.tr("prefs.sketch_tracking_points_note"));
|
||||
ui_kit::settings_section(ui, "sketch", app.tr("prefs.sketch.snapping_guides"), |ui| {
|
||||
let available = ui.available_width();
|
||||
let figure_width = t.space_24 * 5.0;
|
||||
let labels_width = ["prefs.sketch.tracking_guides", "prefs.sketch.tracking_points", "prefs.sketch.recent_snap", "prefs.sketch.align_points"]
|
||||
.into_iter()
|
||||
.map(|id| check_width(ui, app.tr(id), true))
|
||||
.fold(0.0, f32::max);
|
||||
let controls_width = if available >= figure_width + t.space_14 + labels_width { available - figure_width - t.space_14 } else { available };
|
||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::Min).with_main_wrap(true), |ui| {
|
||||
ui.spacing_mut().item_spacing.x = t.space_14;
|
||||
if !crate::prefs_search::suppress_chrome(ui) {
|
||||
let (rect, _) = ui.allocate_exact_size(egui::vec2(figure_width.min(available), t.space_24 * 2.0 + t.space_16), egui::Sense::hover());
|
||||
ui_kit::paint_sketch_guides(&ui.painter_at(rect), rect);
|
||||
}
|
||||
ui.allocate_ui_with_layout(egui::vec2(controls_width, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
check(
|
||||
ui,
|
||||
"sketch_tracking_guides",
|
||||
"prefs.sketch.tracking_guides",
|
||||
Some("prefs.sketch.tracking_guides_note"),
|
||||
&mut app.preferences.sketch_tracking_guides,
|
||||
);
|
||||
ui.add_enabled_ui(app.preferences.sketch_tracking_guides, |ui| {
|
||||
check(
|
||||
ui,
|
||||
"sketch_tracking_points",
|
||||
"prefs.sketch.tracking_points",
|
||||
Some("prefs.sketch_tracking_points_note"),
|
||||
&mut app.preferences.sketch_tracking_points,
|
||||
);
|
||||
});
|
||||
check(
|
||||
ui,
|
||||
"sketch_recent_snap",
|
||||
"prefs.sketch.recent_snap",
|
||||
Some("prefs.sketch_recent_snap_note"),
|
||||
&mut app.preferences.sketch_recent_snap,
|
||||
);
|
||||
check(
|
||||
ui,
|
||||
"sketch_align_points",
|
||||
"prefs.sketch.align_points",
|
||||
Some("prefs.sketch.align_points_note"),
|
||||
&mut app.preferences.sketch_align_points,
|
||||
);
|
||||
});
|
||||
});
|
||||
ui_kit::checkbox(ui, app.tr("prefs.sketch_recent_snap"), &mut app.preferences.sketch_recent_snap)
|
||||
.on_hover_text(app.tr("prefs.sketch_recent_snap_note"));
|
||||
ui_kit::checkbox(ui, app.tr("prefs.sketch_align_points"), &mut app.preferences.sketch_align_points)
|
||||
.on_hover_text(app.tr("prefs.sketch_align_points_note"));
|
||||
let mut auto = app.session.auto_project;
|
||||
if ui_kit::checkbox(ui, crate::i18n::tr_label("Project face edges into new sketches"), &mut auto).changed() {
|
||||
let _ = app.run("sketch.auto_project", json!({"value": auto}));
|
||||
}
|
||||
let owner = setting::sketch_face_activates_part(app, ui).on_hover_text(app.tr("prefs.sketch_face_activates_part_note"));
|
||||
crate::scenario::publish_target("prefs:sketch_face_activates_part", owner.rect);
|
||||
ui_kit::checkbox(ui, app.tr("prefs.project_options_dialog"), &mut app.preferences.project_options_dialog)
|
||||
.on_hover_text(app.tr("prefs.project_options_dialog_note"));
|
||||
ui_kit::checkbox(ui, crate::i18n::tr_label("Pressing a tool's shortcut again switches its mode"), &mut app.preferences.shortcut_cycles_modes)
|
||||
.on_hover_text(crate::i18n::tr_label(
|
||||
"Before the first point, pressing a sketch tool's shortcut again steps through its creation modes. Off: it starts the tool again.",
|
||||
));
|
||||
let ends_tool = setting::ribbon_click_ends_tool(app, ui).on_hover_text(app.tr("prefs.ribbon_click_ends_tool_note"));
|
||||
crate::scenario::publish_target("prefs:ribbon_click_ends_tool", ends_tool.rect);
|
||||
// Sketch icons in the colour of their solve state (#7245).
|
||||
let check = setting::sketch_state_icons(app, ui).on_hover_text(app.tr("prefs.sketch_state_icons_note"));
|
||||
crate::scenario::publish_target("prefs:sketch_state_icons", check.rect);
|
||||
let construction = setting::sketch_construction_lines(app, ui);
|
||||
crate::scenario::publish_target("prefs:sketch_construction_lines", construction.rect);
|
||||
let dimension = setting::sketch_auto_dimensions(app, ui);
|
||||
crate::scenario::publish_handle("prefs:sketch_auto_dimensions", dimension.rect.center());
|
||||
ui.add_enabled_ui(app.preferences.sketch_auto_dimensions, |ui| {
|
||||
let locate = setting::sketch_auto_locate(app, ui);
|
||||
crate::scenario::publish_handle("prefs:sketch_auto_locate", locate.rect.center());
|
||||
});
|
||||
ui_kit::checkbox(ui, crate::i18n::tr_label("Center point arc follows the cursor's direction"), &mut app.preferences.center_arc_follows_cursor)
|
||||
.on_hover_text(crate::i18n::tr_label(
|
||||
"A center point arc runs clockwise or counter-clockwise the way the cursor goes round its center. Off: always counter-clockwise from the start.",
|
||||
));
|
||||
let line_drag = setting::line_drag_draws_one(app, ui).on_hover_text(app.tr("prefs.line_drag_draws_one_note"));
|
||||
crate::scenario::publish_target("prefs:line_drag_draws_one", line_drag.rect);
|
||||
let line_arc = setting::line_hover_tangent_arc(app, ui).on_hover_text(app.tr("prefs.line_hover_tangent_arc_note"));
|
||||
crate::scenario::publish_target("prefs:line_hover_tangent_arc", line_arc.rect);
|
||||
ui_kit::settings_block_hint(ui, app.tr("prefs.hold_stop_snapping"), app.tr("prefs.snap_drawing_note"), t.space_24 * 8.0 + t.space_8, |ui| {
|
||||
let combo = &mut app.preferences.suppress_sketch_snap;
|
||||
ui_kit::settings_control_width(ui, t.space_24 * 7.0 + t.space_12, |ui| {
|
||||
ui_kit::dropdown_menu(ui, "pref_suppress_sketch_snap", &combo.shown_label(), |ui| {
|
||||
for choice in ModifierCombo::SNAP_SUPPRESS_CHOICES {
|
||||
if ui_kit::list_picker(ui, &choice.label(), &choice.shown_label(), *combo == choice).clicked() {
|
||||
*combo = choice;
|
||||
let label_width = ui_kit::ContentWidth::label(ui, app.tr("prefs.hold_stop_snapping"));
|
||||
ui_kit::settings_form(ui, label_width, |ui| {
|
||||
ui_kit::row(ui, app.tr("prefs.hold_stop_snapping"), |ui| {
|
||||
ui_kit::settings_control_width(ui, t.space_24 * 8.0 + t.space_8, |ui| {
|
||||
let combo = &mut app.preferences.suppress_sketch_snap;
|
||||
let response = ui_kit::dropdown_menu(ui, "pref_suppress_sketch_snap", &combo.shown_label(), |ui| {
|
||||
for choice in ModifierCombo::SNAP_SUPPRESS_CHOICES {
|
||||
if ui_kit::list_picker(ui, &choice.label(), &choice.shown_label(), *combo == choice).clicked() {
|
||||
*combo = choice;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.on_hover_text(crate::i18n::tr("prefs.snap_drawing_note"));
|
||||
crate::scenario::publish_target("prefs:suppress_sketch_snap", response.rect);
|
||||
});
|
||||
});
|
||||
});
|
||||
ui_kit::checkbox(ui, app.tr("prefs.sketch_open_look_at"), &mut app.preferences.sketch_open_look_at)
|
||||
.on_hover_text(app.tr("prefs.sketch_open_look_at_note"));
|
||||
ui_kit::settings_block_hint(
|
||||
ui,
|
||||
app.tr("prefs.sketch_exit_view"),
|
||||
app.tr("prefs.sketch_exit_view_note"),
|
||||
t.space_24 * 8.0 + t.space_8,
|
||||
|ui| {
|
||||
let exit = &mut app.preferences.sketch_exit_view;
|
||||
ui_kit::settings_control_width(ui, t.space_24 * 7.0 + t.space_12, |ui| {
|
||||
ui_kit::dropdown_menu(ui, "pref_sketch_exit_view", crate::i18n::tr(exit.label_id()), |ui| {
|
||||
for choice in SketchExitView::ALL {
|
||||
if ui_kit::list_picker(ui, choice.label_id(), crate::i18n::tr(choice.label_id()), *exit == choice).clicked() {
|
||||
*exit = choice;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
ui_kit::checkbox(ui, app.tr("prefs.alt_frees_manipulators"), &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.",
|
||||
));
|
||||
// Conflicting curves and points in the conflict colour (#7244).
|
||||
let check = setting::sketch_conflict_colour(app, ui).on_hover_text(app.tr("prefs.sketch_conflict_colour_note"));
|
||||
crate::scenario::publish_target("prefs:sketch_conflict_colour", check.rect);
|
||||
// Constraint glyphs hide when zoomed out (#8980).
|
||||
let check = setting::hide_constraint_glyphs_zoomed_out(app, ui).on_hover_text(app.tr("prefs.hide_constraint_glyphs_zoomed_out_note"));
|
||||
crate::scenario::publish_target("prefs:hide_constraint_glyphs_zoomed_out", check.rect);
|
||||
});
|
||||
ui_kit::settings_section(ui, "selection", app.tr("prefs.selecting"), |ui| {
|
||||
ui_kit::checkbox(ui, crate::i18n::tr_label("Click selects whole bodies"), &mut app.ui.pick_bodies);
|
||||
ui_kit::checkbox(ui, app.tr("prefs.prefer_free_sketch_points"), &mut app.preferences.prefer_free_sketch_points);
|
||||
let hidden = setting::select_other_hidden(app, ui).on_hover_text(app.tr("prefs.select_other_hidden_help"));
|
||||
crate::scenario::publish_target("prefs:select_other_hidden", hidden.rect);
|
||||
let click = app.tr("prefs.click");
|
||||
let shift = app.tr("prefs.shift");
|
||||
let ctrl = app.tr("prefs.ctrl_cmd");
|
||||
let one = app.tr("prefs.select_one_item");
|
||||
let toggle = app.tr("prefs.toggle_item");
|
||||
let add = app.tr("prefs.add_item");
|
||||
ui_kit::settings_bindings(
|
||||
ui,
|
||||
&[(&[click], one), (&[shift, click], if app.preferences.selection_shift_add_only { add } else { toggle }), (&[ctrl, click], toggle)],
|
||||
);
|
||||
ui_kit::checkbox(ui, app.tr("prefs.shift_add_ctrl_toggle"), &mut app.preferences.selection_shift_add_only)
|
||||
.on_hover_text(crate::i18n::tr_label("On: Shift adds items, Ctrl/Cmd toggles. Off (default): Shift and Ctrl/Cmd both toggle."));
|
||||
ui_kit::text(ui, app.tr("prefs.shift_add_note"), ui_kit::Text::Hint("selection_modifiers"));
|
||||
});
|
||||
}
|
||||
|
||||
fn drawing(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
ui_kit::settings_section(ui, "drawing", app.tr("prefs.sketch.drawing"), |ui| {
|
||||
let left_labels = [
|
||||
"prefs.line_drag_draws_one",
|
||||
"prefs.line_hover_tangent_arc",
|
||||
"prefs.sketch.center_arc",
|
||||
"prefs.sketch_construction_lines",
|
||||
"prefs.sketch.auto_dimensions",
|
||||
"prefs.sketch.auto_locate",
|
||||
];
|
||||
let right_labels =
|
||||
["prefs.sketch.shortcut_cycles_modes", "prefs.ribbon_click_ends_tool", "ui.project_face_edges_sketch", "prefs.sketch.project_options"];
|
||||
let natural = [left_labels.as_slice(), right_labels.as_slice()]
|
||||
.map(|labels| labels.iter().map(|id| check_width(ui, app.tr(id), true)).fold(0.0, f32::max));
|
||||
let available = ui.available_width();
|
||||
let gap = t.space_24 + t.space_8;
|
||||
let two_columns = available >= t.space_24 * 20.0 + gap && !crate::prefs_search::suppress_chrome(ui);
|
||||
let left = if two_columns { (available - gap) * natural[0] / (natural[0] + natural[1]).max(1.0) } else { available };
|
||||
let right = if two_columns { available - gap - left } else { available };
|
||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::Min).with_main_wrap(true), |ui| {
|
||||
ui.spacing_mut().item_spacing.x = gap;
|
||||
ui.allocate_ui_with_layout(egui::vec2(left, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
check(
|
||||
ui,
|
||||
"line_drag_draws_one",
|
||||
"prefs.line_drag_draws_one",
|
||||
Some("prefs.line_drag_draws_one_note"),
|
||||
&mut app.preferences.line_drag_draws_one,
|
||||
);
|
||||
check(
|
||||
ui,
|
||||
"line_hover_tangent_arc",
|
||||
"prefs.line_hover_tangent_arc",
|
||||
Some("prefs.line_hover_tangent_arc_note"),
|
||||
&mut app.preferences.line_hover_tangent_arc,
|
||||
);
|
||||
check(
|
||||
ui,
|
||||
"center_arc_follows_cursor",
|
||||
"prefs.sketch.center_arc",
|
||||
Some("ui.center_arc_follows_cursor_tip"),
|
||||
&mut app.preferences.center_arc_follows_cursor,
|
||||
);
|
||||
check(ui, "sketch_construction_lines", "prefs.sketch_construction_lines", None, &mut app.preferences.sketch_construction_lines);
|
||||
check(
|
||||
ui,
|
||||
"sketch_auto_dimensions",
|
||||
"prefs.sketch.auto_dimensions",
|
||||
Some("prefs.sketch.auto_dimensions_note"),
|
||||
&mut app.preferences.sketch_auto_dimensions,
|
||||
);
|
||||
ui.add_enabled_ui(app.preferences.sketch_auto_dimensions, |ui| {
|
||||
check(
|
||||
ui,
|
||||
"sketch_auto_locate",
|
||||
"prefs.sketch.auto_locate",
|
||||
Some("prefs.sketch.auto_locate_note"),
|
||||
&mut app.preferences.sketch_auto_locate,
|
||||
);
|
||||
});
|
||||
});
|
||||
ui.allocate_ui_with_layout(egui::vec2(right, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
check(
|
||||
ui,
|
||||
"shortcut_cycles_modes",
|
||||
"prefs.sketch.shortcut_cycles_modes",
|
||||
Some("prefs.sketch.shortcut_cycles_modes_tip"),
|
||||
&mut app.preferences.shortcut_cycles_modes,
|
||||
);
|
||||
check(
|
||||
ui,
|
||||
"ribbon_click_ends_tool",
|
||||
"prefs.ribbon_click_ends_tool",
|
||||
Some("prefs.ribbon_click_ends_tool_note"),
|
||||
&mut app.preferences.ribbon_click_ends_tool,
|
||||
);
|
||||
let mut auto = app.session.auto_project;
|
||||
if check(ui, "auto_project", "ui.project_face_edges_sketch", None, &mut auto).changed() {
|
||||
let _ = app.run("sketch.auto_project", json!({"value": auto}));
|
||||
}
|
||||
check(
|
||||
ui,
|
||||
"project_options_dialog",
|
||||
"prefs.sketch.project_options",
|
||||
Some("prefs.project_options_dialog_note"),
|
||||
&mut app.preferences.project_options_dialog,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn opening(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
ui_kit::settings_section(ui, "opening_closing", app.tr("prefs.sketch.opening_closing"), |ui| {
|
||||
check(
|
||||
ui,
|
||||
"sketch_face_activates_part",
|
||||
"prefs.sketch_face_activates_part",
|
||||
Some("prefs.sketch_face_activates_part_note"),
|
||||
&mut app.preferences.sketch_face_activates_part,
|
||||
);
|
||||
check(
|
||||
ui,
|
||||
"sketch_open_look_at",
|
||||
"prefs.sketch_open_look_at",
|
||||
Some("prefs.sketch_open_look_at_note"),
|
||||
&mut app.preferences.sketch_open_look_at,
|
||||
);
|
||||
picture_group(ui, app.tr("prefs.sketch_exit_view"), |ui| {
|
||||
let label = app.tr("prefs.sketch_exit_view");
|
||||
let mut indexed = crate::prefs_search::texts_hit(ui, &[label]);
|
||||
if !crate::prefs_search::suppress_chrome(ui) {
|
||||
ui_kit::section_heading(ui, label);
|
||||
}
|
||||
let cards = ui.horizontal_wrapped(|ui| {
|
||||
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
|
||||
let width = (t.space_24 * 8.0 + t.space_4).min(ui.max_rect().width());
|
||||
for (choice, key, label_id, sub, figure) in [
|
||||
(
|
||||
SketchExitView::Previous,
|
||||
"previous",
|
||||
"prefs.sketch.exit_previous",
|
||||
"",
|
||||
ui_kit::paint_sketch_exit_previous as fn(&egui::Painter, egui::Rect),
|
||||
),
|
||||
(SketchExitView::Keep, "keep", "prefs.sketch.exit_keep", app.tr("prefs.default"), ui_kit::paint_sketch_exit_keep),
|
||||
(
|
||||
SketchExitView::UnlessRotated,
|
||||
"unless_rotated",
|
||||
"prefs.sketch.exit_unless_rotated",
|
||||
app.tr("prefs.sketch.unless_turned_note"),
|
||||
ui_kit::paint_sketch_exit_unless_turned,
|
||||
),
|
||||
] {
|
||||
let response = ui_kit::picture_card(
|
||||
ui,
|
||||
&ui_kit::Card {
|
||||
label: app.tr(label_id),
|
||||
sub: Some(sub),
|
||||
selected: app.preferences.sketch_exit_view == choice,
|
||||
enabled: true,
|
||||
options: None,
|
||||
check: false,
|
||||
aspect: 120.0 / 64.0,
|
||||
figure: &figure,
|
||||
},
|
||||
width,
|
||||
)
|
||||
.on_hover_text(app.tr("prefs.sketch_exit_view_note"));
|
||||
crate::scenario::publish_target(&format!("prefs:sketch_exit_view:{key}"), response.rect);
|
||||
crate::scenario::publish_target(&format!("dialog:list:{}", choice.label_id()), response.rect);
|
||||
if app.preferences.sketch_exit_view == choice {
|
||||
crate::scenario::publish_target("prefs:sketch_exit_view", response.rect);
|
||||
crate::scenario::publish_target("dialog:When a sketch ends", response.rect);
|
||||
}
|
||||
let option = app.tr(label_id);
|
||||
if !indexed && crate::prefs_search::texts_hit(ui, &[option]) {
|
||||
crate::prefs_search::remember(ui, option, response.rect);
|
||||
indexed = true;
|
||||
}
|
||||
crate::prefs_search::follow(ui, option, response.rect);
|
||||
if response.clicked() {
|
||||
app.preferences.sketch_exit_view = choice;
|
||||
}
|
||||
}
|
||||
});
|
||||
crate::scenario::publish_rect("prefs:sketch_exit_view:choices", cards.response.rect);
|
||||
crate::prefs_search::remember(ui, label, cards.response.rect);
|
||||
crate::prefs_search::follow(ui, label, cards.response.rect);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn marks(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
ui_kit::settings_section(ui, "marks", app.tr("prefs.sketch.marks"), |ui| {
|
||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::Min).with_main_wrap(true), |ui| {
|
||||
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
|
||||
let available = ui.available_width();
|
||||
let gap = ui.spacing().item_spacing.x;
|
||||
let nominal = t.space_24 * 8.0 + t.space_16;
|
||||
let fitted = (available - gap * 2.0) / 3.0;
|
||||
let width = if fitted >= nominal { fitted } else { nominal.min(available) };
|
||||
// Round down to whole device pixels so three borders fit along with both gaps.
|
||||
let ppp = ui.ctx().pixels_per_point().max(0.5);
|
||||
let width = (width.max(0.0) * ppp).floor() / ppp;
|
||||
for (key, label, help, value, figure) in [
|
||||
(
|
||||
"sketch_state_icons",
|
||||
"prefs.sketch.state_icons",
|
||||
"prefs.sketch_state_icons_note",
|
||||
&mut app.preferences.sketch_state_icons,
|
||||
ui_kit::paint_sketch_state_icons as fn(&egui::Painter, egui::Rect),
|
||||
),
|
||||
(
|
||||
"sketch_conflict_colour",
|
||||
"prefs.sketch.conflict_colour",
|
||||
"prefs.sketch_conflict_colour_note",
|
||||
&mut app.preferences.sketch_conflict_colour,
|
||||
ui_kit::paint_sketch_conflict,
|
||||
),
|
||||
(
|
||||
"hide_constraint_glyphs_zoomed_out",
|
||||
"prefs.sketch.hide_glyphs",
|
||||
"prefs.hide_constraint_glyphs_zoomed_out_note",
|
||||
&mut app.preferences.hide_constraint_glyphs_zoomed_out,
|
||||
ui_kit::paint_sketch_hide_glyphs,
|
||||
),
|
||||
] {
|
||||
let response = ui_kit::toggle_tile(
|
||||
ui,
|
||||
&ui_kit::Card {
|
||||
label: crate::i18n::tr(label),
|
||||
sub: None,
|
||||
selected: *value,
|
||||
enabled: true,
|
||||
options: None,
|
||||
check: false,
|
||||
aspect: 120.0 / 64.0,
|
||||
figure: &figure,
|
||||
},
|
||||
width,
|
||||
)
|
||||
.on_hover_text(crate::i18n::tr(help));
|
||||
targets(key, &response);
|
||||
if response.clicked() {
|
||||
*value = !*value;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
fn selecting(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
ui_kit::settings_section(ui, "selection", app.tr("prefs.selecting"), |ui| {
|
||||
picture_group(ui, app.tr("prefs.sketch.click_selects"), |ui| {
|
||||
let label = app.tr("prefs.sketch.click_selects");
|
||||
let mut indexed = crate::prefs_search::texts_hit(ui, &[label]);
|
||||
if !crate::prefs_search::suppress_chrome(ui) {
|
||||
ui_kit::section_heading(ui, label);
|
||||
}
|
||||
let cards = ui.horizontal_wrapped(|ui| {
|
||||
ui.spacing_mut().item_spacing = egui::vec2(t.space_10, t.space_10);
|
||||
let width = (t.space_24 * 6.0 + t.space_6).min(ui.max_rect().width());
|
||||
for (bodies, key, label, figure) in [
|
||||
(false, "faces_edges", "prefs.sketch.faces_edges", ui_kit::paint_select_faces_edges as fn(&egui::Painter, egui::Rect)),
|
||||
(true, "bodies", "prefs.sketch.whole_bodies", ui_kit::paint_select_bodies),
|
||||
] {
|
||||
let response = ui_kit::picture_card(
|
||||
ui,
|
||||
&ui_kit::Card {
|
||||
label: app.tr(label),
|
||||
sub: None,
|
||||
selected: app.ui.pick_bodies == bodies,
|
||||
enabled: true,
|
||||
options: None,
|
||||
check: false,
|
||||
aspect: 120.0 / 64.0,
|
||||
figure: &figure,
|
||||
},
|
||||
width,
|
||||
);
|
||||
crate::scenario::publish_target(&format!("prefs:pick_bodies:{key}"), response.rect);
|
||||
if bodies {
|
||||
crate::scenario::publish_target("prefs:pick_bodies", response.rect);
|
||||
crate::scenario::publish_target("dialog:Click selects whole bodies", response.rect);
|
||||
}
|
||||
let option = app.tr(label);
|
||||
if !indexed && crate::prefs_search::texts_hit(ui, &[option]) {
|
||||
crate::prefs_search::remember(ui, option, response.rect);
|
||||
indexed = true;
|
||||
}
|
||||
crate::prefs_search::follow(ui, option, response.rect);
|
||||
if response.clicked() {
|
||||
app.ui.pick_bodies = bodies;
|
||||
}
|
||||
}
|
||||
});
|
||||
crate::scenario::publish_rect("prefs:pick_bodies:choices", cards.response.rect);
|
||||
crate::prefs_search::remember(ui, label, cards.response.rect);
|
||||
crate::prefs_search::follow(ui, label, cards.response.rect);
|
||||
});
|
||||
check(
|
||||
ui,
|
||||
"selection_shift_add_only",
|
||||
"prefs.shift_add_ctrl_toggle",
|
||||
Some("ui.selection_shift_add_only_tip"),
|
||||
&mut app.preferences.selection_shift_add_only,
|
||||
);
|
||||
// Draw after the checkbox so the Shift legend reflects this frame's change.
|
||||
let click = app.tr("prefs.click");
|
||||
let shift = app.tr("prefs.shift");
|
||||
let ctrl = crate::tool_modifiers::ctrl_name_for(crate::tool_modifiers::Platform::of(ui.ctx()));
|
||||
let toggle = app.tr("prefs.toggle_item");
|
||||
ui_kit::settings_bindings(
|
||||
ui,
|
||||
&[
|
||||
(&[click], app.tr("prefs.select_one_item")),
|
||||
(&[shift, click], if app.preferences.selection_shift_add_only { app.tr("prefs.add_item") } else { toggle }),
|
||||
(&[ctrl, click], toggle),
|
||||
],
|
||||
);
|
||||
check(ui, "prefer_free_sketch_points", "prefs.sketch.prefer_free_points", None, &mut app.preferences.prefer_free_sketch_points);
|
||||
check(
|
||||
ui,
|
||||
"select_other_hidden",
|
||||
"prefs.sketch.select_other_hidden",
|
||||
Some("prefs.select_other_hidden_help"),
|
||||
&mut app.preferences.select_other_hidden,
|
||||
);
|
||||
check(
|
||||
ui,
|
||||
"manipulator_free_alt",
|
||||
"prefs.alt_frees_manipulators",
|
||||
Some("ui.manipulator_free_alt_tip"),
|
||||
&mut app.preferences.manipulator_free_alt,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// Natural-height picture groups own their search entries without allocating a form label column.
|
||||
fn picture_group(ui: &mut egui::Ui, label: &str, add: impl FnOnce(&mut egui::Ui)) {
|
||||
let gate = crate::prefs_search::block_gate(ui, label, None);
|
||||
let before = crate::prefs_search::hits(ui);
|
||||
let show = gate.as_ref().is_none_or(|gate| gate.show);
|
||||
let content = |ui: &mut egui::Ui| {
|
||||
let group = ui.scope(|ui| ui_kit::named_control(ui, label, add));
|
||||
crate::scenario::publish_rect(&format!("dialog:row:{label}"), group.response.rect);
|
||||
};
|
||||
if show {
|
||||
content(ui);
|
||||
} else {
|
||||
crate::prefs_search::run_hidden(ui, label, content);
|
||||
}
|
||||
if let Some(gate) = &gate {
|
||||
crate::prefs_search::block_finish(ui, gate, show, before);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_width(ui: &egui::Ui, label: &str, help: bool) -> f32 {
|
||||
let t = Tokens::get();
|
||||
ui_kit::ContentWidth::label(ui, label) + t.space_14 + t.space_6 + if help { t.space_8 + t.space_12 + 1.0 } else { 0.0 }
|
||||
}
|
||||
|
||||
/// Standard checkbox, its hover help, and its existing field target.
|
||||
fn check(ui: &mut egui::Ui, key: &str, label: &str, help: Option<&str>, value: &mut bool) -> egui::Response {
|
||||
let help = help.map(crate::i18n::tr);
|
||||
ui.horizontal_top(|ui| {
|
||||
let t = Tokens::get();
|
||||
let show_help = help.is_some() && !crate::prefs_search::suppress_chrome(ui);
|
||||
let width = (ui.available_width() - if show_help { t.space_8 + t.space_12 + 1.0 } else { 0.0 }).max(0.0).min(check_width(
|
||||
ui,
|
||||
crate::i18n::tr(label),
|
||||
false,
|
||||
));
|
||||
ui.spacing_mut().item_spacing.x = t.space_8;
|
||||
let response = ui
|
||||
.allocate_ui_with_layout(egui::vec2(width, 0.0), egui::Layout::top_down(egui::Align::Min), |ui| {
|
||||
ui_kit::checkbox(ui, crate::i18n::tr(label), value)
|
||||
})
|
||||
.inner;
|
||||
targets(key, &response);
|
||||
if let Some(help) = help {
|
||||
if show_help && response.rect.is_positive() {
|
||||
ui_kit::help_icon(ui, help);
|
||||
}
|
||||
response.on_hover_text(help)
|
||||
} else {
|
||||
response
|
||||
}
|
||||
})
|
||||
.inner
|
||||
}
|
||||
|
||||
fn targets(key: &str, response: &egui::Response) {
|
||||
crate::scenario::publish_target(&format!("prefs:{key}"), response.rect);
|
||||
let legacy = match key {
|
||||
"sketch_tracking_guides" => "Center and midpoint alignment guides",
|
||||
"sketch_tracking_points" => "Alignment guides from end points and corners while drawing",
|
||||
"sketch_recent_snap" => "Auto snap to recent centers and midpoints",
|
||||
"sketch_align_points" => "Line up with other sketch points while drawing",
|
||||
"sketch_auto_dimensions" => "Dimension new shapes",
|
||||
"sketch_auto_locate" => "Also place them from the origin (fully constrained)",
|
||||
"center_arc_follows_cursor" => "Center point arc follows the cursor's direction",
|
||||
"shortcut_cycles_modes" => "Pressing a tool's shortcut again switches its mode",
|
||||
"project_options_dialog" => "Project options dialog",
|
||||
"sketch_state_icons" => "Sketch icons in the color of their state",
|
||||
"sketch_conflict_colour" => "Conflicting geometry in the conflict color",
|
||||
"hide_constraint_glyphs_zoomed_out" => "Hide constraint glyphs when zoomed out",
|
||||
"prefer_free_sketch_points" => "Prefer movable sketch points when points overlap",
|
||||
"select_other_hidden" => "Select hidden geometry with Select Other",
|
||||
_ => return,
|
||||
};
|
||||
crate::scenario::publish_target(&format!("dialog:{legacy}"), response.rect);
|
||||
}
|
||||
|
||||
@@ -572,6 +572,34 @@ pub(crate) fn matches_text(query: &str, texts: &[&str]) -> bool {
|
||||
|
||||
/// Words that find a setting even though they are not written on it.
|
||||
fn keywords(text: &str) -> &'static [&'static str] {
|
||||
let sketch: &'static [&'static str] = match fold(text).as_str() {
|
||||
"center and midpoint guides" | "centre and midpoint guides" => {
|
||||
&["center and midpoint alignment guides", "centre and midpoint alignment guides"]
|
||||
}
|
||||
"guides from sketch points too" => &["alignment guides from end points and corners while drawing"],
|
||||
"snap to where two guides cross" => &["auto snap to recent centers and midpoints", "auto snap to recent centres and midpoints"],
|
||||
"line up with other sketch points" => &["line up with other sketch points while drawing"],
|
||||
"center-point arc follows the cursor" | "centre-point arc follows the cursor" => {
|
||||
&["center point arc follows the cursor's direction", "centre point arc follows the cursor's direction"]
|
||||
}
|
||||
"dimension new shapes fully" => &["dimension new shapes"],
|
||||
"place from the sketch origin" => &["also place them from the origin (fully constrained)"],
|
||||
"shortcut again switches mode" => &["pressing a tool's shortcut again switches its mode"],
|
||||
"ask for project options first" => &["project options dialog"],
|
||||
"return to the view before" => &["return to the previous view"],
|
||||
"keep" => &["keep the current view"],
|
||||
"unless turned" => &["return unless rotated"],
|
||||
"state icons" => &["sketch icons in the color of their state", "sketch icons in the colour of their state"],
|
||||
"conflict color" | "conflict colour" => &["conflicting geometry in the conflict color", "conflicting geometry in the conflict colour"],
|
||||
"hide glyphs zoomed out" => &["hide constraint glyphs when zoomed out"],
|
||||
"prefer movable points where they overlap" => &["prefer movable sketch points when points overlap"],
|
||||
"select other reaches hidden geometry" => &["select hidden geometry with select other"],
|
||||
"whole bodies" => &["click selects whole bodies"],
|
||||
_ => &[],
|
||||
};
|
||||
if !sketch.is_empty() {
|
||||
return sketch;
|
||||
}
|
||||
match fold(text).as_str() {
|
||||
"design" => &["design defaults"],
|
||||
"step values with arrows and wheel" => &["step values with the arrow keys and the wheel"],
|
||||
@@ -1203,6 +1231,87 @@ mod tests {
|
||||
assert_eq!(h.app.prefs_window.section, crate::prefs::PAGE_GRAPHICS, "Escape returns to the page from before the search");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sketch_picture_groups_and_options_have_one_real_search_hit_and_enter_reveals_the_cards() {
|
||||
for theme in ["light", "dark"] {
|
||||
let mut h = crate::scenario::Harness::new();
|
||||
h.app.home.open = false;
|
||||
h.call("ui.resize", serde_json::json!({"width":1600,"height":1100}));
|
||||
h.call("ui.prefs", serde_json::json!({"language":"en","theme":theme}));
|
||||
let original = (h.app.preferences.sketch_exit_view, h.app.ui.pick_bodies);
|
||||
for (query, target, option) in [
|
||||
("When a sketch ends", "prefs:sketch_exit_view:choices", "Keep"),
|
||||
("Return to the view before", "prefs:sketch_exit_view:previous", "Return to the view before"),
|
||||
("Keep", "prefs:sketch_exit_view:keep", "Keep"),
|
||||
("Unless turned", "prefs:sketch_exit_view:unless_rotated", "Unless turned"),
|
||||
("Click selects", "prefs:pick_bodies:choices", "Whole bodies"),
|
||||
("Faces and edges", "prefs:pick_bodies:faces_edges", "Faces and edges"),
|
||||
("Whole bodies", "prefs:pick_bodies:bodies", "Whole bodies"),
|
||||
] {
|
||||
h.call("ui.prefs", serde_json::json!({"open":"General"}));
|
||||
h.app.prefs_window.filter = query.into();
|
||||
h.frames(5);
|
||||
let (_, _, hits) = nav(&h.ctx);
|
||||
let matching: Vec<_> = hits.iter().enumerate().filter(|(_, hit)| hit.page == crate::prefs::PAGE_SKETCH).collect();
|
||||
assert_eq!(matching.len(), 1, "{theme}: {query} has exactly one real Sketch setting hit");
|
||||
assert_eq!(matching[0].1.label, query);
|
||||
let tree = h.output.accesskit_update.as_ref().unwrap();
|
||||
assert!(
|
||||
tree.nodes.iter().any(|(_, node)| {
|
||||
node.role() == egui::accesskit::Role::RadioButton && node.label() == Some(option) && !node.is_disabled()
|
||||
}),
|
||||
"{query} exposes the enabled native card"
|
||||
);
|
||||
set_cursor(&h.ctx, matching[0].0);
|
||||
h.frames(2);
|
||||
h.step(&serde_json::json!({"key":"Enter"})).unwrap();
|
||||
// Enter restores the full page; allow its scroll animation to settle.
|
||||
h.frames(20);
|
||||
assert_eq!(h.app.prefs_window.section, crate::prefs::PAGE_SKETCH);
|
||||
assert!(h.app.prefs_window.filter.is_empty());
|
||||
let body = crate::scenario::rect_of("dialog:page_body").unwrap();
|
||||
let actual = crate::scenario::rect_of(target).unwrap();
|
||||
let revealed = crate::scenario::handle_at("prefs:revealed").expect("Enter publishes an actual reveal target");
|
||||
assert!(body.contains_rect(actual), "{theme}: {query} reveals the actual cards inside the body");
|
||||
assert!(revealed.distance(actual.center()) <= 1.0, "{theme}: {query} outlines its real group/card");
|
||||
if target.ends_with(":choices") {
|
||||
let group = crate::scenario::rect_of(&format!("dialog:row:{query}")).unwrap();
|
||||
assert!((actual.left() - group.left()).abs() <= 1.0, "{theme}: {query} has no phantom label column beside its cards");
|
||||
}
|
||||
assert_eq!((h.app.preferences.sketch_exit_view, h.app.ui.pick_bodies), original, "navigation does not change a choice");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sketch_short_labels_keep_the_legacy_search_terms_in_every_complete_locale() {
|
||||
let cases = [
|
||||
("prefs.sketch.tracking_guides", "Center and midpoint alignment guides"),
|
||||
("prefs.sketch.tracking_points", "Alignment guides from end points and corners while drawing"),
|
||||
("prefs.sketch.recent_snap", "Auto snap to recent centers and midpoints"),
|
||||
("prefs.sketch.align_points", "Line up with other sketch points while drawing"),
|
||||
("prefs.sketch.center_arc", "Center point arc follows the cursor's direction"),
|
||||
("prefs.sketch.auto_locate", "Also place them from the origin (fully constrained)"),
|
||||
("prefs.sketch.shortcut_cycles_modes", "Pressing a tool's shortcut again switches its mode"),
|
||||
("prefs.sketch.project_options", "Project options dialog"),
|
||||
("prefs.sketch.exit_previous", "Return to the previous view"),
|
||||
("prefs.sketch.exit_keep", "Keep the current view"),
|
||||
("prefs.sketch.exit_unless_rotated", "Return unless rotated"),
|
||||
("prefs.sketch.state_icons", "Sketch icons in the color of their state"),
|
||||
("prefs.sketch.conflict_colour", "Conflicting geometry in the conflict color"),
|
||||
("prefs.sketch.hide_glyphs", "Hide constraint glyphs when zoomed out"),
|
||||
("prefs.sketch.prefer_free_points", "Prefer movable sketch points when points overlap"),
|
||||
("prefs.sketch.select_other_hidden", "Select hidden geometry with Select Other"),
|
||||
("prefs.sketch.whole_bodies", "Click selects whole bodies"),
|
||||
];
|
||||
for lang in ["en", "en-GB", "ar", "de", "he", "ja", "ko", "vi", "zh"] {
|
||||
let _language = crate::i18n::scope(lang);
|
||||
for (id, legacy) in cases {
|
||||
assert!(matches_text(legacy, &[crate::i18n::tr(id)]), "{lang}: {legacy} still finds {id}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Typing in a number field (the largest STEP file) edits that field instead of starting
|
||||
/// a search.
|
||||
#[test]
|
||||
|
||||
@@ -64,8 +64,13 @@ pub(crate) fn checkbox_indeterminate(ui: &mut Ui, label: &str, value: &mut bool,
|
||||
}
|
||||
let t = Tokens::get();
|
||||
let font = egui::FontId::proportional(t.font_label);
|
||||
let galley = ui.painter().layout_no_wrap(label.to_owned(), font.clone(), t.form_ink);
|
||||
let gap = if label.is_empty() { 0.0 } else { t.space_6 };
|
||||
let wrap = ui.style().wrap_mode == Some(egui::TextWrapMode::Wrap);
|
||||
let galley = if wrap {
|
||||
ui.painter().layout(label.to_owned(), font.clone(), t.form_ink, (ui.available_width() - t.space_14 - gap).max(0.0))
|
||||
} else {
|
||||
ui.painter().layout_no_wrap(label.to_owned(), font.clone(), t.form_ink)
|
||||
};
|
||||
let width = (t.space_14 + gap + galley.size().x).max(ui.spacing().interact_size.y).min(super::metrics::dimension(ui.available_width()));
|
||||
let height = ui.spacing().interact_size.y.max(t.space_14).max(galley.size().y);
|
||||
let (rect, mut response) = ui.allocate_exact_size(vec2(width, height), egui::Sense::click());
|
||||
@@ -78,7 +83,13 @@ pub(crate) fn checkbox_indeterminate(ui: &mut Ui, label: &str, value: &mut bool,
|
||||
let square = box_at(ui, pos2(rect.left() + t.space_14 / 2.0, rect.center().y));
|
||||
paint_box(ui, square, &response, *value, mixed && !response.changed());
|
||||
let text_rect = Rect::from_min_max(pos2((square.right() + gap).min(rect.right()), rect.top()), rect.max);
|
||||
super::text::paint_text(ui, text_rect, label, font, t.form_ink, false);
|
||||
if wrap {
|
||||
let ppp = ui.ctx().pixels_per_point().max(0.5);
|
||||
let at = pos2((text_rect.left() * ppp).round() / ppp, ((text_rect.center().y - galley.size().y / 2.0) * ppp).round() / ppp);
|
||||
ui.painter().with_clip_rect(ui.clip_rect().intersect(text_rect)).galley(at, galley, t.form_ink);
|
||||
} else {
|
||||
super::text::paint_text(ui, text_rect, label, font, t.form_ink, false);
|
||||
}
|
||||
response.widget_info(|| {
|
||||
let accessible = if label.is_empty() { crate::i18n::tr_label(super::row_label(ui)) } else { label };
|
||||
let mut info = egui::WidgetInfo::selected(egui::WidgetType::Checkbox, ui.is_enabled(), *value, accessible);
|
||||
|
||||
@@ -42,6 +42,31 @@ fn checkbox_keyboard_pointer_disabled_and_mixed() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wrapped_checkbox_keeps_full_label_and_clicks_on_its_last_line() {
|
||||
for enabled in [false, true] {
|
||||
let ctx = crate::fonts::test_context();
|
||||
let label = "A long translated checkbox label remains readable and clickable on its final line";
|
||||
let target = std::cell::Cell::new(Rect::NOTHING);
|
||||
let mut value = false;
|
||||
let mut draw = |ui: &mut Ui| {
|
||||
ui.set_width(180.0);
|
||||
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);
|
||||
ui.add_enabled_ui(enabled, |ui| {
|
||||
target.set(checkbox(ui, label, &mut value).rect);
|
||||
});
|
||||
};
|
||||
frame(&ctx, vec![], &mut draw);
|
||||
let rect = target.get();
|
||||
assert!(rect.height() > Tokens::get().control_height);
|
||||
assert!(rect.width() <= 180.0);
|
||||
let at = rect.left_bottom() + vec2(Tokens::get().space_24, -2.0);
|
||||
frame(&ctx, pointer(at, true), &mut draw);
|
||||
frame(&ctx, pointer(at, false), &mut draw);
|
||||
assert_eq!(value, enabled, "a wrapped checkbox preserves native disabled and click behavior");
|
||||
}
|
||||
}
|
||||
|
||||
fn checkbox_shapes(output: &egui::FullOutput) -> Vec<(Rect, Vec<egui::epaint::ClippedShape>)> {
|
||||
let t = Tokens::get();
|
||||
output
|
||||
|
||||
@@ -1745,6 +1745,13 @@ const ELEMENTS: &[Element] = &[
|
||||
element!("checkbox_off", |ui, _| {
|
||||
checkbox(ui, "Option", &mut false);
|
||||
}),
|
||||
element!("checkbox_wrapped", |ui, s| {
|
||||
ui.scope(|ui| {
|
||||
ui.set_width(Tokens::get().space_24 * 8.0);
|
||||
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Wrap);
|
||||
checkbox(ui, "A long translated checkbox label stays readable on several lines", &mut s.checked);
|
||||
});
|
||||
}),
|
||||
element!("checkbox_disabled_on", |ui, _| {
|
||||
ui.add_enabled_ui(false, |ui| checkbox(ui, "Option", &mut true));
|
||||
}),
|
||||
|
||||
@@ -562,6 +562,11 @@ pub(crate) fn settings_badge(ui: &mut Ui, text: &str, warning: bool) {
|
||||
ui.painter().galley(r.center() - galley.size() / 2.0, galley, ink);
|
||||
}
|
||||
|
||||
pub(crate) use super::preferences_figure_data::{
|
||||
paint_select_bodies, paint_select_faces_edges, paint_sketch_conflict, paint_sketch_exit_keep, paint_sketch_exit_previous,
|
||||
paint_sketch_exit_unless_turned, paint_sketch_guides, paint_sketch_hide_glyphs, paint_sketch_state_icons,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) enum PreferenceFigure {
|
||||
Pivot(usize),
|
||||
|
||||
@@ -196,12 +196,18 @@ pub(crate) fn settings_chip(ui: &mut Ui, label: &str, chip: SettingsChip<'_>) ->
|
||||
|
||||
/// A labelled form block whose control column can contain several natural-height rows.
|
||||
pub(crate) fn settings_block<R>(ui: &mut Ui, label: &str, label_width: f32, add: impl FnOnce(&mut Ui) -> R) -> R {
|
||||
settings_block_content(ui, label, None, label_width, add)
|
||||
settings_block_hint(ui, label, None, label_width, add)
|
||||
}
|
||||
|
||||
/// A form block whose explanatory hint belongs below its label, beside the controls.
|
||||
pub(crate) fn settings_block_hint<R>(ui: &mut Ui, label: &str, hint: &str, label_width: f32, add: impl FnOnce(&mut Ui) -> R) -> R {
|
||||
settings_block_content(ui, label, Some(hint), label_width, add)
|
||||
pub(crate) fn settings_block_hint<'a, R>(
|
||||
ui: &mut Ui,
|
||||
label: &str,
|
||||
hint: impl Into<Option<&'a str>>,
|
||||
label_width: f32,
|
||||
add: impl FnOnce(&mut Ui) -> R,
|
||||
) -> R {
|
||||
settings_block_content(ui, label, hint.into(), label_width, add)
|
||||
}
|
||||
|
||||
fn settings_block_content<R>(ui: &mut Ui, label: &str, hint: Option<&str>, label_width: f32, add: impl FnOnce(&mut Ui) -> R) -> R {
|
||||
|
||||
@@ -22,11 +22,13 @@ Two columns of checkboxes.
|
||||
| Label | Control | Edits | Default | Hover | Figure | Notes |
|
||||
|---|---|---|---|---|---|---|
|
||||
| Press and drag draws one line | Checkbox | `Prefs.line_drag_draws_one` | `false` | none | none | |
|
||||
| Rest on a line's last point to switch to a tangent arc | Checkbox | `Prefs.line_hover_tangent_arc` | `false` | Existing `prefs.line_hover_tangent_arc_note`: leaving, returning to and resting on the last point toggles line / tangent arc. | none | Retained newer control; immediately after press-and-drag, before centre-point arc. |
|
||||
| Centre-point arc follows the cursor | Checkbox | `Prefs.center_arc_follows_cursor` | `true` | none | none | |
|
||||
| Extended construction line tools | Checkbox | `Prefs.sketch_construction_lines` | `true` | none | none | |
|
||||
| Dimension new shapes fully | Checkbox | `Prefs.sketch_auto_dimensions` | `false` | "Typed values plus every dimension that fixes the shape." | none | |
|
||||
| Place from the sketch origin | Checkbox (dimmed on the board while the one above is off) | `Prefs.sketch_auto_locate` | `false` | "With full dimensions." | none | Dimmed unless "Dimension new shapes fully" is on. |
|
||||
| Shortcut again switches mode | Checkbox | `Prefs.shortcut_cycles_modes` | `false` | "Off: it starts the tool again." | none | |
|
||||
| Clicking the running tool's button ends it | Checkbox | `Prefs.ribbon_click_ends_tool` | `true` | Existing `prefs.ribbon_click_ends_tool_note`: the lit ribbon button ends the tool and restores selection; off restarts it. | none | Retained newer control; immediately after shortcut cycling, before the Project pair. |
|
||||
| Project face edges into new sketches | Checkbox | `app.session.auto_project` (session; in the Snapshot) | per session | none | none | Not a `Prefs` field. |
|
||||
| Ask for Project options first | Checkbox | `Prefs.project_options_dialog` | `true` | none | none | |
|
||||
|
||||
@@ -34,6 +36,7 @@ Two columns of checkboxes.
|
||||
|
||||
| Label | Control | Edits | Default | Hover | Figure | Notes |
|
||||
|---|---|---|---|---|---|---|
|
||||
| Sketching on a part's face makes that part active | Checkbox | `Prefs.sketch_face_activates_part` | `false` | Existing `prefs.sketch_face_activates_part_note`: activate the other component before creating the sketch; it stays active. Off keeps the active component. | none | Retained newer control; first row, immediately before turn-to-face. |
|
||||
| Turn to face a sketch when it opens | Checkbox | `Prefs.sketch_open_look_at` | `true` | none | none | |
|
||||
| When a sketch ends: Return to the view before / Keep (default) / Unless turned (return if not rotated) | Three picture cards (196 x 152.5), a before / sketch / after trio each | `Prefs.sketch_exit_view` (`SketchExitView`: Previous, Keep, UnlessRotated) | Keep | none | `sketch-exit-previous`, `sketch-exit-keep`, `sketch-exit-unless-turned` | Card labels: "Return to the view before" / "Keep" with sub-label "default" / "Unless turned" with sub-label "return if not rotated". The 30x30 panels are nested SVGs inside the figure. |
|
||||
|
||||
@@ -60,6 +63,11 @@ Three toggle tiles (208.8 x 140).
|
||||
|
||||
## Mismatches
|
||||
|
||||
* The three retained newer controls above are absent from the old board. Their placements were
|
||||
accepted in #9881 from source-only recommendations; existing labels, help, defaults, profile
|
||||
membership and behavior remain authoritative. Drawing flows down the first column through
|
||||
origin placement, then down the second from shortcut cycling; dependent pairs stay together.
|
||||
|
||||
* "Hold to stop snapping" default differs between the board sample and the code (see above).
|
||||
* "Project face edges into new sketches" and "Click selects" are session values, not `Prefs`.
|
||||
* `Prefs.sketch_variants` and the hole preset library have no control here (not on any board).
|
||||
|
||||
Reference in New Issue
Block a user