home *** CD-ROM | disk | FTP | other *** search
- /*
- Write your own scripts to another file. This file can be changed
- in any future distribution.
-
- (c) 1991, 2002-2003 Slßvek Rydval, http://www.rydval.cz, slavek@rydval.cz
- */
- //-----------------------------------------------IsSomeFileOpenedAndEditable---
- function IsSomeFileOpenedAndEditable()
- {
- Actions.SetActionEnabled (Actions.UpdatedAction,
- Editor.IsSomeFileOpened() &&
- !Editor.ActiveEdit.ReadOnly);
- } //IsSomeFileOpenedAndEditable
- //----------------------------------------------------------IsSomeFileOpened---
- function IsSomeFileOpened()
- {
- Actions.SetActionEnabled (Actions.UpdatedAction,
- Editor.IsSomeFileOpened());
- } //IsSomeFileOpened
- //---------------------------------------------------------TextToXMLSafeForm---
- function TextToXMLSafeForm()
- {
- var x = Editor.ActiveEdit.CaretX;
- var y = Editor.ActiveEdit.CaretY;
- Editor.ActiveEdit.BeginUpdate();
- if (Editor.ActiveEdit.SelText == '')
- Editor.ActiveEdit.SelectAll();
- var s = Editor.ActiveEdit.SelText;
- s = s.replace (/&/g, '&');
- s = s.replace (/</g, '<');
- s = s.replace (/>/g, '>');
- s = s.replace (/\'/g, ''');
- s = s.replace (/\"/g, '"');
- Editor.ActiveEdit.SelText = s;
- Editor.ActiveEdit.SetCaretXY (x, y);
- Editor.ActiveEdit.EndUpdate();
- } //TextToXMLSafeForm
- //----------------------------------------------------------XMLSafeFormToText--
- function XMLSafeFormToText()
- {
- var x = Editor.ActiveEdit.CaretX;
- var y = Editor.ActiveEdit.CaretY;
- Editor.ActiveEdit.BeginUpdate();
- if (Editor.ActiveEdit.SelText == '')
- Editor.ActiveEdit.SelectAll();
- var s = Editor.ActiveEdit.SelText;
- s = s.replace (/&/g, '&');
- s = s.replace (/</g, '<');
- s = s.replace (/>/g, '>');
- s = s.replace (/'/g, "'");
- s = s.replace (/"/g, '"');
- Editor.ActiveEdit.SelText = s;
- Editor.ActiveEdit.SetCaretXY (x, y);
- Editor.ActiveEdit.EndUpdate();
- }
- //---------------------------------------------------------CloseTextToXMLTag---
- function CloseTextToXMLTag()
- {
- if (Dialogs.InputDialog.Execute ("Close block to XML tag", "Enter XML tag name:",""))
- {
- var tag = Dialogs.InputDialog.Value;
- if (tag == "")
- {
- Dialogs.ShowMessage ("No tag was entered.");
- }
- else
- {
- Editor.ActiveEdit.BeginUpdate();
- var s = Editor.ActiveEdit.SelText;
- s = "<" + tag + ">" + s + "</" + tag + ">";
- Editor.ActiveEdit.SelText = s;
- Editor.ActiveEdit.BeginUpdate();
- }
- }
- } //CloseTag
- //-------------------------------------------------------------ScriptingHelp---
- function ScriptingHelp()
- {
- Help.HTMLHelpIndex (System.ApplicationPath+"rkScripting.chm");
- } //ScriptingHelp
- //---------------------------------------------------------------ContextHelp---
- function ContextHelp()
- {
- var
- hl = Editor.ActiveEdit.GetHighlighter();
-
- if (hl == "xml")
- {
- Help.HTMLHelpTopic ("H:\\SGML\\DocBook\\docbook.chm", //<-- here enter path to DocBookHelp
- Editor.ActiveEdit.WordAtCursorPos+".html");
- }
- else
- if (hl == "jscript")
- Help.HTMLHelpTopic (System.ApplicationPath+"rkScripting.chm",
- Editor.ActiveEdit.WordAtCursorPos+".htm")
- else
- Dialogs.ShowMessage ("No context help for this file.");
- } //ContextHelp
-