Class are destined to control multi TEXTEDIT objects.
mEdit() --> MEDIT object mEdit_new() --> MEDIT object
<ClassName> | MEDIT |
<Tobj> | Array, an array of TEXTEDIT objects |
<TobjInfo> | Array, an array of window information for every element <Tobj> |
<Curwin> | Numeric, the cureent window number. |
<Clipboard> | Array, an clipboard array. |
<Find> | FIND object, contain search information and options |
<Opt> | Map, the MEDIT configuration |
OCREATEBAK - Logical, if TRUE create .bak files, specified TE_CREATE_BAK | |
OTABSIZE - Numeric, the tabulation size, specified TE_TABSIZE | |
OAUTOSAVE - Logical, if TRUE save TEXEDIT objects automatical every OTIMEAUTOSAVE time, specified TE_AUTO_SAVE | |
OTIMEAUTOSAVE - Numeric, the time autosave in minute, specified TE_TIME_AUTO_SAVE | |
OSAVESTATUS - Logical, if TRUE autosave this options into file, specified TE_SAVE_STATUS | |
OHYPHEN - Logical, if TRUE hyphen, specified TE_HYPHEN. | |
OAUTOMARGIN - Logical, if TRUE auto margin boundary, specified TE_AUTO_MARGIN. | |
OMARGINLEFT - Numeric, the left margin, specified TE_MARGIN_LEFT. | |
OMARGINRIGHT - Numeric, the right margin, specified TE_MARGIN_RIGHT. | |
OAUTOINDENT - Logical, if TRUE auto set new column position by position first letter of previouse line, specified TE_AUTO_IDENT. | |
<Templ> | Map, the key is template, data - substring to replace. |
<Tempmacro> | Map, the key is template, data - macro values. |
<UserFunc> | String, the name user function. |
<nTop> | a MEDIT viewport coordinates (default - 0) |
<nLeft> | a MEDIT viewport coordinates (default - 0) |
<nBot> | a MEDIT viewport coordinates (default - maxrow()) |
<nRight> | a MEDIT viewport coordinates (default - maxcol()) |
<Param> | Array, array of file names to edit. |
<Tab_size> | Numeric, the tabulation size. |
<bLine> | Numeric, the line number by loading (default 1). |
<bPos> | Numeric, the column number by loading (default 1). |
<wLine> | Numeric, the line number in viewport by loading (default 1). |
<wPos> | Numeric, the column number in viewport by loading (default 1). |
<Single_mode> | Logical, if TRUE - the draw mode is SINGLE (default FALSE) |
<Double_mode> | Logical, if TRUE - the draw mode is DOUBLE (default FALSE). |
<stLine> | String, the status line text (default [ESC - menu]). |
<oMenu> | MENU object. |
<AutoIndent> | Logical, if TRUE auto identification new column position into new line by previose line (default TRUE) |
APPLYHASH | Evaluate the code block. |
BACKSPACE | Delete symbol. |
CALLMENU | Call and run menu. |
CANCELBLOCK | Unmark block. |
CENTERLINE | Centered line. |
CHANGECHARSET | Change charset. |
CHOOSECODEPAGE | Choose and set new codepage. |
CLOSEWINDOW | Close window. |
COPYBLOCK | Copy or move block to new position line and column. |
COPYTOCLIPBOARD | Copy block to clipboard. |
CREATENEWWINDOW | Create new TEXTEDIT object into new window. |
DELETE | Delete symbol. |
DELETEBLOCK | Remove block. |
DELETEEND | Delete string from current column to th end of string. |
DELETEHOME | Delete string from cuurent column to the start of string. |
DELETELINE | Delete line. |
DRAWHEAD | Draw border header. |
EDITKEYS | Edit MEDIT options. |
EDITOPT | Edit MEDIT options. |
ENABLEBLOCKMENU | Enable block menu items. |
ENABLEMENU | Enable menu items. |
FINDNEXT | Search continue to forward. |
FINDPREV | Search continue to backward. |
FINDREPLACE | Find and replace string or regular expression within current one or all windows. |
FINDSTRING | Find string or regular expression within current one or all windows. |
FORMAT | Format line or part of text. |
GETREADONLY | Get mode Read Only. |
GOTO | Run dialog "Go to line". |
HELPEDIT | Make help. |
INITUSERMACRO | Initiation users macros. |
INSMACRO | Insert text string(s) by after do macro expression. |
INSTEMPLATE | Insert text string(s) by template. |
LISTFILES | Show listing opened files. |
LOADBLOCK | Load block from file. |
MARKBLOCK | Start/stop to mark block. |
MATCHSTRUCTURE | Match structure within window. |
MATCHSYMBOL | Match symbol within window. |
MEDIT | MEDIT constructor. |
MENU | Create common menu for MEDIT object. |
NEWLINE | Goto new line of window. |
NEXTWINDOW | Change current window to next. |
OPENFILE | Open file into new window. |
PASTEFROMCLIPBOARD | Paste block from clipboard. |
PREVWINDOW | Change current window to previous. |
Print file or marked block. | |
RELOADFILE | Reload file. |
REMOVEWINDOW | Remove window |
RUNME | Key code handler() |
SAVEBLOCK | Save block to file. |
SAVEFILE | Save file. |
SAVEOPTIONS | Save MEDIT options. |
SAVEPOS | Save current line position. |
SAVEWINS | Save all windows that contained TEXEDIT objects. |
SETDRAW | Start/Stop lines drow mode. |
SETHASH | Set a code block associated with commands hash code value. |
SETINSERTMODE | Set insert mode. |
SETOPTIONS | Set editor options. |
SHOWFILES | Show listing of opened files. |
UNDO | Make "undo" operation. |
WRITESTATUS | Save MEDIT status. |
#include <inkey.ch> #include <edit.ch> /* create new MEDIT object */ me := medit_new() /* get standart HASH command for MEDIT object */ mekeys := HK_get("edit") /* create users HASH command */ keys := map() keys[K_F2] := HASH_Save keys[K_F3] := HASH_Open keys[K_ESC] := HASH_Quit /* set code block to users HASH command */ me:SetHash(HASH_Save, {|oMe, nKey| oMe:SaveFile(), ME_CONTINUE}) me:SetHash(HASH_Open, {|oMe, nKey| oMe:OpenFile(), ME_CONTINUE}) me:SetHash(HASH_Quit, {|oMe, nKey| oMe:CloseWindow(), ME_EXIT}) /* make command */ ret := ME_CONTINUE do while ret != ME_EXIT nKey := inkey(0) if nKey $ keys hKey := keys[nKey] elseif nKey $ mekeys hKey := mekeys[nKey] else hKey := nKey endif ret := me:applyHash(hKey) enddo
No dependies of platform.
Evaluate the code block.
ApplyHash(<nHashCode>) --> nResult
Returns one of numeric value what definited in edit.ch.
ME_EXIT -1 User request for the MEDIT to lose input focus
ME_CONTINUE 0 Code block associated with <nHashCode> was evaluated
ME_EXCEPTION 1 Unable to locate <nHashCode> in the dictionary, hash code was not processed
ApplyHash() evaluates the code block associeated with hash code <nHashCode> that is contained whithin SetHash() dictionary and returns <nResult>.
Delete symbol.
Backspace([<nWin>]) --> .T.
Returns TRUE.
Backspace() is called method Backspace() for TEXTEDIT object <::Tobj[nWin]>.
Call and run menu.
CallMenu(<nChoice>) --> .T.
Returns TRUE.
CallMenu() is called and ran menu object <::oMenu> that was created within method Menu().
Unmark block.
CancelBlock([<nWin>]) --> .T.
Returns TRUE.
CancelBlock() is called method CancelBlock() for TEXTEDIT object <::Tobj[nWin]> .
Centered line.
CenterLine([<nWin>]) --> .T.
Returns TRUE.
CenterLine() is called method CenterLine() for TEXTEDIT object <::Tobj[nWin]>.
Change charset.
ChangeCharset(<nWin>, <sCharset>) --> .T. || .F.
Returns TRUE if sets charset <sCharset>.
ChangeCharset() is called corresponding method SetCharset() for <::Tobj[nWin]>
Choose and set new codepage.
ChooseCodePage() --> NIL
No arguments
Returns NIL.
ChooseCodePage() is ran dialog "Choose code page" and converted editor buffer <::Tobj[::Curwin]> to choosed code page.
All existing code page reading from directory CLIPROOT()+"/charsets"
Close window.
CloseWindow([<nWin>]) --> .T.
Returns TRUE.
CloseWindow() is saved file, closed window <nWin> and removed it from are <::Tobj> listing.
Copy or move block to new position line and column.
CopyBlock([<nWin>][,<lCopy>]) --> .T.
Returns TRUE.
CopyBlock() is called method CopyBlock() or MoveBlock() for TEXTEDIT object <::Tobj[nWin]>.
Copy block to clipboard.
CopyToClipboard([<nWin>]) --> .T.
Returns TRUE.
CopyToClipboard() is called method CopyToClipboard() for TEXTEDIT object <::Tobj[nWin]>.
Create new TEXTEDIT object into new window.
CreateNewWindow() --> .T.
No arguments
Returns TRUE.
CreateNewWindow() is created new TEXTEDIT object into new window.
New window will be created with coordinates <::nTop>, <::nLeft>, <::nBot>, <::nRight> and will be add to listing TEXEDIT objects <::Tobj>. This window will be current and take focus.
Delete symbol.
Delete([<nWin>]) --> .T.
Returns TRUE.
Delete() is called method DelRight() for TEXTEDIT object <::Tobj[nWin]>.
Remove block.
DeleteBlock([<nWin>]) --> .T.
Returns TRUE.
DeleteBlock() is called method DeleteBlock() for TEXTEDIT object <::Tobj[nWin]>.
Delete string from current column to th end of string.
DeleteEnd([<nWin>]) --> .T.
Returns TRUE.
DeleteEnd() is called method DelEnd() for TEXTEDIT object <::Tobj[nWin]>.
Delete string from cuurent column to the start of string.
DeleteHome([<nWin>]) --> .T.
Returns TRUE.
DeleteHome() is called method DelHome() for TEXTEDIT object <::Tobj[nWin]>.
Delete line.
DeleteLine([<nWin>]) --> .T.
Returns TRUE.
DeleteLine() is called method DeleteLine() for TEXTEDIT object <::Tobj[nWin]>.
Draw border header.
DrawHead() --> .T.
No arguments
Returns TRUE.
DrawHead() is drow title for each TEXTEDIT object. Title include next information: file name, read only mode, share mode, SET_INSERT mode, window number.
Edit MEDIT options.
EditOpt() --> .T.
No arguments
Returns TRUE.
EditOpt() is made dialog to edit MEDIT options <::Opt>.
Edit MEDIT options.
EditOpt() --> .T.
No arguments
Returns TRUE.
EditOpt() is made dialog to edit MEDIT options <::Opt>.
Enable block menu items.
EnableBlockMenu() --> .T.
No arguments
Returns TRUE.
EnableBlockMenu() called method MenuItem:EnableStatus() to every items of MENU object that be called block methods.
The status enable specify TRUE if block will be makked.
Enable menu items.
EnableMenu() --> .T.
No arguments
Returns TRUE.
EnableMenu() called method MenuItem:EnableStatus() to every items of MENU object that be created winthin method Medit:Menu().
The status enable specify TRUE if will be opened or created even though file.
Search continue to forward.
FindNext([<nWin>]) --> .T.
Returns TRUE.
FindNext() is called method FindNext() for TEXTEDIT object <::Tobj[nWin]> with find options <::Find>.
Search continue to backward.
FindPrev([<nWin>]) --> .T.
Returns TRUE.
FindPrev() is called method FindPrev() for TEXTEDIT object <::Tobj[nWin]> with find options <::Find>.
Find and replace string or regular expression within current one or all windows.
FindReplace([<nWin>]) --> .T.
Returns TRUE.
FindReplace() is called method Replace() for TEXTEDIT object <::Tobj[nWin]> with find options <::Find>.
Find string or regular expression within current one or all windows.
FindString([<nWin>]) --> .T.
Returns TRUE.
FindString() is called method Find() for TEXTEDIT object <::Tobj[nWin]> with find options <::Find>.
Format line or part of text.
Format([<nWin>][,<lMode>]) --> .T.
Returns TRUE.
Format() is called method FormatLine() or FormatPart() for TEXTEDIT object <::Tobj[nWin]> with parameters that specified <::Opt>.
Get mode Read Only.
GetReadOnly(<nWin>) --> lMode
Returns logical value TRUE if mode ReadOnly specify.
GetReadOnly() is get read only mode for TEXTEDIT objects <::Tobj[nWin]>.
If <nWin> is NIL, then SetReadOnly() returns FALSE.
Run dialog "Go to line".
Goto() --> nNewLine
No arguments
Returns the new line number.
Goto() read new line number and if it number between 1 and <::Lines> called method TextEdit:GotoLine() for current TEXTEDIT object.
Make help.
HelpEdit() --> NIL
No arguments
Returns NIL.
HelpEdit() read help for text editor from file CLIPROOT()+"/doc/edit.html"
Initiation users macros.
InitUserMacro(<sIniFileName>) --> .T. || .F.
Returns TRUE if <sIniFileName> exist and loaded.
IniUserMacro() is read file <sIniFileName> and try loaded it. The format .ini file is:
[Label] UFUNC = <UserFuncName> The name user function UFILE = <UserFuncFileName> The full name file .po that contained user function <UserFuncName> [UALLWINS= <lAll>] If .T. user function take object MEDIT, other its take current TEXTEDIT object. (Default is .F.) [UHOTKEY = <HotKeyCode>] The name hot key code into <inkey.ch> [UCOMMAND= <CommandName>] The command name.(Default <UserFuncName>) [UMENUSTR= <MenuString>] The menu items string. (Default <UserFuncName>) [UMENUMSG= <MenuMsg>] The message menu item.
The all users macro will be added to <::oMenu> object into item "Macro".
The function <UserFuncName> take one parameters MEDIT or TEXTEDIT object and can be returns logical value. If users function returns TRUE, then key code processed. If users function return FALSE, then key code can be processed of standart handler RunMe().
Insert text string(s) by after do macro expression.
InsMacro([<nWin>]) --> .T.
Returns TRUE.
InsMacro() is called method InsMacro() for TEXTEDIT object <::Tobj[nWin]> with templates array <::TemplMacro>.
Insert text string(s) by template.
InsTemplate([<nWin>]) --> .T.
Returns TRUE.
InsTemplate() is called method InsTempl() for TEXTEDIT object <::Tobj[nWin]> with templates array <::Templ>.
Show listing opened files.
ListFiles() --> nCurWindow
No arguments
Returns number choosed window.
ListFiles() is made dialog to choose opened files. It is are listing TEXTEDIT objects.
If window not choosed, ListFiles() returns the number cuurent window.
Load block from file.
LoadBlock([<nWin>]) --> .T.
Returns TRUE.
LoadBlock() is choosed file and called method LoadBlock() for TEXTEDIT object <::Tobj[nWin]>.
Start/stop to mark block.
MarkBlock([<nWin>][,<lMode>]) --> .T.
Returns TRUE.
MarkBlock() is called methods BeginBlock or EndBlock() for TEXTEDIT object <::Tobj[nWin]> .
Match structure within window.
MatchStructure([<nWin>][,<ldirect>]) --> .T.
Returns TRUE.
MatchStructure() is called method MatchStruct() for TEXTEDIT object <::Tobj[nWin]>.
Match symbol within window.
MatchSymbol([<nWin>][,<lDirect>]) --> .T.
Returns TRUE.
MatchSymbol() is called method Identity() for TEXTEDIT object <::Tobj[nWin]>.
MEDIT constructor.
mEdit([<aParam>],[<nTop>],[<nLeft>],[<nBot>],[<nRight>],[<sUserFunc>],[<nTabSize>],[<nBline>],[<nBpos>],[<nWline>],[<nWpos>]) --> MEDIT object mEdit_New([<aParam>],[<nTop>],[<nLeft>],[<nBot>],[<nRight>],[<sUserFunc>],[<nTabSize>],[<nBline>],[<nBpos>],[<nWline>],[<nWpos>]) --> MEDIT object
<aParam> | Array, the file names to edit. |
<nTop> | Numeric, the viewport coordinates (default 0) |
<nLeft> | Numeric, the viewport coordinates (default 0) |
<nBot> | Numeric, the viewport coordinates (default maxrow()) |
<nRight> | Numeric, the viewport coordinates (default maxcol()) |
<sUserFunc> | String, the user function name |
<nTabSize> | Numeric, the tabulation size (default TE_TABSIZE) |
<nBline> | Numeric, the begin line position into editor buffer for each TEXTEDIT object (default 1) |
<nBpos> | Numeric, the begin column position into editor buffer (default 1) |
<nWline> | Numeric, the begin line position into viewport (default 1) |
<nWpos> | Numeric, the begin column position into viewport (default 1) |
New MEDIT object
Medit_new() is constructs and returns new MEDIT object. That class can be used to create, for example, multiwindow text editors.
Medit() is equal to Medit_new(), but it activate method Runme() at once.
Create common menu for MEDIT object.
Menu() --> oMenu
No arguments
Returns the new MENU object.
Menu() created new MENU object to control MEDIT object.
Menu() is calls automaticaly from one of constructors.
Goto new line of window.
NewLine([<nWin>]) --> .T.
Returns TRUE.
NewLine() is called method InsertLine() if Set(_SET_INSERT) is TRUE and method NewLine()for TEXTEDIT object <::Tobj[nWin]>.
Change current window to next.
NextWindow() --> .T.
No arguments
Returns TRUE.
NextWindow() is changed current window to next. <::Curwin> increased by one.
Open file into new window.
OpenFile() --> .T. || .F.
No arguments
Returns TRUE if file will be loaded, and FALSE in other.
OpenFile() is ran file dialog and loaded to new TEXTEDIT object selected file within new window..
New window will be created with coordinates <::nTop>, <::nLeft>, <::nBot>, <::nRight> and will be add to listing TEXEDIT objects <::Tobj>. This window will be current and take focus.
Paste block from clipboard.
PasteFromClipboard([<nWin>]) --> .T.
Returns TRUE.
PasteFromClipboard() is called method PasteFromClipboard() for TEXTEDIT object <::Tobj[nWin]>.
Change current window to previous.
PrevWindow() --> .T.
No arguments
Returns TRUE.
PrevWindow() is changed current window to previous. <::Curwin> decreased by one.
Print file or marked block.
Print([<nWin>][, <lBlock>]) --> .T.
Returns TRUE.
Print() is printed file or if <lBlock> is TRUE marked block.
Reload file.
ReloadFile([<nWin>]) --> .T.
Returns TRUE.
ReloadFile() is called method LoadFile() for TEXTEDIT object <::Tobj[nWin]> with find options <::Find>.
Remove window
RemoveWindow([<@nWin>]) --> NIL
Returns NIL.
RemoveWindow() is removed TEXTEDIT object with number <nWin> from listing <::Tobj> and decreased <nWin> by one.
Key code handler()
RunMe() --> NIL
No arguments
Returns NIL.
RunMe() is started key code handler of MEDIT object. It processed key code and made corresponding of this key MEDIT command.
Save block to file.
SaveBlock([<nWin>]) --> .T.
Returns TRUE.
SaveBlock() is choosed file name and called method SaveBlock() for TEXTEDIT object <::Tobj[nWin]>.
Save file.
SaveFile([<sFileName>]) --> .T. || .F.
Returns TRUE if file saved and returns FALSE in other.
SaveFile() is saved current TEXTEDIT editor buffer (<::Tobj[::Curwin]>) into file <sFileName>. If <sFileName> not specified, then text saved into file with old name specified into TEXTEDIT object attribute <::Path>+<::FileName>.
If option <::Opt:OCREATEBAK> is TRUE, then before saving would be create .bak file.
Save MEDIT options.
Save_options() --> .T.
No arguments
Returns TRUE.
Save_options() is saved MEDIT options <::Opt> to file getenv("HOME")+"/.clip/.edit". Every user can have own file options.
Save current line position.
SavePos([<nWin>]) --> .T.
Returns TRUE.
SavePos() is saved current line position of TEXTEDIT object <::Tobj[nWin]> .
Save all windows that contained TEXEDIT objects.
SaveWins() --> .T. || .F.
No arguments
Returns TRUE if all TEXTEDIT objects was be saved.
SaveWins() is tryed to save to files all TEXEDIT objects from <::Tobj>.
If all objects was be saved, SaveWins return TRUE, in other FALSE.
Start/Stop lines drow mode.
SetDraw([<nWin>][,<lDrawMode>]) --> .T.
Returns TRUE.
SetDraw() is set/unset single/double line draw mode.
Set a code block associated with commands hash code value.
SetHash(<nHashCode>[, <bData>]) --> bPreviouse
Returns the previouse block code if exist or returns current one <bData>.
SetHash() is sets a new code block associated with code <nHashCode>. When replacing an existing code block definition, it returns previous code block, in other returns current one. Its associated hash code will be evaluated ApplyHash() methods.
If <bData> is NIL, SetHash() returns old block code and remove hashcommand/code block definition.
A default hash code is cursor moves(K_UP, K_DOWN, K_LEFT, K_RIGHT, K_PGUP, K_PGDN, K_HOME, K_END ....) associates with corresponded methods Left(), Right(), Up(), Down() and more.
Set insert mode.
SetInsertMode([<lMode>]) --> .T.
Returns TRUE.
SetInsertMode() is sets new insert mode.
Set editor options.
Set_options() --> .T.
No arguments
Returns TRUE.
Set_options() is setted options <::Opt> by default or read its from saved file.
Options file have name: getenv("HOME")+"/.clip/.edit" If this file exist, options reading from it.
For more information about saved options see description of Save_options().
Show listing of opened files.
ShowFiles() --> .T.
No arguments
Returns TRUE.
ShowFiles() is showed opened files and choose some one to edit.
Make "undo" operation.
Undo([<nWin>]) --> .T.
Returns TRUE.
Undo() is called method Undo() for TEXTEDIT object <::Tobj[nWin]> .
Save MEDIT status.
WriteStatus() --> .T. || .F.
No arguments
Returns TRUE is status was saved and FALSE in other.
WriteStatus() is saved MEDIT status to file "edit."+getenv("USER"). Every user can have own file options into many directories.
To status file wrote next information:
- the number current window;
- the history opened files;
- the history for FIND and REPLACE operations;
- the information about editing files: full file name, current position line and column into editor buffer, current position line and column into viewport and more.
Пред. | Начало | След. |
Class LISTITEM | Уровень выше | Class QUEUE |