App-makebeamerinfo
view release on metacpan or search on metacpan
lib/App/makebeamerinfo/GUI.pm view on Meta::CPAN
# "Other options" items
$gui{'check'}{'collapse'} = $gui{'frame'}{'other_options'} -> Checkbutton(
-variable => \$self->{options}{collapse},
-onvalue => 1,
-offvalue => 0
) -> grid(-row => 1, -column=> 1);
$gui{'label'}{'collapse'} = $gui{'frame'}{'other_options'} -> Label(
-text => "Collapse automatically generated\noutline pages at the simultaneous\nstart of a section and a subsection"
) -> grid(-row => 1, -column=> 2);
# Populate custom transition tab
my @all = @App::makebeamerinfo::Transitions::All;
$gui{'label'}{'F1'} = $gui{'frame'}{'custom_transitions'} -> Label(
-text => 'F'
) -> grid(-row => 0, -column => 1);
$gui{'label'}{'I1'} = $gui{'frame'}{'custom_transitions'} -> Label(
-text => 'I'
) -> grid(-row => 0, -column => 2);
$gui{'label'}{'F2'} = $gui{'frame'}{'custom_transitions'} -> Label(
-text => 'F'
) -> grid(-row => 0, -column => 4);
$gui{'label'}{'I2'} = $gui{'frame'}{'custom_transitions'} -> Label(
-text => 'I'
) -> grid(-row => 0, -column => 5);
foreach my $trans (sort @all) {
# Create each transition selection element
$gui{'transitions'}{$trans}{'frame'} = $gui{'frame'}{'custom_transitions'} -> Checkbutton(
-variable => \$custom->{'frame'}{$trans},
-onvalue => 1,
-offvalue => 0
);
$gui{'transitions'}{$trans}{'increment'} = $gui{'frame'}{'custom_transitions'} -> Checkbutton(
-variable => \$custom->{'increment'}{$trans},
-onvalue => 1,
-offvalue => 0
);
$gui{'transitions'}{$trans}{'label'} = $gui{'frame'}{'custom_transitions'} -> Label(
-text => $trans
);
# Put each transition selection element into one of two columns
my $counter = keys %{ $gui{'transitions'} };
my $col;
my $row;
my $num = @all;
if ($counter <= $num / 2) {
$col = 1;
$row = $counter;
} else {
$col = 4;
$row = $counter - $num / 2;
}
$gui{'transitions'}{$trans}{'frame'} -> grid(-row => $row, -column => $col);
$gui{'transitions'}{$trans}{'increment'} -> grid(-row => $row, -column => $col + 1);
$gui{'transitions'}{$trans}{'label'} -> grid(-row => $row, -column => $col + 2);
}
return \%gui;
}
## callbacks for Tk window
sub getFile {
# read file type to get
my ($self, $file_type) = @_;
my $other_type = ($file_type eq 'pdf') ? 'nav' : 'pdf';
# setup file dialog available filetypes
my %types = (
nav =>
[
["Nav Files", '.nav', 'TEXT'],
["All Files", "*"]
],
pdf =>
[
["Pdf Files", '.pdf', 'PDF'],
["All Files", "*"]
]
);
# open file dialog and get full filename
$self->{files}{$file_type} = $self->{gui}{'mw'} -> getOpenFile(-filetypes => \@{ $types{$file_type} });
#if the other file isn't known, try to find it
unless ( $self->{files}{$other_type} ) {
$self->{files}{$other_type} = $self->findFile($self->{files}{$file_type});
}
}
sub clearFile {
my ($self, $file_type) = @_;
$self->{files}{$file_type} = '';
}
1;
( run in 0.614 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )