diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index 57729ad9d..cb3426f80 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -38,16 +38,6 @@ sub new { $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 { my $sizer = Wx::BoxSizer->new(wxVERTICAL); @@ -56,11 +46,36 @@ sub new { $self->SetSizer($sizer); $self->Fit; $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->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; }