diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index 5332eaae3..7a27a74fe 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -15,14 +15,20 @@ use Wx 0.9901 qw(:bitmap :dialog :frame :icon :id :misc :systemsettings); use Wx::Event qw(EVT_CLOSE EVT_MENU); use base 'Wx::App'; -use constant MI_LOAD_CONF => 1; -use constant MI_EXPORT_CONF => 2; -use constant MI_QUICK_SLICE => 3; -use constant MI_REPEAT_QUICK => 4; -use constant MI_QUICK_SAVE_AS => 5; -use constant MI_SLICE_SVG => 6; -use constant MI_CONF_WIZARD => 7; -use constant MI_WEBSITE => 8; +use constant MI_LOAD_CONF => 1; +use constant MI_EXPORT_CONF => 2; +use constant MI_QUICK_SLICE => 3; +use constant MI_REPEAT_QUICK => 4; +use constant MI_QUICK_SAVE_AS => 5; +use constant MI_SLICE_SVG => 6; + +use constant MI_TAB_PLATER => 7; +use constant MI_TAB_PRINT => 8; +use constant MI_TAB_FILAMENT => 9; +use constant MI_TAB_PRINTER => 10; + +use constant MI_CONF_WIZARD => 11; +use constant MI_WEBSITE => 12; our $datadir; @@ -91,6 +97,19 @@ sub OnInit { EVT_MENU($frame, wxID_EXIT, sub {$_[0]->Close(0)}); } + # Window menu + my $windowMenu = Wx::Menu->new; + { + $windowMenu->Append(MI_TAB_PLATER, "Select &Plater Tab\tCtrl+1", 'Show the plater'); + $windowMenu->Append(MI_TAB_PRINT, "Select P&rint Settings Tab\tCtrl+2", 'Show the print settings'); + $windowMenu->Append(MI_TAB_FILAMENT, "Select &Filament Settings Tab\tCtrl+3", 'Show the filament settings'); + $windowMenu->Append(MI_TAB_PRINTER, "Select Print&er Settings Tab\tCtrl+4", 'Show the printer settings'); + EVT_MENU($frame, MI_TAB_PLATER, sub { $self->{skeinpanel}->select_tab(0) }); + EVT_MENU($frame, MI_TAB_PRINT, sub { $self->{skeinpanel}->select_tab(1) }); + EVT_MENU($frame, MI_TAB_FILAMENT, sub { $self->{skeinpanel}->select_tab(2) }); + EVT_MENU($frame, MI_TAB_PRINTER, sub { $self->{skeinpanel}->select_tab(3) }); + } + # Help menu my $helpMenu = Wx::Menu->new; { @@ -108,6 +127,7 @@ sub OnInit { { my $menubar = Wx::MenuBar->new; $menubar->Append($fileMenu, "&File"); + $menubar->Append($windowMenu, "&Window"); $menubar->Append($helpMenu, "&Help"); $frame->SetMenuBar($menubar); } diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index 9773e7ad3..1fdef1508 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -20,19 +20,19 @@ sub new { my ($parent) = @_; my $self = $class->SUPER::new($parent, -1); - my $tabpanel = Wx::Notebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxNB_TOP); - $tabpanel->AddPage($self->{plater} = Slic3r::GUI::Plater->new($tabpanel), "Plater"); + $self->{tabpanel} = Wx::Notebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxNB_TOP); + $self->{tabpanel}->AddPage($self->{plater} = Slic3r::GUI::Plater->new($self->{tabpanel}), "Plater"); $self->{options_tabs} = { - print => Slic3r::GUI::Tab::Print->new ($tabpanel, sync_presets_with => $self->{plater}{preset_choosers}{print}), - filament => Slic3r::GUI::Tab::Filament->new ($tabpanel, sync_presets_with => $self->{plater}{preset_choosers}{filament}), - printer => Slic3r::GUI::Tab::Printer->new ($tabpanel, sync_presets_with => $self->{plater}{preset_choosers}{printer}), + print => Slic3r::GUI::Tab::Print->new ($self->{tabpanel}, sync_presets_with => $self->{plater}{preset_choosers}{print}), + filament => Slic3r::GUI::Tab::Filament->new ($self->{tabpanel}, sync_presets_with => $self->{plater}{preset_choosers}{filament}), + printer => Slic3r::GUI::Tab::Printer->new ($self->{tabpanel}, sync_presets_with => $self->{plater}{preset_choosers}{printer}), }; - $tabpanel->AddPage($self->{options_tabs}{print}, $self->{options_tabs}{print}->title); - $tabpanel->AddPage($self->{options_tabs}{filament}, $self->{options_tabs}{filament}->title); - $tabpanel->AddPage($self->{options_tabs}{printer}, $self->{options_tabs}{printer}->title); + $self->{tabpanel}->AddPage($self->{options_tabs}{print}, $self->{options_tabs}{print}->title); + $self->{tabpanel}->AddPage($self->{options_tabs}{filament}, $self->{options_tabs}{filament}->title); + $self->{tabpanel}->AddPage($self->{options_tabs}{printer}, $self->{options_tabs}{printer}->title); my $sizer = Wx::BoxSizer->new(wxVERTICAL); - $sizer->Add($tabpanel, 1, wxEXPAND); + $sizer->Add($self->{tabpanel}, 1, wxEXPAND); $sizer->SetSizeHints($self); $self->SetSizer($sizer); @@ -222,4 +222,9 @@ sub check_unsaved_changes { return 1; } +sub select_tab { + my ($self, $tab) = @_; + $self->{tabpanel}->ChangeSelection($tab); +} + 1;