Update of /cvsroot/opendemo/opendemo/tools/odcut
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9795
Modified Files:
OdGui.pm
Log Message:
implement help window
eliminate double help
help window start takes much too long
Index: OdGui.pm
===================================================================
RCS file: /cvsroot/opendemo/opendemo/tools/odcut/OdGui.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OdGui.pm 9 Feb 2005 18:12:11 -0000 1.5
--- OdGui.pm 9 Feb 2005 19:44:45 -0000 1.6
***************
*** 12,15 ****
--- 12,16 ----
use Cwd qw(getcwd);
use File::Basename qw(fileparse);
+ use IO::File;
sub new
***************
*** 38,41 ****
--- 39,43 ----
EVT_MENU($self,5,\&OnExit);
EVT_MENU($self,21,\&OnAboutStart);
+ EVT_MENU($self,22,\&OnHelp);
EVT_CLOSE($self,\&OnClose);
***************
*** 365,368 ****
--- 367,371 ----
}
+
sub OnAboutStart($)
{
***************
*** 373,376 ****
--- 376,426 ----
}
+
+ sub OnHelp($)
+ {
+ my $self = shift;
+ if (!exists $self->{helpFrame}) {
+
+ # $self->{helpFrame} = OdGuiHelpFrame->new($self);
+ $self->{helpFrame} = Wx::Frame->new($self, -1, "Help - OpenDemo Cutter");
+
+ # EVT_BUTTON($self->{helpFrame},$self->{helpFrame}->{helpClose},\&OnHelpClose);
+ EVT_CLOSE($self->{helpFrame},\&OnHelpClose);
+
+ # my $html_window = Wx::HtmlWindow->new($self->{helpFrame}->{helpPanel}, -1);
+ my $html_window = Wx::HtmlWindow->new($self->{helpFrame}, -1);
+
+ # TODO It would be more portable, if Pod::Html would be used directly.
+ # The current solution involves pipe redirecting and forking some
+ # external program, which may not be available on all system.
+ # my $parser = new Pod::Html();
+ # $parser->parse_from_file($0);
+ my $command = "pod2html $0";
+ my $fh = IO::File->new("$command|");
+ if ($fh) {
+ while (<$fh>) {
+ $html_window->AppendToPage($_);
+ }
+ $fh->close();
+ }
+ else {
+ $html_window->SetPage("<html><body>Could not call $command:<br>$!.</body></html>");
+ }
+ }
+
+ $self->{helpFrame}->Show(1);
+
+ }
+
+
+ sub OnHelpClose($)
+ {
+ my $help = shift;
+ $help->Show(0);
+ delete $help->GetParent()->{helpFrame};
+ $help->Destroy();
+ }
+
+
sub OnClose
{
|