diff --git a/locales/ar-SA/opencadstudio.ftl b/locales/ar-SA/opencadstudio.ftl index d9b145dcb..1dbe460c1 100644 --- a/locales/ar-SA/opencadstudio.ftl +++ b/locales/ar-SA/opencadstudio.ftl @@ -3519,6 +3519,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE حدد نقطة الإدراج: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/bg-BG/opencadstudio.ftl b/locales/bg-BG/opencadstudio.ftl index dbb285280..8c148507c 100644 --- a/locales/bg-BG/opencadstudio.ftl +++ b/locales/bg-BG/opencadstudio.ftl @@ -3506,6 +3506,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Посочи точка на вмъкване: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/cs-CZ/opencadstudio.ftl b/locales/cs-CZ/opencadstudio.ftl index 577daa7f7..46ef39a13 100644 --- a/locales/cs-CZ/opencadstudio.ftl +++ b/locales/cs-CZ/opencadstudio.ftl @@ -3504,6 +3504,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Zadejte bod vložení: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/de-DE/opencadstudio.ftl b/locales/de-DE/opencadstudio.ftl index 179e5ad89..7266a83aa 100644 --- a/locales/de-DE/opencadstudio.ftl +++ b/locales/de-DE/opencadstudio.ftl @@ -3507,6 +3507,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Einführstelle angeben: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/el-GR/opencadstudio.ftl b/locales/el-GR/opencadstudio.ftl index b3c9add94..d49ef8975 100644 --- a/locales/el-GR/opencadstudio.ftl +++ b/locales/el-GR/opencadstudio.ftl @@ -3507,6 +3507,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Ορίστε σημείο εισαγωγής: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/en-US/opencadstudio.ftl b/locales/en-US/opencadstudio.ftl index 109c504f8..45ab2eafd 100644 --- a/locales/en-US/opencadstudio.ftl +++ b/locales/en-US/opencadstudio.ftl @@ -3509,6 +3509,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Specify insertion point: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/es-ES/opencadstudio.ftl b/locales/es-ES/opencadstudio.ftl index 1ac9bbb7c..34939b6e6 100644 --- a/locales/es-ES/opencadstudio.ftl +++ b/locales/es-ES/opencadstudio.ftl @@ -3507,6 +3507,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Especifique el punto de inserción: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/fi-FI/opencadstudio.ftl b/locales/fi-FI/opencadstudio.ftl index e0dbb5dfb..baaa45de4 100644 --- a/locales/fi-FI/opencadstudio.ftl +++ b/locales/fi-FI/opencadstudio.ftl @@ -3506,6 +3506,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Määritä lisäyskohta: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/fr-FR/opencadstudio.ftl b/locales/fr-FR/opencadstudio.ftl index d538ca9e5..0d8413330 100644 --- a/locales/fr-FR/opencadstudio.ftl +++ b/locales/fr-FR/opencadstudio.ftl @@ -3507,6 +3507,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Spécifier le point d'insertion: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/hi-IN/opencadstudio.ftl b/locales/hi-IN/opencadstudio.ftl index 32af12c50..e0ded79c4 100644 --- a/locales/hi-IN/opencadstudio.ftl +++ b/locales/hi-IN/opencadstudio.ftl @@ -3495,6 +3495,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE निर्दिष्ट सम्मिलन बिंदु: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/hu-HU/opencadstudio.ftl b/locales/hu-HU/opencadstudio.ftl index 73628dd4a..f90bb6edf 100644 --- a/locales/hu-HU/opencadstudio.ftl +++ b/locales/hu-HU/opencadstudio.ftl @@ -3506,6 +3506,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Beszúrási pont megadása: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/it-IT/opencadstudio.ftl b/locales/it-IT/opencadstudio.ftl index c92c3f40a..483ba6af2 100644 --- a/locales/it-IT/opencadstudio.ftl +++ b/locales/it-IT/opencadstudio.ftl @@ -3506,6 +3506,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Specificare il punto di inserimento: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/ja-JP/opencadstudio.ftl b/locales/ja-JP/opencadstudio.ftl index 6c46e9cf1..08dfd6fbd 100644 --- a/locales/ja-JP/opencadstudio.ftl +++ b/locales/ja-JP/opencadstudio.ftl @@ -3497,6 +3497,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE 挿入点を指定: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/ko-KR/opencadstudio.ftl b/locales/ko-KR/opencadstudio.ftl index ee36b001b..9649ec59d 100644 --- a/locales/ko-KR/opencadstudio.ftl +++ b/locales/ko-KR/opencadstudio.ftl @@ -3506,6 +3506,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE 삽입점 지정: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/nl-NL/opencadstudio.ftl b/locales/nl-NL/opencadstudio.ftl index f162e7301..81f77982d 100644 --- a/locales/nl-NL/opencadstudio.ftl +++ b/locales/nl-NL/opencadstudio.ftl @@ -3505,6 +3505,12 @@ annotate = .dimradius-select-arc-circle-or-polyline-arc = DIMRADIUS Selecteer een boog, cirkel of polylijnboog: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/pl-PL/opencadstudio.ftl b/locales/pl-PL/opencadstudio.ftl index 1937bc168..6f7a24ef2 100644 --- a/locales/pl-PL/opencadstudio.ftl +++ b/locales/pl-PL/opencadstudio.ftl @@ -3506,6 +3506,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Określ punkt wstawienia: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/pt-BR/opencadstudio.ftl b/locales/pt-BR/opencadstudio.ftl index 7612ea5f1..110ad6b1e 100644 --- a/locales/pt-BR/opencadstudio.ftl +++ b/locales/pt-BR/opencadstudio.ftl @@ -3507,6 +3507,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Especifique o ponto de inserção: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/ru-RU/opencadstudio.ftl b/locales/ru-RU/opencadstudio.ftl index ab6a4a674..af0989f15 100644 --- a/locales/ru-RU/opencadstudio.ftl +++ b/locales/ru-RU/opencadstudio.ftl @@ -3508,6 +3508,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Укажите точку вставки: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/tr-TR/opencadstudio.ftl b/locales/tr-TR/opencadstudio.ftl index 42c37f657..b27e2be49 100644 --- a/locales/tr-TR/opencadstudio.ftl +++ b/locales/tr-TR/opencadstudio.ftl @@ -3481,6 +3481,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE Ekleme noktasını belirtin: insert = + .refui-requires-int-90 = -90 ile 90 arasında bir tam sayı gerekir. + .refui-xref-fading = Xref soldurma + .refui-edit-reference = Referansı Düzenle + .refui-snap-to-underlays-off = Altlıklara Yakala Kapalı + .refui-snap-to-underlays-on = Altlıklara Yakala Açık + .refui-snap-to-underlays = Altlıklara Yakala .xref-attach-dialog-title = Harici Referans Ekle .xref-attach-browse = Gözat... .xref-attach-reference-type = Referans Türü diff --git a/locales/zh-CN/opencadstudio.ftl b/locales/zh-CN/opencadstudio.ftl index 1dccd7669..096727d8d 100644 --- a/locales/zh-CN/opencadstudio.ftl +++ b/locales/zh-CN/opencadstudio.ftl @@ -3494,6 +3494,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE 指定插入点: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/locales/zh-TW/opencadstudio.ftl b/locales/zh-TW/opencadstudio.ftl index 8edf0dacf..9c2a847c9 100644 --- a/locales/zh-TW/opencadstudio.ftl +++ b/locales/zh-TW/opencadstudio.ftl @@ -3506,6 +3506,12 @@ annotate = .tolerance-specify-insertion-point = TOLERANCE 指定插入點: insert = + .refui-requires-int-90 = Requires an integer between -90 and 90. + .refui-xref-fading = Xref fading + .refui-edit-reference = Edit Reference + .refui-snap-to-underlays-off = Snap to Underlays OFF + .refui-snap-to-underlays-on = Snap to Underlays ON + .refui-snap-to-underlays = Snap to Underlays .xref-attach-dialog-title = Attach External Reference .xref-attach-browse = Browse... .xref-attach-reference-type = Reference Type diff --git a/src/app/commands/mod.rs b/src/app/commands/mod.rs index 6fb283b99..dc819cf25 100644 --- a/src/app/commands/mod.rs +++ b/src/app/commands/mod.rs @@ -610,12 +610,15 @@ inventory::submit!(crate::command::CommandRegistration { "FRAME", "IMAGEFRAME", "PDFFRAME", + "XDWGFADECTL", "POINTCLOUDCLIPFRAME", "XCLIPFRAME", "WIPEOUTFRAME", "FRAMES0", "FRAMES1", "FRAMES2", + "UOSNAP0", + "UOSNAP1", "HALOGAP", "TRACEWID", "SKETCHINC", diff --git a/src/app/commands/styleprops.rs b/src/app/commands/styleprops.rs index d185c40f4..ab421feb2 100644 --- a/src/app/commands/styleprops.rs +++ b/src/app/commands/styleprops.rs @@ -10,6 +10,8 @@ impl OpenCADStudio { "FRAMES0" => return self.dispatch_styleprops("SETVAR FRAME 0", i), "FRAMES1" => return self.dispatch_styleprops("SETVAR FRAME 1", i), "FRAMES2" => return self.dispatch_styleprops("SETVAR FRAME 2", i), + "UOSNAP0" => return self.dispatch_styleprops("SETVAR UOSNAP 0", i), + "UOSNAP1" => return self.dispatch_styleprops("SETVAR UOSNAP 1", i), // COLOR — the colour applied to new // objects (CECOLOR). Bare COLOR reports the current value. "COLOR" | "COLOUR" | "CECOLOR" | "DDCOLOR" => { @@ -1015,6 +1017,7 @@ impl OpenCADStudio { | "FRAME" | "IMAGEFRAME" | "PDFFRAME" + | "XDWGFADECTL" | "POINTCLOUDCLIPFRAME" | "XCLIPFRAME" | "WIPEOUTFRAME" @@ -1081,6 +1084,19 @@ impl OpenCADStudio { crate::t!("SETVAR: CETRANSPARENCY LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR SHORTCUTMENU SHORTCUTMENUDURATION CURSORSIZE PICKBOX CURSORTYPE SNAPANG TEXTFILL CLIPROMPTLINES COMMANDLINEFADETIME ATTREQ ATTDIA DIMASSOC DIMCONTINUEMODE CONSTRAINTSOLVEMODE CONSTRAINTINFER CONSTRAINTBARDISPLAY CONSTRAINTBARMODE CONSTRAINTNAMEFORMAT DYNCONSTRAINTDISPLAY ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE DONUTID DONUTOD CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE CENTERCROSSSIZE CENTERCROSSGAP CENTERMARKEXE COLORTHEME SELECTIONAREA SELECTIONAREAOPACITY SELECTIONEFFECT SELECTIONEFFECTCOLOR WINDOWSAREACOLOR CROSSINGAREACOLOR SELECTIONPREVIEW GRIPSIZE GRIPCOLOR GRIPHOT GRIPHOVER GRIPOBJLIMIT | CLAYER CELTYPE TEXTSTYLE (read-only)").as_ref(), ); } else { + if name == "XDWGFADECTL" { + let current = crate::scene::cache::block_cache::xref_fade_ctl(); + if let Some(value) = &value { + match value.parse::().ok().filter(|v| (-90..=90).contains(v)) { + Some(fade) => self.set_xref_fade(fade), + None => self.command_line.push_error("Requires an integer between -90 and 90."), + } + } else { + self.command_line.push_output(&format!("Enter new value for XDWGFADECTL <{current}>:")); + self.pending_setvar = Some(name.clone()); + } + return Some(self.finish_dispatch(cmd)); + } if name == "CETRANSPARENCY" { let current = self.tabs[i].scene.document.current_entity_transparency(); if let Some(value) = &value { @@ -3525,3 +3541,18 @@ mod scale_validation_tests { } } } + +impl OpenCADStudio { + /// XDWGFADECTL: store it, show it on the ribbon and redraw every tab's + /// referenced drawings. + pub(in crate::app) fn set_xref_fade(&mut self, fade: i32) { + crate::scene::cache::block_cache::set_xref_fade_ctl(fade); + self.ribbon.xref_fade = crate::scene::cache::block_cache::xref_fade_ctl(); + for tab in &mut self.tabs { + if !tab.is_start { + tab.scene.recolor_meshes(); + tab.scene.bump_geometry(); + } + } + } +} diff --git a/src/app/mod.rs b/src/app/mod.rs index 9f5e455c2..58de66687 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -3814,6 +3814,11 @@ pub enum Message { XAttachPickResult(Result), /// ATTACH: pick a drawing, image or PDF to reference. AttachPick, + /// The Reference slide-out's xref fading: amount dragged, drag done, + /// switch. + XrefFadeSlide(u8), + XrefFadeCommit, + XrefFadeToggle, /// Result of the ATTACH file picker. AttachPickResult(Result), /// An edit in the Attach External Reference dialog. diff --git a/src/app/update/mod.rs b/src/app/update/mod.rs index 9e3e52580..67f14b37d 100644 --- a/src/app/update/mod.rs +++ b/src/app/update/mod.rs @@ -5716,6 +5716,20 @@ impl OpenCADStudio { self.ribbon.close_dropdown(); Task::none() } + Message::XrefFadeSlide(amount) => { + let sign = if self.ribbon.xref_fade < 0 { -1 } else { 1 }; + self.ribbon.xref_fade = sign * amount as i32; + Task::none() + } + Message::XrefFadeCommit => { + self.set_xref_fade(self.ribbon.xref_fade); + Task::none() + } + Message::XrefFadeToggle => { + let fade = crate::scene::cache::block_cache::xref_fade_ctl(); + self.set_xref_fade(if fade == 0 { 50 } else { -fade }); + Task::none() + } Message::DropdownSelectItem { dropdown_id, cmd } => { if self.tabs[self.active_tab].is_start { self.ribbon.close_dropdown(); diff --git a/src/entities/insert.rs b/src/entities/insert.rs index 5fe92b024..20e7f88f7 100644 --- a/src/entities/insert.rs +++ b/src/entities/insert.rs @@ -414,7 +414,7 @@ pub(crate) fn append_insert_attribute_wires( ); let sub_color = render::adapt_to_bg(sub_color, bg_color); let sub_color = if is_xref && !sel { - block_cache::fade_toward_bg(sub_color, bg_color) + block_cache::xref_fade(sub_color, bg_color) } else { sub_color }; diff --git a/src/locale_catalog.rs b/src/locale_catalog.rs index bb32171c4..dab65b05a 100644 --- a/src/locale_catalog.rs +++ b/src/locale_catalog.rs @@ -2942,6 +2942,12 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static "Unable to save: file is in use." => Some(("command-line", "unable-to-save-file-is-in-use")), "Unable to verify the server certificate" => Some(("plugins", "unable-to-verify-the-server-certificate")), "Unavailable" => Some(("plugins", "unavailable")), + "Snap to Underlays" => Some(("insert", "refui-snap-to-underlays")), + "Snap to Underlays ON" => Some(("insert", "refui-snap-to-underlays-on")), + "Snap to Underlays OFF" => Some(("insert", "refui-snap-to-underlays-off")), + "Edit Reference" => Some(("insert", "refui-edit-reference")), + "Xref fading" => Some(("insert", "refui-xref-fading")), + "Requires an integer between -90 and 90." => Some(("insert", "refui-requires-int-90")), "Underlay" => Some(("properties", "underlay")), "Underlay\nLayers" => Some(("insert", "underlay-layers")), "Underlay Adjust" => Some(("properties", "underlay-adjust")), diff --git a/src/modules/insert/mod.rs b/src/modules/insert/mod.rs index 9abd83270..669f8bef1 100644 --- a/src/modules/insert/mod.rs +++ b/src/modules/insert/mod.rs @@ -47,41 +47,39 @@ impl CadModule for InsertModule { title: "Reference", tools: vec![ RibbonItem::LargeTool(xattach::tool()), - RibbonItem::LargeTool(pdf_attach::tool()), RibbonItem::LargeTool(xclip::tool()), RibbonItem::LargeTool(xadjust::tool()), - RibbonItem::Tool(underlay_layers::tool()), - RibbonItem::Dropdown { + RibbonItem::LabeledTool(underlay_layers::tool()), + // An empty label shows the chosen item's. + RibbonItem::LabeledDropdown { id: "FRAMES_DROPDOWN", + label: "", icon: IconKind::Svg(include_bytes!( "../../../assets/icons/underlay_frames.svg" )), items: vec![ - ( - "FRAMES0", - "Frames Off", - IconKind::Svg(include_bytes!( - "../../../assets/icons/underlay_frames.svg" - )), - ), - ( - "FRAMES1", - "Frames On", - IconKind::Svg(include_bytes!( - "../../../assets/icons/underlay_frames.svg" - )), - ), - ( - "FRAMES2", - "Frames On, Not Plotted", - IconKind::Svg(include_bytes!( - "../../../assets/icons/underlay_frames.svg" - )), - ), + ("FRAMES0", "Frames Off", IconKind::Svg(include_bytes!( + "../../../assets/icons/underlay_frames.svg" + ))), + ("FRAMES1", "Frames On", IconKind::Svg(include_bytes!( + "../../../assets/icons/underlay_frames.svg" + ))), + ("FRAMES2", "Frames On, Not Plotted", IconKind::Svg(include_bytes!( + "../../../assets/icons/underlay_frames.svg" + ))), ], default: "FRAMES1", }, - RibbonItem::Tool(snap_underlays::tool()), + RibbonItem::LabeledDropdown { + id: "UOSNAP_DROPDOWN", + label: "Snap to Underlays", + icon: snap_underlays::ICON, + items: vec![ + ("UOSNAP1", "Snap to Underlays ON", snap_underlays::ICON), + ("UOSNAP0", "Snap to Underlays OFF", snap_underlays::ICON), + ], + default: "UOSNAP1", + }, ], }, // ── Point Cloud ─────────────────────────────────────────────────── diff --git a/src/modules/insert/pdf_attach.rs b/src/modules/insert/pdf_attach.rs index 3652e6c8d..767e06971 100644 --- a/src/modules/insert/pdf_attach.rs +++ b/src/modules/insert/pdf_attach.rs @@ -4,21 +4,8 @@ use acadrust::EntityType; use glam::DVec3; use crate::command::{CadCommand, CmdResult, WorkingPlane}; -use crate::modules::{IconKind, ModuleEvent, ToolDef}; use crate::t; -pub const ICON: IconKind = - IconKind::Svg(include_bytes!("../../../assets/icons/underlay_layers.svg")); - -pub fn tool() -> ToolDef { - ToolDef { - id: "PDFATTACH", - label: "Attach PDF", - icon: ICON, - event: ModuleEvent::Command("PDFATTACH".to_string()), - } -} - pub struct PdfAttachCommand { definition_handle: Handle, plane: WorkingPlane, diff --git a/src/modules/insert/snap_underlays.rs b/src/modules/insert/snap_underlays.rs index 7c7ae9527..db2c4df0a 100644 --- a/src/modules/insert/snap_underlays.rs +++ b/src/modules/insert/snap_underlays.rs @@ -1,11 +1,3 @@ -use crate::modules::{IconKind, ModuleEvent, ToolDef}; +use crate::modules::IconKind; pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/snap_underlays.svg")); -pub fn tool() -> ToolDef { - ToolDef { - id: "UOSNAP", - label: "Snap to\nUnderlays", - icon: ICON, - event: ModuleEvent::Command("UOSNAP".to_string()), - } -} diff --git a/src/modules/insert/xattach.rs b/src/modules/insert/xattach.rs index c9d2f7967..aa3917f41 100644 --- a/src/modules/insert/xattach.rs +++ b/src/modules/insert/xattach.rs @@ -26,10 +26,10 @@ use crate::scene::Scene; pub fn tool() -> ToolDef { ToolDef { - id: "XATTACH", - label: "Attach XREF", + id: "ATTACH", + label: "Attach", icon: IconKind::Svg(include_bytes!("../../../assets/icons/blocks/insert.svg")), - event: ModuleEvent::Command("XATTACH".to_string()), + event: ModuleEvent::Command("ATTACH".to_string()), } } diff --git a/src/scene/cache/block_cache.rs b/src/scene/cache/block_cache.rs index d327d8a92..51bc96c1b 100644 --- a/src/scene/cache/block_cache.rs +++ b/src/scene/cache/block_cache.rs @@ -1467,6 +1467,29 @@ pub(crate) fn fade_toward_bg(color: [f32; 4], bg: [f32; 4]) -> [f32; 4] { ] } +/// XDWGFADECTL: how far referenced drawings fade toward the background, in +/// percent (0–90); zero or negative shows them unfaded. +static XREF_FADE: std::sync::atomic::AtomicI32 = std::sync::atomic::AtomicI32::new(50); + +pub fn xref_fade_ctl() -> i32 { + XREF_FADE.load(std::sync::atomic::Ordering::Relaxed) +} + +pub fn set_xref_fade_ctl(value: i32) { + XREF_FADE.store(value.clamp(-90, 90), std::sync::atomic::Ordering::Relaxed); +} + +/// A referenced drawing's colour faded by XDWGFADECTL. +pub(crate) fn xref_fade(color: [f32; 4], bg: [f32; 4]) -> [f32; 4] { + let t = xref_fade_ctl().clamp(0, 90) as f32 / 100.0; + [ + color[0] * (1.0 - t) + bg[0] * t, + color[1] * (1.0 - t) + bg[1] * t, + color[2] * (1.0 - t) + bg[2] * t, + color[3], + ] +} + /// Style fingerprint used to group local wires into a single GPU buffer. /// f32 fields are bit-cast to u32 to make the key Hash + Eq. #[derive(Clone, Debug, PartialEq, Eq, Hash)] @@ -2135,7 +2158,7 @@ fn resolve_wire_color(lw: &LocalWire, ctx: &ExpandCtx) -> [f32; 4] { }; } if ctx.is_xref && !ctx.selected { - fade_toward_bg(color, ctx.bg_color) + xref_fade(color, ctx.bg_color) } else { color } diff --git a/src/ui/ribbon/draw_panel.rs b/src/ui/ribbon/draw_panel.rs index 54c6ed688..ae92d7ba3 100644 --- a/src/ui/ribbon/draw_panel.rs +++ b/src/ui/ribbon/draw_panel.rs @@ -111,6 +111,16 @@ struct Panel { tools: &'static [Tool], } +/// The Reference panel's slide-out: Edit Reference, then the xref fading +/// switch and amount (drawn by `reference_overlay`). +const REFERENCE_TOOLS: &[Tool] = &[Tool { + command: "REFEDIT", + label: "Edit Reference", + icon: include_bytes!("../../../assets/icons/edit_block.svg"), + options: &[], +}]; +pub(super) const REFERENCE_PANEL_ID: &str = "reference_extension"; + const PANELS: &[Panel] = &[ Panel { id: PANEL_ID, @@ -124,6 +134,12 @@ const PANELS: &[Panel] = &[ title: "Modify", tools: super::modify_panel::TOOLS, }, + Panel { + id: REFERENCE_PANEL_ID, + title_id: "reference_extension_title", + title: "Reference", + tools: REFERENCE_TOOLS, + }, ]; fn panel_for_dropdown(id: &str) -> Option { @@ -159,7 +175,7 @@ pub(super) fn group_title<'a>(title: &'static str, open: &Option) -> Ele } else { icons::themed_arrow_down(GROUP_TITLE_ARROW_SIZE) }; - PosReport::new( + let title_button: Element<'a, Message> = PosReport::new( panel.id, button( row![ @@ -173,6 +189,30 @@ pub(super) fn group_title<'a>(title: &'static str, open: &Option) -> Ele .style(move |theme: &Theme, status| tool_btn_style(theme, expanded, status)) .padding([1, 4]), ) + .into(); + if panel.id != REFERENCE_PANEL_ID { + return title_button; + } + // The corner arrow opens the External References palette. + let launcher = tooltip( + button(text("↘").size(10)) + .on_press(Message::RibbonToolClick { + tool_id: "EXTERNALREFERENCES".to_string(), + event: crate::modules::ModuleEvent::Command("EXTERNALREFERENCES".to_string()), + }) + .style(move |theme: &Theme, status| tool_btn_style(theme, false, status)) + .padding([0, 3]), + make_tip(format!("{}\n{} EXTERNALREFERENCES", t!("External References"), t!("Command:"))), + tooltip::Position::Bottom, + ) + .delay(Duration::from_millis(400)) + .style(tip_style); + row![ + iced::widget::Space::new().width(Fill), + title_button, + container(launcher).width(Fill).align_x(iced::Right) + ] + .align_y(iced::Center) .into() } @@ -211,8 +251,70 @@ fn tool_button(tool: &Tool, active: bool, panel_id: &'static str) -> Element<'st } } +/// The Reference slide-out: Edit Reference, and xref fading on/off with its +/// amount (XDWGFADECTL; the switch keeps the amount as a negative value). +fn reference_overlay<'a>(ribbon: &Ribbon, panel: Panel, win: (f32, f32)) -> Element<'a, Message> { + let width: f32 = 260.0_f32.min((win.0 - 8.0).max(120.0)); + let (_, x, anchor_top) = ribbon.dd_anchor(panel.id, width, win.0); + let left = x.clamp(0.0, (win.0 - width).max(0.0)); + let top = anchor_top.min((win.1 - 80.0).max(0.0)); + let tool = &panel.tools[0]; + let edit = button( + row![ + make_icon(IconKind::Svg(tool.icon), 16.0), + text(t!(tool.label)).size(11) + ] + .spacing(6) + .align_y(iced::Center), + ) + .on_press(Message::DropdownSelectItem { + dropdown_id: panel.id, + cmd: tool.command, + }) + .style(popup_row_style) + .width(Fill) + .padding([3, 6]); + let fade = ribbon.xref_fade; + let on = fade > 0; + let switch = button(make_icon( + IconKind::Svg(include_bytes!("../../../assets/icons/underlay_frames.svg")), + 16.0, + )) + .on_press(Message::XrefFadeToggle) + .style(move |theme: &Theme, status| tool_btn_style(theme, on, status)) + .padding(3); + let amount = fade.unsigned_abs().min(90) as u8; + let fading = row![ + tooltip( + switch, + make_tip(format!("{}\n{} XDWGFADECTL", t!("Xref fading"), t!("Command:"))), + tooltip::Position::Bottom + ) + .delay(Duration::from_millis(400)) + .style(tip_style), + text(t!("Xref fading")).size(11), + iced::widget::slider(0..=90u8, amount, Message::XrefFadeSlide) + .on_release(Message::XrefFadeCommit) + .width(Fill), + text(amount.to_string()).size(11).width(22), + ] + .spacing(6) + .align_y(iced::Center); + let body = container(column![edit, fading].spacing(4).padding(6)) + .width(width) + .style(|theme: &Theme| { + let mut style = popup_panel_style(theme); + style.border.color = theme.palette().primary.base.color; + style + }); + dropdown_backdrop(position_ribbon_dropdown(body.into(), false, left, top)) +} + pub(super) fn overlay<'a>(ribbon: &Ribbon, id: &str, win: (f32, f32)) -> Element<'a, Message> { let panel = panel_for_dropdown(id).expect("registered ribbon extension"); + if panel.id == REFERENCE_PANEL_ID { + return reference_overlay(ribbon, panel, win); + } let tools = panel.tools; let width = (7.0 * (CELL + GAP) - GAP + 12.0).min((win.0 - 8.0).max(CELL + 12.0)); let (_, x, anchor_top) = ribbon.dd_anchor(panel.id, width, win.0); diff --git a/src/ui/ribbon/mod.rs b/src/ui/ribbon/mod.rs index c1c2852f3..2cec6e2b6 100644 --- a/src/ui/ribbon/mod.rs +++ b/src/ui/ribbon/mod.rs @@ -102,6 +102,8 @@ pub struct Ribbon { /// Set by `CollapsePanels` when the tool row is in its tight state; the mode /// selector hides itself then to give the cramped tab row its space back. collapse_tight: Arc, + /// XDWGFADECTL as the Reference slide-out shows it (negative = off). + pub xref_fade: i32, } /// Per-layer display data shown in the ribbon layer dropdown. @@ -195,6 +197,7 @@ impl Ribbon { tool_bar_h: Arc::new(AtomicU32::new(TOOL_BAR_H.to_bits())), collapse_mode: CollapseMode::default(), collapse_tight: Arc::new(AtomicBool::new(false)), + xref_fade: 50, } } diff --git a/src/ui/ribbon/widgets.rs b/src/ui/ribbon/widgets.rs index 72b765fa2..5aefb45cd 100644 --- a/src/ui/ribbon/widgets.rs +++ b/src/ui/ribbon/widgets.rs @@ -665,7 +665,15 @@ pub(super) fn render_small<'a>( items.iter().find(|(candidate, _, _)| *candidate == cmd) .map(|(_, _, item_icon)| *item_icon) }).or_else(|| items.first().map(|(_, _, item_icon)| *item_icon)).unwrap_or(*icon); - let localized_label = t!(*label).into_owned(); + let localized_label = if label.is_empty() { + items + .iter() + .find(|(cmd, _, _)| *cmd == last) + .map(|(_, item_label, _)| t!(*item_label).into_owned()) + .unwrap_or_default() + } else { + t!(*label).into_owned() + }; let face = row![ container(make_icon(cur_icon, SMALL_ICON)).width(Length::Fixed(SMALL_W)), text(localized_label.clone()).size(10).wrapping(advanced_text::Wrapping::None),