Added TabIface C++ wrapper for GUI::Tab C++ class,

exported the TabIface to Perl.
This commit is contained in:
bubnikv 2018-01-23 11:37:19 +01:00
parent 1d10a2293a
commit 09c9f6bdc3
9 changed files with 33 additions and 0 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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)
{

View File

@ -33,6 +33,7 @@
#include <wx/window.h>
#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<Tab*>(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{

View File

@ -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

View File

@ -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<TabIface> get_preset_tab(char *name)
%code%{ RETVAL=Slic3r::GUI::get_preset_tab_iface(name); %};

View File

@ -229,6 +229,8 @@ PresetBundle* O_OBJECT_SLIC3R
Ref<PresetBundle> O_OBJECT_SLIC3R_T
PresetHints* O_OBJECT_SLIC3R
Ref<PresetHints> O_OBJECT_SLIC3R_T
TabIface* O_OBJECT_SLIC3R
Ref<TabIface> O_OBJECT_SLIC3R_T
Axis T_UV
ExtrusionLoopRole T_UV

View File

@ -207,6 +207,8 @@
%typemap{Ref<PresetBundle>}{simple};
%typemap{PresetHints*};
%typemap{Ref<PresetHints>}{simple};
%typemap{TabIface*};
%typemap{Ref<TabIface>}{simple};
%typemap{PrintRegionPtrs*};
%typemap{PrintObjectPtrs*};