Merge pull request #1512 from ramox81/codex/frame-parity

Frames: follow the drawing state, DWF/DGN frames, image frame profile, frame-only picking

The codec [patch] to ramox81/cadcodec@ea5edaa is dropped: that commit landed as opencadcodec#63 and main already pins ad16215, which contains it.
This commit is contained in:
Hakan Seven committed 2026-09-28 13:52:06 +03:00
commit 7694c506aa
70 files changed
+445 -64

No files matched your search

+3
View File
@@ -618,6 +618,8 @@ inventory::submit!(crate::command::CommandRegistration {
"FRAME",
"IMAGEFRAME",
"PDFFRAME",
"DWFFRAME",
"DGNFRAME",
"PDFOSNAP",
"UOSNAP",
"PDFIMPORTMODE",
@@ -630,6 +632,7 @@ inventory::submit!(crate::command::CommandRegistration {
"WIPEOUTFRAME",
"FRAMES0",
"FRAMES1",
"FRAMES3",
"FRAMES2",
"UOSNAP0",
"UOSNAP1",
+18 -4
View File
@@ -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),
// The mixed state is shown, never chosen.
"FRAMES3" => return Some(Task::none()),
"UOSNAP0" => return self.dispatch_styleprops("SETVAR UOSNAP 0", i),
"UOSNAP1" => return self.dispatch_styleprops("SETVAR UOSNAP 1", i),
// COLOR <ByLayer|ByBlock|1-255|name> — the colour applied to new
@@ -1017,6 +1019,8 @@ impl OpenCADStudio {
| "FRAME"
| "IMAGEFRAME"
| "PDFFRAME"
| "DWFFRAME"
| "DGNFRAME"
| "PDFOSNAP"
| "UOSNAP"
| "PDFIMPORTMODE"
@@ -1283,13 +1287,23 @@ impl OpenCADStudio {
self.tabs[i].scene.bump_entities(&changes);
}
self.tabs[i].dirty = true;
// IMAGEFRAME also lands in the profile.
self.save_config();
}
self.command_line
.push_output(&crate::tf!("{name} = {mode}"));
.push_output(crate::t!("Regenerating model.").as_ref());
}
// Out of range: say so and ask again.
_ => {
self.command_line.push_error(
crate::t!("Requires an integer between 0 and 2.").as_ref(),
);
self.command_line.push_output(
crate::tf!("Enter new value for {name} <{current}>:")
.as_ref(),
);
self.pending_setvar = Some(name.clone());
}
_ => self.command_line.push_error(
crate::tf!("SETVAR: {name} requires 0, 1, or 2.").as_ref(),
),
},
None => {
self.command_line.push_output(crate::tf!(
+4
View File
@@ -366,6 +366,9 @@ pub struct UserSettings {
/// GRIPOBJLIMIT: past this many selected objects, no grips are drawn at
/// all. 0 means no limit. The drawing header carries no slot for it.
pub grip_object_limit: i32,
/// IMAGEFRAME of the profile: used by new drawings and by drawings that
/// carry no image variables of their own.
pub image_frame: i16,
/// Nested-copy symbol handling: false inserts, true binds.
pub ncopy_bind: bool,
/// Last Options page; unknown saved names fall back without rejecting the config.
@@ -653,6 +656,7 @@ impl Default for UserSettings {
right_click_mode: RightClickMode::ShortcutMenu,
right_click_hold_ms: 250,
grip_object_limit: DEFAULT_GRIP_OBJECT_LIMIT,
image_frame: 1,
ncopy_bind: false,
cursor_type: CursorType::Crosshair,
crosshair_color: None,
+2
View File
@@ -614,6 +614,7 @@ impl OpenCADStudio {
right_click_mode: self.right_click_mode,
right_click_hold_ms: self.right_click_hold_ms,
grip_object_limit: self.grip_object_limit,
image_frame: crate::scene::frame::profile_image_mode(),
ncopy_bind: self.ncopy_bind,
cursor_type: self.cursor_type,
crosshair_color: self.crosshair_color,
@@ -698,6 +699,7 @@ impl OpenCADStudio {
self.right_click_mode = s.right_click_mode;
self.right_click_hold_ms = super::super::settings::clamp_right_click_hold_ms(s.right_click_hold_ms);
self.grip_object_limit = s.grip_object_limit.clamp(0, 32767);
crate::scene::frame::set_profile_image_mode(s.image_frame);
self.ncopy_bind = s.ncopy_bind;
self.cursor_type = s.cursor_type;
self.crosshair_color = s.crosshair_color;
+17
View File
@@ -326,9 +326,26 @@ impl OpenCADStudio {
if self.tabs.get(self.active_tab).map(|tab| tab.id) != before {
self.sync_underlay_tab();
}
self.sync_frame_dropdown();
task
}
/// The Frames list on the ribbon shows the active drawing's frame state
/// (FRAME), however it was changed: the list, a command, undo or another
/// drawing.
fn sync_frame_dropdown(&mut self) {
let Some(tab) = self.tabs.get(self.active_tab).filter(|tab| !tab.is_start) else {
return;
};
let current = match crate::scene::frame::master_mode(&tab.scene.document) {
0 => "FRAMES0",
1 => "FRAMES1",
2 => "FRAMES2",
_ => "FRAMES3",
};
self.ribbon.set_dropdown_current("FRAMES_DROPDOWN", current);
}
fn update_message(&mut self, msg: Message) -> Task<Message> {
if let Some(tab) = self.tabs.get(self.active_tab) {
crate::entities::common::set_unit_context(
+1
View File
@@ -2726,6 +2726,7 @@ impl OpenCADStudio {
world_width: 0.0,
depth_override: None,
display_visible: true,
snap_only: false,
plot_visible: true,
fill_is_3d: false,
fill_is_2d_solid: false,