6 # Copyright (C) 2010 Red Hat Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 use Cwd qw(getcwd abs_path);
29 use Glib qw(TRUE FALSE);
37 techtalk-pse - superior technical demonstration software
41 cd /path/to/talk/; techtalk-pse
43 techtalk-pse /path/to/talk/
47 Tech Talk "Platinum Supreme Edition" (PSE) is Linux Presentation
48 Software designed by technical people to give technical software
49 demonstrations to other technical people. It is designed to be simple
50 to use (for people who know how to use an editor and the command line)
51 and powerful, so that you can create informative, technically accurate
52 and entertaining talks and demonstrations.
54 Tech Talk PSE is good at opening editors at the right place, opening
55 shell prompts with preloaded history, compiling and running things
56 during the demonstration, displaying text, photos, figures and video.
58 Tech Talk PSE is I<bad> at slide effects, chart junk and bullet
61 This manual page covers all the documentation you will need to use
62 Tech Talk PSE. The next section covers running the tool from the
63 command line. After that there is a L</TUTORIAL> section to get you
64 started. Then there is a detailed L</REFERENCE> section. Finally
65 there is a discussion on L<WHAT MAKES A GOOD TALK>.
67 =head1 RUNNING THE TOOL FROM THE COMMAND LINE
69 A Tech Talk PSE talk is not a single file, but a directory full of
70 files. (If you want to start a new talk, see the L</TUTORIAL> section
71 below). To display or run the talk, change into the directory
72 containing all those files and run the C<techtalk-pse> command:
74 cd /path/to/talk/; techtalk-pse
76 You can also run C<techtalk-pse> without changing directory, instead
77 specifying the path to the talk:
79 techtalk-pse /path/to/talk/
91 Display brief help and exit.
99 Start at the last slide.
101 You cannot use this with the B<-n> / B<--start> option.
107 =item B<-n SLIDE> | B<--start SLIDE>
109 Start at the named slide. I<SLIDE> is the shortest unique prefix of
110 the slide name, so to start at a slide named
111 I<00010-introduction.html>, you could use I<-n 00010> or I<-n 00010-intro>,
112 or give the full filename I<-n 00010-introduction.html>.
114 The default is to start at the first slide in the talk.
122 Don't display the initial "splash" screen which advertises Tech Talk
123 PSE to your audience. Just go straight into the talk.
131 Display verbose messages, useful for debugging or tracing
132 what the program is doing.
140 Display version number and exit.
146 GetOptions ("help|?" => \$help,
148 "mozembed" => \$mozembed,
150 "splash!" => \$splash,
151 "start=s" => \$start,
152 "verbose" => \$verbose,
153 "version" => \$version,
160 pod2usage (1) if $help;
162 print "@PACKAGE@ @VERSION@\n";
165 die "techtalk-pse: cannot use --start and --last options together\n"
166 if defined $last && defined $start;
168 # --mozembed runs Gtk2::MozEmbed as a subprocess, because MozEmbed
173 my $w = Gtk2::Window->new ();
174 my $vbox = Gtk2::VBox->new ();
175 my $moz = Gtk2::MozEmbed->new ();
176 my $bbox = Gtk2::HButtonBox->new ();
178 $vbox->pack_start ($bbox, 0, 0, 0);
181 #$w->set_default_size (640, 480);
184 $bbox->set_layout ('start');
185 my $bnext = Gtk2::Button->new ("Next slide");
186 $bnext->signal_connect (clicked => sub { $r = 0; Gtk2->main_quit });
189 my $bback = Gtk2::Button->new ("Back");
190 $bback->signal_connect (clicked => sub { $r = 1; Gtk2->main_quit });
193 my $bquit = Gtk2::Button->new ("Quit");
194 $bquit->signal_connect (clicked => sub { $r = 2; Gtk2->main_quit });
196 $bbox->set_child_secondary ($bquit, 1);
198 $w->signal_connect (delete_event => sub {
204 $moz->load_url ($ARGV[0]);
210 die "techtalk-pse: too many arguments\n" if @ARGV >= 2;
212 # Get the true name of the program.
219 chdir $d or die "techtalk-pse: chdir: $d: $!";
221 # XXX In future allow people to specify an archive and unpack
223 die "techtalk-pse: argument is not a directory"
236 foreach (glob ("*")) {
237 if (/^(\d+)([A-Z])?(?:-.*)\.(html|sh)$/) {
238 print STDERR "reading $_\n" if $verbose;
243 warn "techtalk-pse: $_: command file is not executable (+x)\n"
244 if $ext eq "sh" && ! -x $_;
246 my $h = { name => $_, seq => $1, pos => $2, ext => $3 };
250 $groups{$seq} = [] unless exists $groups{$seq};
251 push @{$groups{$seq}}, $h;
253 print STDERR "ignoring $_\n" if $verbose;
258 print STDERR "read ", 0+@files, " files\n" if $verbose;
260 warn "techtalk-pse: no files found, continuing anyway ...\n"
263 # Work out what slide we're starting on.
265 if (defined $current) {
266 die "start slide not implemented yet XXX"
269 $current = $files[0];
271 # else $current is undefined
274 my $w = Gtk2::AboutDialog->new;
275 $w->set_authors ("Richard W.M. Jones");
277 "Superior technical demonstration software\n".
280 "↑ — Go back one slide\n".
281 "↓ — Go forward one slide\n"
283 $w->set_program_name ("Tech Talk Platinum Supreme Edition (PSE)");
284 $w->set_version ("@VERSION@");
285 $w->set_website ("http://people.redhat.com/~rjones");
286 $w->set_license ("GNU General Public License v2 or above");
287 $w->signal_connect (destroy => sub { Gtk2->main_quit });
293 if (defined $current) {
294 my $go = show_slide ($current);
296 print STDERR "go = $go\n" if $verbose;
297 last MAIN if $go eq "QUIT";
302 last FOUND if $files[$i]->{name} eq $current->{name};
305 die "internal error: cannot find \$current in \@files"
307 print STDERR "found current entry at i = $i\n" if $verbose;
308 $i-- if $go eq "PREV" && $i > 0;
309 $i++ if $go eq "NEXT" && $i+1 < @files;
310 $current = $files[$i];
313 print "No slides found. Press any key to reload directory ...\n";
319 if (defined $current && !exists $files{$current->{name}}) {
320 # Current slide was deleted.
322 $current = $files[0] if @files;
329 if ($slide->{ext} eq "html") {
330 # MozEmbed is incredibly crashy, so we run ourself as a
331 # subprocess, so when it segfaults we don't care.
333 my $url = "file://" . $cwd . "/" . $slide->{name};
334 my @cmd = ($0, "--mozembed", $url);
336 die "failed to execute subcommand: $!\n" if $? == -1;
338 # Subcommand probably segfaulted, just continue to next slide.
351 elsif ($slide->{ext} eq "sh") {
352 system ("PATH=.:\$PATH " . $slide->{name});
363 =head1 WHAT MAKES A GOOD TALK
367 The Cognitive Style of PowerPoint, Tufte, Edward R.
371 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
375 Copyright (C) 2010 Red Hat Inc.
377 This program is free software; you can redistribute it and/or modify
378 it under the terms of the GNU General Public License as published by
379 the Free Software Foundation; either version 2 of the License, or
380 (at your option) any later version.
382 This program is distributed in the hope that it will be useful,
383 but WITHOUT ANY WARRANTY; without even the implied warranty of
384 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
385 GNU General Public License for more details.
387 You should have received a copy of the GNU General Public License
388 along with this program; if not, write to the Free Software
389 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.