fix(save): default Save-As format to the drawing's own version
The Save-As dialog hard-coded the format dropdown to the latest (DWG/DXF 2018) regardless of what was opened, so a round-trip silently re-targeted the version. Default it to the loaded document's own version and DWG-vs-DXF kind instead (from `document.version` + the file extension), which always matches one of the dropdown options. A new, unsaved drawing keeps its document default. QSAVE on an existing file already preserved the version; only Save-As was wrong. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
0d4bd274b4
commit
1f4bdfa741
1 changed files with 8 additions and 5 deletions
|
|
@ -23,9 +23,12 @@ use iced::{mouse, Point, Task};
|
||||||
|
|
||||||
impl OpenCADStudio {
|
impl OpenCADStudio {
|
||||||
pub(in crate::app) fn open_save_dialog_window(&mut self, tab_idx: usize) -> Task<Message> {
|
pub(in crate::app) fn open_save_dialog_window(&mut self, tab_idx: usize) -> Task<Message> {
|
||||||
// Default the format dropdown to the latest version (DWG/DXF 2018),
|
// Default the format dropdown to the loaded file's own format — its
|
||||||
// regardless of the loaded file's version. The user can pick any older
|
// DWG-vs-DXF kind (from the extension) and its version (from the parsed
|
||||||
// version explicitly; the selected version is written as-is.
|
// document) — so Save-As round-trips the format instead of silently
|
||||||
|
// re-targeting the latest. A new/unsaved drawing has no path, so it
|
||||||
|
// keeps its document default version and DWG. The user can still pick
|
||||||
|
// any other version explicitly.
|
||||||
let is_dxf = self.tabs[tab_idx]
|
let is_dxf = self.tabs[tab_idx]
|
||||||
.current_path
|
.current_path
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
@ -33,8 +36,8 @@ impl OpenCADStudio {
|
||||||
.and_then(|e| e.to_str())
|
.and_then(|e| e.to_str())
|
||||||
.map(|e| e.eq_ignore_ascii_case("dxf"))
|
.map(|e| e.eq_ignore_ascii_case("dxf"))
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
self.save_dialog_format =
|
let version = self.tabs[tab_idx].scene.document.version;
|
||||||
crate::io::format_for_version(acadrust::DxfVersion::AC1032, is_dxf);
|
self.save_dialog_format = crate::io::format_for_version(version, is_dxf);
|
||||||
|
|
||||||
// Pre-fill the default file name from the current path or the tab name;
|
// Pre-fill the default file name from the current path or the tab name;
|
||||||
// the destination folder comes from the native OS dialog that follows.
|
// the destination folder comes from the native OS dialog that follows.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue