Source-Navigator
allows you to
edit source files with its built-in editor,
or with an external editor that you select in the
Edit
tab of the
Preferences
dialog (see Editor Preferences).
For instructions on how to use emacs as your external editor, see Using emacs as your Editor.
The Editor Window
To open the
Editor, double-click a symbol in the
Symbol Browser (or other Source-Navigator browser window). Symbols are
hyperlinked to the
Editor, which displays the contents of a project source file and allows you to edit it.
When you save a modified source file, the project database is updated and changes are reflected in all of the Source-Navigator tools. Standard mouse operations are supported in the
Editor:
click on the text and new text will be inserted to the right of the cursor.
clicking and dragging selects text so that operations such as
Cut,
Copy, and
Paste
can be performed.
clicking and dragging in the scrollbars scrolls the file appropriately.
double-clicking on words selects the entire word; triple-clicking selects the entire line.
Editor Window
Symbol Accelerator Combo-box
The
Symbol Accelerator
combo-box in the toolbar allows you to quickly navigate through your source code.
Symbol Accelerator Combo-box
When the
Editor
is open this combo-box lists all of the symbols in the open file. When the
All
button is pressed, all of the symbols within the entire project are displayed. When other tools are open, the
Symbol Accelerator
combo-box lists the components relative to the tool.
For instance, in the
Class Browser, it lists only classes in the file. When the
All
button is clicked, all of the classes in the project are displayed.
Notice that the
Symbol Accelerator
text field in the toolbar displays the component that is referenced as the Editor's cursor moves through the file.
Find Box
You can use the
Find
box in the toolbar to search for text. Type text into the text box and press the
Enter
key; the next instance of the text is found. To find a previously used pattern, click the
Find
box down arrow to see a list of previous patterns. Select one of the patterns with the mouse and the next instance of that pattern is found.
Pattern Searching
Use these buttons to search the window or the project database for a symbol.
Pattern Searching Toolbar Buttons
The Extended Toolbar
The extended toolbar provides buttons to manage your files and text. To add this toolbar to Source-Navigator, from the
File
menu, select
Project Preferences. Select the
Edit
tab and select the
Extended Toolbar Buttons
box.
File and Text Management Toolbar Buttons
View History
Source-Navigator provides complex information in a number of ways. As you navigate through a project, you may want to return to the view of a relationship that you previously investigated. Source-Navigator stores a view history of your journey through the project. The left and right arrows in the toolbar act like
Back
and
Forward
buttons in popular Web browsers. You can also right-click on one of these buttons to get a list of previously visited locations within the project.
For more detailed history, the
History
menu lists previous views on a per-tool basis. This lets you jump directly to the view you want, rather than paging through previous views.
Search Menu
The
Search
menu is context-sensitive; different options are available depending upon the tool you're using.
Find dialog
To find a specific string or pattern in the text file, from the
Search
menu select
Find.
Type your string or pattern into the text box and click the
Search
button; you can click the
Search
button multiple times to find more instances of the string. Deselect
Ignore
case
if you want a case-sensitive search. When
Regular expression
is selected, the pattern is treated as a regular expression, and clicking the
Search
button finds the next match for the regular expression. Deselect
Forward
if you wish to search backwards.
Replace dialog
To search and replace a specific string or pattern in the text file, from the
Search
menu select
Replace.
The
Replace
dialog is similar to the
Find
dialog. The
Ignore case,
Regular expression, and
Forward
options behave the same way.
Search
finds the next instance of the pattern.
Replace
replaces the current pattern with the pattern in the
Replace pattern
text box. Select
All
to replace all occurrences of the pattern.
Find Declaration, Implementation
If a symbol is selected in the
Editor, selecting
Find Declaration
switches to the location of the declaration of the symbol, and
Find Implementation
switches to the location of the implementation of the symbol.
Note
You can also toggle between Declaration and Implementation by using the keyboard shortcut commands
Ctrl+Shift+D
and
Ctrl+Shift+I, respectively.
Grep
Grep
activates the
Grep
tool, which allows you to search for text in all project files. Select the
expression you want to search for and from the
Search
menu select
Grep. Source-Navigator automatically searches for your text in all
project files. For more information on Grep, see Grep.
Go To menu
When you want to go to a specific line in the file, from the
Search
menu, select
Go To ->
Go To Line. This allows you to type in the line number you wish to go to.
Set Mark
allows you to set a place in the file you wish to come back to later.
Go To Mark
jumps to the last mark you set.
Go to Error
displays the line that caused the build error.
Editor Preferences
You'll find preference settings for the
Editor
window in the
Edit
tab of the
Preferences
dialog. To find this dialog:
In the
Symbol Browser, from the
File
menu, select
Project Preferences. In the
Editor, from the
Edit
menu, select
View Preferences.
Choose the
Edit
tab.
Edit Tab of the Preferences Dialog
Format
Tab stop
When a tab is inserted, it is this many spaces wide.
Auto Indent width
When the
Enter
key is pressed, this is the number of spaces inserted at the beginning of the next line. This is also the number of spaces inserted by indent (from the
Edit
menu, select
Indent Text) and deleted by outdent (from the
Edit
menu, select
Outdent Text) when reformatting source code.
Wrap by
This controls where the
Editor
breaks a line that is longer than the width of the window.
Work
Create *.bak Files
If selected, the
Editor
creates backup files whenever you save a file.
Output File Translation:
End-of-lines of source files may be represented differently on different platforms:
Keep
retains the original file's end-of-line characters; this is set by default.
Auto
saves the file with your current platform's end-of-line characters.
UNIX,
Windows, or
Macintosh
sets the end-of-line characters to match the platform you choose, regardless of the platform you're working on.
Bracket match delay
Sets the amount of time (in milliseconds) that matching brackets should be highlighted.
Right mouse supports:
If
Edit menu
is selected, you can access some functions, such as
Undo,
Delete,
Cut,
Copy, and
Paste
through a right-mouse pop-up menu.
If
Scrolling
is selected, you can scroll the text in the
Editor
using the right-mouse button.
Translate Tabs to Spaces
Selecting this converts all tab characters in the file to the number of spaces shown in the
Tab Stop
box.
Extended toolbar buttons
Selecting this adds several new tool buttons to the
Editor
toolbar. For more information, see The Extended Toolbar.
External Editor
Insert the command line for your favorite editor in this text box. See Common editor configurations. for command line syntax.
Source-Navigator can set the position of the cursor in the editor if the editor can be configured by command line options. Source-Navigator can perform the following substitutions on the command line before it is executed:
%f
file name
%l
line number
%c
column number
%d
project directory
Common editor configurations
vi
To invoke the vi editor, you must enter the following into either
the
External Editor
text box in the
Edit
preferences tab or at the command line:
xterm -T %f -e vi +%l %f
The modifications you make and save are stored
in the database only after you quit vi.
emacs
Starting a new emacs session: To start a new emacs session whenever
you view source code, enter
emacs
or the name of the executable file of emacs in either the
External Editor
text box in the
Edit
preferences tab or at the command line. For example, enter
nemacs
or
xemacs, without any parameters. The string
emacs
must be found in the command if you want the changes you make and save to be
immediately stored in the database (without terminating emacs).
Using a current emacs session: For instructions on how to configure
Source-Navigator to communicate with a currently running emacs session,
see Using emacs as your Editor.
Using emacs as your Editor
Source-Navigator supports GNU emacs 19.34 and xemacs 19.14; other versions may also work, although these have not been tested.
When you use emacs as your editor, Source-Navigator displays files in an emacs window. Whenever emacs saves a file, Source-Navigator updates the database. Multiple projects can share a single emacs editing session.
You can use emacs with Source-Navigator in one of two ways:
to start a new emacs process whenever you make an edit request.
to communicate with an already running emacs process.
To Start a New emacs Process
Enter
emacs
(or the name of your program with the string
emacs) in the
External Editor
text box of the
Edit
preferences tab.
To Communicate with an Already Running emacs Process
Modify your emacs start-up file so that
gnuserv
utility, which is provided in your emacs distribution, is loaded. This involves adding two lines to your emacs start-up file (usually
~/.emacs). You need to enter the full path to your emacs directory:
(load "<path to emacs location>/lisp/gnuserv")
(server-start)
See your emacs documentation for additional
information.
In the
External Editor
text box, set your editor to
gnuclient.
When you start a new emacs session,
Source-Navigator can now request that the running emacs session bring up
files for editing. Source-Navigator also rescans the files when you finish editing.
Note
If you use
xemacs, the
gnuserv
package is included; see your xemacs documentation for instructions on loading it.
Source-Navigator's search function replaces the
find-tag
command (Meta-period) when you search for a symbol.
Because the other tag commands are not yet available inside Source-Navigator,
you need to use the equivalent
emacs commands, if available.