Deleted on more EVT_NOTEBOOK_PAGE_CHANGE hangling of TabPanel

This commit is contained in:
YuSanka 2018-02-06 14:53:38 +01:00
parent 6bff67a865
commit 407f50a66f
4 changed files with 10 additions and 7 deletions

View File

@ -195,12 +195,12 @@ void create_preset_tabs(PresetBundle *preset_bundle, AppConfig *app_config,
add_created_tab(new TabFilament (g_wxTabPanel, no_controller), preset_bundle, app_config); add_created_tab(new TabFilament (g_wxTabPanel, no_controller), preset_bundle, app_config);
add_created_tab(new TabPrinter (g_wxTabPanel, no_controller, is_disabled_button_browse, is_user_agent), add_created_tab(new TabPrinter (g_wxTabPanel, no_controller, is_disabled_button_browse, is_user_agent),
preset_bundle, app_config); preset_bundle, app_config);
g_wxTabPanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, ([](wxCommandEvent e){ // g_wxTabPanel->Bind(wxEVT_NOTEBOOK_PAGE_CHANGED, ([](wxCommandEvent e){
Tab* panel = (Tab*)g_wxTabPanel->GetCurrentPage(); // Tab* panel = (Tab*)g_wxTabPanel->GetCurrentPage();
if (panel->GetName().compare("Print Settings")==0 || // if (panel->GetName().compare("Print Settings")==0 ||
panel->GetName().compare("Filament Settings") == 0) // panel->GetName().compare("Filament Settings") == 0)
panel->OnActivate(); // panel->OnActivate();
}), g_wxTabPanel->GetId() ); // }), g_wxTabPanel->GetId() );
for (size_t i = 0; i < g_wxTabPanel->GetPageCount(); ++ i) { for (size_t i = 0; i < g_wxTabPanel->GetPageCount(); ++ i) {
Tab *tab = dynamic_cast<Tab*>(g_wxTabPanel->GetPage(i)); Tab *tab = dynamic_cast<Tab*>(g_wxTabPanel->GetPage(i));
if (! tab) if (! tab)

View File

@ -11,6 +11,7 @@ char* TabIface::title() { return (char*)m_tab->title().ToStdString().data();
void TabIface::load_config(DynamicPrintConfig* config) { m_tab->load_config(*config);} void TabIface::load_config(DynamicPrintConfig* config) { m_tab->load_config(*config);}
void TabIface::load_key_value(char* opt_key, char* value){ m_tab->load_key_value(opt_key, static_cast<std::string>(value)); } void TabIface::load_key_value(char* opt_key, char* value){ m_tab->load_key_value(opt_key, static_cast<std::string>(value)); }
bool TabIface::current_preset_is_dirty() { return m_tab->current_preset_is_dirty();} bool TabIface::current_preset_is_dirty() { return m_tab->current_preset_is_dirty();}
void TabIface::OnActivate() { return m_tab->OnActivate();}
DynamicPrintConfig* TabIface::get_config() { return m_tab->get_config(); } DynamicPrintConfig* TabIface::get_config() { return m_tab->get_config(); }
PresetCollection* TabIface::get_presets() { return m_tab->get_presets(); } PresetCollection* TabIface::get_presets() { return m_tab->get_presets(); }
std::vector<std::string> TabIface::get_dependent_tabs() { return m_tab->get_dependent_tabs(); } std::vector<std::string> TabIface::get_dependent_tabs() { return m_tab->get_dependent_tabs(); }

View File

@ -23,6 +23,7 @@ public:
void load_config(DynamicPrintConfig* config); void load_config(DynamicPrintConfig* config);
void load_key_value(char* opt_key, char* value); void load_key_value(char* opt_key, char* value);
bool current_preset_is_dirty(); bool current_preset_is_dirty();
void OnActivate();
DynamicPrintConfig* get_config(); DynamicPrintConfig* get_config();
PresetCollection* get_presets(); PresetCollection* get_presets();
std::vector<std::string> get_dependent_tabs(); std::vector<std::string> get_dependent_tabs();

View File

@ -16,6 +16,7 @@
bool current_preset_is_dirty(); bool current_preset_is_dirty();
void load_key_value(char* opt_key, char* value); void load_key_value(char* opt_key, char* value);
char* title(); char* title();
void OnActivate();
Ref<DynamicPrintConfig> get_config(); Ref<DynamicPrintConfig> get_config();
Ref<PresetCollection> get_presets(); Ref<PresetCollection> get_presets();
std::vector<std::string> get_dependent_tabs(); std::vector<std::string> get_dependent_tabs();