Restore the (modified) label in preset comboctrl

This commit is contained in:
Alessandro Ranellucci 2015-06-01 23:34:04 +02:00
parent 1fcfdf4718
commit c2c321c90b
2 changed files with 14 additions and 5 deletions

View file

@ -437,7 +437,7 @@ sub GetFrame {
sub update_presets {
my $self = shift;
my ($group, $presets, $selected) = @_;
my ($group, $presets, $selected, $is_dirty) = @_;
foreach my $choice (@{ $self->{preset_choosers}{$group} }) {
my $sel = $choice->GetSelection;
@ -463,7 +463,13 @@ sub update_presets {
}
$choice->AppendString($preset->name, $bitmap);
}
$choice->SetSelection($sel) if $sel <= $#$presets;
if ($sel <= $#$presets) {
$choice->SetSelection($sel);
if ($is_dirty) {
$choice->SetString($sel, $choice->GetString($sel) . " (modified)");
}
}
}
$self->{preset_choosers}{$group}[0]->SetSelection($selected);
}

View file

@ -180,8 +180,11 @@ sub _update {}
sub _on_presets_changed {
my $self = shift;
$self->{on_presets_changed}->($self->{presets}, $self->{presets_choice}->GetSelection)
if $self->{on_presets_changed};
$self->{on_presets_changed}->(
$self->{presets},
scalar($self->{presets_choice}->GetSelection),
$self->is_dirty,
) if $self->{on_presets_changed};
}
sub on_preset_loaded {}
@ -1043,10 +1046,10 @@ sub build {
$optgroup->on_change(sub {
my ($opt_id) = @_;
if ($opt_id eq 'extruders_count') {
$self->update_dirty;
wxTheApp->CallAfter(sub {
$self->_extruders_count_changed($optgroup->get_value('extruders_count'));
});
$self->update_dirty;
}
});
}