Remember window size and position. #1253 #2251

This commit is contained in:
Alessandro Ranellucci 2014-12-08 22:05:26 +01:00
parent d350241da3
commit 80c38b0113

View File

@ -38,16 +38,6 @@ sub new {
$self->{loaded} = 1; $self->{loaded} = 1;
# declare events
EVT_CLOSE($self, sub {
my (undef, $event) = @_;
if ($event->CanVeto && !$self->check_unsaved_changes) {
$event->Veto;
return;
}
$event->Skip;
});
# initialize layout # initialize layout
{ {
my $sizer = Wx::BoxSizer->new(wxVERTICAL); my $sizer = Wx::BoxSizer->new(wxVERTICAL);
@ -56,11 +46,36 @@ sub new {
$self->SetSizer($sizer); $self->SetSizer($sizer);
$self->Fit; $self->Fit;
$self->SetMinSize([760, 490]); $self->SetMinSize([760, 490]);
$self->SetSize($self->GetMinSize); if (defined $Slic3r::GUI::Settings->{_}{main_frame_size}) {
$self->SetSize([ split ',', $Slic3r::GUI::Settings->{_}{main_frame_size}, 2 ]);
$self->Move([ split ',', $Slic3r::GUI::Settings->{_}{main_frame_pos}, 2 ]);
$self->Maximize(1) if $Slic3r::GUI::Settings->{_}{main_frame_maximized};
} else {
$self->SetSize($self->GetMinSize);
}
$self->Show; $self->Show;
$self->Layout; $self->Layout;
} }
# declare events
EVT_CLOSE($self, sub {
my (undef, $event) = @_;
if ($event->CanVeto && !$self->check_unsaved_changes) {
$event->Veto;
return;
}
# save window size
$Slic3r::GUI::Settings->{_}{main_frame_pos} = join ',', $self->GetScreenPositionXY;
$Slic3r::GUI::Settings->{_}{main_frame_size} = join ',', $self->GetSizeWH;
$Slic3r::GUI::Settings->{_}{main_frame_maximized} = $self->IsMaximized;
wxTheApp->save_settings;
# propagate event
$event->Skip;
});
return $self; return $self;
} }