feat(dialogs): reopen file pickers in the last-used directory
Every rfd dialog result funnels through sys::handle_path, which now records the picked file's folder (persisted to the config dir), and all pickers are built via sys::file_dialog(), seeded with that folder. Save-As keeps the current tab's own directory as the first choice and falls back to the remembered one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
e8411c1b6d
commit
e78ad7884d
7 changed files with 78 additions and 15 deletions
|
|
@ -153,7 +153,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
|
|||
async move {
|
||||
let exts: Vec<&str> =
|
||||
extensions.iter().map(|s| s.as_str()).collect();
|
||||
let path = rfd::AsyncFileDialog::new()
|
||||
let path = crate::sys::file_dialog()
|
||||
.set_title(title)
|
||||
.add_filter(filter_name, &exts)
|
||||
.add_filter("All Files", &["*"])
|
||||
|
|
|
|||
|
|
@ -845,7 +845,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
|||
let close = self.close_save_dialog_window();
|
||||
let pick = Task::perform(
|
||||
async move {
|
||||
let mut dlg = rfd::AsyncFileDialog::new()
|
||||
let mut dlg = crate::sys::file_dialog()
|
||||
.set_title("Save Drawing As")
|
||||
.set_file_name(default_name)
|
||||
.add_filter(filter_label, &[filter_ext]);
|
||||
|
|
@ -2204,7 +2204,7 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
|||
.unwrap_or("export.ctb".into());
|
||||
Task::perform(
|
||||
async move {
|
||||
rfd::AsyncFileDialog::new()
|
||||
crate::sys::file_dialog()
|
||||
.set_title("Save Plot Style Table")
|
||||
.set_file_name(&default_name)
|
||||
.add_filter("Plot Style Files", &["ctb", "stb", "CTB", "STB"])
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ impl OpenCADStudio {
|
|||
|
||||
Message::XAttachPick => Task::perform(
|
||||
async {
|
||||
let handle = rfd::AsyncFileDialog::new()
|
||||
let handle = crate::sys::file_dialog()
|
||||
.set_title("Select External Reference File")
|
||||
.add_filter("CAD Files", &["dwg", "dxf", "bak", "DWG", "DXF", "BAK"])
|
||||
.add_filter("DWG Files", &["dwg", "DWG"])
|
||||
|
|
@ -446,7 +446,7 @@ impl OpenCADStudio {
|
|||
let name = block_name.clone();
|
||||
Task::perform(
|
||||
async move {
|
||||
let path = rfd::AsyncFileDialog::new()
|
||||
let path = crate::sys::file_dialog()
|
||||
.set_title("Save Block As")
|
||||
.set_file_name("block.dwg")
|
||||
.add_filter("DWG Files", &["dwg"])
|
||||
|
|
@ -469,7 +469,7 @@ impl OpenCADStudio {
|
|||
let csv_clone = csv.clone();
|
||||
Task::perform(
|
||||
async move {
|
||||
let path = rfd::AsyncFileDialog::new()
|
||||
let path = crate::sys::file_dialog()
|
||||
.set_title("Save Data Extraction")
|
||||
.set_file_name("extraction.csv")
|
||||
.add_filter("CSV", &["csv"])
|
||||
|
|
@ -512,7 +512,7 @@ impl OpenCADStudio {
|
|||
}
|
||||
Task::perform(
|
||||
async {
|
||||
rfd::AsyncFileDialog::new()
|
||||
crate::sys::file_dialog()
|
||||
.set_title("Export STL")
|
||||
.set_file_name("export.stl")
|
||||
.add_filter("STL Files", &["stl"])
|
||||
|
|
@ -539,7 +539,7 @@ impl OpenCADStudio {
|
|||
}
|
||||
Task::perform(
|
||||
async {
|
||||
rfd::AsyncFileDialog::new()
|
||||
crate::sys::file_dialog()
|
||||
.set_title("Export STEP AP203")
|
||||
.set_file_name("export.step")
|
||||
.add_filter("STEP Files", &["step", "stp"])
|
||||
|
|
@ -559,7 +559,7 @@ impl OpenCADStudio {
|
|||
// ── OBJ import ────────────────────────────────────────────────
|
||||
Message::ObjImport => Task::perform(
|
||||
async {
|
||||
rfd::AsyncFileDialog::new()
|
||||
crate::sys::file_dialog()
|
||||
.set_title("Import OBJ Mesh")
|
||||
.add_filter("Wavefront OBJ", &["obj", "OBJ"])
|
||||
.add_filter("All Files", &["*"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue