This chapter introduces the concepts behind working with files in CodeWarrior.
The topics in this chapter are:
To create a new untitled window where source code may be entered, choose the New Text item from the File Menu.
To learn more about text editing in the window you have just created, see "Editing Source Code."
There are several ways to open a file with the CodeWarrior IDE:
You can open three types of files with the CodeWarrior Editor:
To open a Text File, choose the Open command from the File Menu. The CodeWarrior Editor displays an Open dialog, as shown in Figure 4.1.
For more information about editing source code, see "Editing Source Code."
To open a Project File, choose the Open command from the File Menu. CodeWarrior displays an Open dialog, as shown in Figure 4.1.
Use the Show popup menu to modify the File List to display Text Files, Project Files, or All Files.
For more information about working with CodeWarrior project files, see "Working with Projects."
There are many different ways to open an interface file using CodeWarrior.
Here's a different method. If you're editing any source code file, you can open an interface file mentioned anywhere in the text file with the Open File command.
First, select text in the editor window containing the name of the interface file you would like to open. An example of a file name you might see in a C source code file is stdio.h. You could select stdio.h
by double-clicking on the stdio
portion of the text. Then, choose the Open File command from the File Menu.
CodeWarrior then searches for the file and opens the file in an editor window.
If you're editing a source code file and want to open an interface file without selecting any text, you may choose the Open File command from the File Menu. This command will use the Access Paths specified for the project to search for the file to open.
CodeWarrior then displays a standard open file dialog, as shown in Figure 4.2.
Type the name of the file you wish to search for in the Open editable text field.
If you want to search both System Include Path Pane and Project Include Path Pane directory trees (all paths specified in the Access Paths panel), turn the Search only in the System Tree option off.
You can also type the filename only using a partial path, or full path. For example:
math.h
Sys/types.h
/boot/develop/headers/Be/AppKit/Application.h
See "Access Paths" for more information.
If the file is a text file, CodeWarrior opens it in an Editor window.
If the file is any other type, CodeWarrior opens the application in which the file was created.
Another way to open a file is to select it, and then press the Enter key.
For more information about the File Column see "File Column."
One way to open a source file is to click on the Group File Pop-up for a particular group so that it pops up, as shown in Figure 4.3. From this pop-up menu you may select the file in the group that you want to open.
You can open a source file by choosing it from the Group File Pop-up menu for the group that contains the file. This works even if the group is collapsed and the file is not visible in the Project window, as shown in Figure 4.3.
To open a header or interface file, click on the Interface File Pop-up to see a list of files. Select the file you want to open from this list, as shown in Figure 4.4.
Files shown in bold typeface in this pop-up cannot be opened.
To open an interface file from a source file, click the Interface Pop-up Menu at the bottom left corner of the Editor Window as shown in Figure 5.1. This pop-up menu lists all interface files used by the source file. Select a file from this menu to open that file in an Editor Window.
An empty menu means your text file does not contain source code, or that the source file has not yet been compiled.This section describes the many ways that CodeWarrior can save files. The choices are:
To save your changes to the current file, choose Save from the File Menu. CodeWarrior saves your file to disk.
The Save command is dimmed if the window is new and has no data, or if the contents of the active window have already been saved.
Projects are saved when they are closed (the Close command), when you quit CodeWarrior (the Quit command), or when the Save A Copy As command is selected.
To save your changes to all the files currently open, press the Alt-Opt-S
key combination.
Alt-Ctrl-S
instead to save all open Editor Windows.
The CodeWarrior editor saves all the modified files to disk.
If you want to save a new untitled file or save a file under a new name, use the Save As command under the File Menu. If the file is in the current project, CodeWarrior updates the project to use the new name.
When you choose Save As from the File Menu, the CodeWarrior editor displays the dialog shown in Figure 4.5.
Choose the file location and name the file, then click the Save button.
CodeWarrior saves the file and changes the name of the editor window to the name you entered.
If the file is in the current project, CodeWarrior changes the file's entry in the project to match the saved name. If you don't want to change the project, but still want to save the file, you can read how to do this in "Backing Up Files".
If you want to save a backup copy of a file before you make some changes to the original, use the Save A Copy As command under the File Menu. CodeWarrior creates a copy of the file under a new name, but leaves the original in the editor window and does not change the project to use the new file name.
After choosing Save A Copy As from the File Menu, the CodeWarrior editor displays the dialog shown in Figure 4.5. Specify the file's save location and name the file. Click Save and CodeWarrior saves a version of the file with a new name. It does not change the file in the editor window or in the current project.
If the project window is the active window, Save A Copy As
allows you to save a copy of the project using a new name
To save a Be, Macintosh, or DOS text file in a different format, use the Options Pop-up Menu at the bottom-left of the window to specify the document format. For more information, refer to "Options Pop-up Menu" for more information.
The topics in this section are:
To close a window, choose Close from the File Menu.
If you close a text file using the File Menu and have not saved your changes, CodeWarrior asks if you want to save the changes before closing the window, as shown in Figure 4.6. If you choose to close the file without saving your changes, all changes are lost.
You can also close a window by clicking the close box of the active window. This is exactly the same as choosing the Close item in the File Menu.
For more on saving project files, consult "Saving a Project."
The Close command also saves other properties of the window, such as the size, location, and the selected text in the active window. These options are configured with the "Syntax Styling." See "Font" for information on how to configure these options. If the appropriate options are enabled, the next time the source code file is opened, it will occupy the same position on your screen and the same text will be selected.
For more information about editor preferences, see "Font."
To close all the open Editor Windows, use the Alt-Opt-W
key combination.
Alt-Ctrl-W
instead to close all open Editor Windows.
Use the print options in CodeWarrior to print open files.
To print all or a portion of a file, choose Print from the File Menu.
CodeWarrior displays the print dialog for your printer.