xmlterm changes only (not part of the default build).

Improvements to the user interface. User level-option and icons-style option
added. Keyboards shortcuts too. Compiles with M14 and March10 source.


git-svn-id: svn://10.0.0.236/trunk@62762 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
svn%xmlterm.org
2000-03-13 15:48:32 +00:00
parent 3031fc5564
commit c605556b32
29 changed files with 1407 additions and 650 deletions

View File

@@ -5,23 +5,29 @@ INSTALL: Installation instructions for XMLterm source code
*NOTE* Check the XMLterm web site <http://xmlterm.org> for updates.
28 Feb 2000
7 Mar 2000
QUICK INSTALLATION INSTRUCTIONS (Linux/Solaris)
-----------------------------------------------
QUICK BUILD INSTRUCTIONS (Linux/Solaris)
----------------------------------------
If you have already built mozilla from the source, then type the following
commands in the "mozilla" directory to build XMLterm:
a) (Build mozilla from the source tarball)
b) cd mozilla/extensions/xmlterm
c) ./makemake -r
d) make all
e) cd ../../dist/bin
f) ./xmlterm
a) configure --with-extensions=xmlterm <other-configure-options>
b) cd extensions/xmlterm
c) make
[Skip step (b) for a fresh build of mozilla from the source tarball]
To execute XMLterm, type one of the following commands in
the mozilla/dist/bin directory:
./xmlterm
OR
./mozilla -chrome chrome://xmlterm/content/xmlterm.xul
DETAILED INSTALLATION INSTRUCTIONS
----------------------------------
DETAILED BUILD INSTRUCTIONS
---------------------------
In the following discussion, file and directory names are relative
to the main ("mozilla/extensions/xmlterm") directory. See the end of the
@@ -119,14 +125,15 @@ 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/xmltpage.css)
Double-clicking is used to activate all XMLterm features, except for
underlined hyperlinks, which are activated by a single click as in a browser.
After typing one or two commands, double-click on the prompt string of any
previous command to see what happens! Then double-click again on the same
After typing one or two commands, click on the prompt string of any
previous command to see what happens! Then click again on the same
prompt string. Also click on "Hide all output" button at the top of the
document.
Double-clicking is used to activate all XMLterm features, *except* for
command prompts and underlined hyperlinks, which are activated by a single
click as in a browser.
Double-clicking on a previous command line (to the right of the prompt)
re-executes the command. Be warned that double-clicking a command line can
profoundly affect your computing environment, depending upon what the command

View File

@@ -56,7 +56,7 @@ DIRS = base tests linetest
else # not STAND_ALONE
DIRS = base ui scripts tests geckoterm
DIRS = base ui scripts doc tests geckoterm
LIBRARY_NAME =

View File

@@ -18,18 +18,25 @@ XMLterm is an open source project in its early stages. Comments and
contributions are welcome!
R. Saravanan <svn@xmlterm.org>
26 Feb 2000 <http://xmlterm.org>
===========
7 Mar 2000 <http://xmlterm.org>
==========
QUICK SET-UP INSTRUCTIONS (Linux/Solaris)
-----------------------------------------
a) (Build mozilla from the source tarball)
b) cd mozilla/extensions/xmlterm
c) ./makemake -r
d) make all
e) cd ../../dist/bin
f) ./xmlterm
If you have already built mozilla from the source, then type the following
commands in the "mozilla" directory to build XMLterm:
a) configure --with-extensions=xmlterm <other-configure-options>
b) cd extensions/xmlterm
c) make
[Skip step (b) for a fresh build of mozilla from the source tarball]
To execute XMLterm, type one of the following commands in
the mozilla/dist/bin directory:
./xmlterm
OR
./mozilla -chrome chrome://xmlterm/content/xmlterm.xul

View File

@@ -153,7 +153,7 @@ int ltermProcessEscape(struct lterms *lts, const UNICHAR *buf,
LTERM_LOG(ltermProcessEscape,52,("Application Keypad\n"));
if (lto->outputMode == LTERM2_LINE_MODE) {
ltermSwitchToScreenMode(lts);
*opcodes = LTERM_SCREENDATA_CODE | LTERM_CLEAR_CODE;
*opcodes = LTERM_LINEDATA_CODE | LTERM_OUTPUT_CODE;
}
return 0;
@@ -161,7 +161,7 @@ int ltermProcessEscape(struct lterms *lts, const UNICHAR *buf,
LTERM_LOG(ltermProcessEscape,52,("Normal Keypad\n"));
if (lto->outputMode == LTERM1_SCREEN_MODE) {
ltermSwitchToLineMode(lts);
*opcodes = LTERM_LINEDATA_CODE;
*opcodes = LTERM_SCREENDATA_CODE | LTERM_CLEAR_CODE;
}
return 0;
@@ -701,7 +701,7 @@ static int ltermProcessCSISequence(struct lterms *lts, const UNICHAR *buf,
/* Switch to alternate buffer */
if (lto->outputMode == LTERM2_LINE_MODE) {
ltermSwitchToScreenMode(lts);
*opcodes = LTERM_SCREENDATA_CODE | LTERM_CLEAR_CODE;
*opcodes = LTERM_LINEDATA_CODE | LTERM_OUTPUT_CODE;
}
}
return 0;
@@ -720,7 +720,7 @@ static int ltermProcessCSISequence(struct lterms *lts, const UNICHAR *buf,
/* Switch to regular buffer */
if (lto->outputMode == LTERM1_SCREEN_MODE) {
ltermSwitchToLineMode(lts);
*opcodes = LTERM_LINEDATA_CODE;
*opcodes = LTERM_SCREENDATA_CODE | LTERM_CLEAR_CODE;
}
}
return 0;
@@ -892,7 +892,7 @@ static int ltermProcessDECPrivateMode(struct lterms *lts,
/* Switch to screen mode */
if (lto->outputMode == LTERM2_LINE_MODE) {
ltermSwitchToScreenMode(lts);
*opcodes = LTERM_SCREENDATA_CODE | LTERM_CLEAR_CODE;
*opcodes = LTERM_LINEDATA_CODE | LTERM_OUTPUT_CODE;
}
}
return 0;
@@ -903,7 +903,7 @@ static int ltermProcessDECPrivateMode(struct lterms *lts,
/* Switch to line mode */
if (lto->outputMode == LTERM1_SCREEN_MODE) {
ltermSwitchToLineMode(lts);
*opcodes = LTERM_LINEDATA_CODE;
*opcodes = LTERM_SCREENDATA_CODE | LTERM_CLEAR_CODE;
}
}
return 0;
@@ -1162,6 +1162,27 @@ static int ltermProcessXMLTermSequence(struct lterms *lts, const UNICHAR *buf,
}
return 0;
case U_F_CHAR: /* Enable/disable full screen mode */
if (param1) {
/* Enable full screen mode */
if (lto->outputMode == LTERM2_LINE_MODE) {
ltermSwitchToScreenMode(lts);
*opcodes = LTERM_LINEDATA_CODE | LTERM_OUTPUT_CODE;
}
LTERM_LOG(ltermProcessXMLTermSequence,52,("Enabled full screen mode\n"));
} else {
/* Disable full screen mode */
if (lto->outputMode == LTERM1_SCREEN_MODE) {
ltermSwitchToLineMode(lts);
*opcodes = LTERM_SCREENDATA_CODE | LTERM_CLEAR_CODE;
}
LTERM_LOG(ltermProcessXMLTermSequence,52,("Disabled full screen mode\n"));
}
return 0;
case U_R_CHAR: /* Enable/disable raw input mode */
if (param1) {
/* Switch to raw input mode */

View File

@@ -313,14 +313,26 @@ int ltermWrite(struct lterms *lts, int *opcodes)
/* Process plain text input record */
int doNotCancelCompletion = 0;
if ( (lti->inputMode >= LTERM3_COMPLETION_MODE) &&
(availableChars == 1) ) {
if (lti->inputMode >= LTERM3_COMPLETION_MODE) {
doNotCancelCompletion =
((lts->completionRequest == LTERM_TAB_COMPLETION) &&
(lti->inputBuf[2] == U_TAB)) ||
((lts->completionRequest == LTERM_HISTORY_COMPLETION) &&
((lti->inputBuf[2] == U_CTL_P) || (lti->inputBuf[2] == U_CTL_N)) );
if (availableChars == 1) {
/* Single control character completion requests */
doNotCancelCompletion =
( (lts->completionRequest == LTERM_TAB_COMPLETION) &&
(lti->inputBuf[2] == U_TAB) ) ||
( (lts->completionRequest == LTERM_HISTORY_COMPLETION) &&
((lti->inputBuf[2] == U_CTL_P) || (lti->inputBuf[2] == U_CTL_N)) );
} else if (availableChars == 3) {
/* Three character escape sequences for up/down arrow keys */
/* NOTE: Input CSI escape sequence; may not be portable */
doNotCancelCompletion =
( (lts->completionRequest == LTERM_HISTORY_COMPLETION) &&
(lti->inputBuf[2] == U_ESCAPE) && (lti->inputBuf[3] == U_LBRACKET) &&
((lti->inputBuf[4] == U_A_CHAR) || (lti->inputBuf[4] == U_B_CHAR)) );
}
}
if (!doNotCancelCompletion &&

View File

@@ -377,6 +377,8 @@ static int ltermLineInput(struct lterms *lts,
} else if (lti->escapeCSIFlag) {
/* Character part of escape code sequence */
LTERM_LOG(ltermLineInput,38,("Escape code sequence - %c\n", (char) uch));
if ((uch >= (UNICHAR)U_ZERO && uch <= (UNICHAR)U_NINE)) {
/* Process numerical argument to escape code sequence */
lti->escapeCSIArg = lti->escapeCSIArg*10 + (uch - U_ZERO);
@@ -386,6 +388,8 @@ static int ltermLineInput(struct lterms *lts,
/* End of escape code sequence */
lti->escapeCSIFlag = 0;
/* NOTE: Input CSI escape sequence; may not be portable */
/* SUN arrow key bindings */
switch (uch) {
case U_A_CHAR:
@@ -500,38 +504,60 @@ static int ltermLineInput(struct lterms *lts,
} else {
/* other control characters */
if (lti->inputMode >= LTERM2_EDIT_MODE) {
LTERM_LOG(ltermLineInput,32,("^%c\n", uch+U_ATSIGN));
if (lti->inputMode < LTERM2_EDIT_MODE) {
/* Non-edit mode; simply transmit control character */
if (ltermSendData(lts, &uch, 1) != 0)
return -1;
} else {
/* Edit input mode */
if (uch == U_CTL_D) {
/* Special handling for ^D */
if (lti->inputChars == 0) {
/* Lone ^D in input line, simply transmit it */
if (ltermSendData(lts, &uch, 1) != 0)
return -1;
uch = U_NUL;
} else if (lti->inputCursorGlyph < lti->inputGlyphs) {
/* Cursor not at end of line; delete to right */
if (ltermDeleteGlyphs(lti, -1) != 0)
return -1;
uch = U_NUL;
}
}
switch (uch) {
case U_NUL: /* Null character; ignore */
break;
case U_CTL_B: /* move cursor backward */
LTERM_LOG(ltermLineInput,32,("^B\n"));
if (lti->inputCursorGlyph > 0) {
lti->inputCursorGlyph--;
}
break;
case U_CTL_F: /* move cursor forward */
LTERM_LOG(ltermLineInput,32,("^F\n"));
if (lti->inputCursorGlyph < lti->inputGlyphs) {
lti->inputCursorGlyph++;
}
break;
case U_CTL_A: /* position cursor at beginning of line */
LTERM_LOG(ltermLineInput,32,("^A\n"));
lti->inputCursorGlyph = 0;
break;
case U_CTL_E: /* position cursor at end of line */
LTERM_LOG(ltermLineInput,32,("^E\n"));
lti->inputCursorGlyph = lti->inputGlyphs;
break;
case U_CTL_K: /* delete to end of line */
LTERM_LOG(ltermLineInput,32,("^K\n"));
if (ltermDeleteGlyphs(lti,-(lti->inputGlyphs-lti->inputCursorGlyph))
!= 0)
return -1;
@@ -539,22 +565,14 @@ static int ltermLineInput(struct lterms *lts,
case U_CTL_L: /* form feed */
case U_CTL_R: /* redisplay */
LTERM_LOG(ltermLineInput,32,("^%c\n", uch+U_ATSIGN));
break;
case U_CTL_D: /* ^D */
case U_CTL_D: /* ^D at end of non-null input line */
case U_CTL_N: /* dowN history */
case U_CTL_P: /* uP history */
case U_CTL_Y: /* yank */
case U_TAB: /* command completion */
if ((lti->inputChars == 0) && (uch == U_CTL_D)) {
/* If lone ^D input, simply transmit it */
if (ltermSendData(lts, &uch, 1) != 0)
return -1;
return 0;
}
/* Assert that completion character occurs at end of buffer;
* enforced by lterm_write.
*/
@@ -582,6 +600,10 @@ static int ltermLineInput(struct lterms *lts,
}
break;
default: /* Transmit any other control character */
if (ltermSendData(lts, &uch, 1) != 0)
return -1;
}
}
}

View File

@@ -131,6 +131,11 @@ public:
*/
NS_IMETHOD GetPresShell(nsIPresShell** aPresShell) = 0;
/** Gets flag denoting whether terminal is in full screen mode
* @param aFlag (output) screen mode flag
*/
NS_IMETHOD GetScreenMode(PRBool* aFlag) = 0;
/** Checks if supplied cookie is valid for XMLTerm
* @param aCookie supplied cookie string
* @param _retval true if supplied cookie matches XMLTerm cookie
@@ -140,6 +145,10 @@ public:
/** Resizes XMLterm to match a resized window.
*/
NS_IMETHOD Resize(void) = 0;
/** Shows the caret and make it editable.
*/
NS_IMETHOD ShowCaret(void) = 0;
};
#define MOZXMLTERMINAL_CID \

View File

@@ -277,13 +277,17 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
NS_SUCCEEDED(keyEvent->GetAltKey(&altKey)) ) {
PRUint32 keyChar = 0;
PRUint32 escPrefix = 0;
nsAutoString JSCommand = "";
PRBool screenMode = 0;
result = mXMLTerminal->GetScreenMode(&screenMode);
result = keyEvent->GetCharCode(&keyChar);
XMLT_LOG(mozXMLTermKeyListener::KeyPress,52,
("code=0x%x, char=0x%x, shift=%d, ctrl=%d, alt=%d\n",
keyCode, keyChar, shiftKey, ctrlKey, altKey));
("code=0x%x, char=0x%x, shift=%d, ctrl=%d, alt=%d, screenMode=%d\n",
keyCode, keyChar, shiftKey, ctrlKey, altKey, screenMode));
if (keyChar == 0) {
// Key that hasn't been mapped to a character code
@@ -305,38 +309,63 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
case nsIDOMKeyEvent::DOM_VK_RETURN:
keyChar = U_CRETURN;
break;
case nsIDOMKeyEvent::DOM_VK_LEFT:
keyChar = U_CTL_B;
break;
case nsIDOMKeyEvent::DOM_VK_RIGHT:
keyChar = U_CTL_F;
break;
case nsIDOMKeyEvent::DOM_VK_UP:
keyChar = U_CTL_P;
escPrefix = 1;
keyChar = U_A_CHAR;
break;
case nsIDOMKeyEvent::DOM_VK_DOWN:
keyChar = U_CTL_N;
escPrefix = 1;
keyChar = U_B_CHAR;
break;
case nsIDOMKeyEvent::DOM_VK_RIGHT:
escPrefix = 1;
keyChar = U_C_CHAR;
break;
case nsIDOMKeyEvent::DOM_VK_LEFT:
escPrefix = 1;
keyChar = U_D_CHAR;
break;
case nsIDOMKeyEvent::DOM_VK_ESCAPE:
keyChar = U_ESCAPE;
break;
case nsIDOMKeyEvent::DOM_VK_HOME:
JSCommand = "ScrollHome";
JSCommand = "ScrollHomeKey";
break;
case nsIDOMKeyEvent::DOM_VK_END:
JSCommand = "ScrollEnd";
JSCommand = "ScrollEndKey";
break;
case nsIDOMKeyEvent::DOM_VK_PAGE_UP:
JSCommand = "ScrollPageUp";
JSCommand = "ScrollPageUpKey";
break;
case nsIDOMKeyEvent::DOM_VK_PAGE_DOWN:
JSCommand = "ScrollPageDown";
JSCommand = "ScrollPageDownKey";
break;
case nsIDOMKeyEvent::DOM_VK_F1:
JSCommand = "HideAll";
JSCommand = "F1Key";
break;
case nsIDOMKeyEvent::DOM_VK_F2:
JSCommand = "ShowAll";
JSCommand = "F2Key";
break;
case nsIDOMKeyEvent::DOM_VK_F3:
JSCommand = "F3Key";
break;
case nsIDOMKeyEvent::DOM_VK_F4:
JSCommand = "F4Key";
break;
case nsIDOMKeyEvent::DOM_VK_F5:
JSCommand = "F5Key";
break;
case nsIDOMKeyEvent::DOM_VK_F6:
JSCommand = "F6Key";
break;
case nsIDOMKeyEvent::DOM_VK_F7:
JSCommand = "F7Key";
break;
case nsIDOMKeyEvent::DOM_VK_F8:
JSCommand = "F8Key";
break;
case nsIDOMKeyEvent::DOM_VK_F9:
JSCommand = "F9Key";
break;
default: // ignore event without consuming
return NS_OK;
@@ -349,6 +378,9 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
keyChar = (keyChar >= 0x60U) ? keyChar-0x60U : keyChar-0x40U;
}
XMLT_LOG(mozXMLTermKeyListener::KeyPress,53,
("escPrefix=%d, keyChar=0x%x, \n", escPrefix, keyChar));
if (JSCommand.Length() > 0) {
// Execute JS command
nsCOMPtr<nsIDOMDocument> domDocument;
@@ -370,8 +402,14 @@ mozXMLTermKeyListener::KeyPress(nsIDOMEvent* aKeyEvent)
if (!mSuspend && (keyChar > 0) && (keyChar <= 0xFFFDU)) {
// Transmit valid non-null Unicode character
const PRUnichar temUString[] = {keyChar,0};
nsAutoString keyString(temUString);
nsAutoString keyString = "";
if (escPrefix) {
keyString.Append((PRUnichar) U_ESCAPE);
keyString.Append((PRUnichar) U_LBRACKET);
}
keyString.Append((PRUnichar) keyChar);
result = mXMLTerminal->SendTextAux(keyString);
}
}

View File

@@ -30,7 +30,6 @@
#include "nsIDocumentViewer.h"
#include "nsICaret.h"
#include "nsITextContent.h"
#include "nsIDOMElement.h"
@@ -81,8 +80,7 @@ const char* const mozXMLTermSession::sessionElementNames[] = {
// Should HTML event names should always be in lower case for DOM to work?
const char* const mozXMLTermSession::sessionEventNames[] = {
"click",
"dblclick"
"click"
};
const char* const mozXMLTermSession::metaCommandNames[] = {
@@ -197,15 +195,6 @@ NS_IMETHODIMP mozXMLTermSession::Init(mozIXMLTerminal* aXMLTerminal,
nsresult result = NS_OK;
// Show the caret
nsCOMPtr<nsICaret> caret;
if (NS_SUCCEEDED(mPresShell->GetCaret(getter_AddRefs(caret)))) {
caret->SetCaretVisible(PR_TRUE);
caret->SetCaretReadOnly(PR_FALSE);
}
mPresShell->SetCaretEnabled(PR_TRUE);
nsCOMPtr<nsIDOMHTMLDocument> vDOMHTMLDocument
(do_QueryInterface(mDOMDocument));
if (!vDOMHTMLDocument)
@@ -552,13 +541,7 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
// WORKAROUND for some unknown bug in the full screen implementation.
// Without this, if you delete a line using "vi" and save the file,
// the cursor suddenly disappears
nsCOMPtr<nsICaret> caret;
if (NS_SUCCEEDED(mPresShell->GetCaret(getter_AddRefs(caret)))) {
caret->SetCaretVisible(PR_TRUE);
caret->SetCaretReadOnly(PR_FALSE);
}
mPresShell->SetCaretEnabled(PR_TRUE);
mXMLTerminal->ShowCaret();
}
if (streamData) {
@@ -1121,6 +1104,9 @@ NS_IMETHODIMP mozXMLTermSession::ReadAll(mozILineTermAux* lineTermAux,
SELECTION_FOCUS_REGION);
}
// Show caret
mXMLTerminal->ShowCaret();
// Scroll frame (ignore result)
ScrollToBottomLeft();
@@ -1171,19 +1157,20 @@ NS_IMETHODIMP mozXMLTermSession::DisplayInput(const nsString& aString,
result = selection->Collapse(mInputTextNode, cursorCol);
} else {
// Get the last bit of text in the prompt
nsCOMPtr<nsIDOMNode> promptTextNode;
result = mPromptSpanNode->GetFirstChild(getter_AddRefs(promptTextNode));
result = mPromptSpanNode->GetLastChild(getter_AddRefs(promptTextNode));
if (NS_SUCCEEDED(result)) {
nsCOMPtr<nsIDOMText> domText (do_QueryInterface(promptTextNode));
if (domText) {
PRUint32 promptLength;
result = domText->GetLength(&promptLength);
PRUint32 textLength;
result = domText->GetLength(&textLength);
if (NS_SUCCEEDED(result)) {
XMLT_LOG(mozXMLTermSession::DisplayInput,72,
("promptLength=%d\n", promptLength));
result = selection->Collapse(promptTextNode, promptLength);
("textLength=%d\n", textLength));
result = selection->Collapse(promptTextNode, textLength);
}
}
}
@@ -1623,6 +1610,7 @@ NS_IMETHODIMP mozXMLTermSession::LimitOutputLines(PRBool deleteAllOld)
if (NS_FAILED(result) || !firstChild)
return NS_ERROR_FAILURE;
attValue = "";
result = mozXMLTermUtils::GetNodeAttribute(firstChild, "class", attValue);
if (NS_FAILED(result))
return result;
@@ -1666,6 +1654,7 @@ NS_IMETHODIMP mozXMLTermSession::LimitOutputLines(PRBool deleteAllOld)
deleteNode = 1;
} else {
attValue = "";
result = mozXMLTermUtils::GetNodeAttribute(nextChild, "class", attValue);
if (NS_FAILED(result)|| (attValue.Length() == 0)) {
@@ -2191,7 +2180,7 @@ NS_IMETHODIMP mozXMLTermSession::AppendLineLS(const nsString& aString,
* @param parentNode parent node for HTML fragment
* @param entryNumber entry number (default value = -1)
* (if entryNumber >= 0, all '#' characters in
* id/onclick/ondblclick attribute values are substituted
* id/onclick attribute values are substituted
* with entryNumber)
* @param beforeNode child node before which to insert fragment;
* if null, insert after last child node
@@ -2377,7 +2366,7 @@ void mozXMLTermSession::SubstituteCommandNumber(nsString& aString,
/** Sanitize event handler attribute values by imposing syntax checks.
* @param aAttrValue attribute value to be sanitized
* @param aEventName name of event being handled ("click", "dblclick", ...)
* @param aEventName name of event being handled ("click", ...)
*/
void mozXMLTermSession::SanitizeAttribute(nsString& aAttrValue,
const char* aEventName)
@@ -2466,6 +2455,7 @@ NS_IMETHODIMP mozXMLTermSession::DeepSanitizeFragment(
attName = "on";
attName.Append(sessionEventNames[j]);
attValue = "";
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {
// Save allowed event attribute value for re-insertion
@@ -2527,6 +2517,7 @@ NS_IMETHODIMP mozXMLTermSession::DeepSanitizeFragment(
// Process ID attribute
attName = "id";
attValue = "";
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {
@@ -2542,7 +2533,6 @@ NS_IMETHODIMP mozXMLTermSession::DeepSanitizeFragment(
attName.Append(sessionEventNames[j]);
attValue = eventAttrVals[j];
if (attValue.Length() > 0) {
SubstituteCommandNumber(attValue, entryNumber);
@@ -2601,6 +2591,7 @@ NS_IMETHODIMP mozXMLTermSession::DeepRefreshEventHandlers(
XMLT_LOG(mozXMLTermSession::DeepRefreshEventHandlers,89,
("Refreshing on%s attribute\n",sessionEventNames[j] ));
attValue = "";
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {
@@ -2840,7 +2831,7 @@ NS_IMETHODIMP mozXMLTermSession::ScrollToBottomLeft(void)
return NS_ERROR_FAILURE;
// Scroll to bottom left of screen
domWindow->ScrollBy(-9999,9999);
domWindow->ScrollBy(-99999,99999);
return NS_OK;
}
@@ -2922,6 +2913,20 @@ NS_IMETHODIMP mozXMLTermSession::SetPrompt(const PRUnichar* aPrompt)
}
/** Gets flag denoting whether terminal is in full screen mode
* @param aFlag (output) screen mode flag
*/
NS_IMETHODIMP mozXMLTermSession::GetScreenMode(PRBool* aFlag)
{
if (!aFlag)
return NS_ERROR_NULL_POINTER;
*aFlag = (mScreenNode != nsnull);
return NS_OK;
}
/** Create a DIV element with attributes NAME="preface", CLASS="preface",
* and ID="preface0", containing an empty text node, and append it as a
* child of the main BODY element. Also make it the current display element.
@@ -3061,6 +3066,68 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
mPromptSpanNode);
if (mPromptHTML.Length() == 0) {
#define DEFAULT_ICON_PROMPT
#ifdef DEFAULT_ICON_PROMPT // Experimental code; has scrolling problems
// Create text node + image node as child of prompt element
nsCOMPtr<nsIDOMNode> spanNode, textNode;
tagName = "span";
name ="noicons";
result = NewElementWithText(tagName, name, -1,
mPromptSpanNode, spanNode, textNode);
if (NS_FAILED(result) || !spanNode || !textNode) {
return NS_ERROR_FAILURE;
}
// Set prompt text
result = SetDOMText(textNode, aPrompt);
if (NS_FAILED(result))
return NS_ERROR_FAILURE;
// Create IMG element
tagName = "img";
nsCOMPtr<nsIDOMElement> imgElement;
result = mDOMDocument->CreateElement(tagName, getter_AddRefs(imgElement));
if (NS_FAILED(result) || !imgElement)
return NS_ERROR_FAILURE;
// Set attributes
nsAutoString attName("class");
nsAutoString attValue("icons");
imgElement->SetAttribute(attName, attValue);
attName = "src";
attValue = "chrome://editor/skin/images/preview.gif";
imgElement->SetAttribute(attName, attValue);
attName = "align";
attValue = "middle";
imgElement->SetAttribute(attName, attValue);
nsCOMPtr<nsIDOMNode> resultNode;
// Append IMG element
nsCOMPtr<nsIDOMNode> imgNode = do_QueryInterface(imgElement);
result = mPromptSpanNode->AppendChild(imgNode,
getter_AddRefs(resultNode));
if (NS_FAILED(result))
return NS_ERROR_FAILURE;
// Append text node containing single space
nsCOMPtr<nsIDOMText> stubText;
nsAutoString spaceStr (" ");
result = mDOMDocument->CreateTextNode(spaceStr, getter_AddRefs(stubText));
if (NS_FAILED(result) || !stubText)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> stubNode = do_QueryInterface(stubText);
result = mPromptSpanNode->AppendChild(stubNode,
getter_AddRefs(resultNode));
if (NS_FAILED(result))
return NS_ERROR_FAILURE;
#else // !DEFAULT_ICON_PROMPT
// Create text node as child of prompt element
nsCOMPtr<nsIDOMNode> textNode;
result = NewTextNode(mPromptSpanNode, textNode);
@@ -3072,6 +3139,7 @@ NS_IMETHODIMP mozXMLTermSession::NewEntry(const nsString& aPrompt)
result = SetDOMText(textNode, aPrompt);
if (NS_FAILED(result))
return NS_ERROR_FAILURE;
#endif // !DEFAULT_ICON_PROMPT
} else {
// User-specified HTML prompt
@@ -3802,7 +3870,7 @@ NS_IMETHODIMP mozXMLTermSession::NewIFrame(nsIDOMNode* parentNode,
}
/** Add event attributes (onclick, ondblclick, ...) to DOM node
/** Add event attributes (onclick, ...) to DOM node
* @param name name of DOM node (supplied as argument to the event handler)
* @param number entry number (supplied as argument to the event handler)
* @param domNode DOM node to be modified
@@ -4197,7 +4265,7 @@ void mozXMLTermSession::TraverseDOMTree(FILE* fileStream,
int j;
for (j=0; j<PRINT_ATTRIBUTE_NAMES; j++) {
nsAutoString attName (printAttributeNames[j]);
nsAutoString attValue;
nsAutoString attValue = "";
result = domElement->GetAttribute(attName, attValue);
if (NS_SUCCEEDED(result) && (attValue.Length() > 0)) {

View File

@@ -103,6 +103,11 @@ class mozXMLTermSession
*/
NS_IMETHOD SetPrompt(const PRUnichar* aPrompt);
/** Gets flag denoting whether terminal is in full screen mode
* @param aFlag (output) screen mode flag
*/
NS_IMETHOD GetScreenMode(PRBool* aFlag);
protected:
/** ShellML element type (see ShellML documentation),
@@ -126,7 +131,6 @@ protected:
/** allowed user-generated input event type */
enum SessionEventType {
CLICK_EVENT = 0,
DBLCLICK_EVENT,
SESSION_EVENT_TYPES
};

View File

@@ -385,10 +385,6 @@ mozXMLTermShell::NewXMLTermWindow(const PRUnichar* args,
XMLT_LOG(mozXMLTermShell::NewXMLTermWindow,0,("check0, topWin=0x%x\n",
(int) topWin.get()));
// Determine preferences
nsCOMPtr<nsIPref> prefs = nsnull;
result = mContentAreaDocShell->GetPrefs(getter_AddRefs(prefs));
#ifdef NEW_XMLTERM_IMP // Test C++ NewXMLTerm implementation
PRInt32 width = 760;
PRInt32 height = 400;

View File

@@ -38,6 +38,7 @@
#include "nsIObserver.h"
#include "nsIPresContext.h"
#include "nsICaret.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMEventListener.h"
@@ -456,6 +457,8 @@ NS_IMETHODIMP mozXMLTerminal::Activate(void)
return NS_ERROR_FAILURE;
}
// Show caret
ShowCaret();
// Instantiate LineTerm
XMLT_LOG(mozXMLTerminal::Activate,22,("instantiating lineterm\n"));
@@ -603,6 +606,30 @@ NS_IMETHODIMP mozXMLTerminal::SendText(const nsString& aString,
return NS_OK;
}
/** Shows the caret and make it editable.
*/
NS_IMETHODIMP mozXMLTerminal::ShowCaret(void)
{
// In principle, this method needs to be called only once;
// in practice, certain operations seem to hide the caret
// especially when one starts mucking around with the display:
// style property.
// Under those circumstances, call this method to re-display the caret.
if (!mPresShell)
return NS_ERROR_FAILURE;
mPresShell->SetCaretEnabled(PR_TRUE);
nsCOMPtr<nsICaret> caret;
if (NS_SUCCEEDED(mPresShell->GetCaret(getter_AddRefs(caret)))) {
caret->SetCaretVisible(PR_TRUE);
caret->SetCaretReadOnly(PR_FALSE);
}
return NS_OK;
}
// Paste data from clipboard to terminal
NS_IMETHODIMP mozXMLTerminal::Paste()
@@ -747,6 +774,15 @@ NS_IMETHODIMP mozXMLTerminal::GetPresShell(nsIPresShell** aPresShell)
}
/** Gets flag denoting whether terminal is in full screen mode
* @param aFlag (output) screen mode flag
*/
NS_IMETHODIMP mozXMLTerminal::GetScreenMode(PRBool* aFlag)
{
return mXMLTermSession->GetScreenMode(aFlag);
}
/** Checks if supplied cookie is valid for XMLTerm
* @param aCookie supplied cookie string
* @param _retval true if supplied cookie matches XMLTerm cookie

View File

@@ -79,10 +79,14 @@ class mozXMLTerminal : public mozIXMLTerminal,
NS_IMETHOD GetPresShell(nsIPresShell** aPresShell);
NS_IMETHOD GetScreenMode(PRBool* aFlag);
NS_IMETHOD MatchesCookie(const PRUnichar* aCookie, PRBool *_retval);
NS_IMETHOD Resize(void);
NS_IMETHOD ShowCaret(void);
// nsIDocumentLoaderObserver interface
NS_DECL_NSIDOCUMENTLOADEROBSERVER

View File

@@ -1,7 +1,7 @@
Known bugs
----------
29 Feb 2000
12 Mar 2000
1. Mozilla bug (Solaris only): The cursor has disappeared! (also in Composer)
@@ -18,10 +18,16 @@ Known bugs
on the window moves it up (very annoying). Mitigated by a WORKAROUND in
mozXMLTermMouseListener::MouseClick.
5. XMLterm bug: Arrow keys are bound to EMACS-style control characters;
do not work with VI
5. XMLterm/DOM bug: As new commands are typed in, scrolling is jerky. For
example, type a few non-trivial commands interspersed with several
trivial commands (i.e., just pressing ENTER key). The output from the
earlier non-trivial commands sometimes jumps downwards instead of moving
monotonically upwards. (Does it have anything to do with deletion of
earlier DOM entries?)
6. LTERM/NCURSES bug: Executing "emacs -nw" in the NCURSES version of LTERM
6. XMLterm bug: Arrow keys are hard-wired to particular escape sequences.
7. LTERM/NCURSES bug: Executing "emacs -nw" in the NCURSES version of LTERM
results in LTERM exiting abnormally when user exits emacs. An interrupt
error seems to occur while polling for output in ltermRead.

View File

@@ -6,7 +6,7 @@ XMLterm installation instructions for Linux binaries
*NOTE* This plain text INSTALL file may be out date. Please check
<http://xmlterm.org/install.html> for the most recent information.
28 Feb 2000
7 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"
@@ -56,15 +56,15 @@ XMLterm installation instructions for Linux binaries
(Of course, the appearance of XMLterm is completely configurable
using the CSS stylesheet chrome://xmlterm/skin/default/xmlterm.css)
Double-clicking is used to activate all XMLterm features, except for
underlined hyperlinks, which are activated by a single click as in a
browser.
After typing one or two commands, double-click on the prompt string of any
previous command to see what happens! Then double-click again on the same
After typing one or two commands, click on the prompt string of any
previous command to see what happens! Then click again on the same
prompt string. Also click on "Hide all output" button at the top of the
document.
Double-clicking is used to activate all XMLterm features, *except* for
command prompts and underlined hyperlinks, which are activated by a single
click as in a browser.
Double-clicking on a previous command line (to the right of the prompt)
re-executes the command. Be warned that double-clicking a command line can
profoundly affect your computing environment, depending upon what the

View File

@@ -0,0 +1,61 @@
#!gmake
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "MPL"); you may not use this file
# except in compliance with the MPL. You may obtain a copy of
# the MPL at http://www.mozilla.org/MPL/
#
# Software distributed under the MPL is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the MPL for the specific language governing
# rights and limitations under the MPL.
#
# The Original Code is lineterm.
#
# The Initial Developer of the Original Code is Ramalingam Saravanan.
# Portions created by Ramalingam Saravanan <svn@xmlterm.org> are
# Copyright (C) 1999 Ramalingam Saravanan. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU General Public License (the "GPL"), in which case
# the provisions of the GPL are applicable instead of
# those above. If you wish to allow use of your version of this
# file only under the terms of the GPL and not to allow
# others to use your version of this file under the MPL, indicate
# your decision by deleting the provisions above and replace them
# with the notice and other provisions required by the GPL.
# If you do not delete the provisions above, a recipient
# may use your version of this file under either the MPL or the
# GPL.
#
# makefile for xmlterm/doc directory
ifdef STAND_ALONE
DEPTH = ..
topsrcdir = ..
VPATH = .
srcdir = .
include $(topsrcdir)/config/autoconf.mk
else
DEPTH = ../../..
topsrcdir = @top_srcdir@
VPATH = @srcdir@
srcdir = @srcdir@
include $(DEPTH)/config/autoconf.mk
endif
include $(topsrcdir)/config/config.mk
include ../config/xmlterm_config.mk
include $(topsrcdir)/config/rules.mk
XMLTERM_DOCS = \
$(srcdir)/INSTALL.xmlterm \
$(NULL)
install::
$(INSTALL) -m 555 $(XMLTERM_DOCS) $(DIST)/bin

View File

@@ -173,7 +173,7 @@ NS_IMETHODIMP mozSimpleContainer::Init(nsNativeWidget aNativeWidget,
webShell->Init(aNativeWidget, 0, 0, width, height);
if (aPref) {
mDocShell->SetPrefs(aPref);
//mDocShell->SetPrefs(aPref);
}
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));

View File

@@ -54,6 +54,7 @@ include ../config/xmlterm_config.mk
include $(topsrcdir)/config/rules.mk
XMLTERM_SCRIPTS = \
$(srcdir)/menuhack \
$(srcdir)/xmlterm \
$(srcdir)/xls \
$(srcdir)/xcat \

View File

@@ -1,6 +1,6 @@
#!/usr/bin/perl
# xls: an XMLterm wrapper for the UNIX "ls" command
# Usage: xls [-c|--cols] [-h|help] [-i||--iconic] [-w|--window]
# Usage: xls [-c|--cols] [-h|help] [-n||--noicons] [-w|--window]
use Cwd;
use Getopt::Long;
@@ -9,10 +9,10 @@ Getopt::Long::config('bundling');
my $options = "@ARGV";
&GetOptions("cols|c=i", "help|h!", "iconic|i!", "window|w!");
&GetOptions("cols|c=i", "help|h!", "noicons|n!", "window|w!");
if ($opt_help) {
print "Usage: xls [-c|--cols] [-i|--iconic] [-w|--window]\n";
print "Usage: xls [-c|--cols] [-n||--noicons] [-w|--window]\n";
exit;
}
@@ -36,6 +36,7 @@ my $dir = cwd();
my $rowimg = "";
my $rowtxt = "";
my $nfile = 0;
foreach $file (glob("*")) { # for each file in current directory
$file =~ m%\A(.*?) (\.[^/.]*)?\Z%x # Deconstruct file name
or die "xls: Internal error; unable to deconstruct file name\n";
@@ -141,7 +142,7 @@ foreach $file (glob("*")) { # for each file in current directory
$nfile++;
if (($nfile % $ncols) == 0) { # print complete table row
print "<TR>$rowimg" if ($opt_iconic) ;
print "<TR CLASS='icons'>$rowimg" unless $opt_noicons;
print "<TR>$rowtxt";
$rowimg = "";
$rowtxt = "";
@@ -150,7 +151,7 @@ foreach $file (glob("*")) { # for each file in current directory
}
if ($rowtxt) {
print "<TR>$rowimg" if ($opt_iconic) ;
print "<TR CLASS='icons'>$rowimg" unless $opt_noicons;
print "<TR>$rowtxt";
}

View File

@@ -1,25 +1,34 @@
#!/bin/sh
# Script to invoke XMLterm from mozilla/dist/bin
# (or from anywhere in the mozilla source tree)
# Script to invoke XMLterm
# 1) as ./xmlterm from mozilla/dist/bin or the package directory, or
# 2) as xmlterm (invoking /usr/bin/xmlterm), if installed with RPM, or
# 3) as xmlterm, if dist/bin or package directory has been included in PATH
XMLTERM_CHROME="xmlterm.xul"
MOZILLA_BIN="./mozilla-bin"
MOZILLA_DIR=""
# Determine command prefix
PREFIX=$(dirname $0)
if [ -d components -a -d res ]
if [ "$PREFIX" = "." ]
then
# Running from dist/bin
MOZILLA_DIR="./"
# Assume running in dist/bin or package directory (useful for testing)
MOZILLA_DIR=$(pwd)
else
# Running from source dir
if [ -f Makefile.in ]
then
MOZILLA_DIR=`grep -w DEPTH Makefile.in | grep -e "\.\." | tail -1 | awk -F"=" '{ print $2; }'`/dist/bin
else
# Running from elsewhere
MOZILLA_DIR="${MOZILLA_FIVE_HOME:?}"
fi
MOZILLA_DIR=""
if [ -f /bin/rpm -a -f /usr/bin/xmlterm ]
then
# Try to find installation directory using RPM
MOZILLA_DIR=$(rpm -q --queryformat "%{INSTALLPREFIX}" xmlterm)
fi
if [ ${#MOZILLA_DIR} -eq 0 ]
then
# Assume command prefix points to mozilla directory
MOZILLA_DIR=$PREFIX
fi
fi
echo cd $MOZILLA_DIR

View File

@@ -0,0 +1,78 @@
Name: xmlterm
Version: M14
Release: 1
Summary: A graphical command line interface using Mozilla
Copyright: Mozilla Public License 1.1
Group: User Interface/X
Source: http://xmlterm.org/xmlterm-source-Mar7-M14.tar.gz
URL: http://xmlterm.org/
Vendor: xmlterm.org
Packager: R. Saravanan <svn@xmlterm.org>
Prefix: /usr/src/redhat/BUILD/package
AutoReqProv: no
%description
XMLterm: A graphical command line interface using Mozilla
%prep
%build
%install
rm -fr xmlterm.tgz package
tar czvhf xmlterm.tgz \
-C /home/svn/mozilla/dist/bin \
INSTALL.xmlterm xmlterm xcat xls geckoterm menuhack \
components/libxmlterm.so \
components/xmlterm.xpt \
chrome/xmlterm
mkdir package
cd package
tar zxvf ../xmlterm.tgz
chown -R root.root .
chmod -R a+rX,g-w,o-w .
%clean
rm -fr xmlterm.tgz package
%pre
cd $RPM_INSTALL_PREFIX
if [ ! -f run-mozilla.sh ]
then
echo "*ERROR* Specify the mozilla package directory using the RPM prefix option"
echo " rpm --prefix /path/package ..."
exit 1
fi
%post
for FILE in xmlterm xcat xls geckoterm
do
ln -s $RPM_INSTALL_PREFIX/$FILE /usr/bin/$FILE
done
cd $RPM_INSTALL_PREFIX
rm -f component.reg
##./menuhack
%postun
for FILE in xmlterm xcat xls geckoterm
do
rm /usr/bin/$FILE
done
%files
/usr/src/redhat/BUILD/package/INSTALL.xmlterm
/usr/src/redhat/BUILD/package/xmlterm
/usr/src/redhat/BUILD/package/xcat
/usr/src/redhat/BUILD/package/xls
/usr/src/redhat/BUILD/package/geckoterm
/usr/src/redhat/BUILD/package/menuhack
/usr/src/redhat/BUILD/package/components/libxmlterm.so
/usr/src/redhat/BUILD/package/components/xmlterm.xpt
/usr/src/redhat/BUILD/package/chrome/xmlterm
%changelog

View File

@@ -57,7 +57,10 @@ EXPORT_RESOURCE_CONTENT = \
$(srcdir)/xmlterm.html \
$(srcdir)/xmlterm.xul \
$(srcdir)/xmlterm2.xul \
$(srcdir)/XMLTermChrome.js \
$(srcdir)/XMLTermCommands.js \
$(srcdir)/xmltermTips.html \
$(srcdir)/xmltermAbout.html \
$(srcdir)/xmltblank.html \
$(NULL)

View File

@@ -0,0 +1,38 @@
// XMLTerm Chrome Commands
function StartupXMLTerm() {
dump("StartupXMLTerm:\n");
dump("StartupXMLTerm:"+window.frames.length+"\n");
dump("StartupXMLTerm:"+window.frames[0].name+"\n");
if (window.frames.length == 2) {
xmltwin = window.frames[1];
xmltwin.xmltbrowser = window.frames[0];
} else {
xmltwin = window.frames[0];
}
dump("StartupXMLterm: WINDOW.ARGUMENTS="+window.arguments+"\n");
dump("Trying to make an XMLTerm Shell through the component manager...\n");
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
dump("Interface xmltshell1 = " + xmltshell + "\n");
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
dump("Interface xmltshell2 = " + xmltshell + "\n");
if (!xmltshell) {
dump("Failed to create XMLTerm shell\n");
window.close();
return;
}
// Store the XMLTerm shell in current window and in the XMLTerm frame
window.xmlterm = xmltshell;
xmltwin.xmlterm = xmltshell;
// Initialize XMLTerm shell in content window with argvals
window.xmlterm.Init(xmltwin, "", window.arguments);
}

View File

@@ -1,36 +1,634 @@
function StartupXMLTerm() {
dump("StartupXMLTerm:\n");
dump("StartupXMLTerm:"+window.frames.length+"\n");
dump("StartupXMLTerm:"+window.frames[0].name+"\n");
// XMLTerm Page Commands
if (window.frames.length == 2) {
xmltwin = window.frames[1];
xmltwin.xmltbrowser = window.frames[0];
} else {
xmltwin = window.frames[0];
}
// CONVENTION: All pre-defined XMLTerm Javascript functions
// begin with an upper letter. This allows
// an easy distinction with user defined functions,
// which should begin with a lower case letter.
dump("StartupXMLterm: WINDOW.ARGUMENTS="+window.arguments+"\n");
// Global variables
var altwin; // Alternate (browser) window
dump("Trying to make an XMLTerm Shell through the component manager...\n");
var tips = new Array(); // Usage tip strings
var tipnames = new Array(); // Usage tip names
var tipCount = 0; // No. of tips
var selectedTip = 0; // Selected random tip
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
dump("Interface xmltshell1 = " + xmltshell + "\n");
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
dump("Interface xmltshell2 = " + xmltshell + "\n");
if (!xmltshell) {
dump("Failed to create XMLTerm shell\n");
window.close();
return;
}
// Store the XMLTerm shell in current window and in the XMLTerm frame
window.xmlterm = xmltshell;
xmltwin.xmlterm = xmltshell;
// Initialize XMLTerm shell in content window with argvals
window.xmlterm.Init(xmltwin, "", window.arguments);
// Set prompt using form entry
function DefineTip(tip, name) {
tips[tipCount] = tip;
tipnames[tipCount] = name;
tipCount++;
return;
}
DefineTip('Click the new tip link to the left to get a new tip!',
'new-tip');
DefineTip('User level setting (at the top) controls amount of help information',
'level-setting');
DefineTip('Mode setting controls if double clicking a directory/executable opens a new window',
'mode-setting');
DefineTip('Icons setting controls whether directory listings use icons',
'icons-setting');
DefineTip('Single click an explicit (underlined) hyperlink; double click implicit (usually blue) hyperlinks',
'double-click');
DefineTip('Click the SetPrompt button to use a cool Mozilla prompt from dmoz.org!',
'set-prompt-moz');
DefineTip('"js:SetPrompt(HTMLstring);" sets prompt to HTML string.',
'set-prompt');
DefineTip('Type "js:func(arg);" to execute inline Javascript function func.',
'inline-js');
DefineTip('Inline Javascript ("js:...") can be used to produce HTML output.',
'js-html');
DefineTip('XMLterm supports full screen commands like "vi", "emacs -nw", and "less".',
'full-screen');
DefineTip('Use "xls -i" for iconic display of directory contents.',
'xls-i');
DefineTip('Use "xcat file" to display file.',
'xcat');
// Display random usage tip
// (should cease to operate after a few cycles;
// need to use Prefs to keep track of that)
function NewTip() {
var ranval = Math.random();
selectedTip = Math.floor(ranval * tipCount);
if (selectedTip >= tipCount) selectedTip = 0;
dump("xmlterm: NewTip "+selectedTip+","+ranval+"\n");
var tipdata = document.getElementById('tipdata');
tipdata.firstChild.data = tips[selectedTip];
ShowHelp("",0);
return false;
}
// Explain tip
function ExplainTip(tipName) {
dump("xmlterm: ExplainTip("+tipName+")\n");
if (tipName) {
var tipdata = document.getElementById('tipdata');
tipdata.firstChild.data = "";
} else {
tipName = tipnames[selectedTip];
}
ShowHelp('xmltermTips.html#'+tipName,0,120);
return false;
}
// F1 key - Hide all output
function F1Key(isShift, isControl) {
return DisplayAllOutput(false);
}
// F2 key - Show all output
function F2Key(isShift, isControl) {
return DisplayAllOutput(true);
}
// F7 - Explain tip
function F7Key(isShift, isControl) {
return ExplainTip();
}
// F8 - New tip
function F8Key(isShift, isControl) {
return NewTip();
}
// F9 key
function F9Key(isShift, isControl) {
return NewXMLTerm('');
}
// Scroll Home key
function ScrollHomeKey(isShift, isControl) {
dump("ScrollHomeKey("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scroll(0,0);
} else {
window.scroll(0,0);
}
return false;
}
// Scroll End key
function ScrollEndKey(isShift, isControl) {
dump("ScrollEndKey("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scroll(0,9999);
} else {
window.scroll(0,9999);
}
return false;
}
// Scroll PageUp key
function ScrollPageUpKey(isShift, isControl) {
dump("ScrollPageUpKey("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scrollBy(0,-300);
} else {
window.scrollBy(0,-300);
}
return false;
}
// Scroll PageDown key
function ScrollPageDownKey(isShift, isControl) {
dump("ScrollPageDownKey("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scrollBy(0,300);
} else {
window.scrollBy(0,300);
}
return false;
}
// Set history buffer size
function SetHistory(value) {
dump("SetHistory("+value+")\n");
window.xmlterm.SetHistory(value, document.cookie);
return (false);
}
// Set prompt
function SetPrompt(value) {
dump("SetPrompt("+value+")\n");
window.xmlterm.SetPrompt(value, document.cookie);
return (false);
}
// Create new XMLTerm window
function NewXMLTerm(firstcommand) {
newwin = window.openDialog( "chrome://xmlterm/content/xmlterm.xul",
"xmlterm", "chrome,dialog=no,resizable",
firstcommand);
//newwin = window.xmlterm.NewXMLTermWindow(firstcommand);
dump("NewXMLTerm: "+newwin+"\n")
return (false);
}
// Handle resize events
function Resize(event) {
dump("Resize()\n");
window.xmlterm.Resize();
return (false);
}
// Form Focus (workaround for form input being transmitted to xmlterm)
function FormFocus() {
dump("FormFocus()\n");
window.xmlterm.IgnoreKeyPress(true, document.cookie);
return false;
}
// Form Blur (workaround for form input being transmitted to xmlterm)
function FormBlur() {
dump("FormBlur()\n");
window.xmlterm.IgnoreKeyPress(false, document.cookie);
return false;
}
// Set user level
function UpdateSettings() {
var oldUserLevel = window.userLevel;
window.userLevel = document.xmltform1.level.options[document.xmltform1.level.selectedIndex].value;
var oldShowIcons = window.showIcons;
window.showIcons = document.xmltform1.icons.options[document.xmltform1.icons.selectedIndex].value;
window.commandMode = document.xmltform1.mode.options[document.xmltform1.mode.selectedIndex].value;
dump("UpdateSettings: userLevel="+window.userLevel+"\n");
dump("UpdateSettings: commandMode="+window.commandMode+"\n");
dump("UpdateSettings: showIcons="+window.showIcons+"\n");
if (window.userLevel != oldUserLevel) {
// Change icon display style in the style sheet
if (window.userLevel == "advanced") {
AlterStyle("DIV.beginner", "display", "none");
AlterStyle("DIV.intermediate", "display", "none");
} else if (window.userLevel == "intermediate") {
AlterStyle("DIV.intermediate", "display", "block");
AlterStyle("DIV.beginner", "display", "none");
} else {
AlterStyle("DIV.beginner", "display", "block");
AlterStyle("DIV.intermediate", "display", "block");
}
}
if (window.showIcons != oldShowIcons) {
// Change icon display style in the style sheet
if (window.showIcons == "on") {
AlterStyle("SPAN.noicons", "display", "none");
AlterStyle("TR.icons", "display", "table-row");
AlterStyle("IMG.icons", "display", "inline");
} else {
AlterStyle("SPAN.noicons", "display", "inline");
AlterStyle("TR.icons", "display", "none");
AlterStyle("IMG.icons", "display", "none");
}
}
return false;
}
// Alter style in stylesheet of specified document doc, or current document
// if doc is omitted.
function AlterStyle(ruleName, propertyName, propertyValue, doc) {
dump("AlterStyle("+ruleName+"{"+propertyName+":"+propertyValue+"})\n");
if (!doc) doc = window.document;
var sheet = doc.styleSheets[0];
var r;
for (r = 0; r < sheet.cssRules.length; r++) {
//dump(sheet.cssRules[r].selectorText+"\n");
if (sheet.cssRules[r].selectorText == ruleName) {
var style = sheet.cssRules[r].style;
//dump("style="+style.getPropertyValue(propertyName)+"\n");
style.setProperty(propertyName,propertyValue,"");
}
}
return false;
}
// Handle default meta command
function MetaDefault(arg1) {
return Load("http://"+arg1);
}
// Load URL in XMLTermBrowser window
function Load(url) {
var succeeded = false;
if (window.xmltbrowser) {
dump("Load:xmltbrowser.location.href="+window.xmltbrowser.location.href+"\n");
if (window.xmltbrowser.location.href.length) {
window.xmltbrowser.location = url;
succeeded = true;
}
}
if (!succeeded) {
window.xmltbrowser = window.open(url, "xmltbrowser");
}
// Save browser window object in global variable
altwin = window.xmltbrowser;
return (false);
}
// Control display of all output elements
function DisplayAllOutput(flag) {
var outputElements = document.getElementsByName("output");
for (i=0; i<outputElements.length-1; i++) {
var outputElement = outputElements[i];
outputElement.style.display = (flag) ? "block" : "none";
}
var promptElements = document.getElementsByName("prompt");
for (i=0; i<promptElements.length-1; i++) {
promptElement = promptElements[i];
promptElement.style.setProperty("text-decoration",
(flag) ? "none" : "underline", "")
}
if (!flag)
ScrollHomeKey(0,0);
return (false);
}
// Centralized event handler
// eventType values:
// click
//
// targetType:
// textlink - hyperlink
// prompt - command prompt
// command - command line
// exec - execute command with sendln/createln
// (depending upon window.commandMode)
// send - transmit arg to LineTerm
// sendln - transmit arg+newline to LineTerm
// createln - transmit arg+newline as first command to new XMLTerm
//
// 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)
//
function HandleEvent(eventObj, eventType, targetType, entryNumber,
arg1, arg2) {
dump("HandleEvent("+eventObj+","+eventType+","+targetType+","+
entryNumber+","+arg1+","+arg2+")\n");
// Entry independent targets
if (action === "textlink") {
// Single click opens hyperlink
// Browser-style
dump("textlink = "+arg1+"\n");
Load(arg1);
} else if (targetType === "prompt") {
// Single click on prompt expands/collapses command output
var outputElement = document.getElementById("output"+entryNumber);
var helpElement = document.getElementById("help"+entryNumber);
var promptElement = document.getElementById("prompt"+entryNumber);
//dump(promptElement.style.getPropertyValue("text-decoration"));
if (outputElement.style.display == "none") {
outputElement.style.display = "block";
promptElement.style.setProperty("text-decoration","none","");
} else {
outputElement.style.display = "none";
promptElement.style.setProperty("text-decoration","underline","");
if (helpElement) {
ShowHelp("",entryNumber);
}
}
} else if (eventType === "click") {
dump("clickCount="+eventObj.clickCount+"\n");
var dblClick = (eventObj.clickCount > 1);
// Execute shell commands only on double-click for safety
// Use single click for "selection" and prompt expansion only
// Windows-style
if (!dblClick)
return false;
if (targetType === "command") {
var commandElement = document.getElementById(targetType+entryNumber);
var command = commandElement.firstChild.data;
window.xmlterm.SendText("\025"+command+"\n", document.cookie);
} else {
// Targets which may be qualified only for current entry
if ((entryNumber >= 0) &&
(window.xmlterm.currentEntryNumber != entryNumber)) {
dump("NOT CURRENT COMMAND\n");
return (false);
}
var action = targetType;
if (action === "exec") {
if (window.commandMode === "window") {
action = "createln";
} else {
action = "sendln";
}
}
if (action === "send") {
dump("send = "+arg1+"\n");
window.xmlterm.SendText(arg1, 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);
}
} else if (action === "createln") {
dump("createln = "+arg1+"\n\n");
newwin = NewXMLTerm(arg1+"\n");
}
}
}
return (false);
}
// Set history buffer count using form entry
function SetHistoryValue() {
var field = document.getElementById('InputValue');
return SetHistory(field.value);
}
// Set prompt using form entry
function SetPromptValue() {
var field = document.getElementById('InputValue');
return SetPrompt(field.value);
}
// Insert help element displaying URL in an IFRAME before output element
// of entryNumber, or before the SESSION element if entryNumber is zero.
// Height is the height of the IFRAME in pixels.
// If URL is the null string, simply delete the help element
function ShowHelp(url, entryNumber, height) {
if (!height) height = 120;
dump("xmlterm: ShowHelp("+url+","+entryNumber+","+height+")\n");
if (entryNumber) {
beforeID = "output"+entryNumber;
helpID = "help"+entryNumber;
} else {
beforeID = "session";
helpID = "help";
}
var beforeElement = document.getElementById(beforeID);
if (!beforeElement) {
dump("InsertIFrame: beforeElement ID="+beforeID+"not found\n");
return false;
}
var parentNode = beforeElement.parentNode;
var helpElement = document.getElementById(helpID);
if (helpElement) {
// Delete help element
parentNode.removeChild(helpElement);
helpElement = null;
// *NOTE* Need to flush display here to avoid black flash?
}
if (url.length > 0) {
// Create new help element
helpElement = document.createElement("div");
helpElement.setAttribute('id', helpID);
helpElement.setAttribute('class', 'help');
var closeElement = document.createElement("span");
closeElement.setAttribute('class', 'helplink');
closeElement.appendChild(document.createTextNode("Close help frame"));
//closeElement.appendChild(document.createElement("p"));
var iframe = document.createElement("iframe");
iframe.setAttribute('id', helpID+'frame');
iframe.setAttribute('class', 'helpframe');
iframe.setAttribute('width', '100%');
iframe.setAttribute('height', height);
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('src', url);
helpElement.appendChild(iframe);
helpElement.appendChild(closeElement);
dump(helpElement);
// Insert help element
parentNode.insertBefore(helpElement, beforeElement);
// NOTE: Need to do this *after* node is inserted into document
closeElement.setAttribute('onClick', 'return ShowHelp("",'+entryNumber
+');');
}
return false;
}
// About XMLTerm
function AboutXMLTerm() {
dump("xmlterm: AboutXMLTerm\n");
var tipdata = document.getElementById('tipdata');
tipdata.firstChild.data = "";
ShowHelp('xmltermAbout.html',0,120);
return false;
}
// onLoad event handler
function LoadHandler() {
dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
// Update settings
UpdateSettings();
NewTip();
if (window.xmlterm) {
// XMLTerm already initialized
return (false);
}
dump("LoadHandler: WINDOW.ARGUMENTS="+window.arguments+"\n");
dump("Trying to make an XMLTerm Shell through the component manager...\n");
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
dump("Interface xmltshell1 = " + xmltshell + "\n");
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
dump("Interface xmltshell2 = " + xmltshell + "\n");
if (!xmltshell) {
dump("Failed to create XMLTerm shell\n");
window.close();
return;
}
// Store the XMLTerm shell in the window
window.xmlterm = xmltshell;
// Content window same as current window
var contentWindow = window;
// Initialize XMLTerm shell in content window with argvals
window.xmlterm.Init(contentWindow, "", "");
//dump("LoadHandler:"+document.cookie+"\n");
dump("contentWindow="+contentWindow+"\n");
dump("document="+document+"\n");
dump("documentElement="+document.documentElement+"\n");
// Handle resize events
//contentWindow.addEventListener("onresize", Resize);
contentWindow.onresize = Resize;
// Set focus to appropriate frame
contentWindow.focus();
//contentWindow.xmlterm = xmlterm;
//dump(contentWindow.xmlterm);
// The following code is for testing IFRAMEs only
dump("[Main] "+window+"\n");
dump(window.screenX+", "+window.screenY+"\n");
dump(window.scrollX+", "+window.scrollY+"\n");
dump(window.pageXOffset+", "+window.pageYOffset+"\n");
dump("IFRAME checks\n");
var iframe = document.getElementById('iframe1');
dump("iframe="+iframe+"\n");
frames=document.frames;
dump("frames="+frames+"\n");
dump("frames.length="+frames.length+"\n");
framewin = frames[0];
dump("framewin="+framewin+"\n");
dump("framewin.document="+framewin.document+"\n");
dump(framewin.screenX+", "+framewin.screenY+"\n");
dump(framewin.scrollX+", "+framewin.scrollY+"\n");
dump(framewin.pageXOffset+", "+framewin.pageYOffset+"\n");
var body = framewin.document.getElementsByTagName("BODY")[0];
dump("body="+body+"\n");
var height= body.scrollHeight;
dump("height="+height+"\n");
// iframe.height = 800;
// iframe.width = 700;
// framewin.sizeToContent();
framewin.xmltshell = xmltshell;
dump(framewin.xmltshell+"\n");
dump("xmlterm: LoadHandler completed\n");
return (false);
}

View File

@@ -1,472 +1,123 @@
<!-- xmlterm.html: XMLterm page -->
<HTML>
<HEAD>
<TITLE>XMLterm Page</TITLE>
<!-- xmlterm.html: xmlterm page -->
<html>
<head>
<title>xmlterm page</title>
<LINK TITLE="DefaultStyle" REL="stylesheet" TYPE="text/css"
HREF="chrome://xmlterm/skin/xmltpage.css">
<link title="defaultstyle" rel="stylesheet" type="text/css"
href="chrome://xmlterm/skin/xmltpage.css">
<SCRIPT language="JavaScript">
// CONVENTION: All pre-defined XMLTerm Javascript functions
// begin with an upper letter. This allows
// an easy distinction with user defined functions,
// which should begin with a lower case letter.
// Show all output
function ShowAll() {
return DisplayAllOutput(true);
}
// Hide all output
function HideAll() {
return DisplayAllOutput(false);
}
// Set history buffer size
function SetHistory(value) {
dump("SetHistory("+value+")\n");
window.xmlterm.SetHistory(value, document.cookie);
return (false);
}
// Set prompt
function SetPrompt(value) {
dump("SetPrompt("+value+")\n");
window.xmlterm.SetPrompt(value, document.cookie);
return (false);
}
// Create new XMLTerm window
function NewXMLTerm(firstcommand) {
newwin = window.openDialog( "chrome://xmlterm/content/xmlterm.xul",
"xmlterm", "chrome,dialog=no,resizable",
firstcommand);
//newwin = window.xmlterm.NewXMLTermWindow(firstcommand);
dump("NewXMLTerm: "+newwin+"\n")
return (false);
}
// Handle resize events
function Resize(event) {
dump("Resize()\n");
window.xmlterm.Resize();
return (false);
}
// Scroll Home
function ScrollHome(isShift, isControl) {
dump("ScrollHome("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scroll(0,0);
} else {
window.scroll(0,0);
}
return false;
}
// Scroll End
function ScrollEnd(isShift, isControl) {
dump("ScrollEnd("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scroll(0,9999);
} else {
window.scroll(0,9999);
}
return false;
}
// Scroll PageUp
function ScrollPageUp(isShift, isControl) {
dump("ScrollPageUp("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scrollBy(0,-300);
} else {
window.scrollBy(0,-300);
}
return false;
}
// Scroll PageDown
function ScrollPageDown(isShift, isControl) {
dump("ScrollPageDown("+isShift+","+isControl+")\n");
if (isShift && window.xmltbrowser) {
window.xmltbrowser.scrollBy(0,300);
} else {
window.scrollBy(0,300);
}
return false;
}
// Form Focus (workaround for form input being transmitted to xmlterm)
function FormFocus() {
dump("FormFocus()\n");
window.xmlterm.IgnoreKeyPress(true, document.cookie);
return false;
}
// Form Blur (workaround for form input being transmitted to xmlterm)
function FormBlur() {
dump("FormBlur()\n");
window.xmlterm.IgnoreKeyPress(false, document.cookie);
return false;
}
// Handle default meta command
function MetaDefault(arg1) {
return Load("http://"+arg1);
}
// Load URL in XMLTermBrowser window
function Load(url) {
var succeeded = false;
if (window.xmltbrowser) {
dump("Load:xmltbrowser.location.href="+window.xmltbrowser.location.href+"\n");
if (window.xmltbrowser.location.href.length) {
window.xmltbrowser.location = url;
succeeded = true;
}
}
if (!succeeded) {
window.xmltbrowser = window.open(url, "xmltbrowser");
}
return (false);
}
// Control display of all output elements
function DisplayAllOutput(flag) {
var outputElements = document.getElementsByName("output");
for (i=0; i<outputElements.length; i++) {
var outputElement = outputElements[i];
outputElement.style.display = (flag) ? "block" : "none";
}
var promptElements = document.getElementsByName("prompt");
for (i=0; i<promptElements.length; i++) {
promptElement = promptElements[i];
promptElement.style.setProperty("text-decoration",
(flag) ? "none" : "underline", "")
}
return (false);
}
// Centralized event handler
// eventType values:
// click
//
// targetType:
// textlink - hyperlink
// prompt - command prompt
// command - command line
// exec - execute command with sendln/createln
// (depending upon window.commandMode)
// send - transmit arg to LineTerm
// sendln - transmit arg+newline to LineTerm
// createln - transmit arg+newline as first command to new XMLTerm
//
// 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)
//
function HandleEvent(eventObj, eventType, targetType, entryNumber,
arg1, arg2) {
dump("HandleEvent("+eventObj+","+eventType+","+targetType+","+
entryNumber+","+arg1+","+arg2+")\n");
// Entry independent targets
if (action === "textlink") {
// Single click opens hyperlink
// Browser-style
dump("textlink = "+arg1+"\n");
Load(arg1);
} else if (eventType === "click") {
dump("clickCount="+eventObj.clickCount+"\n");
var dblClick = (eventObj.clickCount > 1);
// Execute shell commands only on double-click for safety
// Use single click for "selection" only
// Windows-style
if (!dblClick)
return false;
if (targetType === "prompt") {
var outputElement = document.getElementById("output"+entryNumber);
var promptElement = document.getElementById("prompt"+entryNumber);
//dump(promptElement.style.getPropertyValue("text-decoration"));
if (outputElement.style.display == "none") {
outputElement.style.display = "block";
promptElement.style.setProperty("text-decoration","none","");
} else {
outputElement.style.display = "none";
promptElement.style.setProperty("text-decoration","underline","");
}
} else if (targetType === "command") {
var commandElement = document.getElementById(targetType+entryNumber);
var command = commandElement.firstChild.data;
window.xmlterm.SendText("\025"+command+"\n", document.cookie);
} else {
// Targets which may be qualified only for current entry
if ((entryNumber >= 0) &&
(window.xmlterm.currentEntryNumber != entryNumber)) {
dump("NOT CURRENT COMMAND\n");
return (false);
}
var action = targetType;
if (action === "exec") {
if (window.commandMode === "window") {
action = "createln";
} else {
action = "sendln";
}
}
if (action === "send") {
dump("send = "+arg1+"\n");
window.xmlterm.SendText(arg1, 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);
}
} else if (action === "createln") {
dump("createln = "+arg1+"\n\n");
newwin = NewXMLTerm(arg1+"\n");
}
}
}
return (false);
}
// Set history buffer count using form entry
function SetHistoryValue() {
var field = document.getElementById('InputValue');
return SetHistory(field.value);
}
// Set prompt using form entry
function SetPromptValue() {
var field = document.getElementById('InputValue');
return SetPrompt(field.value);
}
// Usage tips
var tips = new Array();
tips[0] = 'Click the SetPrompt button to use a cool Mozilla prompt from dmoz.org!';
tips[1] = '"js:SetPrompt(HTMLstring);" sets prompt to HTML string.';
tips[2] = 'Type "js:func(arg);" to execute inline Javascript function func.';
tips[3] = 'Inline Javascript ("js:...") can be used to produce HTML output.';
tips[4] = 'XMLterm supports full screen commands like "vi", "emacs -nw", and "less".';
tips[5] = 'Use "xls -i" for iconic display of directory contents.';
tips[6] = 'Use "xcat file" to display file.';
// Display random usage tip
// (should cease to operate after a few cycles;
// need to use Prefs to keep track of that)
function UsageTip() {
var tipCount = tips.length;
var ranval = Math.random();
var tipIndex = Math.floor(ranval * tipCount);
if (tipIndex >= tipCount) tipIndex = 0;
dump("xmlterm: UsageTip "+tipIndex+","+ranval+"\n");
var tiphead = document.getElementById('tiphead');
var tipdata = document.getElementById('tipdata');
tiphead.firstChild.data = "Tip:";
tipdata.firstChild.data = tips[tipIndex];
return false;
}
// Display more tips
function MoreTips() {
dump("xmlterm: MoreTips\n");
var moreTipsElement = document.getElementById('moretips');
var moreTipsFrame = document.getElementById('moretipsframe');
if (moreTipsFrame) {
// Remove more tips iframe
document.body.removeChild(moreTipsFrame);
moreTipsElement.firstChild.data = "More tips/news";
} else {
// Create more tips iframe
moreTipsFrame = document.createElement("iframe");
moreTipsFrame.setAttribute('ID', 'moretipsframe');
moreTipsFrame.setAttribute('CLASS', 'moretipsframe');
moreTipsFrame.setAttribute('WIDTH', '100%');
moreTipsFrame.setAttribute('SRC', 'http://xmlterm.org/newstips.html');
dump(moreTipsFrame);
// Insert more tips iframe in body
var sessionElement = document.getElementById('session');
document.body.insertBefore(moreTipsFrame, sessionElement);
moreTipsElement.firstChild.data = "Hide tips/news";
}
return false;
}
// onLoad event handler
function LoadHandler() {
dump("xmlterm: LoadHandler ... "+window.xmlterm+"\n");
UsageTip();
if (window.xmlterm) {
// XMLTerm already initialized
return (false);
}
dump("LoadHandler: WINDOW.ARGUMENTS="+window.arguments+"\n");
dump("Trying to make an XMLTerm Shell through the component manager...\n");
var xmltshell = Components.classes["component://mozilla/xmlterm/xmltermshell"].createInstance();
dump("Interface xmltshell1 = " + xmltshell + "\n");
xmltshell = xmltshell.QueryInterface(Components.interfaces.mozIXMLTermShell);
dump("Interface xmltshell2 = " + xmltshell + "\n");
if (!xmltshell) {
dump("Failed to create XMLTerm shell\n");
window.close();
return;
}
// Store the XMLTerm shell in the window
window.xmlterm = xmltshell;
// Content window same as current window
var contentWindow = window;
// Initialize XMLTerm shell in content window with argvals
window.xmlterm.Init(contentWindow, "", "");
//dump("LoadHandler:"+document.cookie+"\n");
dump("contentWindow="+contentWindow+"\n");
dump("document="+document+"\n");
dump("documentElement="+document.documentElement+"\n");
// Handle resize events
//contentWindow.addEventListener("onresize", Resize);
contentWindow.onresize = Resize;
// Set focus to appropriate frame
contentWindow.focus();
//contentWindow.xmlterm = xmlterm;
//dump(contentWindow.xmlterm);
// The following code is for testing IFRAMEs only
dump("[Main] "+window+"\n");
dump(window.screenX+", "+window.screenY+"\n");
dump(window.scrollX+", "+window.scrollY+"\n");
dump(window.pageXOffset+", "+window.pageYOffset+"\n");
dump("IFRAME checks\n");
var iframe = document.getElementById('iframe1');
dump("iframe="+iframe+"\n");
frames=document.frames;
dump("frames="+frames+"\n");
dump("frames.length="+frames.length+"\n");
framewin = frames[0];
dump("framewin="+framewin+"\n");
dump("framewin.document="+framewin.document+"\n");
dump(framewin.screenX+", "+framewin.screenY+"\n");
dump(framewin.scrollX+", "+framewin.scrollY+"\n");
dump(framewin.pageXOffset+", "+framewin.pageYOffset+"\n");
var body = framewin.document.getElementsByTagName("BODY")[0];
dump("body="+body+"\n");
var height= body.scrollHeight;
dump("height="+height+"\n");
// iframe.height = 800;
// iframe.width = 700;
// framewin.sizeToContent();
framewin.xmltshell = xmltshell;
dump(framewin.xmltshell+"\n");
dump("xmlterm: LoadHandler completed\n");
return (false);
}
</SCRIPT>
<script language="JavaScript" src="XMLTermCommands.js">
</script>
</HEAD>
</head>
<BODY onLoad="return LoadHandler();">
<body onload="return LoadHandler();">
<TABLE FRAME=none BORDER=0>
<TBODY>
<TR><TD ALIGN=center>
<FORM NAME="XMLTERM form">
<INPUT TYPE="button" VALUE="Hide all output"
onClick="return HideAll();">
<INPUT TYPE="button" VALUE="Show all output"
onClick="return ShowAll();">
<INPUT TYPE="button" VALUE="SetHistory"
onClick="return SetHistoryValue();">
<INPUT TYPE="button" VALUE="SetPrompt" onClick="return SetPromptValue();">
<INPUT TYPE="button" VALUE="NewXMLTerm" onClick="return NewXMLTerm('');">
<BR>
Input Value:
<INPUT SIZE=50 TYPE="text" ID="InputValue"
VALUE="<img src='http:/dmoz.org/img/lizard2a.gif'>"
onFocus="return FormFocus();" onBlur="return FormBlur();">
</FORM>
</TABLE>
<form name="xmltform1">
<SPAN CLASS="tiphead" ID="tiphead" STYLE="font-weight:bold"> &nbsp; </SPAN>
<SPAN CLASS="tipdata" ID="tipdata"> &nbsp; </SPAN>
<input type="button" value="New XMLTerm"
onClick="return NewXMLTerm('');">
&nbsp;
<span class="helplink" onclick="return ExplainTip('level-setting');">
Level:</span>
<select name="level" size=1 onchange="return UpdateSettings();">
<option value="beginner">beginner</option>
<option value="intermediate" selected>intermediate</option>
<option value="advanced">advanced</option>
</select>
&nbsp;
<span class="helplink" onclick="return ExplainTip('icons-setting');">
Icons:</span>
<select name="icons" size=1 onchange="return UpdateSettings();">
<option value="on">on</option>
<option value="off" selected>off</option>
</select>
&nbsp;
<span class="helplink" onclick="return ExplainTip('mode-setting');">
Mode:</span>
<select name="mode" size=1 onchange="return UpdateSettings();">
<option value="inline" selected>inline</option>
<option value="window">window</option>
</select>
<SPAN CLASS="moretips" ID="moretips" onClick="return MoreTips();">
More tips/news
</SPAN>
<P>
<!--
<IFRAME NAME="iframet" SRC="chrome://xmlterm/content/xmltblank.html"
FRAMEBORDER=0>
</IFRAME>
<input type="button" value="Save Settings"
onClick="return SaveSettings();">
-->
<DIV CLASS="session" ID="session">
</DIV>
&nbsp;
<span class="helplink" id="aboutxmlterm" onclick="return AboutXMLTerm();">
About XMLTerm
</span>
<hr>
</form>
</BODY>
</HTML>
<div class="intermediate">
<div class="beginner">
<form name="xmltform2">
<center> <span class="formhead">Keyboard shortcuts</span> </center>
<table align=center>
<tr>
<td align=center> <span class="formhead">F1</span>
<td align=center> <span class="formhead">F2</span>
<td align=center> <span class="formhead">F7</span>
<td align=center> <span class="formhead">F8</span>
<td align=center> <span class="formhead">F9</span>
<tr>
<td><input type="button" value="Hide all output"
onClick="return F1Key();">
<td><input type="button" value="Show all output"
onClick="return F2Key();">
<td><input type="button" value="Explain tip"
onClick="return F7Key();">
<td><input type="button" value="New tip"
onClick="return F8Key();">
<td><input type="button" value="New XMLTerm"
onClick="return F9Key();">
</table>
<br>
<input type="button" value="Set History"
onClick="return SetHistoryValue();">
<input type="button" value="Set Prompt"
onClick="return SetPromptValue();">
<span class="formhead">Value:</span>
<input size=45 type="text" id="inputvalue"
value="<img src='http:/dmoz.org/img/lizard2a.gif'>"
onFocus="return FormFocus();" onBlur="return FormBlur();">
</form>
<hr>
</div>
<table id="xmlttip" width=100%>
<tr><td align=left valign=top nowrap>
<span class="helplink" id="tiphead" onclick="return NewTip();">
New Tip:
</span>
<td align=left valign=top>
<span class="tipdata" id="tipdata">
&nbsp;
</span>
<td align=right valign=top nowrap>
<span class="helplink" id="explaintip" onclick="return ExplainTip();">
Explain Tip
</span>
</table>
</div>
<br>
<!--
<iframe name="iframet" src="chrome://xmlterm/content/xmltblank.html"
frameborder=0>
</iframe>
-->
<div class="session" id="session">
</div>
</body>
</html>

View File

@@ -30,7 +30,7 @@
onload="StartupXMLTerm();"
title="xmlterm" align="vertical" width="740" height="484">
<html:script src="chrome://xmlterm/content/XMLTermCommands.js"></html:script>
<html:script src="chrome://xmlterm/content/XMLTermChrome.js"></html:script>
<html:iframe id="content-frame" type="content" html:name="content"
html:src="chrome://xmlterm/content/xmlterm.html" flex="100%"/>

View File

@@ -0,0 +1,28 @@
<html>
<head>
<title>about xmlterm page</title>
<link title="defaultstyle" rel="stylesheet" type="text/css"
href="chrome://xmlterm/skin/xmltpage.css">
</head>
<body>
<a name='about-xmlterm'></a>
<table class="tiptable" width='100%' height=100 frame=none border=0
cellpadding=0 cellspacing=0>
<tr><td>
<div class="tipelement">
XMLterm is an Xterm-like terminal program implemented using the
Mozilla layout engine. XMLterm adds powerful graphical and hypertext
capabilities to the Xterm command line interface, while maintaining
backwards compatibility. See
<a href="http://xmlterm.org">http://xmlterm.org<a>
for more information.
</div>
</table>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<html>
<head>
<title>xmlterm page</title>
<link title="defaultstyle" rel="stylesheet" type="text/css"
href="chrome://xmlterm/skin/xmltpage.css">
</head>
<body>
<a name='new-tip'></a>
<table class="tiptable" width='100%' frame=none border=0
cellpadding=0 cellspacing=0>
<tr><td>
<div class="tipelement">
The tip feature provides a random usage tip every time you start-up xmlterm.
<br>
Click on the <span class="helphighlight">New Tip</span> link to the left,
if you would like a new tip.<br>
Click on the <span class="helphighlight">Explain Tip</span> link to the
right, for more information on the tip.<br>
Set user <span class="helphighlight">Level</span> to <b>advanced</b> to turn
off
tips.
</div>
</table>
<p>
</body>
</html>

View File

@@ -13,26 +13,52 @@ PRE { font-family: monaco;
SPAN.prompt { color: blue }
SPAN.command { color: blue }
/* Screen display */
PRE.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.boldstyle { font-weight: bold; margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.underlinestyle { text-decoration: underline; margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.blinkstyle { font-weight: bold; margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.inversestyle { font-weight: bold; margin: 0; padding-top: 0; padding-bottom: 0 }
/* Tips */
SPAN.tiphead { font-family: sans-serif; font-weight: bold }
SPAN.tipdata { font-family: sans-serif }
SPAN.moretips { font-family: sans-serif; color: blue; cursor: hand;
font-weight: bold; text-decoration: underline };
/* Highlighting */
DIV.textlink { font-family: monaco; color: blue; cursor: hand }
SPAN.textlink { font-family: monaco; color: blue; cursor: hand }
/* Explicit hyperlinks (underlined) */
DIV.textlink { font-family: monaco; color: blue; cursor: hand;
text-decoration: underline }
SPAN.textlink { font-family: monaco; color: blue; cursor: hand;
text-decoration: underline }
/* Imlicit hyperlinks (highlighted) */
SPAN.highlight { font-family: monaco; color: blue; cursor: hand }
SPAN.directory { font-family: monaco; color: blue; cursor: hand }
SPAN.executable { font-family: monaco; color: blue; cursor: hand }
SPAN.plainfile { font-family: monaco; color: blue; cursor: hand}
SPAN.imagefile { font-family: monaco; color: blue; cursor: hand}
SPAN.urlfile { font-family: monaco; color: blue; cursor: hand}
SPAN.plainfile { font-family: monaco; color: blue; cursor: hand }
SPAN.imagefile { font-family: monaco; color: blue; cursor: hand }
SPAN.urlfile { font-family: monaco; color: blue; cursor: hand }
/* Screen display */
PRE.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.row { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.boldstyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.underlinestyle { text-decoration: underline; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.blinkstyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
SPAN.inversestyle { font-weight: bold; margin: 0;
padding-top: 0; padding-bottom: 0 }
/* Forms */
FORM { margin: 0; padding-top: 0; padding-bottom: 0 }
SPAN.formhead { font-family: sans-serif; font-weight: bold }
/* Tips */
SPAN.tipdata { font-family: sans-serif }
TABLE.tiptable { background-color: #DDDDDD }
DIV.tipelement { font-family: sans-serif }
/* Help links */
SPAN.helphighlight { font-family: sans-serif; color: green; cursor: hand }
SPAN.helplink { font-family: sans-serif; color: blue; cursor: hand;
text-decoration: underline}
/* Level style */
DIV.intermediate {display: block}
DIV.beginner {display: none}
/* Icons style */
TR.icons {display: none}
IMG.icons {display: none}
SPAN.icons {display: none}
SPAN.noicons {display: inline}