Occasional mention is made of something called a primitive. For more on primitives see the section called Primitives.
The following depicts what Phedit would look like if you were editing a typical Hello World program. The file being edited is /home/root/default.txt.
Phedit can be operated with the mouse and keyboard. If a menu item has a hotkey, it will be displayed in the menu beside the menu item's text. Macros can be found by choosing the Custom item from the Options menus. All the editing functions such as go left, go right, page up, page down, go to the beginning of the line, etc. have keyboard equivalents (Left, Right, PgUp, PgDn, Home).
The mouse has two buttons: a left one and a right one. The left mouse button is used to position the cursor, choose menu items, click on buttons, ... The right mouse button is used to bring up a special menu. To do this click on some text. If you click where there is no text then you will be prompted for some text and then the menu will appear.
Phedit appears on the screen as one window. The following are more details on each part of the window.
The cursor may be positioned by moving the mouse pointer to where you want the text cursor to go and then clicking with the left mouse button. It may be moved around using many of the keyboard keys such as the arrow keys, PgUp, Home, etc. The cursor will only move to where there is text or where text can be typed. For example, on a blank line the cursor can only appear at the beginning of the line since there is no text on the line.
Key | Description | Primitive |
---|---|---|
Left Arrow | Moves the text cursor left one character. If the cursor is at the beginning of the line, it moves to the end of the previous line. | Left() |
Right Arrow | Moves the text cursor right one character. If the cursor is at the end of the line, it moves to the beginning of the next line. | Right() |
Up Arrow | Moves the text cursor one line up. | Up() |
Down Arrow | Moves the text cursor one line down. | Down() |
Home | Moves the text cursor to the beginning of the line. | BeginningOfLine() |
End | Moves the text cursor to the end of the line. | EndOfLine() |
PgUp | Scrolls the text one page up keeping the text cursor at the same position relative to the window. | PrevPage() |
PgDn | Scrolls the text one page down keeping the text cursor at the same position relative to the window. | NextPage() |
Ctrl+Left Arrow | Moves the cursor to the beginning of the previous word. | WordLeft() |
Ctrl+Right Arrow | Moves the cursor to the beginning of the next word. | WordRight() |
Ctrl+PgUp | Moves the cursor to the beginning of the file. | BeginningOfFile() |
Ctrl+PgDn | Moves the cursor to the end of the file. | EndOfFile() |
Enter | Creates a new line. If the cursor is in the middle of a line then this splits the line. | Newline() |
Del | If a block of text is defined then this copies the block to the clipboard and deletes it. If no block is defined then this deletes the character under the text cursor. In this case if it is at the end of a line then this joins the next line to the current line. Note that the Del key is defined as the hotkey for the Cut menu item in the default menus. If it is not defined as a hotkey then it still works as this behaviour is built into Phedit. | DelCharOrCutBlockToClip() |
Ins | Toggles between insert mode and type over mode. | ToggleInsert() |
Baskspace | Removes the character that is to the left of the cursor and moves left one character. If the text cursor is at the beginning of the line, it joins the previous line with the current line. | Backspace() |
Tab | Inserts a tab character. | none |
F1 | Gets help on the word the cursor is on or on the text that is blocked. | HTLookUp() |
To make sure that you are using the system clipboard check that the Use system clipboard toggle button is selected in the Options window.
If you are not using the system clipboard then any text you copy from one Phedit window can only be pasted to that same Phedit window.
For example press the Shift key down and hold it down while using the right arrow key to move the cursor accross a line of text. As you move the cursor the text under the cursor is blocked. You are not limited to moving in one direction only. Hold the Shift key down while moving to the right, down, one word to the right and so on.
This works with the following keys:
Key | Primitive |
---|---|
Left Arrow | Left() |
Right Arrow | Right() |
Up Arrow | Up() |
Down Arrow | Down() |
Home | BeginningOfLine() |
End | EndOfLine() |
PgUp | PrevPage() |
PgDn | NextPage() |
Ctrl+Left Arrow | WordLeft() |
Ctrl+Right Arrow | WordRight() |
Ctrl+PgUp | BeginningOfFile() |
Ctrl+PgDn | EndOfFile() |
Column type blocks are for marking rectangular areas of text. This can be useful when dealing with indented text such as source code or tables. To set the column block type bring up the Options window. In the Blocking section select the Column toggle button.
The following is a list of the things that can be done to a block along with the primitives that actually do the work.
Description | Do this | Primitive |
---|---|---|
Cut to clipboard | Edit menu, Cut option | DelCharOrCutBlockToClip() |
Copy to clipboard | Edit menu, Copy option | CopyBlockToClip() |
Paste from clipboard | Edit menu, Paste option | PasteClipToCursor() |
Write to a file | Edit menu, Write Block to File ... option | WriteBlockToFilePrompt() |
Convert to upper case | Edit menu, Convert Block submenu, Upper Case option | Upper() |
Convert to lower case | Edit menu, Convert Block submenu, Lower Case option | Lower() |
Capitalize it | Edit menu, Convert Block submenu, Capitalize option | Capitalize() |
Unmark the block | Edit menu, Unblock option | Unblock() |
Format it (word wrap) | Edit menu, Format submenu, Block option | FormatBlock() |
Format using user defined program | Edit menu, Format submenu, Run Reformat Command option | RunReformatBlockOrFile() |
Sort it | Edit menu, Sort option | RunSortBlock() |
Spell check using user defined program | Edit menu, Spell option | RunSpellBlockOrFile() |
Look it up as hypertext (if defined as hypertext) | Press right mouse button, Open Window option | HTLookUp() |
Look it up in Photon helpviewer (if not defined as hypertext) | Press right mouse button, Open Window option | HTLookUp() |
Define it as hypertext | Press right mouse button, Define option | HTLinkToCurFile() |
Undefine it as hypertext | Press right mouse button, Remove option | HTRemoveLink() |
Secondly but probably more important the hypertext feature can also be used to look up documentation using the Photon helpviewer. If the word you ask for help on is not linked using Phedit's hypertext feature then it is looked up in the Photon helpviewer's topics. If it is found there then the helpviewer starts up with the HTML page that has that word in its topic name.
As an example of Phedit style hypertext, imagine you've created a file called common.h and in it you've put a structure definitions for a structure called mystruct_t. From Phedit you right click on the text, "mystruct_t". From the menu that appears you choose Define. What you've just done is linked the word mystruct_t to the file common.h.
Later on you are working on another file called main.c and you have declared a variable of type struct mystruct_t. Before you use it you want to bring up the header file that mystruct_t is defined in. To do this you simply right click on mystruct_t and a menu appears. From that menu you choose Open Window. Automatically another instance of Phedit starts up with common.h already open and the cursor on the first line that contains the text mystruct_t. You are now looking at the definition of mystruct_t.
As an example of using Phedit to access the helpviewer, imagine you are writing code and want to use the mmap function but can't recall all of it's parameters. You would simply put the text cursor on any letter in "mmap" and press F1. Since you hadn't previously defined any hypertext for mmap it is looked up in the helpviewer's topics. The helpviewer then appears with the HTML page for mmap.
To activate these hypertext functions any of these methods can be used:
Click on Open Window if you want to see the document where the clicked word or phrase was defined. If the word or phrase is not defined then it is looked up in the Photon helpviewer topics. If it is found there then the Photon helpviewer is started up with the HTML page for that word. This is especially useful for looking up function prototypes in the online documentation.
By clicking on the Define entry the current word or phrase is added to the hypertext data base. The word is stored with a link to the current file.
If the Remove entry is clicked, the current word or phrase is removed from the hypertext data base.
Changes to any hypertext definitions are saved to file right after they are made. However, once the hypertext file has been read in it will not be read in again. This means that if you have two instances of Phedit started up and both have read in the hypertext file, changes you make to hypertext from one Phedit will not be seen by the other Phedit.