Add stl, step, etc. to recent list (#9481)

* Add stl, step, etc. to recent list

* Make configurable

* Merge branch 'main' into recent-files-pr
This commit is contained in:
Vovodroid 2025-08-23 19:24:30 +03:00 committed by GitHub
parent 5ebb490a8d
commit 5fa35342fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 3 deletions

View file

@ -362,6 +362,10 @@ void AppConfig::set_defaults()
set("max_recent_count", "18");
}
if (get("recent_models").empty()) {
set("recent_models", "0");
}
// if (get("staff_pick_switch").empty()) {
// set_bool("staff_pick_switch", false);
// }

View file

@ -2329,7 +2329,7 @@ void MainFrame::init_menubar_as_editor()
// Recent Project
wxMenu* recent_projects_menu = new wxMenu();
wxMenuItem* recent_projects_submenu = append_submenu(fileMenu, recent_projects_menu, wxID_ANY, _L("Recent projects"), "");
wxMenuItem* recent_projects_submenu = append_submenu(fileMenu, recent_projects_menu, wxID_ANY, _L("Recent files"), "");
m_recent_projects.UseMenu(recent_projects_menu);
Bind(wxEVT_MENU, [this](wxCommandEvent& evt) {
size_t file_id = evt.GetId() - wxID_FILE1;

View file

@ -11233,6 +11233,8 @@ void Plater::add_file()
p->set_project_name(from_u8(full_path.stem().string()));
}
wxGetApp().mainframe->update_title();
if (wxGetApp().app_config->get("recent_models") == "true")
wxGetApp().mainframe->add_to_recent_projects(paths[0].wstring());
}
break;
}
@ -11254,6 +11256,9 @@ void Plater::add_file()
p->set_project_name(from_u8(full_path.stem().string()));
}
wxGetApp().mainframe->update_title();
if (wxGetApp().app_config->get("recent_models") == "true")
for (auto &path : paths)
wxGetApp().mainframe->add_to_recent_projects(path.wstring());
}
break;
}
@ -11271,7 +11276,12 @@ void Plater::add_file()
open_3mf_file(first_file[0]);
load_files(tmf_file, LoadStrategy::LoadModel);
if (!load_files(other_file, LoadStrategy::LoadModel, false).empty()) { wxGetApp().mainframe->update_title();}
if (!load_files(other_file, LoadStrategy::LoadModel, false).empty()) {
wxGetApp().mainframe->update_title();
if (wxGetApp().app_config->get("recent_models") == "true")
for (auto &file : other_file)
wxGetApp().mainframe->add_to_recent_projects(file.wstring());
}
break;
default:break;
}

View file

@ -1249,11 +1249,14 @@ wxWindow* PreferencesDialog::create_general_page()
std::vector<string> projectLoadSettingsConfigOptions = { OPTION_PROJECT_LOAD_BEHAVIOUR_LOAD_ALL, OPTION_PROJECT_LOAD_BEHAVIOUR_ASK_WHEN_RELEVANT, OPTION_PROJECT_LOAD_BEHAVIOUR_ALWAYS_ASK, OPTION_PROJECT_LOAD_BEHAVIOUR_LOAD_GEOMETRY };
auto item_project_load_behaviour = create_item_combobox(_L("Load Behaviour"), page, _L("Should printer/filament/process settings be loaded when opening a .3mf?"), SETTING_PROJECT_LOAD_BEHAVIOUR, projectLoadSettingsBehaviourOptions, projectLoadSettingsConfigOptions);
auto item_max_recent_count = create_item_input(_L("Maximum recent projects"), "", page, _L("Maximum count of recent projects"), "max_recent_count", [](wxString value) {
auto item_max_recent_count = create_item_input(_L("Maximum recent files"), "", page, _L("Maximum count of recent files"), "max_recent_count", [](wxString value) {
long max = 0;
if (value.ToLong(&max))
wxGetApp().mainframe->set_max_recent_count(max);
});
auto item_recent_models = create_item_checkbox(_L("Add model files (stl/step) to recent file list."), page, _L("Add model files (stl/step) to recent file list."), 50, "recent_models");
auto item_save_choise = create_item_button(_L("Clear my choice on the unsaved projects."), _L("Clear"), page, L"", _L("Clear my choice on the unsaved projects."), []() {
wxGetApp().app_config->set("save_project_choise", "");
});
@ -1330,6 +1333,7 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_project_load_behaviour, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_recent_models, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_gcodes_warning, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_backup, 0, wxTOP,FromDIP(3));