4 Default Menus


This section describes the items that are in the default menus. The default menus are the ones built into Phedit. They are the ones that appear if you are not using the embedded menu and if you are not using your own menus (ie; not using the -u Phedit option).

For each menu item the primitive that the menu item runs is given. For more on primitives see the section called Primitives.

4.1 File Menu

This subsection describes the items found in the File menu.

New

Primitive: NewFile()

This function creates an empty new text file with the name default.txt. To save the file and change its name use Save as ...

If a text file was already in memory and changes were performed on it, you will be prompted to save that file before it is erased.

menus

Open ...

Primitive: OpenFilePrompt()

menus

This function allows you to load an existing text file. The File Selector window appears as a result of executing Open ... If you plan to edit for a long time you may also execute Auto Save in the Options menu, to have periodic backups performed automatically.

If a text file was already in memory and changes were performed on it, you will be prompted to save that file before it is replaced with the newly openned file.

Open Another ...

Primitive: OpenAnotherPrompt()

This function allows you to open another Phedit window to simultaneously edit or view more than one document. QNX shares the same code, that is why the second copy of Phedit will be loaded much faster.

To copy text from one file in one Phedit window to another file in another Phedit window you can copy the text to the system clipboard and paste it to the second file. Make sure that you are using the system clipboard for your blocking or this will not work. To make sure of this check that the Use system clipboard toggle button is selected in the Options window.

The next Phedit windows are placed at coordinates [x+20, y+20] where [x, y] are the coordinates of the previous Phedit window.

Save

Primitive: SaveCurFile()

This function unconditionally saves the current file. You will not be prompted in case there is already a file with the same name. You do not have to use this function (unless there is a need for an update, for example when another process must open the same file); Phedit will prompt you to save it when exiting or when another Open ... or New function is performed. If the Keep backup toggle button is selected in the Options window a backup is made before saving the file. The backup file name is made by adding .b to the end of the file name.

Save As ...

Primitive: SaveCurFileAsPrompt()

This function allows you to change the name of a file and to make copies of the file being edited. The File Selector window appears.

Print ...

Primitive: PrintFilePrompt()

This function allows you to print a file. The file will be printed with one of the three QNX utilities: pr (works on any non-Postscript device), lps (for Postscript devices) or cp (for raw printing).

The Print menu item displays a dialog box which has a number of fields and buttons. Click the Done button in order to print or the Cancel button in order to cancel the action.

The file that will be printed is the one whose name appears in the File field. If it is the file that is currently being edited and you have made changes since last saving it then you will be asked to save it first. If you choose to save then the file will be saved and the printing will be done. If you choose to abandon then the last version of the file that has been saved will be printed. If you choose to cancel the saving then no printing will be done but you will still be in the print window.

If you select the toggle button beside the Command field and put a command in the field then:

If you select Raw print then: If you select Postscript printer then: If neither Postscript printer nor Raw print nor the toggle button beside the Command field are selected then: A description for each field and button follows:

File

Output device Font Other options No. of copies Offset Lines per page Page per sheet Vertical spacing Postscript printer Header Line numbers Use spooler Print in background Raw print Print filter Command

Delete File ...

Primitive: DeleteFilePrompt()

This function allows you to delete a file without loading a file manager or shell. The File Selector window appears.

Make Directory ...

Primitive: MakeDirPrompt()

This item allows you to create new directories without running a file manager or opening a shell window.

menus

Delete Directory ...

Primitive: DeleteDirPrompt()

This item allows you to remove directories without running a file manager or opening a shell window.

About Phedit

Primitive: AboutDisplay()

This item displays a window with information about Phedit. The version number and version date are some of the things shown.

Exit

Primitive: Quit()

This function concludes your session with Phedit. If a text file was already in memory and changes were performed on it, you will be prompted to save that file before exiting.

4.2 Edit Menu

This subsection describes the items found in the Edit menu.

Repeat

Primitive: RepeatPrevious()

This function repeats the last performed primitive, macro, or string of text entered.

Cut

Primitive: DelCharOrCutBlockToClip()

This item copies the marked block of text into the clipboard and erases it from memory. If the block type is column then the space occupied by the text is blanked. Read the two sections about marking blocks to find out how to mark a block of text. The text placed on the clipboard will remain there until overwritten by another Copy or Cut. If you are using the system clipboard then other Photon applications may also overwrite the clipboard.

Copy

Primitive: CopyBlockToClip()

This item copies the marked block of text into the clipboard. Read the two sections about marking blocks to find out how to mark a block of text. The text placed on the clipboard will remain there until overwritten by another Copy or Cut. If you are using the system clipboard then other Photon applications may also overwrite the clipboard.

Paste

Primitive: PasteClipToCursor()

This item allows you to have the text that is stored on the clipboard inserted at the text cursor position. Paste does not clear the clipboard.

Paste File ...

Primtive: PasteFileToCursorPrompt()

This item inserts a complete file at the text cursor position. The File Selector window appears.

Write Block to File ...

Primitive: WriteBlockToFilePrompt()

This item writes the marked block of text into a file. Read the two sections about marking blocks to find out how to mark a block of text. The File Selector window appears and from it you specify which file to write to.

Delete Line

Primitive: DeleteLine()

This item deletes the current line and stores it on the clipboard so that it can be brought back by executing Paste. After deleting a line the cursor is placed on the following line.

Convert Block - Upper Case

Primitive: Upper()

This item changes the marked block of text into upper case letters.

Convert Block - Lower Case

Primitive: Lower()

This item changes the marked block of text into lower case letters.

Convert Block - Capitalize

Primitive: Capitalize()

This item changes the marked block of text into lower case letters with the exception of the first letter of every word which is changed into upper case.

Unblock

Primitive: Unblock()

This item unmarks the marked block of text. The end result is that there is now no marked block of text.

Format - Current Paragraph

Primitive: FormatCurParagraph()

This item formats the paragraph that the text cursor is in. Formatting consists of word wrapping it within the Right margin which is set in the Options window.

Format - Block

Primitive: FormatBlock()

This item formats the paragraph or paragraphs that the marked block of text at least partially covers. Formatting consists of word wrapping each paragraph within the Right margin which is set in the Options window.

Format - File

Primitive: FormatFile()

This item formats all paragraphs in the current file. Formatting consists of word wrapping each paragraph within the Right margin which is set in the Options window.

Format - Run Reformat Command

Primitive: RunReformatBlockOrFile()

This item either reformats a marked block of text or reformats the entire file using a command of your own. The command line that will actually be run is one you specify in the Reformat command field in the Options window.

If a block of text has been marked then the following is done:

If no block of text has been marked then the following is done:

Sort

Primitive: RunSortBlock()

This item sorts the marked block of text using the QNX sort utility.

The following steps are done:

Sort Clipboard

Primitive: RunSortClipboard()

This item sorts the contents of the clipboard using the QNX sort utility.

The following steps are done:

Spell

Primitive: RunSpellBlockOrFile()

This item allows you to spell check a marked block of text or the entire file. The command line that will actually be run is one you specify in the Spell command field in the Options window.

If a block of text has been marked then the following is done:

If no block of text has been marked then the following is done:

4.3 Search Menu

This subsection describes the items found in the Search menu.

Pattern ...

Primitive: PatternPrompt()

This item allows you to define the search pattern. As a result of selecting Pattern ... the Search and Replace window is displayed.

menus

This window prompts for the search pattern, the replacement string (used by Replace, Search and Replace, and Replace All menu items) and whether or not the search is to be done case sensitive. If doing a Replace all then you can also indicate whether or not you want to be asked to acknowledge each replace. Buttons for Search, Replace, Search and Replace, and Replace all are also accessible from this window. The search starts at the cursor position and searches to the end of the current file.

The pattern entered in the Search for field recognizes the following syntax:

Where ... matches ...
c the character c where c belongs to the set of ASCII characters except ?,*,[,], \, and newline
? any one character
* any number of characters
[cc...] any one character from the [...] list
\c the character c which can be any ASCII character except newline

Search

Primitive: SearchNext()

This item searches for the pattern defined by the item Pattern .... It starts looking from the cursor position and up to the end of the file.

Replace

Primitive: ReplaceAtCursor()

This item replaces the found pattern with the replacement string. You would have done a Search before this so that your cursor is now on first character of the found pattern.

Search and Replace

Primitive: SearchNextReplace()

This item is the equivalent of Search followed by Replace.

Replace All

Primitive: ReplaceNext()

This function will search for all occurances of the pattern and replace each with the replacement string. It starts searching at the cursor position and continues to the end of the current file. You can indicate that you want to be asked before doing each replacement by setting the Acknowledge replace toggle button in the Search and Replace window.

Match Bracket

Primitive: MatchBracket()

In many programming languages, brackets are used to mark the beginning and end of expressions. This function allows you to put the text cursor on a left bracket (such as [, (, {, , or `), execute Match Bracket, and Phedit will position the cursor on the matching right bracket (that is, ], ), }, , or '.)

4.4 Options Menu

This subsection describes the items found in the Options menu.

Settings ...

Primitive: OptionsPrompt()

This item allows you to do a great deal of customization in the way Phedit behaves. Selecting it causes the Options window to appear.

Start Macro

Primitive: MacroRecordingStart()

This item allows you to record macros (ie; to define them by example). Once you execute Start Macro you are in macro definition mode until you execute End Macro or until you exit Phedit. To indicate that you are in macro definition mode the text Rec is displayed on the Statusbar.

See the section on macros for more on this.

End Macro ...

Primitive: MacroRecordingEndPrompt()

This item ends the macro recording that was begun using the Start Macro menu item. It causes the Define Macro window to appear.

menus

In the Macro name field enter the name for the macro. A macro name is only allowed to have alphabetic characters, numeric characters and the underscore character (_). The maximum number of characters allowed is 40.

You must also enter a Keyboard shortcut for the macro.

See the section on macros for more on this.

Save All Macros and Keys

Primitive: SaveAllMacrosAndKeys()

This item saves all macros and keys to whichever files they were read in from. Any newly recorded macros will be saved to [UserPath]/.phedit.mac and any keys assigned to those newly recorded macros will be saved to [UserPath]/.phedit.key (see the section that talks about the start up search order for how [UserPath] is defined).

Auto Save

Primitive: AutoSavePrompt()

This item starts the autosave. It causes the Auto Save window to appear.

menus

You must specify a number of minutes n. From this point on the current file will be saved every n minutes. When the file is saved you will see a message appear on the bottom bar of Phedit's window. This message will flash the line numbers of the file being saved.

Your editing will not be disturbed by the autosave process. You can type ahead and the system's input queue will memorize all your key strokes, dumping them at the end of the autosave process. To terminate autosave set the time to zero.

Run Program ...

Primitive: RunProgramPrompt()

This item allows you to execute other applications such as make and cc directly from Phedit. When you select this menu item the Run Program prompt window appears.

menus

Any QNX command can be executed.

Character Chart ...

Primitive: CharChartDisplay()

Choosing this item causes the Character Chart window to appear.

menus

This window allows you to get at the ASCII characters that are not on your keyboard. It displays a list of all possible ASCII characters. To insert a character in your text you click on the button for that character in the list. The character is automatically inserted into your text at the current cursor position just as if you had entered it from a keyboard.

Custom

Primitive: CustomDisplay()

This causes the Custom window to appear.

menus

This window contains entries as long as there are macros defined. Macros are defined as described under Start Macro and End Macro ... above. Clicking on a macro in the list runs the macro and closes the Custom window. To make this window stay on the screen even after you click on a macro you must first click the pin in the top left corner. Use the scroll bar to access all the macros. If a keyboard shortcut is associated with a macro then it appears beside that macro's name. To delete a macro, click on the Delete button, then on the button of the macro which you wish to delete.