2000-03-01 01:08:07 +00:00
#!/usr/bin/perl
2000-07-07 14:44:26 +00:00
# menuhack: Modifies the tasks menu to insert XMLterm as a menu item
2000-03-01 01:08:07 +00:00
# Execute in the mozilla "package" directory
#
# NOTE: ** This is temporary hack until the chrome registry becomes
# available. Do not use it if you build mozilla yourself, as it
# messes up the important "tasksOverlay.xul" file.
# (Unless you know what you are doing, of course, in which case
# you may execute it in your "mozilla/dist/bin" directory.)
# Usage: menuhack
use Cwd;
# Locate taskOverlay.xul file
my $dir = cwd();
($dir =~ m%.*/(package|dist/bin)%) or
die "menuhack: Please execute in the package or dist/bin directory\n";
chdir "chrome/global/content/default"
or die "menuhack: Directory chrome/global/content/default not found\n";
my $menufile = "tasksOverlay.xul";
# Insert XMLterm menu item into file
open INFILE, "<$menufile" or die "menuhack: Unable to read $menufile\n";
open OUTFILE, ">$menufile.new" or die "menuhack: Unable to create $menufile.new\n";
while (<INFILE>) {
print OUTFILE unless m/XMLterm/;
2000-05-03 14:42:34 +00:00
if (s%(.*)"&editorCmd.label;"(.*)"toEditor\(\);"%$1"XMLterm" $2"window.open('chrome://xmlterm/content/xmlterm.xul','_blank','chrome,dialog=no,resizable');"%) {
2000-03-01 01:08:07 +00:00
print OUTFILE;
}
}
2000-03-07 15:45:16 +00:00
close INFILE;
close OUTFILE;
2000-03-01 01:08:07 +00:00
rename $menufile, "$menufile.bak";
rename "$menufile.new", $menufile;
print "Modified tasksOverlay.xul to display XMLterm item\n";