Bundle-PBib
view release on metacpan or search on metacpan
lib/PBibTk/Main.pm view on Meta::CPAN
$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],
-l => ['%0',0],
-r => ['%100',0],
-b => ['%100', 0]);
$self->{'chosenfromlist'} = $list;
my $b3=$l3->Frame()->form(
-t => [$list,0],
-l => ['%0',0],
-r => ['%100',0],
-b => ['%100',0]);
my $bf3 = $b3->Frame()->pack();
#myline hoch ---------------------------------------------------
# menu inside a menu frame
my $mf = $win->Menu(-type => 'menubar');
$win->configure(-menu => $mf);
$self->initMenu($mf, $win);
}
sub initMenu {
my ($self, $mf, $win) = @_;
$self->initFileMenu($mf, $win);
$self->initBiblioMenu($mf, $win);
$self->initPaperMenu($mf, $win);
}
sub initFileMenu {
my ($self, $mf, $win, $model) = @_;
my $cmd;
$model = $self unless defined $model;
my $mb = $mf->cascade(-label => '~File'); ###, -tearoff => 0);
$cmd = [ $model, 'browsePaperFile' ];
$mb->command(-label => "~Open New Paper", -command => $cmd,
-accelerator => 'Ctrl-O' );
$win->bind('<Control-Key-o>' => $cmd);
$mb->separator();
$cmd = [ $model, 'importBiblioRefs' ];
$mb->command(-label => "~Import References ...", -command => $cmd );
#$win->bind('<Control-w>' => $cmd);
$cmd = [ $model, 'exportBiblioRefs' ];
$mb->command(-label => "~Export References ...", -command => $cmd );
#$win->bind('<Control-w>' => $cmd);
$mb->separator();
$cmd = sub { Tk::exit(0); };
$mb->command(-label => '~Quit', -command => $cmd,
-accelerator => 'Ctrl-Q');
$win->bind('<Control-q>' => $cmd);
}
sub initBiblioMenu {
my ($self, $mf, $win, $model) = @_;
my $cmd;
$model = $self unless defined $model;
my $mb = $mf->cascade(-label => '~Biblio'); ###, -tearoff => 0);
# $cmd = sub { $model->showSelectedBiblioReference(); };
$cmd = [$model, 'showSelectedBiblioReference'];
$mb->command(-label => 'Show ~Reference', -command => $cmd,
-accelerator => 'Ctrl-R' );
$win->bind('<Control-r>' => $cmd);
# $win->bind('<Return>' => $cmd);
$cmd = [ $model, 'clipboardSelectedBiblioReferenceId'];
$mb->command(-label => '~Copy CiteKey to Clipboard', -command => $cmd,
-accelerator => 'Ctrl-C' );
$win->bind('<Control-c>' => $cmd);
$cmd = sub { $model->searchSelectedBiblioReferenceId(); };
$mb->command(-label => '~Search CiteKey in Paper', -command => $cmd,
-accelerator => 'Ctrl-J' );
$win->bind('<Control-j>' => $cmd);
$cmd = sub { $model->refList()->focus(); };
$mb->command(-label => 'Keyboardfocus to ~Biblio', -command => $cmd,
-accelerator => 'Ctrl-B' );
$win->bind('<Control-b>' => $cmd);
$mb->separator();
# $cmd = sub{$model->queryAuthor()}; # start search via menu
# better: set focus to queryAutor input field
$cmd = [ $model, 'entryFocusAndSelectAll',
$self->queryAuthorList() ];
$mb->command(-label => "Query ~Author", -command => $cmd,
-accelerator => 'Ctrl-A' );
$win->bind('<Control-a>' => $cmd);
#$cmd = sub{$model->queryKeyword()};
# instead of start query: set focus to keyword input field
$cmd = [ $model, 'entryFocusAndSelectAll',
$self->queryKeywordList(), ];
$mb->command(-label => "Query ~Keyword", -command => $cmd,
-accelerator => 'Ctrl-F' );
$win->bind('<Control-f>' => $cmd);
$mb->separator();
$cmd = sub{$model->updateBiblioRefs()};
$mb->command(-label => "~Update from database",
-command => $cmd,
-accelerator => 'Ctrl-N' );
$win->bind('<Control-n>' => $cmd);
}
sub initPaperMenu {
my ($self, $mf, $win) = @_;
my $cmd;
my $mb = $mf->cascade(-label => '~Paper');
$cmd = sub { $self->showSelectedPaperReference(); };
$mb->command(-label => 'Show ~Reference', -command => $cmd,
-accelerator => 'Ctrl-T' );
$win->bind('<Control-Key-t>' => $cmd);
$cmd = sub { $self->clipboardSelectedPaperReferenceId(); };
$mb->command(-label => '~Copy CiteKey to Clipboard', -command => $cmd,
-accelerator => 'Ctrl-X' );
$win->bind('<Control-Key-x>' => $cmd);
$cmd = sub { $self->searchSelectedPaperReferenceId(); };
$mb->command(-label => '~Search CiteKey in Paper', -command => $cmd,
-accelerator => 'Ctrl-G' );
$win->bind('<Control-Key-g>' => $cmd);
$cmd = sub { $self->foundList()->focus(); };
$mb->command(-label => 'Keyboardfocus to ~Paper', -command => $cmd,
-accelerator => 'Ctrl-P' );
$win->bind('<Control-p>' => $cmd);
$mb->separator();
$cmd = sub { openFile($filename); };
$mb->command(-label => '~Edit Paper', -command => $cmd,
-accelerator => 'Ctrl-E' );
$win->bind('<Control-Key-e>' => $cmd);
$mb->separator();
$mb->command(-label => "Read & ~Analyze Paper", -command => [ $self, 'readPaperFile' ]);
$cmd = [ $self, 'processPaperFile' ];
$mb->command(-label => "Pr~ocess Paper",
-command => $cmd,
-accelerator => 'Ctrl-S' );
$win->bind('<Control-Key-s>' => $cmd);
$mb->command(-label => "~Write newrefs file", -command => [$self => 'writeNewRefs']);
}
sub refList {
my $self = shift;
# access window first, to ensure it's created.
$self->window();
return $self->{'refList'};
}
sub foundList {
my $self = shift;
# access window first, to ensure it's created.
$self->window();
return $self->{'foundList'};
}
sub queryAuthorList { return shift->{'queryAuthorList'}; }
sub queryKeywordList { return shift->{'queryKeywordList'}; }
sub chosenLabel { my $self = shift; return $self->{'chosenLabel'}; }
sub refListLabel { my $self = shift; return $self->{'refListLabel'}; }
sub foundListLabel { my $self = shift; return $self->{'foundListLabel'}; }
sub refListSelection { my $self = shift; return $self->refList()->curselection(); }
sub foundListSelection { my $self = shift; return $self->foundList()->curselection(); }
( run in 0.526 second using v1.01-cache-2.11-cpan-56fb94df46f )