ENH: restore single instance (#4810)

This commit is contained in:
noobydp 2024-04-20 20:05:15 +08:00 committed by GitHub
parent 1101ed9955
commit 2b4520b2df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 57 additions and 46 deletions

View file

@ -3092,7 +3092,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
//wxPostEvent(this->q, wxCommandEvent{EVT_RESTORE_PROJECT});
}
/*this->q->Bind(EVT_LOAD_MODEL_OTHER_INSTANCE, [this](LoadFromOtherInstanceEvent& evt) {
this->q->Bind(EVT_LOAD_MODEL_OTHER_INSTANCE, [this](LoadFromOtherInstanceEvent& evt) {
BOOST_LOG_TRIVIAL(trace) << "Received load from other instance event.";
wxArrayString input_files;
for (size_t i = 0; i < evt.data.size(); ++i) {
@ -3103,8 +3103,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
});
this->q->Bind(EVT_INSTANCE_GO_TO_FRONT, [this](InstanceGoToFrontEvent &) {
bring_instance_forward();
});*/
//wxGetApp().other_instance_message_handler()->init(this->q);
});
wxGetApp().other_instance_message_handler()->init(this->q);
// collapse sidebar according to saved value
//if (wxGetApp().is_editor()) {
@ -7502,10 +7502,11 @@ void Plater::priv::set_project_name(const wxString& project_name)
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << __LINE__ << " project is:" << project_name;
m_project_name = project_name;
//update topbar title
wxGetApp().mainframe->SetTitle(m_project_name);
#ifdef __WINDOWS__
wxGetApp().mainframe->SetTitle(m_project_name + " - OrcaSlicer");
wxGetApp().mainframe->topbar()->SetTitle(m_project_name);
#else
wxGetApp().mainframe->SetTitle(m_project_name);
if (!m_project_name.IsEmpty())
wxGetApp().mainframe->update_title_colour_after_set_title();
#endif
@ -8409,10 +8410,10 @@ void Plater::priv::update_after_undo_redo(const UndoRedo::Snapshot& snapshot, bo
void Plater::priv::bring_instance_forward() const
{
/*#ifdef __APPLE__
#ifdef __APPLE__
wxGetApp().other_instance_message_handler()->bring_instance_forward();
return;
#endif //__APPLE__*/
#endif //__APPLE__
if (main_frame == nullptr) {
BOOST_LOG_TRIVIAL(debug) << "Couldnt bring instance forward - mainframe is null";
return;