diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index e6bcf4ec2..0d8ed634c 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -170,6 +170,10 @@ sub _init_tabpanel { print "PRESETS_CHANGED_EVENT: ", $event->GetString, "\n"; }); Slic3r::GUI::create_preset_tabs(wxTheApp->{preset_bundle}, wxTheApp->{app_config}, $VALUE_CHANGE_EVENT, $PRESETS_CHANGED_EVENT); + $self->{options_tabs2}{print} = Slic3r::GUI::get_preset_tab("Print"); + $self->{options_tabs2}{filament} = Slic3r::GUI::get_preset_tab("Filament"); + $self->{options_tabs2}{printer} = Slic3r::GUI::get_preset_tab("Printer"); +# $self->{options_tabs2}{print}->rebuild_page_tree(); if ($self->{plater}) { $self->{plater}->on_select_preset(sub { diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 43353f665..c44a08aab 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -179,6 +179,8 @@ add_library(libslic3r_gui STATIC ${LIBDIR}/slic3r/GUI/GUI.hpp ${LIBDIR}/slic3r/GUI/Tab.cpp ${LIBDIR}/slic3r/GUI/Tab.h + ${LIBDIR}/slic3r/GUI/TabIface.cpp + ${LIBDIR}/slic3r/GUI/TabIface.hpp ${LIBDIR}/slic3r/GUI/Field.cpp ${LIBDIR}/slic3r/GUI/Field.hpp ${LIBDIR}/slic3r/GUI/OptionsGroup.cpp @@ -295,6 +297,7 @@ set(XS_XSP_FILES ${XSP_DIR}/GUI_AppConfig.xsp ${XSP_DIR}/GUI_3DScene.xsp ${XSP_DIR}/GUI_Preset.xsp + ${XSP_DIR}/GUI_Tab.xsp ${XSP_DIR}/Layer.xsp ${XSP_DIR}/Line.xsp ${XSP_DIR}/Model.xsp diff --git a/xs/lib/Slic3r/XS.pm b/xs/lib/Slic3r/XS.pm index 26c8befe2..c43b80eea 100644 --- a/xs/lib/Slic3r/XS.pm +++ b/xs/lib/Slic3r/XS.pm @@ -283,6 +283,7 @@ for my $class (qw( Slic3r::GUI::_3DScene::GLVolume Slic3r::GUI::Preset Slic3r::GUI::PresetCollection + Slic3r::GUI::Tab2 Slic3r::Layer Slic3r::Layer::Region Slic3r::Layer::Support diff --git a/xs/src/perlglue.cpp b/xs/src/perlglue.cpp index 948fcfd93..866341181 100644 --- a/xs/src/perlglue.cpp +++ b/xs/src/perlglue.cpp @@ -62,6 +62,7 @@ REGISTER_CLASS(Preset, "GUI::Preset"); REGISTER_CLASS(PresetCollection, "GUI::PresetCollection"); REGISTER_CLASS(PresetBundle, "GUI::PresetBundle"); REGISTER_CLASS(PresetHints, "GUI::PresetHints"); +REGISTER_CLASS(TabIface, "GUI::Tab2"); SV* ConfigBase__as_hash(ConfigBase* THIS) { diff --git a/xs/src/slic3r/GUI/GUI.cpp b/xs/src/slic3r/GUI/GUI.cpp index 9118999ab..d3f7efd41 100644 --- a/xs/src/slic3r/GUI/GUI.cpp +++ b/xs/src/slic3r/GUI/GUI.cpp @@ -33,6 +33,7 @@ #include #include "Tab.h" +#include "TabIface.hpp" #include "AppConfig.hpp" namespace Slic3r { namespace GUI { @@ -205,6 +206,19 @@ void create_preset_tabs(PresetBundle *preset_bundle, AppConfig *app_config, int } } +TabIface* get_preset_tab_iface(char *name) +{ + for (size_t i = 0; i < g_wxTabPanel->GetPageCount(); ++ i) { + Tab *tab = dynamic_cast(g_wxTabPanel->GetPage(i)); + if (! tab) + continue; + if (tab->title().ToStdString() == name) { + return new TabIface(tab); + } + } + return new TabIface(nullptr); +} + void change_opt_value(DynamicPrintConfig& config, t_config_option_key opt_key, boost::any value) { try{ diff --git a/xs/src/slic3r/GUI/GUI.hpp b/xs/src/slic3r/GUI/GUI.hpp index 3d57b9977..9427529d2 100644 --- a/xs/src/slic3r/GUI/GUI.hpp +++ b/xs/src/slic3r/GUI/GUI.hpp @@ -17,6 +17,7 @@ class PresetBundle; class PresetCollection; class AppConfig; class DynamicPrintConfig; +class TabIface; namespace GUI { @@ -36,6 +37,8 @@ void set_tab_panel(wxNotebook *tab_panel); void add_debug_menu(wxMenuBar *menu); // Create a new preset tab (print, filament and printer), void create_preset_tabs(PresetBundle *preset_bundle, AppConfig *app_config, int event_value_change, int event_presets_changed); +TabIface* get_preset_tab_iface(char *name); + // add it at the end of the tab panel. void add_created_tab(Tab* panel, PresetBundle *preset_bundle, AppConfig *app_config); // Change option value in config diff --git a/xs/xsp/GUI.xsp b/xs/xsp/GUI.xsp index b2f11f06f..ca3f17eaa 100644 --- a/xs/xsp/GUI.xsp +++ b/xs/xsp/GUI.xsp @@ -37,3 +37,6 @@ void add_debug_menu(SV *ui) void create_preset_tabs(PresetBundle *preset_bundle, AppConfig *app_config, int event_value_change, int event_presets_changed) %code%{ Slic3r::GUI::create_preset_tabs(preset_bundle, app_config, event_value_change, event_presets_changed); %}; + +Ref get_preset_tab(char *name) + %code%{ RETVAL=Slic3r::GUI::get_preset_tab_iface(name); %}; diff --git a/xs/xsp/my.map b/xs/xsp/my.map index ba4f52f46..ec95a8fbb 100644 --- a/xs/xsp/my.map +++ b/xs/xsp/my.map @@ -229,6 +229,8 @@ PresetBundle* O_OBJECT_SLIC3R Ref O_OBJECT_SLIC3R_T PresetHints* O_OBJECT_SLIC3R Ref O_OBJECT_SLIC3R_T +TabIface* O_OBJECT_SLIC3R +Ref O_OBJECT_SLIC3R_T Axis T_UV ExtrusionLoopRole T_UV diff --git a/xs/xsp/typemap.xspt b/xs/xsp/typemap.xspt index d6c74659c..0f2791ba2 100644 --- a/xs/xsp/typemap.xspt +++ b/xs/xsp/typemap.xspt @@ -207,6 +207,8 @@ %typemap{Ref}{simple}; %typemap{PresetHints*}; %typemap{Ref}{simple}; +%typemap{TabIface*}; +%typemap{Ref}{simple}; %typemap{PrintRegionPtrs*}; %typemap{PrintObjectPtrs*};