Reposition of Slic3r::GUI::ProgressStatusBar fields are only needed in ::OnSize()

This commit is contained in:
Henrik Brix Andersen 2012-07-11 16:55:47 +02:00
parent 5e5dc02016
commit 500e44f8ea

View File

@ -196,7 +196,6 @@ sub new {
$self->SetFieldsCount(3); $self->SetFieldsCount(3);
$self->SetStatusWidths(-1, 150, 155); $self->SetStatusWidths(-1, 150, 155);
Wx::Event::EVT_IDLE($self, sub { $self->_Reposition });
Wx::Event::EVT_TIMER($self, \&OnTimer, $self->{timer}); Wx::Event::EVT_TIMER($self, \&OnTimer, $self->{timer});
Wx::Event::EVT_SIZE($self, \&OnSize); Wx::Event::EVT_SIZE($self, \&OnSize);
Wx::Event::EVT_BUTTON($self, $self->{cancelbutton}, sub { Wx::Event::EVT_BUTTON($self, $self->{cancelbutton}, sub {
@ -212,8 +211,8 @@ sub DESTROY {
$self->{timer}->Stop if $self->{timer} && $self->{timer}->IsRunning; $self->{timer}->Stop if $self->{timer} && $self->{timer}->IsRunning;
} }
sub _Reposition { sub OnSize {
my $self = shift; my ($self, $event) = @_;
my %fields = ( my %fields = (
# 0 is reserved for status text # 0 is reserved for status text
@ -228,12 +227,7 @@ sub _Reposition {
$fields{$_}->Move($pos); $fields{$_}->Move($pos);
$fields{$_}->SetSize($rect->GetWidth - $offset, $rect->GetHeight); $fields{$_}->SetSize($rect->GetWidth - $offset, $rect->GetHeight);
} }
}
sub OnSize {
my ($self, $event) = @_;
$self->_Reposition;
$event->Skip; $event->Skip;
} }
@ -293,7 +287,6 @@ sub ShowProgress {
my $self = shift; my $self = shift;
my ($show) = @_; my ($show) = @_;
$self->_Reposition;
$self->{prog}->Show($show); $self->{prog}->Show($show);
$self->{prog}->Pulse; $self->{prog}->Pulse;
} }
@ -303,7 +296,6 @@ sub StartBusy {
my $rate = shift || 100; my $rate = shift || 100;
$self->{_busy} = 1; $self->{_busy} = 1;
$self->_Reposition;
$self->ShowProgress(1); $self->ShowProgress(1);
if (!$self->{timer}->IsRunning) { if (!$self->{timer}->IsRunning) {
$self->{timer}->Start($rate); $self->{timer}->Start($rate);