diff options
author | bubnikv <bubnikv@gmail.com> | 2017-12-04 12:48:40 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2017-12-04 12:48:40 +0300 |
commit | 8af329e660904653f210e959d73ae4269b5a459c (patch) | |
tree | d078c2d2a33ce917d676de1eb8d1414bb6dc4f3c /lib | |
parent | 16bd3fc62457221f84f211fe90df31382a601f48 (diff) |
Added Perl to C++ interfaces for creating the preset editor pages
from C++ and to add debugging menus from C++. These lightweigth
interfaces should help new team members to hack the UI without
a Perl knowledge.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Slic3r/GUI.pm | 1 | ||||
-rw-r--r-- | lib/Slic3r/GUI/MainFrame.pm | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index a8799c458..78e82a6ef 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -79,6 +79,7 @@ sub OnInit { # Windows: "C:\Users\username\AppData\Roaming\Slic3r" or "C:\Documents and Settings\username\Application Data\Slic3r" # Mac: "~/Library/Application Support/Slic3r" Slic3r::set_data_dir($datadir || Wx::StandardPaths::Get->GetUserDataDir); + Slic3r::GUI::set_wxapp($self); $self->{notifier} = Slic3r::GUI::Notifier->new; $self->{app_config} = Slic3r::GUI::AppConfig->new; diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index 2f93899a4..370bac2ed 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -22,6 +22,7 @@ sub new { my ($class, %params) = @_; my $self = $class->SUPER::new(undef, -1, $Slic3r::FORK_NAME . ' - ' . $Slic3r::VERSION, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE); + Slic3r::GUI::set_main_frame($self); if ($^O eq 'MSWin32') { # Load the icon either from the exe, or from the ico file. my $iconfile = Slic3r::decode_path($FindBin::Bin) . '\slic3r.exe'; @@ -92,6 +93,8 @@ sub _init_tabpanel { my ($self) = @_; $self->{tabpanel} = my $panel = Wx::Notebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxNB_TOP | wxTAB_TRAVERSAL); + Slic3r::GUI::set_tab_panel($panel); + EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{tabpanel}, sub { my $panel = $self->{tabpanel}->GetCurrentPage; $panel->OnActivate if $panel->can('OnActivate'); @@ -145,6 +148,9 @@ sub _init_tabpanel { $tab->load_current_preset; $panel->AddPage($tab, $tab->title); } + +#TODO this is an example of a Slic3r XS interface call to add a new preset editor page to the main view. +# Slic3r::GUI::create_preset_tab("print"); if ($self->{plater}) { $self->{plater}->on_select_preset(sub { @@ -330,6 +336,8 @@ sub _init_menubar { $menubar->Append($windowMenu, "&Window"); $menubar->Append($self->{viewMenu}, "&View") if $self->{viewMenu}; $menubar->Append($helpMenu, "&Help"); + # Add an optional debug menu. In production code, the add_debug_menu() call should do nothing. + Slic3r::GUI::add_debug_menu($menubar); $self->SetMenuBar($menubar); } } |