3 Default User Interface


This section describes Phedit as it comes from the factory. Since Phedit's menus are 100% customizable and since most keys can be changed this section may be different from how you have things configured. The section called Default Menus goes through all of the items on the default menus that are built into Phedit.

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.

interfac

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.

3.1 Editing and Moving Around

Text cursor

The text cursor indicates where text will appear when you press a key. If you are insert mode then it will appear as a block about half the height of a character. If you are in replace mode then it will appear about a quarter the height of a character. The text cursor appears on top of a character.

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.

Insert and replace modes

To toggle between insert mode and replace mode, press the Ins key. These modes may also be changed in the Options window using the Insert mode toggle button.

List of keyboard keys

These are all the keyboard keys recognized by Phedit and their significance. This list does not include hotkeys that are defined for menu items.
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()

3.2 Working with Blocks

Blocks are areas of text that you have highlighted by either using the mouse or using the keyboard. Once you've marked a block (ie; highlighted some text) then you can:

The system clipboard

You have a choice of two clipboards to use. You can either use the non-system clipboard or the system clipboard. The system clipboard has the advantage that many other Photon applications also use it. Copying something to the system clipboard means that you can paste it to another application and visa versa. You also use the system clipboard to copy text from one Phedit window to another since each Phedit window is really a seperate Photon application.

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.

Marking a block using the mouse

Blocks can be defined by dragging the cursor, by double clicking on any alphanumeric character of a word (marking the word), or by double clicking on a non-alphanumeric character in a line (marking the line). To drag the cursor:
  1. move the mouse to the beginning of the block;
  2. holding the left mouse button down, move the mouse to the end of the block;
  3. release the button.
If the text you wish to block is not all visible in the Edit Area do the same steps shown above but in step 2 simply drag the mouse out of the Edit Area. Wiggling the mouse (in step 2) will make the text scroll. Holding the mouse still will make the text will stop scrolling.

Marking a block using the keyboard

Just like a lot of Phedit this is customizable. Using the default settings you simply hold the Shift key down while using any combination of the direction keys. But from the Options window you can turn this method of blocking on or off using the Allow Shift-Cursor blocking toggle button.

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()
The alternate way of blocking with the keyboard is to turn on the Cursor blocking on option in the Options window. While this is on the same cursor movement keys listed above will block text without any other key being pressed (ie; you don't have to hold the Shift key down).

The two types of blocks

There are two types of blocks: Paragraph is the regular type and is used to mark words and paragraphs. To set the paragraph type bring up the Options window. In the Blocking section select the Paragraph toggle button.

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.

What to do with blocks

As listed below there is a great deal that you can do with blocks. The most obvious of these is to use them to copy text. Once a block is marked you may press the key Del to cut the block to the clipboard or Ctrl+Del to copy it to the clipboard. The difference is that Del deletes the text once it has been put on the clipboard whereas Ctrl+Del leaves the text where it was. To retrieve the text saved on the clipboard first move the cursor to where you want that text to go and the press Ctrl+Ins. The text will be inserted at the cursor position. These keys (Del, Ctrl+Del, and Ctrl+Ins) are menu item hotkeys and are displayed beside their corresponding menu items in the Edit menu (ie; Cut, Copy, and Paste).

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()

3.3 Hypertext and the Photon Helpviewer

The hypertext feature allows you to link a word to a file. Once linked, whenever Phedit is told to look up that word another instance of Phedit will be started up with that file already open. In this way you have simple hypertext.

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:

Doing any of the above causes a menu to appear right where the mouse was clicked. The items in the menu that are relevant to hypertext are: Open Window Define Remove

The hypertext file

The hypertext definitions are stored in a file called HyperText.def in the [UserPath]. See the section that talks about the start up search order for how [UserPath] is defined.

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.