forked from 1b-agent/opencadstudio-upstream
fix: restore workspace verification
This commit is contained in:
1 parent
d36134900d
commit
1dded7f881
19 files changed
+91
-71
No files matched your search
@@ -111,6 +111,7 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.pending_close = Some(crate::app::PendingClose::Tab(idx));
|
||||
return self.open_unsaved_dialog_window();
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let tab_id = self.tabs.get(idx).map(|t| t.id);
|
||||
// This tab is closing for good — drop its autosave recovery copy.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
@@ -135,8 +136,8 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
self.sync_ribbon_layers();
|
||||
self.sync_ribbon_styles();
|
||||
self.sync_ribbon_from_selection();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
if let Some(tab_id) = tab_id {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
v4_support::on_tab_closed(tab_id);
|
||||
}
|
||||
Task::none()
|
||||
|
||||
@@ -4202,15 +4202,16 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
.unwrap_or("export.ctb".into());
|
||||
Task::perform(
|
||||
async move {
|
||||
let mut dialog = crate::sys::file_dialog()
|
||||
let dialog = crate::sys::file_dialog()
|
||||
.set_title("Save Plot Style Table")
|
||||
.set_file_name(&default_name)
|
||||
.add_filter("Plot Style Files", &["ctb", "CTB"])
|
||||
.add_filter("All Files", &["*"]);
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
if let Ok(dir) = crate::io::plot_style::ensure_plot_styles_dir() {
|
||||
dialog = dialog.set_directory(dir);
|
||||
}
|
||||
let dialog = match crate::io::plot_style::ensure_plot_styles_dir() {
|
||||
Ok(dir) => dialog.set_directory(dir),
|
||||
Err(_) => dialog,
|
||||
};
|
||||
dialog.save_file().await
|
||||
.map(|h| crate::sys::handle_path(&h))
|
||||
},
|
||||
|
||||
@@ -6635,16 +6635,17 @@ impl OpenCADStudio {
|
||||
|
||||
Message::PlotStylePanelApply => self.on_plot_style_panel_apply(),
|
||||
|
||||
Message::PlotStylePanelSaveDirect => {
|
||||
let Some(table) = self.active_plot_style.as_ref() else {
|
||||
Message::PlotStylePanelSaveDirect => {
|
||||
if self.active_plot_style.is_none() {
|
||||
self.command_line.push_error(
|
||||
crate::t!("No plot style table loaded. Load or create one first.").as_ref(),
|
||||
);
|
||||
return Task::none();
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
let table = self.active_plot_style.as_ref().expect("checked above");
|
||||
let table_name = table.name.clone();
|
||||
|
||||
let result = crate::io::plot_style::ensure_plot_styles_dir().and_then(|dir| {
|
||||
|
||||
Reference in new issue
Block a user