Merge pull request #1777 from ramox81/codex/refedit-dialog

REFEDIT: Reference Edit dialog and unique names for xref objects

# Conflicts:
#	locales/ar-SA/opencadstudio.ftl
#	locales/bg-BG/opencadstudio.ftl
#	locales/cs-CZ/opencadstudio.ftl
#	locales/de-DE/opencadstudio.ftl
#	locales/el-GR/opencadstudio.ftl
#	locales/en-US/opencadstudio.ftl
#	locales/es-ES/opencadstudio.ftl
#	locales/fi-FI/opencadstudio.ftl
#	locales/fr-FR/opencadstudio.ftl
#	locales/hi-IN/opencadstudio.ftl
#	locales/hu-HU/opencadstudio.ftl
#	locales/it-IT/opencadstudio.ftl
#	locales/ja-JP/opencadstudio.ftl
#	locales/ko-KR/opencadstudio.ftl
#	locales/lo-LA/opencadstudio.ftl
#	locales/nl-NL/opencadstudio.ftl
#	locales/pl-PL/opencadstudio.ftl
#	locales/pt-BR/opencadstudio.ftl
#	locales/ru-RU/opencadstudio.ftl
#	locales/tr-TR/opencadstudio.ftl
#	locales/zh-CN/opencadstudio.ftl
#	locales/zh-TW/opencadstudio.ftl
#	src/app/control/actions.rs
#	src/app/mod.rs
#	src/app/view/modal.rs
This commit is contained in:
Hakan Seven committed 2026-10-14 12:10:40 +03:00
commit 21f33e933e
34 files changed
+1070 -23

No files matched your search

+31
View File
@@ -105,6 +105,7 @@ pub(super) const NAMES: &[&str] = &[
"pdf_dialog_ok",
"view_background",
"image_adjust",
"refedit_dialog",
"pdf_layer_toggle",
"pc_manager_toggle",
"pc_manager",
@@ -1885,6 +1886,36 @@ impl OpenCADStudio {
})
}
"ribbon_dropdown" => Message::ToggleRibbonDropdown(string(req, "value")?.into()),
// The Edit Reference dialog, one field per call: "level=<n>" (0 =
// the picked reference), "nested=0|1" (pick the working set in the
// drawing), "attributes=0|1", "lock=0|1", "unique=0|1", "ok" or
// "cancel".
"refedit_dialog" => {
use crate::ui::window::refedit_dialog::RefEditDialogMsg as R;
if self.active_modal != Some(crate::app::ModalKind::RefEdit) {
return Err(failure("no_dialog", "The Reference Edit dialog is not open"));
}
let spec = string(req, "value")?;
let (key, value) = spec.split_once('=').unwrap_or((spec, ""));
let flag = || match value {
"1" => Ok(true),
"0" => Ok(false),
_ => Err(failure("invalid_value", spec)),
};
if key == "cancel" {
Message::CloseModal
} else {
Message::RefEditDialog(match key {
"ok" => R::Ok,
"level" => R::Level(value.parse().map_err(|_| failure("invalid_value", spec))?),
"nested" => R::Nested(flag()?),
"attributes" => R::Attributes(flag()?),
"lock" => R::Lock(flag()?),
"unique" => R::Unique(flag()?),
_ => return Err(failure("invalid_value", "Unknown Reference Edit field")),
})
}
}
// The -VIEW Background dialog, one field per call: "type=gradient",
// "color|top|middle|bottom=r,g,b", "three=1", "rotation=30",
// "image=<path>", "position=center|stretch|tile", "aspect=1", "offset=x,y" (pixels), "scale=x,y",