mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Improved application recreation after language change
This commit is contained in:
parent
6044be7793
commit
10641f7e9c
4 changed files with 20 additions and 11 deletions
|
@ -274,6 +274,8 @@ void GUI_App::recreate_GUI()
|
||||||
{
|
{
|
||||||
std::cerr << "recreate_GUI" << std::endl;
|
std::cerr << "recreate_GUI" << std::endl;
|
||||||
|
|
||||||
|
clear_tabs_list();
|
||||||
|
|
||||||
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
|
MainFrame* topwindow = dynamic_cast<MainFrame*>(GetTopWindow());
|
||||||
mainframe = new MainFrame();
|
mainframe = new MainFrame();
|
||||||
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
sidebar().obj_list()->init_objects(); // propagate model objects to object list
|
||||||
|
@ -285,6 +287,8 @@ void GUI_App::recreate_GUI()
|
||||||
|
|
||||||
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
m_printhost_job_queue.reset(new PrintHostJobQueue(mainframe->printhost_queue_dlg()));
|
||||||
|
|
||||||
|
load_current_presets();
|
||||||
|
|
||||||
mainframe->Show(true);
|
mainframe->Show(true);
|
||||||
|
|
||||||
// On OSX the UI was not initialized correctly if the wizard was called
|
// On OSX the UI was not initialized correctly if the wizard was called
|
||||||
|
@ -669,13 +673,6 @@ bool GUI_App::checked_tab(Tab* tab)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::delete_tab_from_list(Tab* tab)
|
|
||||||
{
|
|
||||||
std::vector<Tab *>::iterator itr = find(tabs_list.begin(), tabs_list.end(), tab);
|
|
||||||
if (itr != tabs_list.end())
|
|
||||||
tabs_list.erase(itr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update UI / Tabs to reflect changes in the currently loaded presets
|
// Update UI / Tabs to reflect changes in the currently loaded presets
|
||||||
void GUI_App::load_current_presets()
|
void GUI_App::load_current_presets()
|
||||||
{
|
{
|
||||||
|
@ -689,6 +686,15 @@ void GUI_App::load_current_presets()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI_App::clear_tabs_list()
|
||||||
|
{
|
||||||
|
for (auto tab : tabs_list) {
|
||||||
|
tab->Destroy();
|
||||||
|
tab = nullptr;
|
||||||
|
}
|
||||||
|
tabs_list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// wxWidgets override to get an event on open files.
|
// wxWidgets override to get an event on open files.
|
||||||
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
void GUI_App::MacOpenFiles(const wxArrayString &fileNames)
|
||||||
|
|
|
@ -133,8 +133,8 @@ public:
|
||||||
void add_config_menu(wxMenuBar *menu);
|
void add_config_menu(wxMenuBar *menu);
|
||||||
bool check_unsaved_changes();
|
bool check_unsaved_changes();
|
||||||
bool checked_tab(Tab* tab);
|
bool checked_tab(Tab* tab);
|
||||||
void delete_tab_from_list(Tab* tab);
|
|
||||||
void load_current_presets();
|
void load_current_presets();
|
||||||
|
void clear_tabs_list();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// wxWidgets override to get an event on open files.
|
// wxWidgets override to get an event on open files.
|
||||||
|
|
|
@ -121,6 +121,11 @@ void MainFrame::init_tabpanel()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (wxGetApp().plater_) {
|
||||||
|
// before creating a new plater let's delete old one
|
||||||
|
wxGetApp().plater_->Destroy();
|
||||||
|
wxGetApp().plater_ = nullptr;
|
||||||
|
}
|
||||||
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
|
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
|
||||||
wxGetApp().plater_ = m_plater;
|
wxGetApp().plater_ = m_plater;
|
||||||
m_tabpanel->AddPage(m_plater, _(L("Plater")));
|
m_tabpanel->AddPage(m_plater, _(L("Plater")));
|
||||||
|
|
|
@ -213,9 +213,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Tab(wxNotebook* parent, const wxString& title, const char* name);
|
Tab(wxNotebook* parent, const wxString& title, const char* name);
|
||||||
~Tab() {
|
~Tab() {}
|
||||||
wxGetApp().delete_tab_from_list(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxWindow* parent() const { return m_parent; }
|
wxWindow* parent() const { return m_parent; }
|
||||||
wxString title() const { return m_title; }
|
wxString title() const { return m_title; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue