Add menuitems with keyboard shortcuts to quickly navigate between tabs.

This commit is contained in:
Henrik Brix Andersen 2012-07-24 12:59:02 +02:00
parent 4dc41d2ca3
commit 4bee713579
2 changed files with 42 additions and 17 deletions

View File

@ -21,8 +21,14 @@ 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_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);
}

View File

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