| Configuring your External Editor |

By default, Edit from the Web is configured to use Microsoft Visual C++ with Genitor OCS Add-In or Surveyor Add-In as its external file editor. A sample configuration file showing how to configure Edit from the Web to use the CodeWright® Programmer's Editing System as the external editor is provided; refer to the topic Sample Editor Configuration File at the end of this page.

In addition to Microsoft Visual C++ and CodeWright, Surveyor and Genitor OCS support any file editor that:

- can open files using a drag-and-drop operation from Windows Explorer; or
- has a command line interface.

Essentially all commercial programming editors, as well as most popular C/C++ compiler IDEs, are supported. The following topics provide details.

- Using the File | Preferences Command
- Using the Workstation Setup Program
- Editing the Configuration File
- Sample Editor Configuration File

## Using the File | Preferences Command

The easiest way to select an editor for use with Edit from the Web is to use the File | Preferences command in Surveyor, or in the Class Editor or Class Workshop provided in Genitor OCS. This command leads to a property sheet that allows you to configure your editor settings.

[Back to Top]

## Using the Workstation Setup Program

You can also set the editor configuration using Surveyor or Genitor OCS Workstation Setup programs. There is a shortcut to this program in the "Utilities" subfolder of the Surveyor or Genitor OCS folders in your Windows Start menu.

[Back to Top]

## Editing the Configuration File

The actual configuration information is stored in a profile file named `GtorSS.ini` that resides in your Windows directory. In most cases, you should use one of the methods described above to change the editor configuration. However, you may directly edit `GtorSS.ini` using a text editor. Below is a description of the relevant profile sections and keywords.

### `[C/C++ Environments]`

GtorSS.ini can contain configuration information for any number of external editors. This makes it easy to switch between several different external editors. This profile section lists all of the supported editors. The form of each entry in this section is

Editor-name=Short-Name

where Editor-name is the full name of an external editor and Short-Name is a short abbreviation used to identify the editor. For example:

    [C/C++ Environments]
    CodeWright Programmer's Editing System=CodeWright

### `[Editor-name]`

There is one such section for each Editor-name listed in the `[C/C++ Environments]` section. The keywords in these sections define the characteristics of each specific editor. The following table describes the keywords recognized in this section.

Keyword | Description
`AppName` | Specifies the name of the executable application file. If this name is not fully qualified, the subsystem may not be able to find it. For example: D:\Program Files\CodeWright\CW32.exe
`CmdArgs` | Specifies the command line arguments to pass to the editor when using a command line interface. A single %s parameter specifies where to insert the name of the file (or files) being edited. If you do not specify a %s, a single space and the name of the file are appended to the end of the command line.
`DropFiles` | Specifies which type of editor interface to use. `DropFiles=0` — Use command line interface. `DropFiles=1` — Use a simulated drag-and-drop interface. A default value of zero is used if this keyword is omitted.
`MaxFiles` | Specifies the maximum number of files that can be simultaneously opened in the editor. Set this value to zero if the editor can not edit multiple files simultaneously. A default value of zero is used if this keyword is omitted.
`MultiInstance` | Specifies whether or not multiple instances of the editor should be invoked when opening multiple files using a command line interface. `MultiInstance=0` — Invokes a single instance of the editor with the names of all files to be edited (separated by spaces) on a single command line. Command line length restrictions imposed by the operating system may limit the number of files that can be simultaneously edited. `MultiInstance=1` — Invokes a separate instance of the editor for each file to be edited. This approach avoids any concern regarding command line length restrictions imposed by the operating system. Some editors, such as CodeWright, can open all files in a single instance of the editor even when multiple instances are invoked. In this case, it is best to set MultiInstance to one. This has the same ultimate effect as setting MultiInstance to zero but avoids any concern for the command line length. A default value of zero is used if this keyword is omitted.
`WindowClass` | Specifies the window class name of the editor's top-level window. See `DropFiles` below for more details.
`WindowTitle` | Specifies the window title of the editor's top-level window. See `DropFiles` below for more details.

Finding the Drop Target—When the generic editor subsystem is configured to use a simulated drag-and-drop interface to the external editor, the subsystem sends a message (WM_DROPFILES) to the external editor's top-level window (i.e., the drop target) for each file to be opened. The `WindowClass` and/or `WindowTitle` keywords (discussed above) describe how to locate the drop target window.

- The simplest and most common method is to use the `WindowTitle` keyword. The `WindowTitle` keyword specifies a title string for the drop target window. The editor subsystem examines all top-level windows to find a window whose title contains the specified string.

If you place a ? at the front of the string, the editor subsystem finds a top-level window with a title containing the remaining characters of the string anywhere in the title. If you do not place a ? in the front of the string, the editor subsystem finds top-level windows with titles that begin with the string.

Using the window title is very reliable but may not work for all applications. In such cases, you can use the `WindowClass` keyword to specify the internal window class name of the editor's top-level window. Of course, to use this feature, the class name must be fixed (i.e., not generated dynamically) and you must know what it is.

If you specify both the `WindowClass` and `WindowTitle` keywords, the subsystem attempts to locate a window that has the specified class and exactly matches the specified window title string. In this case, the `WindowTitle` is interpreted as a complete window title, not just a prefix or portion of the title.

If the subsystem is unable to locate a drop target window, it loads the application specified by the AppName keyword. Once this application has started, the subsystem again attempts to locate the drop target window.

## [Options]

This section must contain the following keyword:

`C/C++ Environment=`Editor-name

This keyword specifies which of the editors defined in the `[C/C++ Environments]` is the selected editor.

[Back to Top]

## Sample Editor Configuration File

The example below selects CodeWright as the active editor.

    [Options]
    C/C++ Environment= CodeWright Programmer's Editing System

    [C/C++ Environments]
    CodeWright Programmer's Editing System=CodeWright

    [CodeWright Programmer's Editing System]
    AppName=Cw32.exe
    CmdArgs=%s
    MaxFiles=50
    MultiInstance=1
    WindowClass=
    WindowTitle=CodeWright
    DropFiles=1

[Back to Top]

This web site was generated using Surveyor V4.50.811.1. Click here for more information. | Site content copyright © 2001 Barak Weichselbaum. See the About page for additional notices. This page last updated: 27 Jun 2001.