From bc1e33c0b7036eef4fb32d0c29105cb781b3b604 Mon Sep 17 00:00:00 2001 From: "svn%xmlterm.org" Date: Tue, 21 Mar 2000 14:26:59 +0000 Subject: [PATCH] xmlterm changes only; UI changes. If user has started typing in a new command, double-clicking a filename copies the filename to the cursor position, rather than opening/executing the file. git-svn-id: svn://10.0.0.236/trunk@63583 18797224-902f-48f8-a5cc-f745e15eee43 --- .../xmlterm/base/mozXMLTermSession.cpp | 2 +- .../extensions/xmlterm/doc/INSTALL.xmlterm | 43 +++--- mozilla/extensions/xmlterm/scripts/xcat | 7 +- mozilla/extensions/xmlterm/scripts/xls | 42 +++--- .../xmlterm/ui/content/XMLTermCommands.js | 127 +++++++++++++----- .../extensions/xmlterm/ui/skin/Makefile.in | 1 + .../xmlterm/ui/skin/images/wheel.gif | Bin 0 -> 185 bytes 7 files changed, 132 insertions(+), 90 deletions(-) create mode 100644 mozilla/extensions/xmlterm/ui/skin/images/wheel.gif diff --git a/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp b/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp index c84fa84cb21..60573298aae 100644 --- a/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp +++ b/mozilla/extensions/xmlterm/base/mozXMLTermSession.cpp @@ -3098,7 +3098,7 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt) imgElement->SetAttribute(attName, attValue); attName = "src"; - attValue = "chrome://editor/skin/images/preview.gif"; + attValue = "chrome://xmlterm/skin/images/wheel.gif"; imgElement->SetAttribute(attName, attValue); attName = "align"; diff --git a/mozilla/extensions/xmlterm/doc/INSTALL.xmlterm b/mozilla/extensions/xmlterm/doc/INSTALL.xmlterm index df6d85608c7..81066cb0d9e 100644 --- a/mozilla/extensions/xmlterm/doc/INSTALL.xmlterm +++ b/mozilla/extensions/xmlterm/doc/INSTALL.xmlterm @@ -1,12 +1,16 @@ XMLterm installation instructions for Linux binaries ---------------------------------------------------- -*NOTE* This work in progress. User beware! +*NOTE 1* This is work in progress. User beware! -*NOTE* This plain text INSTALL file may be out date. Please check - for the most recent information. +*NOTE 2* If this file was already present in your "package" directory, + it means that xmlterm is included in your build! You don't need + to install it. Skip steps 1 & 2 and go directly to step 3. -15 Mar 2000 +*NOTE 3* This plain text INSTALL file may be out date. Please check + for the most recent information. + +20 Mar 2000 1. First obtain the Mozilla Linux binary tar file ftp://ftp.mozilla.org/pub/mozilla/releases/m14/mozilla-i686-pc-linux-gnu-M14.tar.gz" @@ -18,6 +22,11 @@ XMLterm installation instructions for Linux binaries 3. Type the following command in the "package" directory: + ./xmlterm + + "xmlterm" is shorthand for the following command, which you may also execute + directly + ./mozilla -chrome chrome://xmlterm/content/xmlterm.xul This should create an XMLTerm in the browser window. Then click on @@ -29,29 +38,11 @@ XMLterm installation instructions for Linux binaries "#$%>?", followed by a space. If this is not the case, many features will not work. This restriction will be relaxed in the future. -4. To use the stand-alone XMLterm executable called "xmlterm", - type the following command in the "package" directory: - - ./xmlterm - - "xmlterm" is shorthand for the following command, which you may also execute - directly - - ./mozilla -chrome chrome://xmlterm/content/xmlterm.xul - - The above command(s) should create an XMLterm window. Click on that window - with the mouse to give it focus and start typing UNIX commands. - - **NOTE** - The command prompt is assumed to be terminated by one of the characters - "#$%>?", followed by a space. If this is not the case, many features will - not work. This restriction will be relaxed in the future. - -5. The command line can be edited using EMACS-style key bindings. +4. The command line can be edited using EMACS-style key bindings. Command completion should also work with TCSH and BASH, as should history recall. -6. By default, blue coloring is used to indicate clickable display elements. +5. By default, blue coloring is used to indicate clickable display elements. Note that the prompt and the input command line are clickable. (Of course, the appearance of XMLterm is completely configurable using the CSS stylesheet chrome://xmlterm/skin/default/xmlterm.css) @@ -70,11 +61,11 @@ XMLterm installation instructions for Linux binaries profoundly affect your computing environment, depending upon what the command is. -7. The sample Perl script "xls", the iconic/hypertext version of the Unix "ls" +6. The sample Perl script "xls", the iconic/hypertext version of the Unix "ls" command, is in the "package" directory. Also in the "package" directory is "xcat", an XMLterm-aware version of the "cat" command. -8. To use XMLterm most efficiently, add the mozilla "package" directory +7. To use XMLterm most efficiently, add the mozilla "package" directory to your execution PATH variable by modifying your shell initialization file (.profile/.cshrc). This will enable you to use commands such as "xmlterm", "xls", and "xcat" easily. diff --git a/mozilla/extensions/xmlterm/scripts/xcat b/mozilla/extensions/xmlterm/scripts/xcat index 4b8dcf3dbf4..caa34432be8 100755 --- a/mozilla/extensions/xmlterm/scripts/xcat +++ b/mozilla/extensions/xmlterm/scripts/xcat @@ -92,6 +92,11 @@ foreach my $url (@ARGV) { # for each argument print ""; print "\000"; # Terminate HTML stream + } elsif (($scheme eq "file") && ($extension eq ".ps")) { +## print STDERR "PostScript local file\n"; + + system("ghostview $pathname&"); + } elsif (($scheme eq "file") && ($extension eq ".url")) { # URL open INFILE, $pathname or next; @@ -183,5 +188,3 @@ foreach my $url (@ARGV) { # for each argument next; } } - - diff --git a/mozilla/extensions/xmlterm/scripts/xls b/mozilla/extensions/xmlterm/scripts/xls index ae9c6fd1408..2a6b3aeb53c 100755 --- a/mozilla/extensions/xmlterm/scripts/xls +++ b/mozilla/extensions/xmlterm/scripts/xls @@ -1,16 +1,16 @@ #!/usr/bin/perl # xls: an XMLterm wrapper for the UNIX "ls" command -# Usage: xls [-c|--cols] [-h|help] [-t||--text] [-w|--window] +# Usage: xls [-c|--cols] [-h|help] [-t||--text] use Cwd; use Getopt::Long; Getopt::Long::config('bundling'); -&GetOptions("cols|c=i", "help|h!", "text|t!", "window|w!"); +&GetOptions("cols|c=i", "help|h!", "text|t!"); if ($opt_help) { - print "Usage: xls [-c|--cols] [-t||--text] [-w|--window] []\n"; + print "Usage: xls [-c|--cols] [-t||--text] []\n"; exit; } @@ -53,40 +53,36 @@ foreach $file (@filelist) { # for each file in the list my ($filename, $extension) = ($1, $2); - my $sendcmd; - if ($opt_window) { - $sendcmd = "exec"; - } else { - $sendcmd = "execwin"; - } + my ($filetype, $fileimg, $sendcmd, $sendtxt1, $sendtxt2); - my ($filetype, $fileimg, $sendtxt1, $sendtxt2); + $sendtxt1 = $file; + if ($dir eq "/") { + $sendtxt2 = "/"; + } else { + $sendtxt2 = "$dir/"; + } if (-d $file) { # directory $filetype = "directory"; $fileimg = "$imgdir/$img{$filetype}"; - $sendtxt1 = "cd $dir/$file; xls"; - $sendtxt2 = "cd $file; xls"; + $sendcmd = "cdxls"; } elsif (-x $file) { # executable $filetype = "executable"; $fileimg = "$imgdir/$img{$filetype}"; - $sendtxt1 = "$dir/$file"; - $sendtxt2 = "./$file"; + $sendcmd = "exec"; } elsif (($extension eq ".gif") || ($extension eq ".png") || ($extension eq ".jpg")) { # image $filetype = "imagefile"; $fileimg = "file://$dir/$file"; - $sendtxt1 = "xcat $dir/$file"; - $sendtxt2 = "xcat $file"; + $sendcmd = "xcat"; } elsif ($extension eq ".ps") { # postscript $filetype = "plainfile"; $fileimg = "$imgdir/$img{$filetype}"; - $sendtxt1 = "ghostview $dir/$file &"; - $sendtxt2 = "ghostview $file &"; + $sendcmd = "xcat"; } elsif ($extension eq ".url") { # URL open INFILE, $file or next; @@ -119,6 +115,8 @@ foreach $file (@filelist) { # for each file in the list $urldesc = $urlstr if !$urldesc; $sendcmd = "textlink"; # override send command + $sendtxt1 = "$urlstr"; + $sendtxt2 = "$urlstr"; $filetype = "urlfile"; if ($nurl >= 2) { @@ -126,20 +124,16 @@ foreach $file (@filelist) { # for each file in the list } else { $fileimg = "$imgdir/$img{$filetype}"; #default URL icon } - $sendtxt1 = "$urlstr"; - $sendtxt2 = "$urlstr"; } else { $filetype = "plainfile"; $fileimg = "$imgdir/$img{$filetype}"; - $sendtxt1 = "xcat $dir/$file"; - $sendtxt2 = "xcat $file"; + $sendcmd = "xcat"; } } else { # plain file $filetype = "plainfile"; $fileimg = "$imgdir/$img{$filetype}"; - $sendtxt1 = "xcat $dir/$file"; - $sendtxt2 = "xcat $file"; + $sendcmd = "xcat"; } my @comps = split(m./.,$file); diff --git a/mozilla/extensions/xmlterm/ui/content/XMLTermCommands.js b/mozilla/extensions/xmlterm/ui/content/XMLTermCommands.js index 9dd14e77d3e..d2c6cbee17c 100644 --- a/mozilla/extensions/xmlterm/ui/content/XMLTermCommands.js +++ b/mozilla/extensions/xmlterm/ui/content/XMLTermCommands.js @@ -145,16 +145,24 @@ function F9Key(isShift, isControl) { function ScrollHomeKey(isShift, isControl) { dump("ScrollHomeKey("+isShift+","+isControl+")\n"); - ScrollWin(isShift,isControl).scroll(0,0); - return false; + if (isControl) { + return F1Key(isShift, 0); + } else { + ScrollWin(isShift,isControl).scroll(0,0); + return false; + } } // Scroll End key function ScrollEndKey(isShift, isControl) { dump("ScrollEndKey("+isShift+","+isControl+")\n"); - ScrollWin(isShift,isControl).scroll(0,99999); - return false; + if (isControl) { + return F2Key(isShift, 0); + } else { + ScrollWin(isShift,isControl).scroll(0,99999); + return false; + } } // Scroll PageUp key @@ -358,9 +366,12 @@ function DisplayAllOutput(flag) { // textlink - hyperlink // prompt - command prompt // command - command line -// execwin - execute command with sendln/createln (doubleclick) -// (depending upon window.windowsMode) -// exec - execute command with sendln only (doubleclick) +// +// (Following are inline or in new window depending upon window.windowsMode) +// cdxls - change directory and list contents (doubleclick) +// xcat - display file (doubleclick) +// exec - execute file (doubleclick) +// // send - transmit arg to LineTerm // sendln - transmit arg+newline to LineTerm // createln - transmit arg+newline as first command to new XMLTerm @@ -368,9 +379,9 @@ function DisplayAllOutput(flag) { // entryNumber: >=0 means process only if current entry // <0 means process anytime // -// arg1: command/pathname string (without newline) -// arg2: alternate command line (for use in current entry only; -// uses relative pathnames assuming current working directory) +// arg1: relative pathname of file/directory +// arg2: absolute pathname prefix (for use outside current entry; +// use relative pathname in current working directory) // function HandleEvent(eventObj, eventType, targetType, entryNumber, arg1, arg2) { @@ -413,12 +424,32 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber, // Use single click for "selection" and prompt expansion only // Windows-style + var currentEntryNumber = window.xmlterm.currentEntryNumber; + + var currentCmdElement = document.getElementById("command"+currentEntryNumber); + var currentCommandEmpty = true; + if (currentCmdElement && currentCmdElement.hasChildNodes()) { + + if (currentCmdElement.firstChild.nodeType == Node.TEXT_NODE) { + //dump("textLength = "+currentCmdElement.firstChild.data.length+"\n"); + currentCommandEmpty = (currentCmdElement.firstChild.data.length == 0); + + } else { + currentCommandEmpty = false; + } + } + //dump("empty = "+currentCommandEmpty+"\n"); + if (targetType === "command") { if (!dblClick) return false; var commandElement = document.getElementById(targetType+entryNumber); var command = commandElement.firstChild.data; - window.xmlterm.SendText("\025"+command+"\n", document.cookie); + if (currentCommandEmpty) { + window.xmlterm.SendText("\025"+command+"\n", document.cookie); + } else { + window.xmlterm.SendText(command, document.cookie); + } } else { // Targets which may be qualified only for current entry @@ -429,52 +460,74 @@ function HandleEvent(eventObj, eventType, targetType, entryNumber, return (false); } - var action; + var action, sendStr; + + if ( (targetType === "cdxls") || + (targetType === "xcat") || + (targetType === "exec") ) { + // Complex commands - if (targetType === "execwin") { - // Execute command; inline or in a new window if (!dblClick) return false; - if (window.windowsMode === "on") { - action = "createln"; + var filename; + var isCurrentCommand = (Math.abs(entryNumber)+1 == + window.xmlterm.currentEntryNumber); + + if (!isCurrentCommand && (arg2 != null)) { + filename = arg2+arg1; } else { - action = "sendln"; + filename = arg1; + if (targetType === "exec") + filename = "./"+filename; } - } else if (targetType === "exec") { - // Execute command inline - if (!dblClick) - return false; + var prefix, suffix; + if (targetType === "cdxls") { + // Change directory and list contents + prefix = "cd "; + suffix = "; xls"; + } else if (targetType === "xcat") { + // Display file + prefix = "xcat "; + suffix = ""; + } else if (targetType === "exec") { + // Execute file + prefix = ""; + suffix = ""; + } - action = "sendln"; + if (window.windowsMode === "on") { + action = "createln"; + sendStr = prefix + filename + suffix; + + } else if (currentCommandEmpty) { + action = "sendln"; + sendStr = prefix + filename + suffix; + + } else { + action = "send"; + sendStr = filename + " "; + } } else { // Primitive action action = targetType; + sendStr = arg1; } // Primitive actions if (action === "send") { - dump("send = "+arg1+"\n"); - window.xmlterm.SendText(arg1, document.cookie); + dump("send = "+sendStr+"\n"); + window.xmlterm.SendText(sendStr, document.cookie); } else if (action === "sendln") { - - if ((Math.abs(entryNumber)+1 == window.xmlterm.currentEntryNumber) && - (arg2 != null)) { - // Current command - dump("sendln = "+arg2+"\n\n"); - window.xmlterm.SendText("\025"+arg2+"\n", document.cookie); - } else { - // Not current command - dump("sendln = "+arg1+"\n\n"); - window.xmlterm.SendText("\025"+arg1+"\n", document.cookie); - } + dump("sendln = "+sendStr+"\n\n"); + window.xmlterm.SendText("\025"+sendStr+"\n", document.cookie); } else if (action === "createln") { - dump("createln = "+arg1+"\n\n"); - newwin = NewXMLTerm(arg1+"\n"); + dump("createln = "+sendStr+"\n\n"); + newwin = NewXMLTerm(sendStr+"\n"); } } } diff --git a/mozilla/extensions/xmlterm/ui/skin/Makefile.in b/mozilla/extensions/xmlterm/ui/skin/Makefile.in index 3e82d55859b..660b2a3f47d 100644 --- a/mozilla/extensions/xmlterm/ui/skin/Makefile.in +++ b/mozilla/extensions/xmlterm/ui/skin/Makefile.in @@ -60,6 +60,7 @@ EXPORT_RESOURCE_SKIN = \ EXPORT_RESOURCE_TOOLBAR = \ $(srcdir)/images/ficon.gif \ + $(srcdir)/images/wheel.gif \ $(NULL) install:: diff --git a/mozilla/extensions/xmlterm/ui/skin/images/wheel.gif b/mozilla/extensions/xmlterm/ui/skin/images/wheel.gif new file mode 100644 index 0000000000000000000000000000000000000000..56de7ae8073e1a36fb288f26958a89270024c034 GIT binary patch literal 185 zcmZ?wbhEHb6k-rz_{_j?;J|_Z{}~z@8WzUgq8Bdhz`Ylh%zkvIWeWY`6=49FvJ_+`|&E{!-u4SxmK3y0W6atsR{b Hf(+IGA&oaa literal 0 HcmV?d00001