Bundle-PBib
view release on metacpan or search on metacpan
lib/PBibTk/Main.pm view on Meta::CPAN
#
# widgets
#
sub initWidgets {
my ($self, $win) = @_;
my $f2=$win;
my $cmd;
# biblio and paper frames
my $l3=$f2->LabFrame(-label => 'choose a Ref', -labelside => "acrosstop")->pack(qw/-expand yes -fill both -side bottom/); #myline
$self->{'chosenLabel'} = $l3; #myline
my $l1=$f2->LabFrame(-label => 'Biblio Refs', -labelside => "acrosstop")->pack(qw/-expand yes -fill both -side left/);
$self->{'refListLabel'} = $l1;
my $l2=$f2->LabFrame(-label => 'Paper Refs', -labelside => "acrosstop")->pack(qw/-expand yes -fill both -side right/);
$self->{'foundListLabel'} = $l2;
my $off = -100;
# biblio frame
my $list = $l1->Scrolled('Listbox',
-scrollbars => 'e',
-width => 32,
-height => 16,
)->form(
-t => ['%0',0],
-l => ['%0',0],
-r => ['%100',0],
-b => ['%100', $off]);
$self->{'refList'} = $list;
$cmd = [$self, 'showSelectedBiblioReference'];
$list->bind('<Return>' => $cmd);
$list->bind('<Double-Button-1>' => $cmd);
# $list->bind('<Button-1>' => [ $list, 'focus' ] ); #focus wird in updateExpandedSelectedBiblioReference ausgefuehrt
$list->bind('<Button-1>' => [$self, 'updateExpandedSelectedBiblioReference']);
$list->bind('<Up>' => [$self, 'selectionMove', $list, -1]);
$list->bind('<Down>' => [$self, 'selectionMove', $list, 1]);
$list->bind('<Control-Home>' => [$self, 'selectionMove', $list, 0]);
$list->bind('<Control-End>' => [$self, 'selectionMove', $list, 'end']);
for( my $c = ord('a'); $c <= ord('z'); $c++ ) {
# $win->bind(('<Key-' . chr($c) . '>') => [$self, 'keyPressed', Ev('A'), Ev('s')]);
$list->bind(('<Key-' . chr($c) . '>') => [$self, 'keyPressed', Ev('A'), Ev('s'), $list, 'refListIds']);
}
my $b1=$l1->Frame()->form(
-t => [$list,0],
-l => ['%0',0],
-r => ['%100',0],
-b => ['%100',0]);
my $bf1 = $b1->Frame()->pack(qw/-fill both -expand 1/);
# $bf1->Button(-text => "Update", -command => sub{$self->updateBiblioRefs()} )->pack();
$self->loadQueryHistory();
$cmd = [ $self, 'queryAuthor' ];
# $bf1->Button(-text => "Query Author", -command => $cmd )->pack(qw/-side left/);
$list = $bf1->BrowseEntry(-label => "Author",
-variable => \$queryAuthorItem,
-choices => \@queryAuthorHistory,
# -listcmd => sub { print "popup list"; },
-browsecmd => $cmd,
)->pack(qw/-side top/);
$list->bind('<Return>' => $cmd);
$self->{'queryAuthorList'} = $list;
# $list->PrintConfig();
$cmd = [ $self, 'queryKeyword' ];
# $bf1->Button(-text => "Query Keyword", -command => $cmd )->pack(qw/-side left/);
$list = $bf1->BrowseEntry(-label => "Keyword",
-variable => \$queryKeywordItem,
-choices => \@queryKeywordHistory,
# -listcmd => sub { print "popup list"; },
-browsecmd => $cmd,
)->pack(qw/-side top/);
$list->bind('<Return>' => $cmd);
$self->{'queryKeywordList'} = $list;
$b1->Button(-text => "Quit", -command => sub{ Tk::exit(0); } )->pack(-side => 'bottom', -padx => 10);#myline "..right', -padx => 10.." statt "..bottom.."
# paper frame
$list = $l2->Scrolled('Listbox',
-scrollbars => 'e',
-width => 48,
-height => 16,
)->form(
-t => ['%0',0],
-l => ['%0',0],
-r => ['%100',0],
-b => ['%100', $off]);
$self->{'foundList'} = $list;
$cmd = [$self, 'showSelectedPaperReference'];
$list->bind('<Return>' => $cmd);
$list->bind('<Double-Button-1>' => $cmd);
# $list->bind('<Button-1>' => [ $list, 'focus' ] ); #focus wird in updateExpandedSelectedBiblioReference ausgefuehrt
$list->bind('<Button-1>' => [$self, 'updateExpandedSelectedPaperReference']); #myline
$list->bind('<Up>' => [$self, 'selectionMove', $list, -1]);
$list->bind('<Down>' => [$self, 'selectionMove', $list, 1]);
$list->bind('<Control-Home>' => [$self, 'selectionMove', $list, 0]);
$list->bind('<Control-End>' => [$self, 'selectionMove', $list, 'end']);
for( my $c = ord('a'); $c <= ord('z'); $c++ ) {
# $win->bind(('<Key-' . chr($c) . '>') => [$self, 'keyPressed', Ev('A'), Ev('s')]);
$list->bind(('<Key-' . chr($c) . '>') => [$self, 'keyPressed', Ev('A'), Ev('s'), $list, 'foundListIds']);
}
my $b2=$l2->Frame()->form(
-t => [$list,0],
-l => ['%0',0],
-r => ['%100',0],
-b => ['%100',0]);
$b2->LabEntry(-label => "File: ",
-labelPack => [-side => "left", -anchor => "w"],
# -width => 20,
-textvariable => \$filename)->pack(-expand => 1, -fill => 'x');
my $bf2 = $b2->Frame()->pack();
$bf2->Button(-text => "Browse", -command => sub{$self->browsePaperFile()} )->pack(qw/-side left/);
$bf2->Button(-text => "Edit", -command => sub { openFile($filename); } )->pack(qw/-side left/);
$bf2->Button(-text => "Update", -command => sub{$self->readPaperFile()} )->pack(qw/-side left/);
$bf2->Button(-text => "Process", -command => [ $self, 'processPaperFile' ] )->pack(qw/-side left/);
# $bf2->Button(-text => "Write newrefs.txt", -command => sub{$self->writeNewRefs()})->pack();
#myline runter ---------------------------------------------------
# chosen frame
$list = $l3->Scrolled('TextUndo',
-scrollbars => 'se',
-wrap => 'word',
-setgrid => 'true',
-exportselection => 'true',
-height => 6,
)->form(
-t => ['%0',0],
( run in 0.785 second using v1.01-cache-2.11-cpan-364913b4093 )