3

Editor



3.1    Introduction

The Tornado source-code editor includes standard text manipulation capabilities, as well as the following specialized features:

  • C and C++ syntax-element color highlighting.
  • Debugger integration: the editor window tracks code execution.
  • Compiler integration: links to the editor window from compiler messages.

The Tornado editor also provides features tailored to the programming environment. You can have the editor display program syntactic elements such as C or C++ keywords, preprocessor directives, and comments in color. Because the editor is integrated with the Tornado debugger (10. Debugger), the editor also keeps pace automatically with program execution during debugging sessions.

You can work on as many files simultaneously as your computer's memory allows. This is convenient when you are working with more than one module, or want to edit both a source and header file at the same time.

Typically, developers use the Tornado editor to work with source files, header files, and makefiles. However, because it is a text editor, it can also be used on any text file. For example, you can view a bug report from one of your users, or save a note in a text file.

The Tornado editor uses standard Windows editing commands and conventions. In describing the features and usage of the editor, we assume you are already familiar with these conventions.



3.2    The Standard Toolbar

The Standard toolbar has buttons for frequently used editing commands that are also available in the File and Edit menus. Figure 3-1 shows the Standard toolbar as a floating palette.

Figure 3-1:   Standard Toolbar

The following are summary descriptions of each of these buttons and the equivalent menu option. For full descriptions, see the discussion of the menu command equivalent to each button.

Table 3-1:   Toolbar Buttons 


Button
Menu
Description

File>New
Create a new document. See 3.3.1 Creating a File.
File>Open
Open an existing document. See 3.3.2 Opening a File.
File>Save
Save the current document. See 3.3.3 Saving and Closing a File.
Edit>Cut
Delete the selection and place it in the clipboard. See 3.4.2 Editing Text.
Edit>Copy
Copy the selection to the clipboard. See 3.4.2 Editing Text.
Edit>Paste
Insert the clipboard text at the insertion point. See 3.4.2 Editing Text.
File>Print
Print the document. See 3.4.5 Printing.
Help>About Tornado
Display the About Tornado dialog box, which shows the version number of Tornado.
n/a
Display context-sensitive help.



3.3    File Management

Commands in the File menu include: file management commands, printing commands, recently-opened files, and the Exit command.

The following sections describe these commands. Each section begins with a table that summarizes the buttons (if any) and keyboard shortcuts for the commands described in that section. For information about printing, see 3.4.5 Printing.

3.3.1   Creating a File


Button
Shortcut
File Menu Command

CTRL+N
New

To create a new file, click File>New. A dialog box (Figure 3-2) appears where you can select the type of file you want to create. The file type you select controls such default parameters as color keywords. To enter plain text, you can use any file type.

Figure 3-2:   File Types (New File)

When you select a file type, an empty window appears, ready for you to begin entering text. Figure 3-3 shows a new file window for type Source File (the type for C or C++ source, including header files).

Figure 3-3:   New Source File

The area at the left margin is called the attribute pane. Only the Source File file type includes an attribute pane in its display. The attribute pane indicates breakpoints and the target-program context when you use the debugger. You can turn the attribute pane off (among other editor options) from Tools>Options>Editor (see 12.3.2 Editor Preferences). If there is no attribute pane, the debugger highlights an entire line of source code to show the location of a breakpoint and to show where the program has stopped. (You can control the color used for such highlighting; see 12.3.6 Fonts/Colors.)

3.3.2   Opening a File


Button
Shortcut
File Menu Command

CTRL+O
Open
n/a
ALT+F num
File Name

To open an existing file, click File>Open. A standard Windows file browser (Figure 3-4) allows you to select what file to open.

Figure 3-4:   Opening C++ Source Files

The bottom part of the File menu lists the most recently opened files. You can choose one of these without navigating through the Open dialog box.

3.3.3   Saving and Closing a File


Button
Shortcut
File Menu Command

n/a
CTRL+F4
Close
CTRL+S
Save
n/a
ALT+F a
Save As

To write out the current file, click File>Save. To specify a new name (or path) for the current file, click Save As instead. (Save is disabled until you modify the current file.)

Click Close to dismiss the editor window for the current file. If the file has changed since you last saved, a confirmation dialog box offers you the opportunity to save the file before closing it.



3.4    Typing and Editing

Only one of the edit windows in Tornado is active at any one time. The active window contains a text cursor, a blinking vertical line also called an insertion point. Whatever you type appears at the text location indicated by the text cursor.

The editor is designed for editing source files. As such, it does not provide the "word wrap" feature found in many word processors. You must press ENTER to start a new line. If a line is too long for the current width of the edit window, the text scrolls horizontally as necessary to display the portion of the line you are editing.


*      
NOTE: If you cannot type inside an editor window, check for a READ indicator on the status line at the bottom of the Tornado window. If that indicator appears, the editor is displaying a read-only file. To enable typing in that window, save a copy of the file under a different name, or use Windows to turn off the read-only file attribute.

3.4.1   Editing Mode

There are two editing modes in Tornado: overtype mode, which replaces the existing text under the cursor as you type, and insert mode (the default), which displaces text to the right while adding the characters you type. Use the INSERT key on your keyboard to toggle between these two modes. The indicator OVR appears in the status line at the bottom of the Tornado window when overtype mode is on. The editing mode does not change when you switch edit windows; the last mode you selected continues to apply, even if you switch to a window that you last edited with the other editing mode.

3.4.2   Editing Text


Button
Shortcut
Edit Menu Command

n/a
CTRL+Z
Undo
CTRL+X
Cut
CTRL+C
Copy
CTRL+V
Paste
n/a
DEL
Delete
n/a
CTRL+A
Select All

The Edit menu supports the Windows standard editing functions: Undo, Cut, Copy, Paste, Delete, and Select All, with standard shortcuts.

The Undo command reverses the effects of the most recent change; click the command again to reverse the change before that. The editor supports up to 512 levels of undo history; you can set how much history to save (among other editor options) by clicking Tools>Options>Editor (12.3.2 Editor Preferences).

3.4.3   Navigation


Button
Shortcut
Edit Menu Command

n/a
CTRL+G
Go To
n/a
F4
Next Error/Tag
n/a
SHIFT+F4
Previous Error/Tag

The Go To command in the Edit menu displays a dialog box that allows you to specify, by line number, what portion of the file to view.

The Next Error/Tag and Previous Error/Tag commands are enabled when errors or warnings are displayed in the Build Output window. In that situation, click these commands to examine the source-code context for each error or warning in turn. See 4.3.4 Building a Downloadable Application for more information.

The editor uses the standard Windows keys and mouse actions for moving throughout the file.

3.4.4   Search and Replace


Button
Shortcut
Edit Menu Command

n/a
CTRL+F
Find
n/a
ALT+F3
Find
n/a
F3
Find Next
n/a
SHIFT+F3
Find Previous
n/a
n/a
Replace

Click Edit>Find to search for a string in your file. You can also open the Find dialog box with CTRL+F or ALT+F3. Figure 3-5 shows the Find dialog box.

Figure 3-5:   Find Dialog Box

Enter the string you are looking for, set the options, and click OK. The option buttons under Direction determine whether the editor searches back (Up) from the cursor position, or forwards (Down). If the text is not found, the editor displays an error message; the Find dialog box remains open, in case you need to correct the search string.

Click Find Next to search for another instance of the same string in the same search direction; click Find Previous to repeat the search, but in the opposite direction.

Click Replace to specify both a string to find and a replacement for it. Figure 3-6 shows the Replace dialog box. The buttons in the Replace dialog box allow you to replace all occurrences of a string, or examine each individual occurrence before deciding whether or not to replace it.

Figure 3-6:   Replace Dialog Box

3.4.5   Printing


Button
Shortcut
File Menu Command

n/a
ALT+F t
Page Setup
CTRL+P
Print

To print the current edit window, click File>Print. A standard Print dialog box (Figure 3-7) appears.

Figure 3-7:   Print Dialog Box

Click Page Setup to change the text that appears at the top (Header) and bottom (Footer) of each page in printouts from the Tornado editor. The dialog box in Figure 3-8 allows you to specify the header and footer text.

Figure 3-8:   Page Setup Dialog Box

In the Header and Footer boxes of the Page Setup dialog box, you can use the character sequences in Table 3-2 to request timestamps or file names and to control alignment.

Table 3-2:   Page Setup for Printing: Header/Footer Escape Sequences


To Print
Specify
For Alignment
Specify

File name
&f
Left aligned
&l
Page # of current page
&p
Centered
&c
Current system time
&t
Right aligned
&r
Current system date
&d



3.5    Editor Customization

You can customize the editor by specifying fonts, colors, and options such as tab stops, scrollbar displays, and the number of levels of undo history. See 12.3 Setting Options for details.

You can also select an alternate editor for use with Tornado. See 12.3.3 External Editor.