From 123c5af34743e5a639f862936ae4af46689fecda Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 6 May 2021 10:11:53 +0200 Subject: [PATCH] #6473 - Update titlebar when opening a project file by double-clicking the file icon --- src/slic3r/GUI/GUI_App.cpp | 14 ++++++++++++-- src/slic3r/GUI/Plater.cpp | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f18a1fbe4..62961a867 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -633,8 +634,17 @@ void GUI_App::post_init() //FIXME this is not strictly correct, as one may pass a print/filament/printer profile here instead of a full config. this->mainframe->load_config_file(this->init_params->load_configs.back()); // If loading a 3MF file, the config is loaded from the last one. - if (! this->init_params->input_files.empty()) - this->plater()->load_files(this->init_params->input_files, true, true); + if (!this->init_params->input_files.empty()) { + const std::vector res = this->plater()->load_files(this->init_params->input_files, true, true); + if (!res.empty() && this->init_params->input_files.size() == 1) { + // Update application titlebar when opening a project file + const std::string& filename = this->init_params->input_files.front(); + if (boost::algorithm::iends_with(filename, ".amf") || + boost::algorithm::iends_with(filename, ".amf.xml") || + boost::algorithm::iends_with(filename, ".3mf")) + this->plater()->set_project_filename(filename); + } + } if (! this->init_params->extra_config.empty()) this->mainframe->load_config(this->init_params->extra_config); } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 841a07513..60f829728 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -5722,7 +5722,7 @@ wxString Plater::get_project_filename(const wxString& extension) const void Plater::set_project_filename(const wxString& filename) { - return p->set_project_filename(filename); + p->set_project_filename(filename); } bool Plater::is_export_gcode_scheduled() const