Commit f6bec639 authored by Stefan Tauner's avatar Stefan Tauner
Browse files

fiji_scripts: set up window to accommodate a complete FIU row without scrolling

parent 65415550
......@@ -283,6 +283,28 @@ sub _fiu_cnt {
}
sub get_fiu_dimensions {
my $scrolled = $fr_fius->parent()->parent()->parent();
my $h = $fr_fius->height() + $scrolled->Subwidget('xscrollbar')->cget('width');
my $w = $fr_fius->width() + $scrolled->Subwidget('yscrollbar')->cget('width');
return ($w, $h);
}
sub append_fiu ($) {
my($self, $fiu) = @_;
$self->_add_fiu($fiu);
}
sub remove_fiu ($) {
my($self, $i) = @_;
$i = 0 if !defined($i);
splice(${$self->{'settings'}}->{'FIUs'}, $i, 1);
$self->update();
}
sub _add_fiu ($$) {
my($self, $fiu, $i) = @_;
if (!defined($i)) {
......@@ -371,10 +393,7 @@ sub _add_fiu ($$) {
# );
my $del_button = $fr_fius->Button(
-text => 'Delete',
-command => sub {
splice(${$self->{'settings'}}->{'FIUs'}, $i, 1);
$self->update();
},
-command => [\&remove_fiu, $self, $i],
);
$model_menu->configure(
'-command' => sub {
......
......@@ -66,8 +66,16 @@ sub main {
my $fiji_icon = $mw->Photo(-file => "$icon_base.png", -format => 'PNG');
$mw->iconimage($fiji_icon);
$self->{'FIJISettingsViewer'}->append_fiu(); # add dummy FIU for layouting purposes
$mw->update();
$mw->minsize($mw->width(), $mw->height());
my @fiu_dims = $self->{'FIJISettingsViewer'}->get_fiu_dimensions();
$mw->minsize(int($fiu_dims[0] + $fiu_dims[0] * 0.1), $mw->height());
$mw->geometry(sprintf("%dx%d", int($fiu_dims[0] + $fiu_dims[0] * 0.1), $mw->height()));
$self->{'FIJISettingsViewer'}->remove_fiu(0); # remove dummy again
$mw->update();
MainLoop;
$logger->trace("=== Stopping execution ===");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment