Home
Downloads
Media
Blog Roll
Contact
 
TEdit Plugin Programming Interface

 


tedit::ppi::addcommandlineoption {option argcount callback args}
Adds a command line option to TEdit.

option - The name of the option as appear on command line. Users specify a dash in front to invoke it.

argcount - The number argument expected after the option's name.

callback - The callback function to call when the option is specified at the command line. The arguments to the command line is passed to this callback.

args - Variable number of optional arguments to callback.


tedit::ppi::addentry {callback args}
Adds an input box at the bottom of TEdit for user input. Returns 1 if no input box exists; returns 0 otherwise.

callback - The callback function to call when the user hits enter at the input box. The string at the input box is passed to callback as the last argument.

args - Variable number of optional arguments to callback.
See Also
[bindentry] [focusentry] [removeentry] [setentry]



tedit::ppi::addfiletype {type extension}
Adds a file type for the file selection dialog box.

type - Name of the new file type.

extension - Extension of the new file type.


tedit::ppi::addhelpmenuitem {name helpfilename}
Adds a menu selection at the Help menu.

name - Name to appear at the Help menu.

helpfilename - Full path to the text file that contains the help page.


tedit::ppi::addhelpmenuitemcustom {name callback args}
Adds a menu selection at the Help menu.

name - Name to appear at the Help menu.

callback - The callback to call when the menu selection is selected.

args - Variable number of optional arguments to callback.


tedit::ppi::addlinenumber {}
Adds line number to text.
See Also
[deletelinenumber]



tedit::ppi::addmenubutton {icon helpstring callback args}
Adds a button at the button bar.

icon - Full path to the the icon file (GIF format) to be used as the button's image.

helpstring - Short help message to appear at the status bar.

callback - The callback to call when the button is pressed.

args - Variable number of optional arguments to callback.


tedit::ppi::addmenuitem {name type args}
Adds a menu selection at the Plug-In menu.

name - Name to appear at the Plug-In menu.

type - One of command, cascade, radiobutton and checkbutton.

args - If type is command: The callback to call when the menu selection is selected, and optional arguments to the callback. If type is cascade: A list of tuples where the first element of the tuple is the name appears in the cascade menu, and the second element is the callback. If type is radiobutton or checkbutton: A list where the first element is a global variable name, and the rest are triplets where for each triplet, the first element is the name appears in the cascade menu, the second element is the value to assign to the global variable and the third element is the callback to call.


tedit::ppi::addtofilehistory {}
Adds current file to the MRU file list at the File menu.
See Also
[getfilehistorylen] [setfilehistorylen]



tedit::ppi::bindentry {seq callback args}
Binds a callback to an event sequence at TEdit's input box. Returns 1 if an input box exists; returns 0 otherwise.

seq - Tk event sequence. See Tk help.

callback - The callback to call after the event sequence.

args - Variable number of optional arguments to callback.
See Also
[addentry] [bindtext] [focusentry] [removeentry] [setentry]



tedit::ppi::bindfileevent {type callback args}
Binds a callback to a file event.

type - File event type, one of new, load, save and exit.

callback - The callback to call after the file event.

args - Variable number of optional arguments to callback.


tedit::ppi::bindtext {seq callback args}
Binds a callback to a event sequence at TEdit's text area.

seq - Tk event sequence. See Tk help.

callback - The callback to call after the event sequence.

args - Variable number of optional arguments to callback.
See Also
[bindentry]



tedit::ppi::comment {start end}
Comments out the text between the specified indices.

start - Start index of the portion of text to comment out.

end - End index of portion of text to comment out, or end for end of text.
See Also
[getcomment] [setcomment]



tedit::ppi::confirmunload {}
Prompts the user to confirm unloading of the current buffer. Effective only if confirm unload is set to yes in preference. Returns whether or not it is ok to unload the current buffer.
See Also
[getconfirmunload] [setconfirmunload]



tedit::ppi::cuttextat {start end}
Cuts the text between the specified indices.

start - Start index of the portion of text to cut.

end - End index of portion of text to cut, or end for end of text.


tedit::ppi::deletelineat {index}
Deletes the line that contains the specified index.

index - Any one of the indices within the line of interest.


tedit::ppi::deletelinenumber {}
Deletes the line numbers, if they has been added. Returns 0 if no line number has been added; returns 1 otherwise.
See Also
[addlinenumber]



tedit::ppi::deletetextat {start end}
Deletes the text between the specified indices.

start - Start index of the portion of text to delete.

end - Optional end index of portion of text to delete, or end for end of text.


tedit::ppi::deletewordat {index}
Deletes the word that contains the specified index.

index - Any one of the indices within the word of interest.


tedit::ppi::exitapp {status}
Exits TEdit with specified exit status.

status - Integer exit status. Defaults to 0.


tedit::ppi::fileloaded {}
Returns 1 if the current editing buffer corresponds to a named file; returns 0 otherwise.
See Also
[getfilename] [setfilename]



tedit::ppi::flashatstatus {msg}
Flashes the specified message at the status bar.

msg - Message to show at status bar.
See Also
[showatstatus]



tedit::ppi::focusentry {}
Directs the input focus to TEdit's input box. Returns 0 if no input box exists; returns 1 otherwise.
See Also
[addentry] [bindentry] [removeentry] [setentry]
[focuslinenumber] [focustext]



tedit::ppi::focuslinenumber {}
Directs the input focus to TEdit's line number box.
See Also
[focusentry] [focustext]



tedit::ppi::focustext {}
Directs the input focus to TEdit's text area.
See Also
[focusentry] [focuslinenumber]



tedit::ppi::getbackward {index numchars}
Returns the index, offset backward by the specified number of characters, from the specified index.

index - Index to offset from.

numchars - Number of characters to offset.
See Also
[getforward]



tedit::ppi::getcharat {index}
Returns the character at the specified index.

index - Any one of the indices within the word of interest.


tedit::ppi::getcolor {attribute}
Returns the current color used for the specified attribute; returns an empty string if the specified attribute is invalid.

attribute - One of the following: fgcolor - foreground color of normal text. bgcolor - background color of normal text. markfg - foreground color of marked text. markbg - background color of marked text. highlightfg - foreground color of highlighted text. highlightbg - background color of highlighted text.
See Also
[restoretextcolor] [setcolor] [settextcolor]



tedit::ppi::getcomment {}
Returns the comment pair.
See Also
[comment] [setcomment]



tedit::ppi::getconfirmunload {}
Returns 1 if confirming unload is enabled; returns 0 otherwise.
See Also
[confirmunload] [setconfirmunload]



tedit::ppi::getcursor {}
Returns index of the cursor.


tedit::ppi::getend {}
Returns the index of the end of text.


tedit::ppi::getfilehistorylen {}
Returns the maximum number of MRU files TEdit remembers.
See Also
[addtofilehistory] [setfilehistorylen]



tedit::ppi::getfilename {}
Returns the current editing buffer's file name; returns an empty string if current editing buffer does not correspond to a named file.
See Also
[setfilename]



tedit::ppi::getfont {which}
Gets the font used by tedit.

which - One of text and status Returns the existing font used in a list of three elements where the first element is the font name, the second the font size and the thrid the font style. Returns empty string if error.
See Also
[setfont]



tedit::ppi::getforward {index numchars}
Returns the index, offset forward by the specified number of characters, from the specified index.

index - Index to offset from.

numchars - Number of characters to offset.
See Also
[getbackward]



tedit::ppi::getheader {}
Returns the header template. The header template contains a %s, which is to be substitute by the header file name.
See Also
[setheader]



tedit::ppi::gethighlighted {}
Returns the start and stop indices of the highlighted text; return "0.0 0.0" if there is no highlighted text.
See Also
[sethighlighted]



tedit::ppi::getindentchar {}
Returns the indent character used when tab is overrided.
See Also
[setindentchar]



tedit::ppi::getlineat {index}
Returns the line, excluding end of line, that contains the specified index.

index - Any one of the indices within the line of interest.


tedit::ppi::getlineend {index}
Returns the index of the end of the line that contains the specified index.

index - Any one of the indices within the line of interest.


tedit::ppi::getlinestart {index skipwhitespace}
Returns the index of the start of the line that contains the specified index.

index - Any one of the indices within the line of interest.

skipwhitespace - One of yes and no. Defaults to no.


tedit::ppi::getmarked {}
Returns a list of all start and stop indices of the marked text.
See Also
[setmarked]



tedit::ppi::getpersistentvar {name}
Retrieves the value of a variable that persists over a plug-in's loads and exits. Useful for memorizing the state of a plug-in since its last execution. Returns the variable's value, or an empty string if the variable has not been set.

name - Variable name.
See Also
[setpersistentvar]



tedit::ppi::getshowbuttonbar {}
Returns 1 if button bar enabled; returns 0 otherwise.
See Also
[setshowbuttonbar]



tedit::ppi::gettedithomedir {}
Returns TEdit's installation directory.


tedit::ppi::getteditprivdir {}
Returns user's private directory if HOME is defined; returns TEdit's library directory otherwise.


tedit::ppi::getteditversion {}
Returns TEdit's version number.


tedit::ppi::gettextat {start end}
Returns the text between the specified indices.

start - Start index of the portion of text to return.

end - Optional end index of portion of text to return, or end for end of text.


tedit::ppi::getwordat {index}
Returns the word that contains the specified index.

index - Any one of the indices within the word of interest.


tedit::ppi::getwordend {index}
Returns the index of the end of the word that contains the specified index.

index - Any one of the indices within the word of interest.


tedit::ppi::getwordstart {index}
Returns the index of the start of the word that contains the specified index.

index - Any one of the indices within the word of interest.


tedit::ppi::getwrapline {}
Returns 1 if line wrap is enabled; returns 0 otherwise.
See Also
[setwrapline]



tedit::ppi::gotohome {}
Sets cursor to anchored index, or first column of first line if no anchor has been set. Returns the current cursor index.
See Also
[setanchor]



tedit::ppi::indentblock {}
Indents the highlighted block.
See Also
[getindentchar] [setindentchar] [unindentblock]



tedit::ppi::inserttextat {index text}
Inserts text at the specified index.

index - Index to insert.

text - Text to insert.


tedit::ppi::isbuffermodified {}
Returns 1 if editing buffer has been modified since last save; returns 0 otherwise.


tedit::ppi::iteratend {}
Returns 1 if iterator is at the end of text; returns 0 otherwise.
See Also
[iterindex] [iternextchunk] [iternextline]
[iternextword] [iternotat] [iternotpass] [iterreset]
[iterset]



tedit::ppi::iterindex {}
Returns the index of the iterator.
See Also
[iteratend] [iternextchunk] [iternextline]
[iternextword] [iternotat] [iternotpass] [iterreset]
[iterset]



tedit::ppi::iternextchunk {numchars}
Returns a chunk of text following the iterator; returns an empty string if iterator is at or pass end of text.

numchars - Number of characters after the iterator to return.
See Also
[iteratend] [iterindex] [iternextline] [iternextword]
[iternotat] [iternotpass] [iterreset] [iterset]



tedit::ppi::iternextline {}
Returns the line that contains the iterator, excluding end of line, and set iterator to next line.
See Also
[iteratend] [iterindex] [iternextchunk] [iternextword]
[iternotat] [iternotpass] [iterreset] [iterset]



tedit::ppi::iternextword {}
Returns the word that contians the iterator, and set iterator to next word.
See Also
[iteratend] [iterindex] [iternextchunk] [iternextline]
[iternotat] [iternotpass] [iterreset] [iterset]



tedit::ppi::iternotat {index}
Returns 1 if iterator is not at the specified index; returns 0 otherwise.

index - Index to be compared with iterator.
See Also
[iteratend] [iterindex] [iternextchunk] [iternextline]
[iternextword] [iternotpass] [iterreset] [iterset]



tedit::ppi::iternotpass {index}
Returns 1 if iterator is pass the specified index; returns 0 otherwise.

index - Index to be compared with iterator.
See Also
[iteratend] [iterindex] [iternextchunk] [iternextline]
[iternextword] [iternotat] [iterreset] [iterset]



tedit::ppi::iterreset {}
Resets iterator to first column of first line.
See Also
[iteratend] [iterindex] [iternextchunk] [iternextline]
[iternextword] [iternotat] [iternotpass] [iterset]



tedit::ppi::iterset {index}
Sets iterator to the specified index.

index - Index to set the iterator to.
See Also
[iteratend] [iterindex] [iternextchunk] [iternextline]
[iternextword] [iternotat] [iternotpass] [iterreset]



tedit::ppi::loadfile {filename}
Loads a file into the editing buffer. Returns 1 if successful; returns 0 otherwise.

filename - Full path to file to load.
See Also
[newfile] [savefile]



tedit::ppi::matchbracket {index limit}
Returns index of matching bracket at the specified index. If the specified index does not represent a bracket, or matching bracket not found, returns 0.0

index - Index of the bracket of interest.

limit - Optioanl index of limit as to where matching should stop.


tedit::ppi::newfile {}
Clears current editing buffer.
See Also
[loadfile] [savefile]



tedit::ppi::pastetextat {index}
Inserts text from clipboard at the specified index.

index - Index to insert.


tedit::ppi::pluginexec {execname args}
Executes a platform dependent Executable Plug-In.

execname - Full path to the Executable Plug-In.

args - Variable number of optional argument to the Executable Plug-In.


tedit::ppi::removeentry {}
Removes the TEdit's input box. Returns 0 if no input box is added; returns 1 otherwise.
See Also
[addentry] [bindentry] [focusentry] [setentry]



tedit::ppi::replacealltext {pattern replacetext}
Replaces all occurences of pattern with another.

pattern - Pattern to replace.

replacetext - Text to replace the pattern.
See Also
[searchregexp] [searchtext]



tedit::ppi::restoretextcolor {start end}
Restores background and foreground color of text.

start - Start index of the portion of text to restore.

end - End index of portion of text to restore, or end for end of text.
See Also
[restoretextcolor] [setcolor] [settextcolor]



tedit::ppi::savefile {filename}
Saves current editing buffer to the specified file. Returns 1 if successful; returns 0 otherwise.

filename - Full path to file to save as.
See Also
[loadfile] [newfile]



tedit::ppi::saveprefoptn {}
Saves options and preferences to file. Returns 1 if successful; returns 0 otherwise.


tedit::ppi::searchregexp {exp direction start}
Searches for next occurence of the specified expression. Returns the index of the beginning of the searched expression; returns 0.0 if expression not found.

exp - Regular expression to search for.

direction - One of forwards and backwards. Defaults to forwards.

start - Optional start index.
See Also
[replacealltext] [searchtext]



tedit::ppi::searchtext {pattern direction start}
Searches for next occurence of the specified pattern. Returns the index of the beginning of the searched pattern; returns 0.0 if pattern not found.

pattern - Pattern to search for.

direction - One of forwards and backwards. Defaults to forwards.

start - Optional start index.
See Also
[replacealltext] [searchregexp]



tedit::ppi::seetext {index}
Scrolls text such that the specified index is visible.

index - Index to scroll to.


tedit::ppi::setanchor {}
Sets anchor at cursor.
See Also
[gotohome]



tedit::ppi::setcolor {attribute color}
Sets color for the specified attribute.

attribute - One of the following: fgcolor - foreground color of normal text. bgcolor - background color of normal text. markfg - foreground color of marked text. markbg - background color of marked text. highlightfg - foreground color of highlighted text. highlightbg - background color of highlighted text.

color - Color name or RGB hex values prefixed by a '#'.
See Also
[getcolor] [restoretextcolor] [settextcolor]



tedit::ppi::setcomment {commentstart commentend}
Sets the comment pair to the specified comment pair.

commentstart - String to use as start of comment.

commentend - String to use as end of comment.
See Also
[getcomment] [comment]



tedit::ppi::setconfirmunload {enable}
Enables or disables confirming unload when there is unsaved changes.

enable - One of yes and no. Defaults to yes.
See Also
[confirmunload] [getconfirmunload]



tedit::ppi::setcursor {index}
Sets the cursor to the specified index.

index - Index to set cursor to.


tedit::ppi::setdebug {enable}
Enables or disables debugging message. When debug is enabled, TEdit prints the name of an error PPI call sent to TEdit. Default is not enabled.

enable - One of yes and no. Defaults to yes.


tedit::ppi::setentry {string}
Insert the specified string at the TEdit's edit box.
See Also
[addentry] [bindentry] [focusentry] [removeentry]



tedit::ppi::setfilehistorylen {length}
Sets the maximum number of MRU files TEdit remembers.

length - number of files to store in file history list.
See Also
[addtofilehistory] [getfilehistorylen]



tedit::ppi::setfilename {filename}
Assigns the specified file name to the current editing buffer.

filename - File name to assign to current editing buffer.
See Also
[getfilename]



tedit::ppi::setfont {which font size style}
Sets the font used by tedit.

which - One of text and status

font - Name of font to set to

size - Size of font to set to

style - Style of font, one of bold and normal Returns the existing font used in a list of three elements where the first element is the font name, the second the font size and the thrid the font style. Returns empty string if error.
See Also
[getfont]



tedit::ppi::setheader {header}
Sets header template to the specified template.

header - Header template. The first occurence of %s is interpreted as the position of the header file.
See Also
[getheader]



tedit::ppi::sethighlighted {start end}
Highlights out the text between the specified indices.

start - Start index of the portion of text to comment out.

end - End index of portion of text to comment out, or end for end of text.
See Also
[gethighlighted]



tedit::ppi::setindentchar {indentspace}
Sets the indent character to be used when tab is overrided.

indentspace - Indent string used in place of tab.
See Also
[getindentchar]



tedit::ppi::setmarked {start end}
Marks the text between the specified indices.

start - Start index of the portion of text to mark.

end - End index of portion of text to mark, or end for end of text.
See Also
[getmarked]



tedit::ppi::setpersistentvar {name value}
Sets the value of a variable that persists over a plug-in's loads and exits. Useful for memorizing the state of a plug-in since its last execution. Returns the old value of the variable, or an empty string if the variable has not been created.

name - Variable name.

value - New value assigned to the variable.
See Also
[getpersistentvar]



tedit::ppi::setshowbuttonbar {enable}
Shows or hides button bar.

enable - One of yes and no. Defaults to yes.
See Also
[getshowbuttonbar]



tedit::ppi::settabtospace {numspace}
Replaces all tabs with specified length of space tabs.

numspace - Length of space tab.


tedit::ppi::settextcolor {start end foreground background}
Changes color of the text between the specified indices.

start - Start index of the portion of text to change color.

end - End index of portion of text to change color, or end for end of text.

foreground - Foreground color name or RGB hex values prefixed by a '#'.

background - Background color name or RGB hex values prefixed by a '#'.
See Also
[getcolor] [restoretextcolor] [setcolor]



tedit::ppi::settitle {title}
Changes the title of TEdit's window.

title - Title to set the TEdit's window to.


tedit::ppi::setwindowsize {width height}
Changes the size of TEdit's window.

width - New width of TEdit's window.

height - New height of TEdit's window.


tedit::ppi::setwrapline {enable}
Enables or disables wrapping long lines.

enable - One of yes and no. Defaults to yes.
See Also
[getwrapline]



tedit::ppi::showatstatus {msg}
Shows the specified message at the status bar.

msg - Message to show at status bar.
See Also
[flashatstatus]



tedit::ppi::undo {}
Undo previous insert or delete. Returns 0 if unsuccessful (for example, nothing to undo); returns 1 otherwise.


tedit::ppi::unindentblock {}
Unindents the highlighted block.
See Also
[getindentchar] [setindentchar] [indentblock]