Remove label for large text fields

This commit is contained in:
Alessandro Ranellucci 2012-06-17 23:24:10 +02:00
parent ce9fdbc047
commit b7983b54f8
3 changed files with 35 additions and 16 deletions

View file

@ -18,22 +18,25 @@ sub new {
my $box = Wx::StaticBox->new($parent, -1, $p{title});
my $self = $class->SUPER::new($box, wxVERTICAL);
my $grid_sizer = Wx::FlexGridSizer->new(scalar(@{$p{options}}), 2, 2, 0);
my $grid_sizer = Wx::FlexGridSizer->new(scalar(@{$p{options}}), 2, ($p{no_labels} ? 1 : 2), 0);
#grab the default font, to fix Windows font issues/keep things consistent
# grab the default font, to fix Windows font issues/keep things consistent
my $bold_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
$bold_font->SetWeight(&Wx::wxFONTWEIGHT_BOLD);
foreach my $opt_key (@{$p{options}}) {
my $opt = $Slic3r::Config::Options->{$opt_key};
my $label = Wx::StaticText->new($parent, -1, "$opt->{label}:", Wx::wxDefaultPosition,
[$p{label_width} || 180, -1]);
$label->Wrap($p{label_width} || 180); # needed to avoid Linux/GTK bug
my $label;
if (!$p{no_labels}) {
$label = Wx::StaticText->new($parent, -1, "$opt->{label}:", Wx::wxDefaultPosition, [$p{label_width} || 180, -1]);
$label->Wrap($p{label_width} || 180) ; # needed to avoid Linux/GTK bug
$grid_sizer->Add($label);
# set the bold font point size to the same size as all the other labels (for consistency)
$bold_font->SetPointSize($label->GetFont()->GetPointSize());
$label->SetFont($bold_font) if $opt->{important};
}
#set the bold font point size to the same size as all the other labels (for consistency)
$bold_font->SetPointSize($label->GetFont()->GetPointSize());
$label->SetFont($bold_font) if $opt->{important};
my $field;
if ($opt->{type} =~ /^(i|f|s|s@)$/) {
my $style = 0;
@ -92,7 +95,7 @@ sub new {
} else {
die "Unsupported option type: " . $opt->{type};
}
$grid_sizer->Add($_) for $label, $field;
$grid_sizer->Add($field);
$fields{$opt_key} ||= [$field];
}