Code Wright Userguide 750
Code Wright Userguide 750
Borland Software Corporation. All rights reserved. All Borland brand and product names are
trademarks or registered trademarks of Borland Software Corporation in the United States and
other countries. All other marks are the property of their respective owners.
This document contains trade secrets and other proprietary information which belong to
Borland Corporation or others. Information in this document is subject to change without
notice. The software described in this document is furnished under a license agreement or
nondisclosure agreement. The software may be used or copied only in accordance with the
terms of those agreements. No part of this publication may be reproduced, stored in a retrieval
system, or transmitted in any form or any means electronic or mechanical, including
photocopying and recording for any purpose other than the purchaser's personal use or by any
method conveyed or disclosed to a third party or parties without the written permission of
Borland Corporation.
The following copyright message is required due to the inclusion of CTL3D.DLL with our
product: Portions ã Microsoft Corporation, 1985-2002. All rights reserved.
Publication History
Trademarks
Borlandâ, C++ Builderâ, BRIEFâ, CodeWright â and StarTeamâ are registered trademarks
of Borland Software Corporation.
Delphiä, CodeSenseä, CodeFolioä, CodeMeetingä, ChromaCodeä, ChromaCodingä,
Programmer’s Editing Systemä and ChatWrightä are trademarks of Borland Software
Corporation.
Texas Instrumentsâ is a registered trademark and Code Composer StudioÔ is a trademark of
Texas Instruments Incorporated. TICCSync only works with Code Composer StudioÔ from
Texas Instrumentsâ.
MERANTä is a trademark of MERANT International Limited. PVCSâ is a registered
trademark of MERANT Solutions Incorporated.
ii
Microsoftâ, Windowsâ, MS-DOSâ, Internet Explorerâ, Visual C++â, Visual Studioâ .NET
and Visual Basicâ are registered trademarks of Microsoft Corporation.
Macintoshâ is a registered trademark of Apple Computer, Inc.
UNIXâ is a registered trademark of The Open Group.
Netscapeâ is a registered trademark of Netscape Communications Corporation.
Javaä is a trademark of Sun Microsystemsâ.
Operaä is a trademark of Opera Software.
Epsilonä is a trademark of Lugaruâ, Inc.
Vignetteâ StoryServerä Tool Command Language is a trademark of Vignette Corporation.
AppBasic uses WinWrapâ Basic, Copyright ã 1993-1996, Polar Engineering and Consulting.
Sentry Spelling-Checker Engine, Copyright ã 1993-1997, Wintertree Software Inc.
All other brand or product names are trademarks or registered trademarks of their respective
companies.
Contact Information
SALES:
Borland Software Corporation
9615 S.W. Allen Blvd
Suite 107
Beaverton, Oregon 97005
www.codewright.com
503.641.6000
800.547.9902
503.641.6001 fax
PRODUCT SUPPORT:
503.207.1190
[email protected]
HEADQUARTERS:
Borland Software Corporation
100 Enterprise Way
Scotts Valley, CA 95066-3249
www.borland.com
831.431.1000
iii
iv
Table of Contents
Publication History ii
Trademarks ii
Contact Information iii
TABLE OF CONTENTS V
CHAPTER OUTLINE 1
Chapter 1: Introduction 1
Chapter 2: Run CodeWright for the First Time 1
Chapter 3: Build Your First Project 1
Chapter 4: Command Key, Libraries, & Environment 1
Chapter 5: View Themes and Language Support 1
Chapter 6: Editing & Printing 2
Chapter 7: Projects, Project Spaces, and Workspaces 2
Chapter 8: Set up a Compiler 2
Chapter 9: Version Control 2
Chapter 10: Synchronization 3
Chapter 11: Search and Replace and Navigational Tools 3
Chapter 12: Checking and Reformatting Files 3
Chapter 13: Custom Interface 3
Chapter 14: File Support and Sharing 3
Chapter 15: Large Files 3
Chapter 16: Extend CodeWright 4
Chapter 17: UNIX 4
Chapter 18: Configuration Files & Command Line Parameters 4
Appendix A: TagWnn Utility 4
Appendix B: Making and Modifying DLLs 5
1- INTRODUCTION 7
Table of Contents v
The Menu Bar 36
File Menu 36
Edit Menu 37
Search Menu 38
Project Menu 38
Build Menu 39
Text Menu 39
Document Menu 40
Tools Menu 40
Window Menu 44
The Difference between Windows and Documents 44
Details of the Window Menu 45
Help Menu 46
Output and Project Windows 47
Output Window 47
Default Tabs 48
Optional Tabs 48
Output, File Find and Search Tabs 48
The Project Window 49
Detaching Project Window Tabs 51
Incremental Searching in the Project Window 53
More on the Open Tab 53
The Standard Toolbar 55
vi Table of Contents
CodeWright Language Support 72
Language Support Lexers and DLL’s 73
Language DLLs 74
Tools|Customize|Libraries 74
ChromaCoding Lexers 74
Creating a Lexer 75
Configuring Options in the Language Dialog 83
File Types 84
Options Tab 84
Tabs/Indenting Tab 85
Templates Tab 85
Coloring Tab 85
CodeSense Tab 87
Format Tab 87
Comments Tab 87
Adding a New File Type to the Language Dialog 88
Aliasing 88
Creating a Language Support DLL 89
Definitions 157
What is a Project? 157
What is a Project Space? 158
What is a Workspace? 158
Creating a Project Space 158
The Project Properties List and Project Settings 160
Project Properties List 160
Default Settings 160
Working Directory 161
Table of Contents ix
Creating a Project and the Members Tab of Project Properties 161
Creating a New Project 162
Adding Files to a Project 163
Adding Existing Projects to a Space 163
Auto-detect File Type 164
Reading External Makefiles and Visual Studio Workspaces 165
Steps for Setting up New Makefile/Workspace Parsers 166
Synchronize Makefile/Workspace with Project/Project Space 167
Characteristics of the Project Tab 168
Organizing the Hierarchy 168
Version Control 169
Directories Tab of Project Properties 170
Storing Configuration Options with a Project 172
Reading Configuration Settings from Other Files 173
Tools Tab of Project Properties 174
Tool Categories 174
Build Tools 175
Compile Tools 176
Custom Tools 179
VCS Tools 180
Setting up Project Tools 181
Command Options on the Tools Tab 182
Filename Component Macros 183
Uppercase Macros 185
Response File 185
Symbolic Macros 186
Errors tab of Project Properties 187
Custom Error Parsers 189
Navigating Build and Rebuild Command Output 190
Traversing the Output 191
Filters tab of Project Properties 192
Project Setup Checklist 193
Using Project Spaces 194
Selecting or Changing Projects 194
Selecting or Changing Project Spaces 195
Using Projects 195
Loading Files for Editing 195
Creating, Selecting and Saving Workspaces 196
Creating a New Workspace 196
Automatic Saving 197
Loading an Existing Workspace 197
Searching Project Space and Project Files 197
Selecting files for Check-in or Check-out 198
Project Files 198
Configuration and State Hierarchy 198
x Table of Contents
Modifying the Command Line Environment 204
Displaying Output in CodeWright (FTEE and VDOS) 205
FTEE 205
Use VDOS 206
Version Control Commands 207
Table of Contents xi
TI Code Composer Studio File Synchronization 237
TICCSync Setup 238
A First View 239
Bi-directional Synchronization 239
Sync Configuration Options 240
Accessing Menu Items via Synchronization 241
Differencing 297
Interleaved Differencing 298
Text Difference Analysis Dialog for Interleaved Differencing 298
Interleaved Document 300
Side-by-Side Differencing 300
Text Difference Analysis Dialog for Side-by-Side Differencing 300
Side-By-Side Difference Window 301
Side-by-Side Difference Printing 307
Binary File Differencing 308
Directory Differencing 309
Directory Difference Analysis Dialog 309
Tree Difference Window 311
Metrics Reports 313
Create Difference Metrics Report Dialog 313
File Difference Metrics Dialog 316
Using Difference Utilities 317
Merging 317
Using the Merge Files Dialog 317
Merge Output 319
Removing Changes with Merge 320
Format Source 320
Setting up Your Formatting Criteria 321
Using the Format Feature 322
Spell Check 323
Check Spelling 323
General Tab of Check Spelling 323
Word Format Tab of Check Spelling 324
Advanced Tab of Check Spelling 326
Documents Tab of Check Spelling 327
Dictionaries Dialog 328
Dictionaries 328
Table of Contents xv
FTP: File Transfer in CodeWright 377
Enabling the FTP Manager 377
Creating Profiles 377
Logging in to a Remote Server 378
Using the FTP Manager 378
Directory Trees vs. Base Directories 379
Put or Get using Base Directories from your Profile 379
Transferring Open Documents or Project Files 380
Displaying the FTP Toolbar 380
CodeMeeting: Messaging and File Sharing 381
Preparing for Initial Use 382
User Maintenance 383
Adding a User or Modifying User Settings 383
Updating Your Own User Settings 385
Deleting a User 385
Connecting to Other Users 385
Creating a Connection 385
Posting Away from Desk Message 385
Ending a Connection 386
Sending Messages 386
Broadcast vs. Private Chat 386
Notification of Incoming Message 386
Sharing Documents 387
Begin or End Document Sharing 387
Editing Control 388
Following Along when Switching between Documents 389
Following Along in the Current Document 389
INDEX 507
xx Table of Contents
Chapter Outline
The Chapter Outline provides an overview of the chapters in this manual.
Chapter 1: Introduction
The first chapter of this manual is a brief introduction to CodeWrightâ. It includes a
list of some of the latest and greatest features and information on where to get
additional product support.
Chapter Outline 1
Most of the available language support modules in CodeWright are loaded out-of-
the-box, but there are a few that need to be loaded manually. For those languages for
which no language support modules are provided (whether loaded or not),
CodeWright has two methods for creating language support. Chapter 5 describes
those methods. It also talks about how to configure CodeWright to ChromaCodeÔ
languages that are embedded in other languages (e.g. JavaScript in an HTML file).
2 Chapter Outline
Chapter 10: Synchronization
This chapter talks about the various Synchronization programs that come with
CodeWright, and how they are used. With Synchronization, CodeWright can be
used in conjunction with certain GUI-based development environments, such as
Microsoft Visual Studio. Borlandâ Sync Technology coordinates tasks performed in
CodeWright with tasks performed in the synchronized environment. It is designed
to make the many features in CodeWright available to the synchronized
environment. Synchronization programs are available for Borlandâ DelphiÔ and
C++ Builderâ, Microsoftâ Visual Studioâ .NET, Visual Studio C++â and Visual
Basicâ, and Texas Instrumentsâ Code Composer Studioâ.
Chapter Outline 3
Chapter 16: Extend CodeWright
CodeWright is a fairly complete product; there is not much that it lacks.
Nevertheless, there always seems to be one job for which necessary tools just can't be
found. If this is the case, CodeWright has three macro languages (Perl, AppBasic, and
API Macros) for extending functionality. They are provided in the event that
CodeWright doesn't already have the necessary functions for handling the task at
hand. Chapter 16 describes these tools in detail.
4 Chapter Outline
Appendix B: Making and Modifying DLLs
In the CodeWright SDK, you can obtain resources to create new DLLs, and resources
to modify existing fundamental DLLs. Appendix B describes some of the
CodeWright architecture as it pertains to the construction or modification of
CodeWright DLLs, as well as the preliminary components of a CodeWright DLL.
Also look for tips on compiling the DLLs.
Chapter Outline 5
6 Chapter Outline
1- Introduction
CodeWright is an editor with features geared towards software programmers and
web content providers. It is designed to support multiple programming languages in
that (at a minimum) it ChromaCodes™ the syntax elements of the language. It is the
first professional-quality, extensible programmer's editor written for Windowsâ
from the ground up.
1- Introduction 7
3 Merge and Difference
3 Elided text (Selective Display)
3 Help Manager
3 IDE integration
3 Button Links
3 HTML WYSIWYG viewer
3 MVB, IVT, and HTML help file support along with traditional HLP help file
support.
Web Page
You can access our home page on the Internet’s World Wide Web using the following
URL: http://www.codewright.com. Information and services available there include:
n Knowledge Base and Developer ’s Forum
n Online (PDF) versions of our manuals
n Messaging to sales and product support
n Pricing and product descriptions
n Problem and enhancement report forms
n Downloading of Add-Ons and patches
Additional Support
Support for installation issues will be provided regardless of support coverage. Any
issue that arises during installation of CodeWright, up to the first execution of the
program, is considered an installation issue. After CodeWright has been successfully
installed and executed one time, the following additional resources are available
under a support contract.
Email
You can send email to [email protected], and we will assist you as soon as
possible.
8 1- Introduction
Fax
A fax normally gets a quick response. Our fax number is (503) 641-6001.
Phone Support
If you urgently need some information in order to continue using CodeWright, or if
you have an urgent bug report, give us a call. The phone number is (503) 207-1190.
For more information on arranging a support contract, please contact our Sales
Department at [email protected].
Category/ Feature
Chapter
1- Introduction 9
Key Editing Features
Category/ Feature
Chapter
10 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 11
Key Editing Features
Category/ Feature
Chapter
12 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 13
Key Editing Features
Category/ Feature
Chapter
14 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 15
Key Editing Features
Category/ Feature
Chapter
16 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 17
Key Editing Features
Category/ Feature
Chapter
18 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 19
Key Editing Features
Category/ Feature
Chapter
20 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 21
Key Editing Features
Category/ Feature
Chapter
Search and Use the Color Limited search option to only search
Replace and for text that is ChromaCoded in a particular way
Navigational (e.g. find “foo” only in comments or strings).
Tools Configure your default Color Limited search from
the Search|Options dialog, or change the
restrictions on a case-by-case basis from the Search,
Replace, File Grep or Search and Replac e Multiple
Sources dialog.
22 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 23
Key Editing Features
Category/ Feature
Chapter
24 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 25
Key Editing Features
Category/ Feature
Chapter
26 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 27
Key Editing Features
Category/ Feature
Chapter
File Support and New Quickly access all FTP functionality within
Sharing CodeWright from the redesigned and consolidated
FTP Manager tab, located on the Output Window
by default. FTP: Transfer files from within
CodeWright. The FTP feature supports file
structures for UNIX, Tandem Guardian, and VMS
hosts. (continued...)
28 1- Introduction
Key Editing Features
Category/ Feature
Chapter
1- Introduction 29
Key Editing Features
Category/ Feature
Chapter
30 1- Introduction
2- Run CodeWright for the
First Time
This section describes the way CodeWright looks when it is first loaded, giving some
tips about things to know before getting started. Many of the items described will be
deferred to other chapters in this manual for more information. The descriptions
provided are brief, intended only to familiarize the user with the initial CodeWright
environment.
The first time you run CodeWright, a popup dialog will ask you to register your copy
of CodeWright. The following four options are presented:
n Connect to Website: Click this button to launch the Registration page on
www.codewright.com. A second dialog will also display, with options to
indicate that you have completed the Registration form, or that you will fill out
the form later. If you elect to defer the task, this reminder dialog will continue
to display each time you start up CodeWright until you select a button that
indicates you have completed registration.
n Call Borland: Click this button to see a message containing contact phone
numbers and hours of operation. The reminder dialog will not display again.
n Already Registered: Click this button to indicate that you have already
registered your copy, closing the dialog. The reminder dialog will not display
again.
n Do it Next Time: Click this button to postpone registration. A reminder dialog
will display each time you start up CodeWright until you have selected one of
the preceding options.
A First Look
After completing any necessary configuration tasks, and accessing needed help tips,
the Configuration Wizard and Tip of the Day dialogs can be closed. The resulting
CodeWright screen displays a menu bar at the top, with the Standard toolbar docked
directly beneath. The window docked on the left is the Project Window, and the
window docked on the bottom is the Output Window. All of these items will be
described briefly in the remainder of this chapter.
Note: Some aspects of this style are still limited by the operating system
you run (e.g. menu fade is only visible with Windowsâ XPâ).
File Menu
The first menu is the File menu. The File menu is intended for standard file
operations (i.e. New, Open, Save, Print, etc).
On the File|New (Create a Document) dialog, you can create a blank document, or
populate the document with one or more Code Snippets from the CodeFolio
directory to jumpstart your editing session. Include file headers, function headers,
structs and more to help eliminate repetitive typing, ensure consistent code
formatting, and encourage code reuse within your team.
The CodeFolio directory on the Create New Document dialog mirrors the CodeFolio
tab of the Project Window; you can add, edit or delete Snippets from the CodeFolio
tab.
Additional items are described (or deferred to other chapters for more information)
below:
n Difference and Merge. Operations available from the Difference submenu
and the Merge utility are described in detail in the User’s Guide chapter on
Checking and Reformatting Files.
n The Find menu-item is used for finding files on any storage medium. Standard
DOS wildcard characters can be used when searching for files with this option.
n Send Mail and Reload. Send Mail sends files via MS mail or cc:Mail, and
Reload reloads the current file from disk.
Description Pattern
To store filter settings with the current project, check the box Save Filename
Filters in project file. If the box is checked but no project is open, the settings
are stored as default settings for use with future projects.
n Print and Print Setup. The last two items on the File menu, Print and Print
Setup, are described in more detail in the chapter entitled Editing & Printing.
Edit Menu
The first two sections of the Edit menu contain standard editing items, such as
Undo, Redo, Cut, Copy and Paste. Three items that may not be familiar are the Scrap
Buffer, Append, and Erase items:
n The Scrap Buffer item selects the Scrap Buffer for cut/paste operations.
n The Append item adds selected text to the end of the selected clipboard/scrap
buffer.
n The Erase item clears the selected clipboard/scrap buffer.
The CodeWright Scrap and Clipboard features are both described in more detail in
the chapter on Editing & Printing.
The third section of the Edit menu has options for inserting items into the current
buffer:
n Insert File brings up a dialog for selecting a file to be inserted into the current
document.
n Insert Literal brings up a dialog for entering characters into the document that
would otherwise trigger a command. The literal may be chosen using ASCII,
Hex, or Decimal values.
In the Macros section of the Edit menu, Record, Playback, Keystroke Macros, and
Run Key Macro are available for making, testing, editing and executing Keystroke
Macros. CodeWright Keystroke Macros are described in greater detail in the chapter
on Custom Interface.
Search Menu
The Search menu contains all the items necessary for performing search and
replacement operations on single or multiple files. CodeWright search features are
described in detail in the chapter on Search and Replace and Navigational Tools. The one
item worth describing here is Options. Search|Options brings up the Default
Search and Replace Settings dialog, where you set up searches to operate the way
you expect.
It is prudent to set search options before editing so that some of the following issues
might be addressed:
n Should the search be case sensitive?
n Should there be a prompt on replacement by default?
n Should searches be limited to text that is ChromaCoded (colored) in certain
ways (e.g. find “foo” in comments or strings only)?
n Should regular expressions be found?
n Should matching text be selected (highlighted)? If so, should it be momentary
or continuous? If continuous, should Restrict to Selection be turned off so that
Search Again will work as expected?
n Should the word that the cursor sits on populate the Search dialog by default,
or should the word be typed?
Project Menu
The Project menu is used for creating, opening, closing and manipulating projects,
project spaces, and workspaces:
n Projects are used to organize and store individual sets of files and configuration
settings. A project, at a minimum, is a list of files that you find it useful to group
together logically.
Build Menu
The Build menu contains a variety of options related to building and compiling your
files, as well as build and compile configuration.
n Compile, Build, Rebuild, Debug, and Execute, all of which have to be
configured in the Project|Properties dialog in order to use them. More
information about CodeWright projects is provided in the User’s Guide chapters
on Build your First Project and Projects, Project Spaces, and Workspaces.
n Find Next Error, used to locate the next error in the Output tab of the Output
Window.
n Build Tags, generates both the tags hypertext database and the Borland
compiled tags database. A project must be open for this to work.
n Configurations, accesses the Project Configuration Settings dialog. Here you
can select a configuration to be used in executing Build and Compile
commands, or create a new one. Configurations can be more extensively
tailored in the Project|Properties|Tools dialog.
Text Menu
The Text menu has various items for formatting and editing text. Some of these
items, like Selective Display, the Comment items, and Format Source, are discussed
in-depth in various chapters. The other items are fairly self-explanatory and will be
briefly described here.
Document Menu
The Document menu has items that access dialogs and perform operations that are
commonly used on documents. The first and second sections contain fairly self-
explanatory items for creating, closing, clearing and maneuvering documents. The
third section has items for inserting bookmarks and moving between them.
Bookmarks are described in detail in the chapter on Search and Replace and
Navigational Tools.
Tools Menu
The Tools menu has a variety of tools for manipulating and extending CodeWright.
Items on this menu are described/referenced below:
n The first five items on the Tools menu, (with the exception of API Command),
are for CodeWright macro languages:
3 The API Macros and Run API Macro menu items are used for making and
running CodeWright API Macros.
3 The AppBasic Macros and Perl Macros menu items have submenus
containing items for loading and working with AppBasic and Perl Macros,
respectively.
Macros are described in greater detail in the chapter on Extend CodeWright.
(The API Command option is described in the chapter on Command Key,
Libraries and General Environment.)
Window Menu
Similar to the Document menu, the Window menu is used for manipulating and
creating windows opened in CodeWright. It is important to understand how
CodeWright differentiates "windows" and "documents". Depending on the
configurations that have been made in CodeWright, the files that are open may not
always be contained in their own windows. The difference between windows and
documents is described next.
Help Menu
Use the CodeWright Help menu for accessing and configuring online help files,
accessing Configuration Wizards, and finding resources on the CodeWright website.
Output Window
There are a number of windows in CodeWright that are not normal edit windows.
They contain such things as output from a compiler or OS command, and require
special treatment. CodeWright has a special Output Window for these purposes.
The Output Window initially has seven tabs and is docked on the bottom edge of the
CodeWright screen. When a tab has focus, its name will display on the title bar of
the Output Window.
Optional Tabs
Up to four additional Search tabs can be made visible on the Toolbars tab of the
Tools|Customize|Toolbars dialog (Search 2, Search 3, Search 4 and Search 5).
The AppBasic Edit, Perl, ClipView and FTP Manager tabs are also tabs that will not
be marked by default. Each of these tabs has an associated DLL that must be loaded
on the Tools|Customize|Libraries dialog before it can be used.
n Use the Save button or File|Save menu item to save the contents of the
current Output Window tab.
n Right-click and drag the mouse to make a block selection, or left-click and drag
the mouse to make a stream selection. Stream selections can also be created
using theS key combined with motion keys. Use Cc to copy your
selection to the clipboard.
Project Window
Like the Output Window, the Project Window initially contains several tabs. The
tabs are primarily for viewing information about projects and other files. When a tab
has focus, its name will display on the title bar of the Project Window.
The tabs (from left to right) are:
n Project tab: Lists the files in the current project in hierarchical form, and lets you
operate on individual files or groups of files. More information about the Project
tab can be found in the chapter on Projects, Project Spaces, and Workspaces.
Press to access the StarTeam Filter Options dialog, where you can filter
Tasks and Change Requests by User, View and/or Folder to obtain a
meaningful list. By choosing All Views, you will see the Tasks and Change
Requests in all the Views to which you have access at one time.
Once you have obtained the StarTeam SCC Integration from the Borland
website, via a link in your current version of StarTeam, you can complete setup
of CodeWright StarTeam Integration from the Version Control Setup dialog.
If you would like to group multiple Project Window tabs together, simply follow
the preceding instructions, docking the successive tabs on top of the first. You
can rearrange tabs by positioning them in the desired location as you drop
them, or by dragging them to different positions at any time.
n A tab will auto-hide if you dock it on a side of the screen that has auto-hide
turned on. If the push pin button in the upper right-hand corner of the tab
is horizontal, auto-hide is ON; if it is vertical, auto-hide is OFF. You can
toggle the auto-hide setting for a particular side of the screen (left, right, top
or bottom) using this pushpin, or by toggling the Auto-hide Toolbar setting
on the Tools|Customize|Toolbars|General dialog.
n You can quickly dock or undock a dockable window by selecting from the
following methods as appropriate:
3 To dock or undock a set of Project or Output Window tabs together,
right-click on the frame or title bar of the Project or Output Window,
and toggle the Docked item. You can also double-click on the caption
of a Project or Output Window toolbar to undock the tabs together if
Toolbar Captions is marked on the Tools|Customize|Toolbars|
General dialog.
3 To undock a single Project or Output Window tab from a group of tabs
(e.g. the Outline tab), right-click on the frame or title bar of the tab and
select Detach tab.
Incremental searching is available to help you quickly navigate tree controls. Give
the tree control focus (e.g. click in the Project tab), then type as many characters as
necessary to find the desired string.
Example: Say that you are in the Project tab of the Project Window, and
would like to search for a file called myproject.c. Complete the
following steps:
1. Click inside the Project tab to give it focus.
2. Type ‘m’. CodeWright will highlight the next item in the Project
tab that begins with 'm'.
3. Type ‘y’. CodeWright will highlight the next item in the Project
tab that begins with ‘my’.
4. Type ‘p’. CodeWright will highlight the next item in the Project
tab that begins with ‘myp’.
5. Continue pressing keys until you have found the item you are
looking for.
If you type a character that is not part of a continuing match, the search is started
over with the next item that begins with that character.
Use the File Open Tab - Configure dialog to remove, add or reconfigure the icons on
the Open tab. To access this dialog, select Tools|Customize|Open Tab|General or
click on the Configuration Dialog button:
Standard Toolbar
n The next two buttons on the Standard toolbar are also related to searching:
3 Press to perform a Quick Search for the word under the cursor in the
current document. Parameters from the Default Search and Replace
Settings dialog are used. Word Delimiters defined on Tools|Customize|
Language|Options also affect this search type.
n The last button on the Standard toolbar (the question mark) is for accessing the
CodeWright online help file.
CodeWright projects offer a means for storing related files as a unit. They make
version control operations simpler and more convenient, and they store unique
configuration settings, like compiler commands, with each project.
Project spaces are an extension of the project facility. They store sets of projects,
allowing multiple projects to be displayed at a time. A project space must be open
before a project can be created.
Creating a Project
Once a project space has been created, individual projects can be created for the
space. Projects are created in the Project|Properties|Members dialog. This dialog
should appear immediately after a new project space has been created. To otherwise
access the dialog, select Project|Properties, and then click the Members tab. Carry
out the following steps to create a CodeWright project:
1. Highlight the current project space in the listbox on the left.
2. Click to access the Add New Project to Project Space dialog. (The same
dialog can be accessed using the Add New Project item on the Project|Project
Space menu.)
3. In the Add New Project to Project Space dialog, click Browse to make sure that
the directory the project is being created in is appropriate, then name the
project.
4. Click OK. CodeWright creates a new configuration file in the chosen directory
with the name that was typed and a .PJT extension.
n Click to access the Scan Existing Files into Project dialog. Add
individual files by typing in the name or add multiple files using file filters
(e.g.*.C). Paths are optional (e.g. C:\TEST\*.H). Use the […] button to
browse for different directories.
n Multiple filters can be used by separating each filter with semi-colons (e.g.
*.C;*.H;*.CPP). The Include Subdirectories option causes files in
subdirectories of the current directory to be included with files that are
added.
n Click to access the Select One or More Files to Add to Project dialog.
Add individual files by double-clicking or typing the name. Add multiple
files by S or C -clicking.
n Use the External Makefile option to read files from an existing makefile.
See Reading External Makefiles in the chapter Projects, Project Spaces, and
Workspaces.
n Use the VCS Project option to read files from a version control project file
(see Using Version Control in CodeWright, in the Chapter Version Control).
Note: You can make it easier to include and work with UNIX or Macintosh
files by converting their EOL types; you can also convert Unicode or
UTF-8 files for editing in CodeWright. Refer to the section Converting
File Type and EOL Characters in the UNIX chapter of this manual.
Project|Properties
The Project|Properties dialog is where all project configurations are set. Most of the
settings made in this dialog can be used without an open project, in which case they
would be global settings and would become the defaults. More information on the
Project|Properties dialog is provided in the chapter on Projects, Project Spaces, and
Workspaces.
Project Tools
Once the necessary files have been added in the Members tab of the Project|
Properties dialog, the project space and projects are basically complete. Before
clicking OK, though, it often desirable to set up some tools in the dialog's Tools tab.
See the topic Tools Tab of Project Properties in the chapter Projects, Project Spaces and
Workspaces for more information.
For a graphical display of the project space, click the Project tab of the Project
Window. The project space and its included projects will be displayed. The projects
can be further expanded to display each project's member files. An example of the
Project tab, expanded to show project space, projects and files, follows:
Project Tab
To load project files for editing, double-click on them in the window, or click on the
Load Files item in the Project menu.
For more information on CodeWright projects, see the chapter on Projects, Project
Spaces, and Workspaces.
API Command
API (Application Program Interface) functions drive the interface between the
operating system and application programs. This includes the way the application
communicates with the services the operating system makes available. For example,
APIs make it possible to open windows, display message boxes, and load dialogs.
CodeWright has numerous API functions, many of which are available for
interactive use from within the CodeWright editor. CodeWright APIs can be used to
change keystrokes, buttons, and menu commands; they can be used in the macros
and DLLs that extend CodeWright; and they can be used interactively from the API
Command prompt.
To run a CodeWright API on the fly, type in the function name and any required
parameters, and press E or OK.
In addition to the menu item, the API Command prompt can be accessed with a
special keystroke, appropriately named the Command Key. The API Command Key
is described next.
n If you are using the Visual Studio .NET command set, the Command Key is @
n If you are using the CUA or the vi keymap command set, the Command Key is
(.
n If you are using the BRIEF-compatible keymap command set, the Command
Key is ), which in BRIEF also provides access to the BRIEF interpreter.
Command:
You respond to the prompt by entering a CodeWright API function call, for example,
much as you would enter it in CodeWright C source code (available with the
CodeWright SDK). Press E to send the command off for processing.
Note: To specify a status line Command Key, choose the Use Command
Line Prompt option on the Tools|Customize|Environment
|General dialog. Refer to the topic Command Line Response Editing, in
the online help, for command line key sequences.
2. Enter the word color and press T. The following dialog displays.
3. Select the desired command from the list to place it on the command line for
you.
If you want a complete list of the commands available just press the T key
without entering anything at the prompt. To filter the list more selectively, you may
use regular expressions. For example, use the characters ‘.* ’ before and after
characters that you know you want to see.
Then press T.
More information about using CodeWright's API and the Command Key can be
found in the chapter Extend CodeWright.
Tools|Customize|Libraries: Loading
CodeWright Add-Ons
The Libraries option on the Tools|Customize dialog is used for interactively loading
CodeWright DLLs (or Add-Ons) that extend the functionality of the CodeWright
program. A number of commonly used Add-Ons are contained in the list of
CodeWright Libraries in the Libraries dialog. The CodeWright Libraries can be
quickly and conveniently loaded by placing checkmarks next to the ones to be
loaded. (More Add-Ons are available in the \SUPPORT directory of the CodeWright
CD or from our web site at http://www.codewright.com.)
Note: DLLs (Dynamic Link Libraries) are software used by Microsoft
Windows to provide services to applications. Some DLLs are
automatically loaded when needed by a program, and others must
be loaded at system startup. DLLs can be written in any
programming language used for Windows programming. Three
terms are used when referring to CodeWright DLLs: Add-Ons,
Libraries, and DLLs.
Loading a library in the Tools|Customize|Libraries dialog adds a line similar to the
following in the CWRIGHT.INI file (described in the chapter on Configuration Files &
Command Line Parameters) and loads the DLL into CodeWright:
[LibPreload]
LibPreload=CWHTML.DLL
For example, the option Tile using single row/column in the General tab affects the
Vertical/Horizontal Tile options on the Window menu. When the option is marked
(and you have selected either Standard MDI or Both), CodeWright has 'true' vertical
and horizontal tiling, as displayed.
The File Options tab addresses many file-related concerns, such as:
3 Whether a list of recently loaded files should appear at the bottom of the File
menu. This option that can be quite handy for reloading files, and is turned on
by marking Show File List on File Menu.
3 Whether filenames should be case-sensitive.
3 Whether to save files on loss of focus.
3 Whether Unicode and UTF-8 should be automatically detected and converted
when files are opened and closed (mark Auto-detect file encoding). If a file in
Unicode or UTF-8 format can be converted to the Windows ANSI character set
and back again without loss, CodeWright can load, edit and save it. This means
that the extended characters used in European languages are supported (e.g. á,
è, ï, û, ñ, æ, ß, ç, Å), but files cannot contain Hebrew, Kanji, Hangul or similar
characters.
Note: You can also elect to convert some file types to/from Unicode or
UTF-8 from the File|Save As and File|Open dialogs.
The State tab allows you to save state information between CodeWright sessions.
Ask yourself these questions:
3 Do you want CodeWright to remember and load the last file you were working
on, all files, or no files?
3 Do you want to save Window, Document and Marks state information in the
project or project space file?
The second part of this chapter covers CodeWright's main claim to fame, which is
programming language support. Since colors are a primary concern in language
support, and colors are a principal part of View Themes, View Themes seem to be a
natural lead-in to language support. Language support features like ChromaCoding
(lexical coloring for keywords, comments, etc), template expansion, and smart
indenting are essential when editing source code. If those features are not
immediately apparent during editing, it will be necessary to understand the process
for turning them on or creating them.
Among the list of View Themes, the Default and “Output Window” items are of
particular interest. Both of these View Themes affect windows in a particular way
and have additional screen elements available for modification.
Note: Screen elements are the elements on the CodeWright screen whose
colors can be changed. Examples of screen elements are functions
and keywords for supported programming languages. Screen
elements are listed in the Screen Element list in the View Themes
dialog.
n If the Default View Theme is selected, additional screen elements are available
for controlling colors and fonts of system elements such as the status bar. The
items are in the System group at the bottom of the list.
n If the “Output Window” View Theme is chosen, additional screen elements are
available for controlling window attributes of the Output Window.
View Themes that are not named "Default" can be made the Default by marking
Make Default in the Apply View Theme dialog while the desired View Theme is
selected in the View Themes dialog.
Since much of the language support in CodeWright involves colors, and View
Themes have something to do with color, CodeWright language support is described
next.
Some languages are supported by default in CodeWright. For example, when files
with .C extensions are opened in CodeWright, ChromaCoding is immediately
apparent and template expansion can be enabled and used by marking a single
option in the Tools|Customize|Language dialog. In this sense, files with .C file-type
extensions are supported by CodeWright out-of-the-box. When a language is
supported out-of-the-box it often gets its functionality from CodeWright's
CWSTART.DLL, which loads automatically each time CodeWright is launched.
For language support that is available but not loaded out-of-the-box, there are two
options:
n The support can be obtained from external Add-Ons (DLLs) which must be
loaded manually,
OR
n The support can be obtained from a Lexer, that can be created and/or modified
in the ChromaCoding Lexer Settings dialog.
The topics that follow describe the two methods for adding language support to
CodeWright. CodeWright language DLLs are covered first, followed by a discussion
of CodeWright ChromaCoding Lexers. When reading the following information,
keep in mind that ChromaCoding Lexers are the easiest way to create new language
support for CodeWright. ChromaCoding provided by lexers is also faster, meaning
that color display will be smoother. However, lexers do not support Smart Indenting,
Template Expansion, or Brace Expansion. These features are provided by other
means.
It is possible to use Add-Ons together with lexers. In such cases, the lexer's
ChromaCoding functionality will take precedence, but the Add-On will still provide
other language support features.
Tools|Customize|Libraries
After making sure that the appropriate DLL is in the CodeWright directory, the
library needs to be loaded. CodeWright libraries (including language support) are
loaded using the CodeWright Tools|Customize|Libraries dialog. The DLLs will add
functionality to CodeWright, whether that functionality is language support, or
some other feature.
Some Add-Ons are listed in the Libraries dialog, in the list of CodeWright Libraries.
If a language is not supported out-of-the-box, the first place to look is in the list of
CodeWright Libraries. Loading a library from the list is as simple as putting a
checkmark next to the item to be loaded. If the language is not listed explicitly, it may
be available in the \Support directory of the CodeWright CD, as mentioned. The
library can be loaded by clicking Add and browsing for the appropriate DLL. When
loading an Add-On from the CD, it is a good idea to first copy the Add-On to a
directory on your local hard drive (preferably the CodeWright installation directory)
so that it will be available after the CD has been removed. For more information
about the Libraries dialog, see the topic Tools|Customize|Libraries: Loading CodeWright
Add-Ons in the chapter on Command Key, Libraries and General Environment.
ChromaCoding Lexers
ChromaCoding Lexers provide language support (i.e. ChromaCoding) for
programming languages being edited in CodeWright. They store collections of
settings to color various elements of the programming language's "vocabulary".
Those "vocabulary" elements include identifiers, braces, preprocessors, keywords,
operators, strings and comments.
Lexers are the easiest way to add support for a language that CodeWright did not
previously support. ChromaCoding Lexers can be created or modified in the
ChromaCoding Lexer Settings dialog.
There are two ways to access the ChromaCoding Lexer Settings dialog:
n Click the ChromaCoding Lexers item on the Tools|Customize dialog.
n Click the Settings button on the Tools|Customize|Language|Coloring dialog.
Some lexers are provided in the drop-down list under the ChromaCoding Lexer
Settings dialog's Lexer: combo box. Default settings on the tabs of the
ChromaCoding Lexer Settings dialog will vary depending upon the lexer selected.
Creating a Lexer
To create a Lexer, complete the following sections:
n Make a Lexer Name.
n Define Identifier/Brace Characters and Text to Exclude from Coloring.
n Define Keywords.
n Define Comments.
n Define String Delimiters.
n Define Numbers.
After the lexer name has been created, identifier characters must be defined.
Identifier characters are characters that distinguish “identifiers” from other
elements of the language. Identifiers can best be described as a set of characters
used to make up the "words" of the language. Keywords and function names are
identifiers, but operators are not. If identifier characters are not defined,
ChromaCoding for identifiers will not work.
Character classes (described under the topic Regular Expressions in the chapter on
Search and Replace and Navigational Tools) can be used when defining identifier
characters.
Example: A-Za-z$
A-Za-z0-9$
Note: Certain regular expression characters must be escaped with a back
slash (\) in order to use them literally. For example, to specify a dash
(-) character as an identifier character, enter it as \-.
There are three fields in the Identifier Characters section:
n The First field is for characters that will normally appear as the first
character of an Identifier.
n The Follow field is for characters that will normally follow the first
character of each Identifier.
n A checkbox that indicates whether Identifiers followed by parentheses are
functions (like C++).
(Refer to the CodeWright online help for additional information on the options
available on the Words tab.)
Define Comments
On the Comments tab, define all the appropriate comment delimiters for each
comment set. The configurations made in this dialog will tell the
ChromaCoding Lexer when to color comments.
To define single-line comment delimiters, click the Add Line Comment button.
To define multi-line comment delimiters, click Add Multi-line Comment. Each
time either of the buttons is clicked, the Begin Column or Use Delimiter options
become available, depending on which radio button is chosen at the time.
n If a single-line comment is being added, the right side of the Use Delimiter
section is not available.
n If a multi-line comment is being added, the Begin Column option will not
be available.
Finish setting up the comment support by completing the fields and command
options that apply to the characteristics of the comments for the language in
question.
(See the CodeWright online help for more information on the Comments tab.)
If the language in question does not use quoted strings, mark the option that
specifies that Quote does not start a string (for Single and/or Double quoted
strings).
Mark the option Identify strings with regex, and complete the enabled fields, to
more flexibly define which strings to color using regular expressions. These
fields work to identify strings in much the same way as the regex fields defined
previously under Define Identifier/Brace Characters and Text to Exclude from
Coloring.
Define Numbers
On the Numbers tab, define any numbers that should be colored by the
ChromaCoding Lexer for the language in question. The available number types
are:
n Float
n Hexadecimal
n Decimal
n Octal
n Binary
n Regex
n No Type
The number types only serve to identify an entry. They are there for
convenience. When one of the types is chosen, the most appropriate number set
is automatically inserted in the Digits field. The name of the chosen type is also
displayed, for reference purposes, beside the number set in the Numbers List
Box. The other settings in the dialog control how the elements are
ChromaCoded by the lexer.
The Language dialog is where all CodeWright's language features are stored and
controlled. CodeWright language features consist of settings and support that are
associated with file type extensions (i.e. .C, .TXT, .ASM, etc). The available features
vary depending on the extension of the file.
Tools|Customize|Language
The Language dialog has seven tabs, which will be described here, along with a few
other elements of the dialog.
Note: The main thing to remember when making changes in the Language
dialog is that the changes are file-type specific. That is, the
customizations that you make in any tab of this dialog will only be
applied to the extension that is selected in the Customize dialog
navigation tree at the time of the change.
File Types
All of the available file types for CodeWright are listed under
Tools|Customize|Language in the Customize dialog navigation tree.
A file type is the extension of a given file (e.g..c). It is used for selecting the file type
whose settings will be viewed or modified. The file type associated with the current
document is selected initially, if it is in the tree. If it is not in the tree, it can be added,
or the default settings (indicated by file type .*) will apply.
Options Tab
The Tools|Customize|Language|Options dialog has options for controlling certain
attributes and functions for files of the selected type. Some of the options available
are as follows:
n Read-only controls whether files of the selected type should be opened as read-
only.
n Make backups controls whether backup files should be made for files of the
selected type.
n EOL options control whether UNIX, DOS, or Mac EOL characters should be
inserted when the E key is pressed in files of the selected type.
n Word Wrap options control whether and how text should be wrapped in files of
the selected type.
n Virtual Space options control whether a cursor can be placed inside a tab, after
the end of a line, and/or after the end of a file for the selected file type.
Many of the features in the Language|Options dialog are also available on a per-
document, non-file-type-specific basis, in the Document/Window Manager dialog.
Templates Tab
The Templates tab of the Language dialog is for turning on, examining, deleting and
redefining language templates associated with the selected extension. More
information about templates is available in the chapter on Editing & Printing.
Coloring Tab
The Coloring tab of the Language dialog has options for controlling how
ChromaCoding operates. It is also where CodeWright is configured to provide
ChromaCoding support for languages that are embedded in other languages. The
items in the dialog that are of special interest are the Lexer and DLL options, and the
Embedded Languages and Scripts section.
n Mark the Lexer radio button to make the Lexer options available and to cause
the combo-box to display the currently selected Lexer, as described in the
section on ChromaCoding Lexers. ChromaCoding lexers maintain numerous
settings that add support to and for programming languages edited in
CodeWright. To choose a different lexer, select it from the drop-down list under
the combo. The lexer displayed in the combo box will be associated with the
selected file type in the Customize dialog navigation tree.
The Settings button can be used to access the ChromaCoding Lexer Settings
dialog, used for making new ChromaCoding Lexers. The dialog can also be
accessed by clicking the ChromaCoding Lexers option on the Tools|Customize
dialog.
CodeSense Tab
The CodeSense tab of the Language dialog is used for selecting and manipulating
the Name Completion, Outline Symbols, and CodeSense features. These features
parse specified text from files being edited, which is then used for editing or
navigational purposes. More information about Name Completion and CodeSense
can be found in the chapter on Editing & Printing. Symbols are described in the
chapter on Search and Replace and Navigational Tools.
Format Tab
The Format tab of the Language dialog contains options for code reformatting or
beautifying. These options are used by the Format Source item on the Text menu.
Format Source is explained in more detail in the chapter on Checking and Reformatting
Files.
Comments Tab
The Comments tab of the Language dialog is for setting the parameters for the
Comment and Comment Box menu items on the Text menu. The Comment features
are explained in more detail in the chapter on Editing & Printing.
When a source file with the new extension is opened, syntax colors (ChromaCoding)
should be visible. Other features that the corresponding Add-On or lexer has been
designed to support should also be available.
Aliasing
If there isn't a language support DLL for a particular file type, you can add support
by creating a lexer (described in the previous section) or creating a DLL. There is
information on creating a language DLL in the appendix on Making and Modifying
CodeWright DLLs.
An alternative way to add language support is to alias the unsupported file type
with a supported one. If the code style of the unsupported language is similar to one
that is supported, all the templates, keywords and coloring for the existing file type
will be used by the unsupported file type. Keywords can be added to the supported
file type's list for additional coloring.
Some of the tabs in the Language dialog will be unavailable for mapped or aliased
files. This is because mapped file types use the language-specific functions of the
type to which they are mapped. In such cases, mapped file types can only be
changed by changing options for the original file type to which the unsupported
language is mapped.
Note: You can override the extension of a selected file, effectively creating
an alias on a per-file basis. To do this, highlight the name of the file
on the Document/Window Manager|General dialog, and choose the
desired file type from the Extension Override drop-down list.
Templates
Templates may be language-specific (i.e. associated with a particular programming
language) or language-independent. They are useful for taking the drudgery out of
repetitive editing tasks. They are designed to insert frequently-used text into files at
the press of a button, or to automatically expand common statements used in
programming languages when appropriate abbreviations are typed.
To use it, highlight the appropriate file type and mark the Template Expansion
option. Templates work as follows (using C++ "if" statement as an example):
Example: Type if, and then press the space bar.
The appropriate ending statement and any necessary parentheses,
curly braces, etc., will be inserted in the appropriate positions for the
statement, like so:
if ()
CodeWright templates have a macro capability that makes them useful for much
more than just language constructs. The next sections go over the necessary
information for creating templates used for language constructs and describe the
advanced features provided by template macros.
Two methods are provided for adding template constructs, or changing existing
ones:
n Templates defined for a particular file type can be viewed, added and changed
on the Tools|Customize|Language|Templates dialog. Use the dialog to see,
create and modify the abbreviations that trigger template expansion and the
string values associated with them.
n Add templates by directly editing the CodeWright configuration file. Use a call
to ExtAssignTemplate under the [Templates] heading of the CWRIGHT.INI
file. ExtAssignTemplate is a CodeWright API.
There are special characters defined for use in language templates that give
CodeWright useful instructions. The following table defines those characters:
Character Purpose
@ Issues a backspace.
\t Inserts a tab.
Most templates will take up more than one line in the document. There is a need,
therefore, to specify the locations of new lines in the template string. In most
templates, you will also need to specify a location in which the cursor is to be placed
after the template is inserted.
Examples:
Here are some sample template strings that give an idea of how these special
characters are used to construct templates:
"if (&)\n{\n}"
"do \n{\n\t&\n}\n while( );"
"for (&; ; )\n{\n}"
Finally, here is how the complete ExtAssignTemplate line might look in the
configuration file:
ExtAssignTemplate=".PAS","proc","Procedure
&();\nBegin\nEnd;"
Two buttons on the Edit toolbar are used to insert the contents of FILE.TPL and
FUNCT.TPL into the current document. The buttons use the function
ExtExpandTemplate to insert the templates. The same function can be used to insert
templates with any CodeWright button or keystroke. Details for the
ExtExpandTemplate function can be found in CodeWright's online help.
Note: The Edit toolbar is turned on by marking the Visible option for Edit
in the list of toolbars on the Toolbars tab of the Tools|Customize
|Toolbars dialog.
To see examples of how ExtExpandTemplate is used, take a look at the function
bindings for the function and file header buttons on the Edit toolbar. The function
bindings for the toolbars can be viewed on the Bindings tab of the Tools|Customize
|Toolbars dialog. To view the function bindings, highlight the Edit item in the list of
toolbars and scroll through the toolbar's buttons in the right window. As you scroll
through the buttons, you will see the function binding for each button in the
Function Bindings edit box at the bottom of the dialog. The first two buttons on the
Edit toolbar are the buttons that insert the headers. The function binding for the
function header appears like this:
ExtExpandTemplate %ffunct.tpl$
This command uses the %f template macro to insert the contents of FUNCT.TPL. The
contents of FUNCT.TPL will make up the function header. The trailing $ is used to
delimit the filename string.
ExtExpandTemplate %ffile.tpl$
Note that the two function bindings are exactly the same except for the names of the
template files. Template macros are described next.
Template Macros
True to their name, template macros like %f can also be used within templates.
FUNCT.TPL contains the '%q' macro. When it is expanded, it presents a prompt that
queries the user for information, which will be used when the template is inserted.
In the following examples we show before and after shots of FUNCT.TPL after it has
been modified with extra template macros, to illustrate their use.
The second line contains the %q 'query' macro, which requests the
name of the function.
/*************************************************
** MyFunc
*
* PARAMETERS:
*
* DESCRIPTION:
*
* RETURNS:
*
* CREATED: 08/16/95 11:45:50
*
* BY: milow
These are just a few of the things that can be done with template macros. A table
containing a complete list of the % template macros available follows:
Macros in Templates
%fFilename$ Insert the named file at the cursor. Any template macros
within the file are also processed.
%open Open a new line following the current. Similar to going to the
end of the line and pressing E .
%qPrompt$ Query for string to insert, using the string Prompt to prompt
the user.
%tof Move cursor to the top (first line) of the file. Requires %home
to position cursor at the first character of the file.
Snippets have a default file extension of .TPL; configuration details for Snippets are
stored in the file CODESNIP.INI.
To see a directory of the Snippets that are shipped with CodeWright, click on the
CodeFolio tab of the Project Window. The directory tree is organized by language
type, as follows:
In addition to using the Snippets that are shipped with CodeWright, you may add
your own Snippets to the existing directory structure, or add whole new directories
to the CodeFolio tab (refer to Adding or Removing Snippets Directories, in this chapter).
Snippets may also be edited to conform to your own needs (see Editing a Snippet, also
in this chapter).
3 The Snippets shown on the CodeFolio tab are also available when you create a
new document from the File|New menu item.
If the template has a prompt for a name, an edit box to input that name will
display after the checkbox in the Use Templates group.
To remove a Snippet from the Use Templates group, highlight the Snippet and
press . You can also uncheck the Snippet’s checkbox to exclude it from the
new document.
Editing a Snippet
If you wish to edit the actual content of a Snippet, complete the following steps:
1. Right-click on the name of the Snippet in the CodeFolio tab’s tree directory.
2. Select Edit Template from the popup menu. The Snippet is displayed in a
separate window.
3. Edit as desired. Select File|Save from the main menu to save your changes.
4. Close the Snippet file.
The Command Key is described in more detail in the chapter Command Key, Libraries,
& Environment.
To match all curly braces within a file, respond to the Command: prompt as follows:
The function shows its progress by displaying the number of the line it is processing
on the status line. If the function finds an unmatched curly brace, the cursor is
positioned on that curly brace.
Brace Highlighting
There are two functions that examine or operate on the text between matching
braces:
n The first function is BraceMatchNext, which looks for the next left brace or
parenthesis, locates its mate, and then highlights the text between them. On
subsequent calls, this function will find pairs nested within the highlighted set,
or a pair following the highlighted set.
n The second function is BraceMatch, which operates similarly to
BraceMatchNext, except that it searches for a match to the brace at the cursor
position. If the curly brace at the cursor is a left brace or parenthesis, the
function searches forward for its mate. If it is a right curly brace or parenthesis,
the function instead searches backward for the mate. If neither a left nor a right
parenthesis or brace is at the cursor position, the function searches forward for
the next matching set. If the parameter to BraceMatch is omitted, it will look for
braces only.
Brace Locating
The function BraceFind is provided for locating the brace, parenthesis, or square
bracket that is the mate for the one at the cursor position. It does not create a
highlight, but just positions the cursor at the corresponding object.
The function also has a "kissing" mode that can be activated by giving the function a
TRUE or 1 value as a parameter. In this mode, the cursor moves to the
corresponding object, but only momentarily. After a brief pause, the cursor returns
to its original position. This provides allows you to verify that the appropriate block
or clause is closed.
BraceFindEx
BraceFindEx() is another brace-matching function that can be used from
CodeWright's API Command dialog (API Command on the Tools menu), or bound
to a button or keystroke.
Brace Expansion
Brace Expansion is activated on the Tools|Customize|Language|Tabs/Indenting
dialog and works in the following way:
3 Type a brace. It is automatically positioned. The closing brace is instantly
inserted in the correct position and the cursor is placed between them.
Brace Expansion operates very much like the brace template in template expansion.
The difference between template expansion and brace expansion is that brace
expansion instantly inserts braces whenever the left brace ( { ) key is typed, while
template expansion doesn’t insert braces until the space bar is pressed. The sequence
used by template expansion may be unnatural for some programmers, and
therefore, brace expansion provides an alternative. Brace expansion may also be
useful for users who do not want full template expansion, but who want the benefits
of automatic brace insertion.
Note: When expanding a brace in column one, the template for “^{“ is
used.
Tab Columns
The string placed in the Tab Columns editbox onTools|Customize|Language|
Tabs/Indenting describes where tab stops will occur. Tab stops are placed at the
columns specified in the string. For evenly spaced tab stops, you need not specify
more than two column numbers. CodeWright calculates the interval between the
last two column numbers and repeats that interval between tab stops all the way out
to the number specified in the Maximum Column field. The column count begins
with 1, not 0.
Example: A 4-column tab stop would be set by inserting the following
numbers: 5 9.
It works this way: The cursor starts in column 1. When the tab key is
pressed, 4 columns are added, putting the cursor in the 5th column.
When the tab key is pressed again, 4 columns are added, putting the
cursor in the 9th column, and so on, thus explaining the reason for the
"5" and "9".
Indent Columns
The Indent Columns option onTools|Customize|Language|Tabs/Indenting
controls the amount of indenting that occurs when you press [Tab] in the CUA
keymap (or outdenting that occurs when hitting [Shift]-[Tab]). It can be used in
combination with the Tab Columns option to provide indention levels between
larger tab intervals (but is off by default). The space inserted by the Indent Columns
setting can be a combination of tab characters and/or space characters.
Example: A line in a .C file might end with an open curly brace, or begin with
while. When you press E to terminate the line after the curly
brace, the next line will automatically be indented.
Smart Indenting may be thought of as an extension of the Seek-Indentation
feature. Smart Indenting may be used with Seek Indentation turned off, but
leaving it on ensures the most consistent appearance.
Block Alignment
All the editing features that have been discussed in this chapter so far deal with
potentially indenting blocks of code. Since preferences may differ as to how
indenting should occur, CodeWright offers several different indentation styles to
choose from. These styles are set on the Tabs/Indenting tab of the Language dialog.
Thus far this chapter has discussed CodeWright features that aid with repetitious
editing tasks. The chapter will continue along these lines by discussing features that
help with editing by offering information and reminders about parts of the file being
edited: Name Completion, CodeSense, and Comments and Comment Boxes. Hex
editing; HTML, XML and COBOL editing; Clipboard and Scrap features, and help
index file configuration are also discussed.
Name Completion
CodeWright Name Completion will automatically complete strings that occur in
either the current document or the CodeSense database, as the strings are typed.
CodeSense
CodeWright offers a feature called CodeSense that provides advanced "word"
completion for .C, .CPP, .H, .HPP, .CS and .JAVA files. It works by gathering
information about functions, methods, structures, unions, namespaces, packages,
interfaces and other pieces of code in source files, and then using the information for
editing and informational purposes. The following topics describe CodeSense in
detail and offer some troubleshooting tips in the event that the feature does not
work as expected.
Symbols Window
2. Click the File List button to access the Edit Symbol File List dialog and
type in or browse for the file to be added to the list.
The following steps will also work to access the Edit Symbol File List dialog:
1. Right-click on the left most status bar icon to access the CodeSense
popup menu.
2. Click Edit Symbol DB File List to access the Edit Symbol File List dialog.
3. Type in or browse for the file to be added to the list.
CodeSense information that is gathered from open files is stored in memory rather
than in databases. It is specific to the files that are open and will only be available
while the files are open. This feature allows CodeSense to display information from
files that have not yet been saved to disk.
Tools|Customize|CodeSense|General
The CodeSense Global Configuration dialog can be accessed from three alternate
locations:
n From the Tools|Customize dialog, by clicking CodeSense|General.
n From Tools|Customize|Language|CodeSense, by pressing Global
Configuration.
n From the CodeSense popup menu (right-click on the status bar), by selecting
Global Configuration.
CodeSense Databases
Once the necessary CodeSense library databases have been established in the
CodeSense Global Configuration dialog, and the Rescan button has been pressed if
necessary, the libraries will be scanned for information that will be stored in
databases for future use. Project and Symbols Window File List databases will be
created automatically given that:
n CodeSense is marked in Tools|Customize|Language|CodeSense (marked by
default for .C, .CPP, .H, .HPP, .CS and .JAVA files).
Project|Properties|Directories
Database Corruption
Sometimes CodeSense databases can become corrupt. While CodeSense is designed
to detect database corruption, it is not foolproof. If it detects corruption in a database
created from a CodeSense library database, a "(Corrupted)" message will appear in
the CodeSense Global Configuration dialog to the immediate right of the library.
To delete and rescan databases that are maintained for CodeWright projects:
1. Exit CodeWright and go to Windows Explorer.
2. Navigate to the directory containing the project (.PJT) file.
3. Delete the project database. See the topic Database Files earlier in this chapter to
get a list of the files and locations that make up the database. Project files will be
rescanned automatically when the project is open so long as the following
conditions are met:
3 CodeSense is marked in Tools|Customize|Language|CodeSense.
3 Auto-update symbol database and Show Definitions in Symbols tab are
marked for the Symbol file option in Project|Properties|Directories.
Name Completion
To have CodeSense complete or show a list of possible matches for symbols when
C -[Space] is pressed, mark Name Completion in Tools|Customize|Language
|CodeSense. Once marked, the option can be used by pressing C-[Space] at
appropriate times while typing. The option is marked by default for .C, .CPP, .H,
.HPP, .CS and .JAVA file types.
Example:
Auto-list Members
To have CodeSense automatically display member lists when appropriately
following symbols such as structs, classes, unions, enums, namespaces, packages or
interfaces with ‘.’, ‘->’, or ‘::’, mark Auto-list Members in
Tools|Customize|Language|CodeSense. The option is marked by default for .C,
.CPP, .H, .HPP, .CS and .JAVA file types. Once the list is displayed, use it by either
selecting the desired symbol and pressing E, or by simply clicking on the
desired symbol. It will insert automatically.
Example:
Auto-type Info
To have CodeSense display a Tooltip containing a symbol’s definition as the mouse
cursor hovers over it, mark Auto-type info in Tools|Customize|Language|
CodeSense. The option is marked by default for .C, .CPP, .H, .HPP, .CS and .JAVA file
types.
Except in Tooltips
If you have marked the Consolidate Matching Lookup Definitions option, the
checkbox Except in Tooltips is also enabled. This allows you to roll up matching
definitions in the Show Symbols Called or Used by <function/class name>
dialog, and in Name Completion lists, but to automatically show all relevant
definitions in CodeSense tooltips, since the tooltips don’t allow you to expand
or collapse identical definitions.
A small cache size will limit memory usage, but will also decrease the likelihood of a
recent lookup remaining in the cache when the same lookup is repeated.
Conversely, if you increase the size of the cache, it is more likely that a lookup will
still be available upon subsequent request, making the lookup faster.
This setting affects the speed of CodeSense tooltips, member lists and Name
Completion lists.
Symbol Lookups
CodeSense symbol lookups are done in a context-sensitive (scope sensitive) manner.
The buffer offset of a symbol is used to determine the context. For example, in the
following pseudo code, the scope of the first "str" would be "global, <foo>, <while
block>, <if block>". Therefore the definition of "str" found in the else block would
not qualify as the definition of the "str" in the if block.
Troubleshooting
If CodeSense is not performing as expected, refer to the following sections.
Tools|Customize|Language|Comments
HTML Editing
With the ever-increasing popularity of the Internet, it has become necessary to own
at least one good HTML editor. CodeWright provides several features that make it
ideal for HTML editing. Those features are described next.
The process for enabling both of the HTML viewing and editing features is described
next.
[LibPreLoad]
LibPreLoad=cwweb.dll
LibPreLoad=cwhtml.dll
Editing Capabilities
HTML WYSIWYG editing provides the following capabilities:
n Edit HTML files as normal documents. Text cut or copied from the WYSIWYG
window is available on the ClipView tab of the Output Window.
n Quickly insert HTML tables and graphics.
n Resize HTML tables and graphics with mouse drag operations.
Differencing/Merging
By default, changes made in the code window must be saved or undone before
editing in the WYSIWYG window. Conversely, changes made in the WYSIWYG
window must be updated or abandoned before the code window can be edited. The
Update button transfers changes one-way, from the current window to the
opposite view.
If you wish to enable differencing/merging (so the Update button combines changes
from both views and updates both views), press to invoke the HTML
Configuration Options dialog and mark Enable Differencing/Merging. Also on this
dialog:
n Mark Open Viewer in Edit Mode to open the WYSIWYG viewer in editing
mode by default.
n Mark Enable WYSIWYG Editing to enable editing in the WYSIWYG window.
Note: You can also set these flags programatically using the
HTMLConfigFlags API function, described under Help|CodeWright
API Library.
Differencing/merging in the HTML WYSIWYG window will be disabled if any of the
following load errors are encountered:
n Document contains one or more frame sets.
n Document contains server script too complex to be parsed.
n Document contains multiple <BODY>, <HEAD>, <TITLE>, or <HTML> tags.
n Document contains server script inside a <LISTING> tag.
XML Editing
Enjoy robust XML support in CodeWright that includes:
n A variety of XML viewers (Split Window, Source Code, and Browser), and an
XSL Transformation View.
n Enhanced XML editing in the tree hierarchy.
n XML source formatting.
n XML/XSL templates and template expansion.
n XML project filters.
The Split Window View has a toolbar that allows you to display your XML document
in the various viewers; press to return to the Split Window View.
n To save changes made in the Hierarchy, press the Save button on the
Standard toolbar, or right-click in the Hierarchy and select Save.
n To delete the currently selected element row from the hierarchy, right-click
and select Delete Row.
n To add an element row to the Hierarchy with the element name derived
from the currently selected row, right-click and select Add Row: [Element].
The node is inserted as a sibling or child, based on the current selection.
n To add an element row to the Hierarchy with a user-defined element item,
right-click and select Add Row. Use the Add Row dialog to give the
element a name, and choose whether to add the element as a child node or
sibling node.
n Press the Save button on the Standard toolbar to save changes made in
the Code View (refreshing the Hierarchy automatically).
To view or edit the source code in a larger window, bring up the XML Source
Code View, detailed next.
Expand XML and XSL templates shipped with CodeWright into your document
with a few keystrokes, or add custom, user-defined templates on the
Tools|Customize|Language|Templates dialog. Refer to the following section,
Template Expansion.
If an XSL stylesheet is referenced, the XML Browser View will contain the same
output as the XSL Transformation View, described next.
Tools|Customize|Language|Templates
Project Filters
Two categories of project filters are available for XML Files and Web Files on the
Project|Properties|Filters dialog. Use these categories to group XML-related files
and/or HTML- related files on the Project tab of the Project Window.
Use these project filters to gain quick access to the following file types during web
development:
n XML Files: .XML, .XSL, .DTD, .XHTML, .XDR and .DCD
n Web Files: .HTM, .HTML, .SHTM, .ASP and .CSS
Refer to the following setup on the Filters tab, and the resulting hierarchy on the
Project tab:
Project|Properties|Filters Dialog
COBOL Editing
This section describes COBOL language support and editing features in
CodeWright.
Open a COBOL file to see ChromaCoding language support. Note that language
support DLLs and ChromaCoding lexers can be used together. If both exist, it is
advisable to use the lexer for ChromaCoding, and the DLL for other language
support features.
COBOL Extensions
CodeWright has a COBOL Extensions module that provides various COBOL-
specific functions and controls. To turn it on, mark COBOL Extensions in
Tools|Customize|Libraries. The features that are provided by the module are listed
next.
Note: Keep in mind that COBOL reserves everything past column 72 for
comments. If you are typing in the middle of a line, there is a beep
when text at the end of that line reaches column 72 and no further
insertion is allowed. If you are typing at the end of a line, the
character is inserted or overtyped at the start of the next line. If a
clipboard paste, drag and drop, or search and replace operation
pushes text past column 72, that text will be truncated.
If line numbers are valid, no lines will be highlighted, and the following will display
in CodeWright's status bar:
For example, to create a COBOL Extensions patch file that will show the differences
between the file being edited and the backup file that CodeWright optionally creates
when the file is saved, set the following filename component macros in
Tools|Customize|CobolExt Settings|General:
The CS+ key sequence will save the current file while creating the patch
file. The contents of the patch file will be over-written every time the key sequence is
successfully completed.
For a description of filename component macros, see the topic Filename Component
Macros in the chapter Projects, Project Spaces, and Workspaces. For more information
about the CobolExt Settings dialog, see the online help topic CobolExt Settings.
The Cobol Extensions module does not require that COBOL language support be
turned on. However, the module will be more useful if it is.
Hex Editing
A frequently used CodeWright editing feature is Hex-mode editing. Hex mode
allows you to view and edit a file in hexadecimal values. You may edit the file by
entering values for each byte, or by typing the ASCII equivalent.
n Use the button on the Edit toolbar (described briefly in the chapter on
Custom Interface) that switches the current document to Hex mode.
When you enter the Hex mode, the T key is redefined. It may be used to switch
from the Hex values to their ASCII equivalent, and back again. To return to Standard
mode from Hex mode, press the X key.
Hex mode displays the document offset at the left, 16 bytes of hex values in the
middle, and their ASCII equivalent to the right. The 16 hex values are divided into
four groups of four. Each value has two digits: a high nibble and a low nibble.
You cannot insert a nibble; you must insert an entire byte. Therefore, when you type
at the high nibble position, both nibbles of the byte are inserted. The low nibble is
initially zero. The cursor is then positioned over the low nibble. The next number
you type replaces the value of the low nibble. So, as you type, you will alternately
see two nibbles inserted, and one nibble overtyped.
The following image shows options available when the Clipboard radio button is
selected. If you choose Scrap Buffers instead, another version of the tab displays
that is specific to Scrap Buffer options.
Tools|Customize|Environment|Clipboard
The Clipboard tab also has an Auto-increment Clipboard/Scrap Buffer option. With
either enabled, the clipboard/scrap buffer to use is incremented immediately prior to
copying or cutting new content. If the highest numbered clipboard/scrap buffer is
already the current one, the zeroth one is used next.
Check the option Store Clipboard/Scrap Options in project file to store these
Clipboard/Scrap settings with the project currently open. If the box is checked but
no project is open, options selected on the Clipboard tab are stored as default
settings for use with future projects.
Help files that can be accessed from within CodeWright must be one of the
following:
n .HLP Windows help files
n Microsoft Visual Studio 6.0 and Visual Studio .NET HTML help files
n .IVT Microsoft Visual C++ 5.0 help files
n .MVB Microsoft C++ 4.0 help files
n .CHM Compiled Microsoft HTML Help Files
Once the index has been created, press ! on a word that is contained in the newly-
indexed help file to display the word as a choice in a help window. If no help topic is
found, a popup dialog displays all of the available help files. Select any of the help
files listed to initiate a second search.
CodeWright can also be set up to display help from files other than .HLP files (i.e.
.MVB, .IVT, .CHM and Visual Studio 6.0 or .NET .HTML help files). These processes
will be discussed next.
To set CodeWright up to access HTML help files, go to the Configure Help Index
dialog:
1. Click the MSDN Help Setup button.
2. Check Use HTML Help Viewer as default when keyword not found.
When configured, the Search For Help On item in the Help menu (or ! key) will
be connected to Visual Studio 6.0 or Visual Studio .NET help. The first time you
invoke help, the HTML Help Viewer is launched, and a keyword lookup is
performed on the topic of interest. Subsequent help invocations bring the HTML
Help Viewer to the foreground and perform the lookup.
To set CodeWright up to access .CHM help files, go to the Configure Help Index
dialog:
1. Press Add. The Add Helpfile Keywords dialog displays.
2. Browse for the desired .CHM file. You will probably need to select All Files in
the Files of Type drop-down list to see .CHM files.
3. Select the .CHM file and press Open. The file will now display in the Filename
window on the Configure Help Index dialog.
4. With the file still highlighted, press Edit.
5. On the Edit File Information dialog, type a Description to identify the .CHM
help file in your list.
6. Press OK to exit back to the Configure Help Index dialog, and Save to retain
your changes.
To access information from the indexed .CHM file, select Help|Search for Help On.
Type the Keyword to search for, select the desired entry from the .CHM file, and
press OK.
Once the .MVB help integration setup is complete, position the cursor on a keyword
and press !, or enter the keyword in the Search for Help On dialog, to access all
the help (.HLP and .MVB) files listed in the index. A dialog box displays the help
files found; choose the help file to be viewed.
The next section talks about some of the more unique print features in CodeWright.
Printing
The CodeWright Print dialog has options that make printing more flexible and
efficient. Documents can be printed in color (if a color printer is available), line
numbers can be added, long lines can be wrapped or not wrapped (whatever the
choice may be), and sets of configurations can be created and stored with individual
print configuration names. A quick description of some of the features available in
the CodeWright Print dialog is available below, along with an explanation of the
Side-by-Side Difference Printing feature.
Print Dialog
Print Configurations
CodeWright has the ability to save named print configurations. The Configurations
tab of the Print dialog has a listbox that contains existing configuration names.
Selected Print Configurations can be deleted, updated, or loaded. Both the Load and
Update operations modify the 'current configuration'.
Color Printing
The Options tab of the Print dialog has options for printing in color. The colors
printed will be those that are seen on the screen. It is also possible to distinguish
colors using font styles (bold, italics, underlined). Font styles and colors can be used
separately or together when printing.
Do not confuse font-style printing with the printed font. Documents printed in
CodeWright will always display the fonts that are set up in the Print dialog, not the
fonts that are displayed on the screen. The font styles are only for bolding, italicizing,
or underlining text being printed. Font styles can be specified in the Font Style
group of the Tools|Customize|View Themes|Colors dialog.
Print Preview
CodeWright has a Preview button in its Print dialog that allows you to see what the
document will look like before printing. The Print Preview has buttons for zooming
and for moving between pages in the document .
Multi-Copy Printing
The CodeWright multi-copy printing feature can use the multi-copy capabilities of a
printer, if present, in non-collated mode. The configuration options are on the Scope
tab of the Print dialog.
Available print macros refer, in a generalized way, to the page number (%p), current
date (%d), current time (%t), and name of the file you are printing (%f). Place these
keywords at the location within the header or footer string where you want the
corresponding information to appear.
C:\CW32\FOO.C 1\1\1999
;%P
%d or %D date
%t or %T time
%f or %F filename
%v or %V volume
%r or %R root
%e or %E extension
%b or %B basename
%p page n of m
%P page number
%x or %X project path
%y or %Y project root
Functionality
Printing the contents of the Side-by-Side Difference Window is similar to printing a
regular document in two-up mode, except that the left side will contain the
Reference document/file, while the right side will contain the Target document/file.
Differences between the documents are shown as follows:
n Lines that are "deleted" in one side will display as a minus sign only.
n Lines that are "added" on one side will print, preceded by a plus sign.
n Lines that are modified will be preceded by an asterisk.
Definitions
Projects, project spaces, and workspaces are defined as follows:
What is a Project?
A CodeWright project is a single file containing a list of filenames and settings that
are intended to make up the project. The contents of a CodeWright project are at the
discretion of the person making it. The configuration file containing the project files
and settings is stored in the directory in which the project was created, and is given
the name of the project with a .PJT extension.
Language, compiler, version control, clipboard and scrap, and other options can all
be stored in projects. Storing settings with CodeWright projects allows for unlimited
feature variation when going from project to project. With projects, the user can
create mini-environments for sets of files that, for example, use different compiler
options, have different promotion groups for version control, or use different
languages. Closing one project and opening another automatically sets the options
to that of the open project.
Overall, CodeWright projects allow the user to organize a group of files as a unit,
giving quick access to the configurations necessary for using and working with those
files more efficiently.
What is a Workspace?
A workspace can be thought of as a separate instance of CodeWright. It is a "mini-
project" within a project. When you change workspaces, you have the ability to pick
up where you left off with a group of files. It doesn't matter if you worked on that
group of files a half-hour before or three months ago. It is as if an instance of
CodeWright were frozen in time containing these files.
A workspace differs from a project in that it does not store the system-wide options
normally stored in a configuration file. In a sense, the workspace is like a
CodeWright state file that is swapped on the fly.
3 For additional discussion of workspaces, refer to the topic Creating, Selecting and
Saving Workspaces, in this chapter.
Project|Properties|Members
Projects are added to project spaces, and then files to projects, in the Project|
Properties|Members dialog. The information for creating and adding files to
projects is contained in the section on Creating a Project and the Members tab of Project
Properties. Before covering that topic, however, it is necessary to have some
understanding of the Project Properties List and the process for setting project
configurations. Those topics will be covered next.
Default Settings
The <Default Settings> item in the Project Properties List of the Project Properties
dialog is available at all times, regardless of whether or not there is a project or
project space open. Settings made in the Project Properties dialog while the
<Default Settings> item is selected will apply to all projects until those settings
have been changed for the projects individually. Settings made while a project is
selected are called "project-specific settings" and are stored with that project only.
The other tabs in the dialog are available for the <Default Settings> item, as well as
for selected projects because they are used for making configuration changes that
can be either global (i.e. <Default Settings>) or specific to individual projects.
Working Directory
One important item to consider when setting project defaults is the project's
working directory. It is set in the Project|Properties|Directories dialog. The
working directory is the directory from which all tool commands (configured in the
Project|Properties|Tools dialog) are run.
Once the project's desired default settings have been established, appropriate
modifications can be made on a per-project basis. The information for setting project
configurations, and the tabs of the Project|Properties dialog, will be covered
throughout the remainder of this chapter.
2. Click to access the Add New Project to Project Space dialog. (The same
dialog can be accessed using Add New Project on the Project|Project Space
submenu.) In the Add New Project to Project Space dialog, click Browse to
make sure that the directory in which the project is being created is appropriate.
n Use the External Makefile option to read files from an existing makefile
into the project being created (see the topic on Reading External Makefiles
and Workspaces).
n Use the VCS Project option to 'read' a version-control project file (see Using
Version Control in CodeWright, in the chapter Version Control).
3. Click OK. Any matched files should be immediately added to the project.
Files that are included in the project are listed in the Files list box in the center of the
dialog. To delete files from the project, select them in the box and press the Delete
button.
n Click to access the Select One or More Projects to Add to Project Space
dialog (also accessed using the Add Project… item on the Project|Project
Space menu). Browse for individual project files or use extended selection
listbox rules (i.e. SHIFT/CTRL keys with mouse clicks) to add multiple
projects from the same directory at a time.
n From the Read External Workspace dialog (accessed in the Project|
Properties|Members dialog) select an external Visual Studio workspace
that CodeWright will use to Read projects from. The projects will be
read from the Visual Studio workspace into the current CodeWright project
space. See the topic Reading External Makefiles and Workspaces for more
information.
3. Click OK. Appropriate projects should be immediately added to the project
space. The projects are shown below the current project space in the Project
Properties List.
If the option Auto-detect file type is not marked, the files listed above will open as
normal edit buffers in CodeWright.
To have CodeWright automatically use this capability, mark the Look in directory for
external makefile/workspace option in the Create a New Project Space dialog, or in
the Add New Project to Project Space dialog. CodeWright automatically searches
the directory in which the project/project space is being created for any makefiles or
workspace files whose names match the project/project space name specified. If the
files are found, CodeWright automatically inserts the name of the file into the Create
a New Project Space dialog, or the Add New Project to Project Space dialog. The
projects or files that are part of the workspace or makefile are subsequently read into
the CodeWright project or project space.
9. Click Read .
10. Click OK. Files or projects in the makefile or workspace are added to the project
or project space.
To open a file for editing, double-click on the file in the Project tab.
n Use Filters to Group Files: Press to use and show project file filters on the
Project tab. When the button is in the raised position, the filters are not used
and do not display. You can define filters on the Project|Propeties|Filters tab.
For more information, refer to the topic Filters Tab of Project Properties, later in
this chapter.
n Use Directory Tree to Group Files: Press to group files by their path under
folder nodes. The folder nodes that group the files can contain multiple path
components. File nodes do not show the full path since it is shown in the
preceding folder nodes.
n File Sorting: Press to sort by filename, according to the settings you have
made on the Tools|Customize|Environment|File Sort Mode dialog.
When the File Sorting button is not selected (in the raised position), the tooltip
says File sorting (Currently by State then File Sort Mode). In this mode, the file
state (indicated by the version control file icon) is used for the primary sort, and
the filename is used for a secondary sort. The following rules apply:
3 Deleted files show before read/write files.
3 Read-only files are last.
3 Files in the same version control state (e.g. checkin in) are grouped
together, with the archived type being last.
The state of whether each node is expanded or not will be saved in the project space
(.psp) file, and restored when you start CodeWright or change project spaces.
Version Control
The primary purpose of the Project tab is to open files and facilitate version control
operations. Right-click on a file, or on a selected group of files, in the Project tab to
bring up a menu listing various operations that can be performed on the file(s). If
the selection of files includes filters and folder items, these are simply removed
before the file operation is performed.
When files are under version control, file icons depict different states of the file:
n When the files are checked-in (or read-only) the icons that represent the
files are grayed out.
n When the files are checked out, CodeWright conveniently places a red
checkmark to the upper right of the file icons.
n If another user has a lock on a file that is part of the project being worked
on, CodeWright will display the file with a gray checkmark in the Project tab.
n Some Version Control projects are set to delete work files when they are
checked in. CodeWright displays files not found at the specified location
(usually archived) with an exclamation point.
Note: Press the Refresh button from time to time when using the
Project tab to see the most current status of the files. Hover over any
icon to display its meaning in a helpful tooltip.
Project|Properties|Directories
In addition to indicating that certain system options be stored with the project, the
Store System Options in Project File checkbox in Project|Properties|Directories
allows the listed configuration file names to be edited. Changing the names of those
files on a per-project basis allows them to be made project-specific so that the
settings they store will also be project specific. To set the Store System Options in
Project File checkbox on the appropriate version of the Directories tab, complete the
following steps:
1. Access the Project|Properties dialog.
2. In the Project Properties List:
n Select a project if the options being viewed or modified are intended to be
specific to the selected project only, OR
n Choose <Default Settings> if the options being viewed or modified are
intended to be global.
3. Click the Directories tab.
4. Check the Systems Options checkbox, and press OK.
The series of checkboxes in the Read Configuration Data dialog limit what settings
are read from the file. When marked, the Update Configuration Files checkbox
immediately updates the project and/or configuration files with the specified
information.
To access/edit the appropriate version of the Tools tab, complete the following:
1. Access the Project|Properties dialog.
2. In the Project Properties List:
n Select a project if the tools being viewed or modified are intended to be
specific to the selected project only.
n Choose <Default Settings> if the tools being viewed or modified are
intended to be global.
3. Click on the Tools tab.
Tool Categories
The items in the Tools tab change depending on the tool category. Different tool
categories can be selected from the drop-down list under the Category combo box.
Project tools include command line entries for compile utilities, make or build
utilities, executables that may be run on a regular basis, and command line version
control utilities. CodeWright doesn't come with the utilities (e.g. compilers and
version control); these must be purchased separately. CodeWright simply provides a
way to use the utilities in a more practical and efficient way.
The tools in the various categories correspond to menu items and buttons in
CodeWright that are used to run the utilities. When one of the menu items or
buttons is clicked, CodeWright runs the tool by shelling to DOS and running the
tool’s command. Any output generated is captured for display in designated tabs of
the CodeWright Output Window. The specific tool categories are:
n Build
n Compile
n Custom
n VCS
The following sections describe the tool categories in Project| Properties|Tools.
These tools (with the exception of Build Tags) should be set with any make and
execute utilities necessary for building or running the files being edited in
CodeWright.
Compile Tools
The Compile category of tools in Project|Properties|Tools is displayed in the
following image:
The Compile tools should be set with any compile utilities necessary for compiling
the files being edited in CodeWright.
More Information
The Compile tools are the most commonly used tools in the Project|
Properties|Tools dialog. Therefore, the instructions for setting them up are
given their own chapter, called Set up a Compiler. Many of the concepts described
therein apply to the other tool-categories as well. Refer to it for more detailed
information on setting up Compile and other project tools.
You will notice that the VCS tools come pre-configured with commands for some of
the more popular version control systems. The pre-configured commands change
depending on the provider-name chosen in the Command Line Provider list box in
the Tools|Version Control|Setup (or Tools|Customize|Version Control|General)
dialog.
You can use filename component and symbolic macros as placeholders to insert or
transform filenames and filename components (directories, filenames, etc) used with
the version control utilities. This eliminates the need to manually insert filenames
every time a new file is opened in CodeWright for editing or compiling. More
information on filename component and symbolic macros can be found in the
sections on Filename Component Macros and Symbolic Macros.
You should only be concerned with the VCS tools if you use command line (DOS)
version control utilities, such as PVCS GET.EXE or MS VSS SS.EXE, to carry out your
version control operations. You should also be aware that the VCS category of tools
is not the only method for using version control in CodeWright. Version control
operations can also be performed via SCC API integration. More information about
using either of the Version Control integration methods can be found in the chapter
on Version Control.
You may notice that many of the project tools in the Tools tab are already
configured. These pre-set commands may not apply to the utilities actually being
used. In such cases, the tools will need to be reconfigured.
Example: Highlighting the Build tool for the first time shows the following
command in the Command: edit box:
${FTEE} nmake CFG="%x - Win32 Release"
Nmake is Microsoft's make utility, which may not be the utility of
choice for the files being edited. If that is the case, it will be necessary
to change the command to apply the obligatory utilities for the files
being edited.
The ${FTEE} macro expands the full path and filename of FTEE.EXE,
a utility that pipes output to a running DOS window. A detailed
description of FTEE can be found in the chapter on Set up a Compiler.
With this option marked, any output that normally displays in a DOS
window will be redirected into the error file. CodeWright then uses an
FTEE program to display that information in the Output tab of the Output
Window. (More information about FTEE can be found in the in the chapter
on Set up a Compiler.)
n No Command Shell causes the command not to be run in a command shell
(COMMAND.COM or CMD.EXE). If you select this option, redirection and
other services will not be available. If you are executing a Windows program,
there is no need for a command shell.
n Save Current File causes the current file to be saved before the corresponding
tool runs.
n Save All Files causes all files opened in CodeWright to be saved before the
corresponding tool runs.
n Background determines if the program is executed in the foreground or the
background. If you elect to execute the program in the background, a message
will appear in CodeWright's status bar, and a beep sounds to indicate that the
program has been completed.
n Use VDOS causes from the compile or build to be sent to the VDOS window.
This is convenient for cutting and pasting from the output, and for re-executing
commands, but you may not be able to see a prompt if the program prompts for
a response.
n Prompt for Arguments causes a prompt to come up before the tool executes,
allowing the user to insert extra parameters to be used by the associated
program.
Each category of tools has one or more macro assistants that can be used to quickly
insert appropriate filename component macros at the cursor-position of any one of
the tools' command lines. The macro assistant provides a popup menu listing
available macros. To access the popup menu, click the black right-arrow on the gray
portion of the Command edit box.
Macro Assistant
Components Description
Components Description
Uppercase Macros
You can enable uppercase versions of these macros to support short (8.3) filenames,
while the lowercase macros support long filenames. To do so, complete the
following steps:
1. Go to Tools|API Command to display the command line prompt.
2. Type the following command:
SysFlagsEx=1,SYSFLAG1_ENABLE_SHORT_FILENAMES, SET_FLAGS
Response File
The %Q macro and the Response File Contents edit box (on the Project| Properties|
Tools dialog) work together to automate response files and avoid command line
length limits. The Response File Contents edit box only comes into play if you have
used the %Q macro on one or both of your compile command lines.
Note: This macro is case sensitive. An uppercase Q must be used.
When the %Q macro is used in a compile command, the name of a temporary file is
substituted at that position in the command line. Before execution of the command,
the contents of the Response File Contents edit box are written to that temporary
file.
Example: cl /c @%Q
An alternate syntax for the %Q macro allows this macro to be the only thing on the
command line. If the character following the %Q is a dot, the three characters
following the dot are used as the temporary filename’s extension.
Example: %Q.BAT
Symbolic Macros
Symbolic macros are another form of macro that can be used with many of the
commands in the Project|Properties|Tools dialog. CodeWright Symbolic macros are
meant to make the process of constructing command lines more flexible and
convenient.
Symbolic macros take the form ${NAME} or $(NAME). At the time the command
line is evaluated or run, the dollar sign and braces are removed and the symbolic
NAME is replaced in accordance with the table on the following page.
Note: As a special case, if the first character of NAME is a question mark, the
rest of the NAME string is treated as an executable macro. The result
returned by the macro is converted to a string, if necessary, and
substituted for the macro occurrence. If the executed macro returns a
type other than integer or string, it is treated as if it returned an
empty string.
Example: A symbolic macro that is commonly used with some of the default
commands is ${FTEE}, which expands the full path and filename
of FTEE.EXE, a utility that pipes output to the CodeWright Output
Window (described in the chapter on Set up a Compiler).
A list of Symbolic Macros and their descriptions appear next.
Symbolic Macros
Macro Description
Macro Description
CodeWright uses two methods for capturing and displaying output from a compile.
These methods, called FTEE and VDOS, are described in the next chapter on Set up a
Compiler. Once the output has been captured, CodeWright uses Error Parsers to
access the files that contain the errors in that output.
An error parser is a function that takes error messages from a compiler, assembler, or
linker and extracts the name, line number and error message for the file in which the
error occurs. CodeWright uses that extracted information for error navigation. The
error parsers allow you to double-click on an error or warning in the Output
Window in order to bring up the source file(s) containing the error(s). The cursor will
be positioned at the line where the error or warning occurs.
Project|Properties|Errors
There are three combo-boxes in Project|Properties|Errors and one edit box for the
Error File. Complete the boxes as outlined next.
n In the edit box Error Filename: specify the file needed to capture any output
produced by a compile or build. The error file is the name of the file that is used
to capture the output of commands that have the Redirect Output command
option checked (see the topic Command Options on the Tools Tab, in this chapter,
for more information).
3 Error files are created in the current directory.
3 The error file is set to PROJ.ERR by default, but can be changed to any
filename desired.
3 Filename component macros can be used for the filename, but it's usually
best to leave it as it is.
The output captured by the error file will be used to display in the Output tab of
the CodeWright Output Window.
A sample regular expression for making an error parser for the Microsoft J++ Java
compiler follows. Instructions for making the parser are also provided.
Line Number: 2
Message: 3
To make a custom error parser using the above example, do the following:
1. Go to the Custom Error Parser dialog and copy the name of the above parser
into the Parser Name field.
2. Copy the regex pattern into the Pattern field.
3. Fill in the appropriate group information.
4. Select OK in the dialog. The parser will then be listed as _ErrorInfoParser
MicrosoftJ++Java in the Project|Properties|Errors dialog.
5. Choose _ErrorInfoParser MicrosoftJ++Java from the drop-down lists under
the Error Parser combos.
6. Click OK in the Project|Properties|Errors dialog.
The following differences occur with the output produced by Build and Rebuild as
opposed to the output produced by the Compile and Debug commands:
n A Build or Rebuild command just places the output in the Output Window, as
described above.
n A Compile or Debug Compile command automatically positions the cursor on
the correct line in the source file and places the error message text on the
CodeWright status line when the source is open.
This behavior can be configured to your own taste. A CodeWright API call
determines whether to show a list of errors, or whether to jump directly to the first
flagged file after a compile. These options are only available when using FTEE and
the Redirect Output command option to capture and use output. Examples follow.
Example: To cause the error list to be displayed after each compile, add this
line to the appropriate [Extension] section, or to the [Editor]
section, of your CWRIGHT.INI file:
ExecShowCompileErrors=TRUE
There is an analogous call for Build and Rebuild commands. To have
CodeWright jump to the first error after such a command, add this
line to the [Editor] section of CWRIGHT.INI:
ExecShowBuildErrors=FALSE
Note: For more information on ExecShowCompileErrors and
ExecShowBuildErrors, see the online help (Help|CodeWright API
Library).
More information on FTEE can be found in the chapter Set up a
Compiler. Information on the command options is available in this
chapter under the topic Command Options on the Tools Tab.
CUA Keystrokes
Keystroke Action
grouped and displayed when the button is selected in the Project tab of the
Project Window (the Project tab is described in the topic on Characteristics of the
Project Tab, in this chapter). The grouping is accomplished using wildcard characters
and filename extensions.
To access/edit the appropriate version of the Filters tab, complete the following:
1. Select Project|Properties.
2. In the Project Properties List:
n Select a project if the filters being viewed or modified are intended to be
specific to the selected project only, OR
n Select <Default Settings> if the filters being viewed or modified are
intended to be global.
3. Click on the Filters tab.
The default file filters for project files are Source Files, Header Files, Web Files, XML
Files, Resources, and Other Files. Use the Filters dialog to add, remove or rearrange
filters in the list.
Recently-selected project spaces will be listed at the bottom of the Project Space
submenu, numbered from one to nine. You may select from this list to reload any of
the project spaces listed.
Using Projects
Read on to find out about the following primary uses for a project that has been
defined in a project space:
n Loading Files for Editing.
n Creating, Selecting and Saving Workspaces.
n Searching Project Files.
n Selecting files for version control Checkin or Checkout.
2. You will see a workspace that is always available called <none>. Select that
workspace to wipe the slate clean.
3. Set the Close Windows/Delete Documents option to All to close all your buffers
and windows and start afresh, and click OK. Of course, if any of the buffers
contain changes that have not been saved to disk you will be given an
opportunity to do so.
Now that you have your clean slate, open the files that you want to have open in
your workspace. At any point, you can save your workspace under whatever
descriptive name you wish, by clicking Save Workspace on the Project menu.
Remember that workspaces are specific to the projects in which they are created.
Project Files
A project file (.PJT) is essentially a configuration file and state file all in one.
Workspaces are stored as additional "state files" within the project file. Once you
understand the format of a CodeWright configuration file, you understand a
CodeWright project file. These files look just like standard Windows .INI files with
headings enclosed in square brackets, and statements on lines following these
headings. Statements take the form of <keyword>=<value>.
You determine the amount of configuration information kept in the project file by
selecting either the <Default Settings> item or a project from the Project Properties
List, and then setting options in the various tabs of the Project|Properties dialog.
Various CodeWright dialogs also have options for specifying that dialog settings be
stored with the project. Additionally, the Directories tab in the Project|Properties
dialog has an option to Store System Options in project file. See the topic Storing
Configuration Settings with a Project.
If you are using one or more workspaces within your project, document and
window state information is stored with the active workspace section of the project/
project space file when you exit, rather than in the state section of the project. For
more information about the main configuration files in CodeWright, see the chapter
on Configuration Files & Command Line Parameters.
All compiler configurations are done through the Project|Properties dialog. You do
not have to use CodeWright projects in order to set up any compilers. However, if
you do plan on creating and using projects, it is best to set up some default
configurations (including compiler configurations) prior to creating the projects so
that CodeWright will use them as defaults when additional projects are created. See
the previous chapter on Projects, Project Spaces, and Workspaces for more information
on CodeWright projects and setting project defaults.
In the Settings For: field, select the Debug configuration, Release configuration, a
custom configuration, or All Configurations, then complete the remainder of the
dialog for that configuration. This allows you to save a group of settings under the
selected configuration name. To use the configuration in executing Compile
commands, select it on the Build|Configurations dialog, and press Set Active.
Compiler commands are defined for the selected file type. Please ensure that you
also have the desired file type(s) selected from the list of file types before modifying
settings.
The default compiler for the extension you selected is displayed in the Name box:
n If the box is empty, or the wrong compiler is displayed, select the down arrow to
the right of the box to display the list of other compiler names.
n If the compiler you seek is not listed, press the New button , type in a
descriptive string for it, and enter an appropriate command.
n If the list is cluttered with compilers that you will never use, you can delete
Use the Macro Assistant to add filename component macros to expand the name of
the current CodeWright edit buffer. Use the macros, as desired, within and at the
end of the command.
If you want to set up a custom configuration that has a Debug compile Command
line and a Release compile Command line, you must do the following:
1. Temporarily select the Debug configuration in the Settings For: field.
2. Select the compiler definition in the Name field that you will also use for your
custom configuration.
Note: You may want to create a new compiler definition for your
custom configuration, since the compile and debug compile
settings for a given definition are shared by all extensions and
configurations with which it is associated.
3. Save the Debug configuration.
Once you have completed the custom configuration and saved it, you will likely
want to go back to the Debug configuration and change the compiler definition back
to what you had before.
Example: If you use Microsoft’s Visual C++, a good general-purpose
Compile command might be:
${FTEE} cl -DSTRICT -c -W3 -G3 -D_X86_=1 -DWIN32
%r%e
n The ${FTEE} is a command macro which calls the CodeWright
FTEE.EXE program to capture the output of the compile. Refer to
the topic FTEE, later in this chapter.
n The %r and %e are Filename Component Macros that expand to
the current file and extension. Refer to the listing of Filename
Component Macros in the previous chapter on Projects, Project
Spaces, and Workspaces.
n The remainder of the above example is specific to each compiler.
As discussed in the topic Working Directory in the chapter Projects, Project Spaces, and
Workspaces, CodeWright will shell out to DOS in the directory you have specified in
Project|Properties|Directories to execute your commands. If you have designed a
directory structure where your files are not all in the same directory, problems can
arise.
Example: You might have a root application directory containing .exe's, a
subdirectory containing object code, another subdirectory
containing headers and include files, and another subdirectory
containing your source files. Making the Compiler aware of where
the necessary files for compiling are becomes tricky.
One solution would be to use a Make ‘Description’ file instead of the
standard Compile line. To compile a specified target you might use
the following command:
nmake -f MYPROJ.MAK %r.OBJ
This is basically a Compile, with the details supplied by the
Description file rather than the command line or the environment.
FTEE
If you want the output of your command to display in the DOS window while it is
being redirected to the error output file, you can use our FTEE command:
Example: ${FTEE} nmake -f %y.MAK
The ${FTEE} command macro calls the appropriate version of FTEE, a program that
is located in the CodeWright directory. In the above example, the output of nmake
will be split so that it goes to both the output file and the screen.
The FTEE32 utility is supplied along with CodeWright. The ${FTEE} macro expands
the name and path of the FTEE utility. FTEE 'splits' generated output so that it can
be placed in the error file as well as in the running DOS window. Just place the
${FTEE} command at the beginning of the command lines using the Redirect
output option. Since FTEE32 executes a command by creating a separate process for
the command and capturing its output, it will only work for executable commands.
If your CodeWright directory is not on the path, ensure the file FTEE.EXE is in a
directory that is.
FTEE is similar to the several TEE programs found in the public domain and on
many UNIX systems. Like a plumbing or electrical "Tee" connector, these programs
allow output to be directed to two places at once. The difference between FTEE and
these TEE programs is that FTEE allows the command to execute normally
whenever you do not redirect output to a file. Other TEE programs typically quit
with an error message under these circumstances.
Before using FTEE, make sure that your application does not do any redirection on
its own. Nothing useful can result from both your program and FTEE trying to
redirect the same output.
Note: If you are calling a Windows executable, such as Borlandâ C++
Builderâ, do not try to redirect output with FTEE. The program will
be treated as a DOS application if you do.
Sending output to the Output tab is convenient for seeing the output as a process is
executed, for cutting and pasting from the output, and for re-executing commands.
If you are prompted for input, however, you must press Cc to access the
console application for data input.
Note: Although you will not see anything in the console window, this is
where your application is expecting input to come from.
Project|Properties|Tools
Remove references to other redirectors from your command lines when you use
VDOS. Programs such as FTEE are not compatible with VDOS. Checking the No
Command Shell box in Project| Properties|Tools for any of the project tools will
disable the use of VDOS or FTEE for that command. For troubleshooting
information, refer to the topic VDOS Shell Window (indexed under VDOS) in the
online help.
This chapter is composed of three main topics. Using Version Control in CodeWright
deals with the user interface for version control (i.e. menu items, windows, and
popup menus, etc.). The next two topics, Using a Command Line Version Control
Provider and CodeWright SCC Integration with Version Control Systems, describe two
alternative methods for CodeWright-version control integration.
A version control project can be associated with a CodeWright project from one of
two different dialogs: the Tools|Version Control|Setup dialog or the
Project|Properties|Members dialog. To associate the two projects in the
Tools|Version Control|Setup dialog, do the following:
1. Create a new project space with at least one member project (or open an
existing one). For information about how to do this, see the chapter on Projects,
Project Spaces, and Workspaces.
2. Set a current CodeWright project using the Set Current menu item on the
Project menu.
3. Go to Tools|Version Control|Setup.
4. Choose the SCC Provider radio button.
5. Assuming that the version control provider has already been initialized, click
Open Project.
6. Choose the version control project that you want to associate with the current
CodeWright project.
To add version control files to a CodeWright project, use the VCS Project Read
feature. This feature will read or scan a version control project or configuration file
for files, in order to incorporate those files into a CodeWright project. The version
control “Read” feature can be found in the Project |Properties|Members dialog.
Address the following items that have to do with CodeWright’s version control
“Read” feature:
n VCS Project: - Lists the name of the current version control project.
n When the files are checked-in (or read-only) the icons that represent the
files will be gray with horizontal lines in them.
n When the files are checked out CodeWright conveniently places a red
checkmark to the upper right of the file icons.
n If another user has a lock on a file that is part of the project being worked
on, CodeWright represents the file with a gray checkmark in the Project tab.
n If the file currently being edited (as it is stored on disk) differs from the
latest revision in version control, CodeWright will display the file’s
representative icon in a pale yellow color, indicating that it is an old version.
Notes: To perform version control operations on the file(s) selected in the
Project Window, access the right-click menu from the Project or
StarTeam tab. When using the Project Window to carry out version
control operations or view version control status, it is a good idea to
press the Refresh button from time to time to see the most current
status of the files.
To access version control operations for the document you are editing
instead, use the Tools|Version Control submenu or VCS toolbar, or
right-click within the document.
The main popup menu already contains two commonly used VCS commands:
checkin and checkout. The checkout command in the menu uses the Check Out w/
Lock command, as defined in the Version Control Setup dialog (Tools|Customize|
Version Control|General). Here is how to add an item in the popup menu to
perform a non-locking checkout.
1. Right-click in an un-highlighted, non-HTML document to access the popup
menu, then click Edit this menu.
2. Using the existing Check out line as a frame of reference, make a new menu
item by first highlighting the Check out line and then clicking Insert|Menu
Item.
3. In the Menu Item dialog, type Check out--no lock in the Menu Item Text field.
4. In the Execute Function field type
MenuCommand IDM_TOOLS_VCS_GET.
5. You can choose to have your new menu item inserted before the Checkout line
by checking Insert Before.
6. Click OK, and then save the changes in the popup menu editor by clicking
File|Save.
7. Click OK to close the dialog.
The right-mouse button popup menu should now contain three VCS commands.
Note: The preceding example works with command line or SCC VCS
integration.
The following examples give an idea of how multiple version control configuration/
project files can be used.
Examples: Suppose you need access to two separate checkin commands
without changing projects. You can set up each command with its
own keystroke, button, or menu item.
1. The first thing to do is to create a section in your CWRIGHT.INI
file for each checkin command. Here is a sample pair:
[VCSCheckIn1]
CheckInSetCmd=’put -cvcs1.cfg -M%Q %r%e’
CheckInBuffer
[VCSCheckIn2]
CheckInSetCmd=’put -cvcs2.cfg -M%Q %r%e’
CheckInBuffer
[VCSCheckOut1]
CheckOutSetCmd=0,’get -cvcs1.cfg %r%e’
CheckOutBuffer=0
[VCSCheckOutLock1]
CheckOutSetCmd=1,’get -cvcs1.cfg -l %r%e’
CheckOutBuffer=1
[VCSCheckOut2]
CheckOutSetCmd=0,’get -cvcs2.cfg %r%e’
CheckOutBuffer=0
[VCSCheckOutLock2]
CheckOutSetCmd=1,’get -cvcs2.cfg -l %r%e’
CheckOutBuffer=1
The version control capabilities that CodeWright provides will vary depending on
which integration method is used and which Version Control Provider is used. The
integration method is specified by selecting either the Command Line Provider, or
the SCC Service Provider option in the CodeWright Tools|Version Control|Setup
dialog. Descriptions of the two integration methods follow. It is only necessary to
use one integration method in order to access version control from within
CodeWright. Choose the method that applies to the type of version control system
you have (SCC for GUI, or Command Line for DOS).
In order to use the command-line Version Control Interface, the Source Code
Control System must be properly installed according to the instructions provided by
the Version Control Vendor.
3 The following information is based on the assumption that command-line
version control operations can be successfully performed from any directory in
DOS according to the instructions provided by the Version Control Vendor.
To set up the version control command lines, complete the following steps:
1. Select the CodeWright Tools menu.
2. Find the Version Control submenu.
3. Select the Setup item.
4. Make sure that the Command Line Provider radio button is selected.
5. Choose a command set from the list. You are now ready to use the commands
on the Tools|Version Control menu.
_StateHistory=XVCS,RCS,TLIB,PVCS,SourceSafe
Project|Properties|Tools
3. Select the entry labeled External VCS Check In in the Description field.
4. View the command sequence displayed in the Command edit control. This is
the command that will be executed whenever you select Check In from any of
the various menus and toolbars that provide the Check In item. The command
includes CodeWright filename component macros.
5. To see exactly how the command will run, select the Test button . Note that,
when you have a dummy file such as FOO.C opened in CodeWright, the
macros resolve and the command is displayed for operation on the current
document, FOO.C.
Check-out Command
The Checkout command is the command line to execute when you are checking
out a revision from a version control system or other archive. If your version
control system offers revision locking, this command should not lock the
revision. This is the command to be used when you are browsing or compiling
the file, rather than planning to change it.
n If you don’t define a command for check-out, the following command will
be used:
Get %b%e
Lock Command
The lock command is the command that your version control system uses to
lock a revision without checking it out. This is useful when you already have a
modified version of the source file that you want to check in, but you discover
that the file was not locked.
Additional Tips
Refer to the following tips regarding command line Version Control integration:
n The version control command runs in a DOS shell. Once the command is
executed, the shell exits and any output that would normally be displayed in
DOS is lost. In order to see the output, mark Use VDOS for each of the Version
Control commands on the Project|Properties|Tools dialog. The output will
then be displayed in the Output tab of the CodeWright Output Window.
All of the CodeWright SCC Provider support is based on the Microsoft Common
Source Code Control (SCC) Specification. This spec describes a dozen or so entry-
points that cover various version control operations (checkin, checkout, etc). For
SCC Providers to comply, they must provide an SCC Server DLL that contains these
entry-points. When this SCC Server DLL is properly installed and configured, IDEs
such as CodeWright can hook up their dialog boxes to these entry-points and get
more or less the same functionality, independent of SCC Provider.
To find out whether a particular Version Control Provider offers Common Source
Code Control (SCC) Integration, check with the vendor.
2. Select your version control system from the list in the dialog.
Note: If StarTeam is installed on your system, and you have obtained
the StarTeam SCC Integration from the Borland website (via a
link in your current version of StarTeam), select CodeWright
StarTeam Integration to enable a StarTeam tab on the
CodeWright Project Window. The StarTeam tab provides a
browse window for your StarTeam projects, displaying
information from the StarTeam Change Request, Task and File
tabs, and provides version control functionality on a right-click
menu.
3. Press the Initialize Provider button in the Version Control Setup dialog.
4. Press the Open Project button in the Version Control Setup dialog.
5. Select the version control project you wish to use (the project should already
exist in your version control system).
At this point you should be completely set and ready to perform check-ins, check-
outs, and other version control operations from within CodeWright. If any of the
above steps didn't go as planned, however, read the following paragraphs.
CodeWright's Sync Technology allows the stand-alone editor to be used along with
development environments without concern for extra loading and reloading, or
losing features or edits. Editing can be done in both environments with changes
instantly updated in the alternate environment. In addition, keystrokes are available
that will access menu commands in the alternate environment.
Once the necessary sync modules have been installed, there are some setup
procedures to follow for each individual development environment. The sections
that follow provide that setup information.
[LibPreLoad]
LibPreLoad=CWSYNC.DLL
A First View
Once you have set up VCSync appropriately, start Visual Studio .NET (if it is not
already running). There should be a new Tools|Synchronize with CodeWright
menu item. Click on this item to start CodeWright with all the same files that were
loaded in the Visual Studio text editor.
On the CodeWright side, you can enable the MSDevSync toolbar in the
Tools|Customize|Toolbars dialog. This toolbar has buttons to synchronize the
current file or all open files. The toolbar buttons allow you to update files in Visual
Studio .NET without giving it focus.
When you switch tasks between the two programs, each will automatically reload
any source files that were changed in the other, maintaining the cursor position in
both directions.
VCSync Setup
Perform the following steps to run and setup VCSync:
1. Run VCSync. This can be done in one of two ways.
n Run VCSYNC.EXE using the CodeWright MSVC Sync program item in the
CodeWright program group. Access the CodeWright program group by
going to Start|Programs|CodeWright. Click the program item to invoke
VCSync and run it minimized. As long as it is running, it will periodically
check to see if MSVC++ has been invoked. When it has, it will start
VCSYNCIN.EXE, a background task. OR
n Run VCSYNC.EXE to invoke MSVC so that only one program invocation is
necessary, rather than two. Just specify the MSVC application name as a
parameter to VCSYNC.EXE using a –u option. The -u option will cause
VCSYNC.EXE to invoke VCSYNCIN.EXE and then exit. The following
steps describe how to do this:
1. In Windows, right-click on the Start button, then click Open.
2. Open the Programs folder.
3. Open the CodeWright folder.
VCSync Configuration
Once the above steps are performed, a CodeWright toolbar button appears in Visual
C++. The button can be moved, docked, or attached to any visible toolbars.
A First View
Once you have set up VCSync appropriately, start Visual C++ (if it is not already
running). There should be a new button. Click on this button to start CodeWright
with all the same files that were loaded in the Visual C++ text editor. A switch
between the two programs will automatically reload files that were changed in the
other.
When synchronizing CodeWright and Visual C++, changes to files are detected at
three different times during normal editing:
n When either Visual C++ or CodeWright is first invoked.
n When either Visual C++ or CodeWright becomes the active application.
n When either Visual C++ or CodeWright edits an existing file on disk.
Read the topic Bi-directional Synchronization, later in this chapter, to find out about the
MSDevSync toolbar that synchronizes backwards, from CodeWright to Visual C++.
Also see Accessing Menu Items via Synchronization to access Visual C++ menu items
from CodeWright.
DPRSync Setup
Perform the following steps to configure DPRSync:
1. Start the Borland Delphi IDE.
2. In the Component|Install Package… dialog, select the Add button.
3. If it is not already there, add the DPRSYNCx.BPL file found in the CodeWright
directory (DPRSYNC7.BPL for Delphi 7, or DPRSYNC6.BPL for Delphi 6) . You
will see CodeWright - Delphi Sync Package show up in the list of loaded packages.
4. After completing the above steps, you will see two new menu items:
n CodeWright! (found on the right side of the menu bar).
n An About CodeWright item on the Help Menu that accesses a
Configuration dialog for the Synchronization program.
5. From the Delphi Help menu, choose About CodeWright.
6. Select the Settings button to access the Delphi Integration Configuration
dialog:
A First View
Open a sample project in Delphi. Select CodeWright! from the Delphi main menu,
or use the keyboard shortcut [Alt]-[i]. CodeWright should activate. The files that
were open in Delphi should automatically open in CodeWright.
Note: Synchronization happens when going from Delphi to CodeWright
by clicking on the CodeWright! menu item or by executing an
[Alt]-[i] shortcut. Synchronization going from CodeWright to Delphi
happens when CodeWright loses focus and Delphi gains it.
Known Problems
The following are known issues with Borland Delphi synchronization:
n Automatic Generation of Event Handlers: One problem may occur immediately
after returning to Delphi from editing a form in CodeWright. If the first
operation you perform is to double-click on a control to insert an event handler,
the handler may not get inserted into the correct position within the form’s
source file. A workaround is to place the form into a modified state first. For
example, insert a space, then delete the space.
n Forms inheritance: A problem exists when editing dependent forms in
CodeWright. Once the child has been modified in CodeWright, Delphi will be
unable to reload the parent until Delphi has been restarted.
BCBSync Setup
Complete the following steps to setup synchronization for Borland C++ Builder 5.0
or 6.0:
1. Start the Borland C++ Builder IDE.you will see two additional menu items in :
n CodeWright! (found on the right side of the menu bar).
n An About CodeWright item on the Help Menu that accesses a
Configuration dialog for the Synchronization program.
2. Go to the C++ Builder Component|Install Package… dialog.
3. Verify that the CodeWright - C++ Builder x Sync Package is loaded (where 'x' is
the Builder version). If not, click Add and load BCBSYNCx.BPL from the
CodeWright directory.
4. Click OK.
5. From the Builder Help menu, choose About CodeWright.
6. Select the Settings button to access the C++ Builder Configuration dialog:
A First View
Open a sample project into C++ Builder. Select CodeWright from the C++ Builder
main menu, or use the keyboard shortcut [Alt]-[i]. CodeWright should activate.
Press [Ctrl]-[P]. The Builder Project Info will display, if you made the key bindings
described in the section Accessing Menu Items via Synchronization.
Notes:
n Synchronization happens when going from C++ Builder to CodeWright
by clicking on the CodeWright menu item or by executing an [Alt]-[i]
shortcut.
n Synchronization going from CodeWright to C++ Builder happens when
CodeWright loses focus and Builder gains it.
n This synchronization can only be reliably achieved if the C++ Builder
BCBSYNC.BPL expert file is loaded as described above and the CodeWright
CWSYNC.DLL file was loaded during CodeWright installation.
n When synchronizing C++ Builder units, the .CPP file and the .H file are
both opened. Cursor positions are only set on the .CPP file. The .H file's
cursor position will remain in the position CodeWright had it last. When
changes are made to the C++ Builder Open Tools interface to access the .H
file, an update will be made to sync the cursor position for the unit's .H
files.
VBSync Setup
Do the following to setup Visual Basic Synchronization with CodeWright:
1. Start the Visual Basic IDE. You will see three additional menu items:
n A CodeWright - VB Sync toolbar button to SYNC between VB 6.0 and
CodeWright.
n The VBSync command menu item, CodeWright!, in the Add-Ins menu. It
does the same thing that the toolbar button does.
n The VBSync configuration menu item CodeWright Sync... in the Add-Ins
menu.
2. From the Add-Ins menu, choose CodeWright Sync… to access the VB-
CodeWright Synchronization dialog:
VB-CodeWright Synchronization
A First View
Open a sample project into Visual Basic 6.0. Select the CodeWright toolbar button.
CodeWright should activate and any files loaded in Visual Basic will subsequently be
loaded in CodeWright.
n Synchronization happens when going from Visual Basic to CodeWright by
clicking on the CodeWright - VB Sync toolbar button or the CodeWright! menu
item. Synchronization going from CodeWright to Visual Basic happens when
CodeWright loses focus and Visual Basic gains it.
n This synchronization can only be achieved reliably if the VBSYNC.DLL Add-In
and the CodeWright CWSYNC.DLL Add-On files are both loaded as described
above.
TICCSync Setup
Do the following to setup TI Code Composer Studio synchronization with
CodeWright:
1. Start the TI Code Composer Studio IDE. You will see two additional menu
items:
n A CodeWright! menu item on the Tools menu in Code Composer Studio.
Select it to launch CodeWright and synchronize files.
n A CodeWright Settings... menu item on the Tools menu in Code Composer
Studio. Select it to launch a sync configuration dialog box.
2. From the Tools menu, choose CodeWright Settings… to access the TI Code
Composer Studio Sync Configuration dialog:
A First View
Once you have set TICCSync up appropriately, start Code Composer Studio. Select
CodeWright! from the Tools menu. CodeWright will be activated with all the same
files loaded that were loaded in the Code Composer Studio text editor. When you
switch tasks between the two programs, each will automatically reload any source
files that were changed in the other, with the cursor position maintained. Changes to
files are detected at three different times during normal editing:
n When either Code Composer Studio or CodeWright is first invoked.
n When either Code Composer Studio or CodeWright becomes the active
application.
n When either Code Composer Studio or CodeWright edits a file on disk.
Notes:
n Synchronization happens when going from Code Composer to
CodeWright by clicking on the CodeWright! menu item.
n This synchronization can only be achieved reliably if TICCSYNC.DLL
and CodeWright CWSYNC.DLL are both loaded as described above.
Read the following topic Bi-directional Synchronization to find out about the
TICCSync toolbar that synchronizes backwards, from CodeWright to Code
Composer Studio. Also see Accessing Menu Items via Synchronization to access Code
Composer Studio menu items from CodeWright.
Bi-directional Synchronization
The synchronization modules for Visual Studio 98, .NET and TI Code Composer
Studio each have toolbars that make VCSync and TICCSync bi-directional. This
means that, when the appropriate button is pressed, files in CodeWright will
automatically load in Visual Studio or Code Composer Studio, with the cursor
position intact. The MSDevSync and TICCSync toolbars can be enabled in the
CodeWright Tools|Customize|Toolbars dialog. They have buttons for syncing
either the current file or all files open in CodeWright with the other development
environment.
; Uncomment for Visual Studio 97 (MSDev 5.0 or MSDev 6.0) Menu commands:
;ConfigFileRead( CWSYNC.INI, KmapAssign_MSVC50, FALSE )
See the topic Assigning Menu Items to Keystrokes under the Synchronization topic in
CodeWright’s online help for a list of key assignments in CWSYNC.INI.
The topics covered in this chapter regarding search and replace are listed below:
n Search and Replace dialogs
n Incremental Search
n Toolbar Search
n Quick Search
n Multi-source Search and Replace
n Search Options (Default Search and Replace Settings) dialog
n Fast Find on Edit and Search Window Popup Menus
n Stop a long search
n Regular Expressions
Replace
Save Settings
The Save Settings check box is provided to save you from editing the Default
Search and Replace Settings dialog whenever you want to make a change to the
search values. Settings are not immediately written to disk, however. Checking the
box makes the current settings the default for that search session.
If you elect only to search a series of files, rather than selecting the Replace action,
you are actually performing a File Grep. This can also be done from the File Grep
dialog (Search|File Grep). A list of matches in the specified files will appear in a
Search tab of the Output Window (Search 1, Search 2, etc.):
n The Search tab also displays the line numbers and the line containing the
matching text.
n To move to any of the matches listed in the Search tab, double-click on it with
the mouse, or select the matching line from the list and press E.
n Right-click within a Search tab to give a file focus. Then select Open Explorer
with Directory from the popup menu to launch Windows Explorer and
automatically navigate to the directory containing the file you selected.
Several features exclusive to the Search and Replace Multiple Sources dialog make
it one of the more convenient navigating tools in CodeWright. Descriptions of some
of these features are provided next.
Current Directory
The directory defined for the search is displayed at the lower left of the Search and
Replace Multiple Sources dialog, under the checkbox labeled Set as CWD. Items to
consider with regard to the current directory are:
File Pattern
You may use the File Pattern edit box in the Search and Replace Multiple Sources
dialog for quick, ad hoc searches that you are not apt to repeat. It lets you specify a
file type or series of file types to search without associating it with a search set name.
While not as powerful as the Search list, it is simpler to use. Enter one or more
wildcard patterns into this box. Separate multiple patterns with a semicolon.
The File Pattern supplements the selected items on the Search list, if any. You may
add it to the Search list by pressing the Add button.
Note: The File Pattern, when specified, does not override the list of files in
the Search list. If both are defined, the files in both the File Pattern
and any selected members of the Search list are searched.
The Search List is usually a series of wildcard patterns. To edit the list, press the Edit
button to bring up the Edit Files/Folders dialog, described under the topic Edit
Search List.
When you first select your desired mode, you will see that the entire contents of the
listbox are selected. If you wish to further limit the search or replace to a subset of
the list, deselect the files you want to exclude.
Search Subdirectories
Check the Subdirectories box in the Search and Replace Multiple Sources dialog if
you want the search to encompass files in subdirectories of the path searched.
Threaded
The Search and Replace Multiple Sources dialog’s Use Thread option allows the
search or replace operation to proceed as a separate process, so that other tasks can
be performed as the search continues. If the operation is a search only (File Grep),
the Output Window updates as matches are found. Otherwise, matches are listed
after the operation completes.
n Save Window Contents between Sessions: Check this box to save the contents
of each active Search tab of the Output Window between CodeWright sessions.
Text and color attributes in these tabs will be restored on your next use of
CodeWright.
n List to File: You may specify that the information about the matches found be
stored in a file; you may also specify the name of that file. The default name is
CWFGREP.___, which is created in the current directory. You may specify
another name if the default causes a conflict, or if you wish to save the output
from the previous or current operation, rather than allowing it to be
overwritten. You may also redisplay the results of a previous search by
specifying the name of the file in which the results were saved.
Patterns List
The Edit Files/Folders dialog’s File Pattern listbox contains the patterns already
defined for this Search Set. The Search Set is composed of the union of these
patterns, rather than the intersection. Files are only searched once, even if they
match several of the Search Set’s patterns. Therefore, if the Search Set contains
the pattern *.*, other patterns are superfluous unless they contain a path
element. Source patterns that do not contain a path element will apply to the
current directory.
Include Directory
When Include Directory is checked in the Edit Files/Folders dialog, the drive
and directory selected in the adjacent list boxes are automatically added to the
pattern specified in the Search Pattern edit box as you press the Add button.
This dialog is used to set default options for search and replace activities.
To access the Default Search and Replace Settings dialog, do one of the following:
n Click Options on the Search menu.
n Click Default Options in the Search dialog.
n Click Default Options in the Replace dialog.
n Click Default Options in the Search and Replace Multiple Sources dialog.
The items in the Default Search and Replace Settings dialog are listed next.
Search Direction
The search Direction section of the Default Search and Replace Settings dialog
allows you to search forward from the cursor position or backward. In a multiple
source search, CodeWright searches forward from the beginning of each requested
file.
Replacement
The Replacement group of options in the Default Search and Replace Settings
dialog is specific to the replacement operation. They are listed next.
Prompt
The options in the Prompt section of the Default Search and Replace Settings dialog
control what word appears in the Find What field by default. Definitions of the
options are as follows:
n Current word: Uses the word at the cursor as the default search string.
n Selection/Word: Uses the contents of the selection as the default search string.
If there is no selection, uses the word at the cursor.
n History: Uses the most recent response in the history list.
Search Options
The Options group of check boxes is also available in the Search, the Replace, the
Default Search and Replace Settings, the Search and Replace Multiple Sources,
and the File Grep dialogs. The options allow you to turn various search attributes on
or off. They include:
n Ignore case: When checked, uppercase characters or lower case characters will
be matched. When it is not checked, the case of the characters in the specified
search string is significant.
n Regular expression: When checked, the search pattern is viewed as a regular
expression. Some of the characters in regular expressions are given a different
meaning than they would have in an ordinary string search. This allows for
more powerful searches.
n Maximal match: A check in this check box indicates that regular expressions
should match the largest possible unit. If this box is not checked, regular
expressions will match the smallest possible unit, which in some cases may be 0
characters. For example, if the regular expression specifies matching 2 or more
A's in a row (AA+), and the search encounters 5 in a row (AAAAA), what does it
match? If maximal match is on, it matches five. If it is not, the search matches
the first two.
n Whole word: When the whole word box is checked, the pattern you are
searching will not match strings that begin or end with only partial words. That
is, the pattern must be preceded and followed by one of the following:
3 Beginning of file or end of file
3 Beginning of line or end of line
3 Spaces or tabs
3 Word delimiters
Refer to the online help topic on Word Delimiters for information on how to
define what a "word" is for files of an extension.
n Color Limited: Restricts your search to text that is ChromaCoded in a particular
way (e.g. find "foo" only in comments or strings). Press to display the Color
Limited Search Settings dialog on which you can indicate the ChromaCoded
elements that should be included in your search. (The dialog is named Default
Color Limited Search Settings if you access it from the Search|Options dialog.)
Text General
Comments Comments
Keywords Words
Strings Strings
Numbers Numbers
Braces General
Preprocess Words
Functions Words
Operators Words
Review color settings for these same elements by selecting the appropriate View
Theme on the Tools|Customize|View Themes|Colors dialog.
Matches
The following settings are under the heading Matches in the Default Search and
Replace Settings dialog:
n Select string: The Select String check box specifies whether the text that
matches the search will be highlighted in a selection at the end of the search.
n Retain selection: When the Select String box is checked, the Retain Selection
box indicates whether the selection that encompasses matching text is
momentary or retained so that you may operate on it (copy, cut, or replace).
Suppose you want to look for the string version in two directories, C:\DOCS\*.TXT
and D:\PROJECT\*.C. Here’s what to do:
1. Select Search|Multiple Sources to get to the Search and Replace Multiple
Sources dialog.
2. Select the Files/Folders radio button in the upper-right corner of the dialog.
3. In the accompanying combo box, select All Files.
Incremental Searching
Incremental searches can save time and typing within both edit windows and tree
controls. This is because the string is matched as the word is typed, instead of being
matched after the word is typed. Many times the search function finds the string
you are looking for before it is all typed in.
Edit Windows
Begin an incremental search by invoking ISearch. This can be done from Tools|API
Command, or by pressing CBi in the CUA keymap. ISearch may already be
bound to a key in your keymap, but if not, you can easily add such a binding with
the Keyboard dialog on the Tools|Customize dialog.
ISearch prompts you for the search string, and you begin typing. Keep in mind that
ISearch always searches in a case-sensitive fashion. The case of the characters you
type must agree with the case of the characters in the document, in order to match.
When you type the first character, ISearch moves to the next occurrence of that
character and highlights it. ISearch performs a search after each character you type,
looking for the sequence of characters you have typed thus far. If it doesn't find a
match, it issues a beep, and the character you just typed is removed from the search
string.
If you find you have mistyped, just backspace over the incorrect character or
characters. As you remove characters from the search string, the cursor backs up to
the position that first matched the characters that remain. Delete the entire search
string and you will find yourself at the position where the search began.
Tree Controls
Tree controls are used in various locations throughout CodeWright. Examples
include the tabs of the Project Window (Project, Outline, etc.), the left pane of the
Directory Difference Window, and some dialogs (such as the Document/Window
Manager).
Incremental searching works basically the same in a tree control as an edit window,
except that you don't need to execute a command or keystroke shortcut. Just give the
tree control focus, then type as many characters as necessary to quickly navigate to
the desired string. If you type a character that is not part of a continuing match, the
search is started over with the next item that begins with that character.
Quick Search
The Quick Search facility is a function you can use to do an immediate search for the
word at the cursor. It uses settings from the Default Search and Replace Settings
dialog.
In the default configuration, you will find this function assigned to the button
on the Standard Toolbar, and assigned to the CBq key combination in the
CUA keymap. There is also a Quick Search option in the right-click popup menu.
Other assignments may be made, or readily changed.
Toolbar Search
"Toolbar Search" refers to the search capability built into the Standard toolbar in the
If CodeWright finds a match, the Toolbar Search will retain the focus. This gives you
the opportunity to search again just by pressing E again. Pressing anything else
will cause the Toolbar Search to lose the focus, and you are then able to edit at the
position where the match was found.
The Toolbar Search maintains its own response history, to allow you to recall strings
or patterns you previously typed. These are available when you select the down
arrow to the right of the edit box, causing the history list to drop down.
Regular Expressions
Regular Expressions are powerful notations for matching string patterns.
CodeWright makes UNIX-style Regular Expressions available for its search feature.
CodeWright also uses Regular Expressions for interactively customizing CodeWright
Symbols, embedded language configurations, user-defined keywords parser,
makefile reader, and Visual Studio workspace reader.
Note: For more information on Symbols, review the topic on Outline
Symbols later in this chapter. For more information on the makefile
and workspace readers, read the chapter on Projects, Project Spaces,
and Workspaces.
Investing a relatively small amount of time to gain some knowledge of Regular
Expressions will pay back in the long run with the amount of time you can save
searching for string patterns.
A Regular Expression can be as simple as a single, literal character, like "a". You could
search for the character "a" from the CodeWright Search dialog, with Regular
Expression marked, and you would be searching using Regular Expressions. Such
simple expressions are usually a sub-expression of more complex regular
expressions. When reading the descriptions that follow, remember that an
"expression" may mean a single character, a group of characters, or a class of
characters.
Special Characters
Regular Expressions give special meaning to certain characters. Some are operators
and some show grouping. There is also a method of representing non-printing
characters, such as a tab, within Regular Expressions. All other characters just
represent themselves, as they would in an ordinary string search.
Character Meaning
Escape Meaning
\t Tab.
\b C -H (backspace).
\r Carriage return.
\f Form feed.
Matching a Character
The basic unit of a regular expression is matching a single character. You can match
a single character in one of three ways:
n Literally, by using the character itself or the appropriate escape sequence. (e.g.
‘cat’)
n Ambiguously, by using the dot ( . ) metacharacter, if matching a character
literally is too limiting. (e.g. ‘..t’)
n With a Character Class. If a literal character is too narrow a match and the dot is
too broad a match, a character class can be used for anything in between. (e.g.
[A-Za-z])
Ranges of characters may also be specified within a character class. This is done by
placing a dash between the character that begins the range and the character that
ends the range. The following character class [0-9]will match any character
between 0 and 9.
How do you match a DASH (-), then? If it is not in the character range you specified,
just place it at the beginning or end of the character class where it is not between two
characters of the class. If you precede the dash with a backslash ( \ ) you can put it
anywhere within the class.
The CARET ( ^ ) has a special meaning when it appears as the first character of a
character class. It complements the class. When it appears at any other position
within the character class, it just adds the up-caret to that class. You may use it as a
shorthand method of saying "match any characters except for the following:", rather
than specifying a large character class.
Example: [^$.|(){}*+?^]
matches anything except the eleven characters following the up-
caret.
] " \ and sometimes - and ^ depending on the position within the class.
n Escape the - when you use it in the middle of a class but don't intend it to signify
a range.
n Escape the ^ when it would otherwise be at the beginning of a class but you do
not intend for it to signify complement.
When in doubt, escape the character. It can't do any harm. The above characters
look like this when escaped:
\] \" \\ \- \^
Without these qualifiers, a regular expression will match exactly one occurrence in
the text.
Examples
Let us consider some specific examples of how these qualifiers might be used in the
task of matching white space:
n \t*
This example will match any number of consecutive tabs, including none. By
itself, it is not very useful to match none of something. As part of a larger
regular expression, it could be quite useful.
If you wanted to match the white space within a function call, where you knew
there might be one space or tab, or there might be none, your expression could look
like this:
n \([ \t]?
Alternation uses the metacharacter | to denote that a match has been found if the
text matches either of two Regular Expressions. This operator may be repeated to
indicate that the text may match any one of several expressions.
Because of the typical order of precedence, the alternation applies to the entire
expression, if not limited by grouping. Grouping occurs when you place
parentheses around one or more expressions that are part of a larger expression.
Examples:
n PUBLIC|PRIVATE matches either the word "PUBLIC" or "PRIVATE".
n PUBLIC (void|DWORD) matches the word "PUBLIC", when followed by a
single space, and then followed by either the word "void" or "DWORD".
n ^PUBLIC[ \t]+(void|int|long|DWORD) matches, at the beginning of a
line, the word "PUBLIC", followed by one or more spaces or tabs, followed
by any one of the following words: "void", "int", "long" or "DWORD".
Search pattern:
GotoXY\((.*),(.*)\)
Replacement pattern:
move_cursor(\2,\1)
Note that in replacement patterns you do not need to escape metacharacters, such as
the left parenthesis, with a backslash. There are a few escape sequences that are
meaningful in a replacement string, such as those used by reference groups, but
such sequences are not themselves regular expressions. An operation using
reference groups, such as that depicted above, could be used to reverse the
parameter order used by one function when converting to a similar function.
There is an implicit reference group that you can use in replacement strings to
represent the matching text in its entirety. You reference this group in the
replacement string with an & at the desired location. This means that you must use
\& to specify an ampersand in a replacement string, when regular expressions are
enabled.
The escape sequence that specifies cursor position is \c. An example of its use
follows:
singletons\[\c.*\]
This example places the cursor at the beginning of whatever text is contained
between the left and right square brackets. The square brackets are metacharacters
and are therefore escaped. This cursor positioning facilitates editing the contents of
the square brackets.
Examples
The following examples are intended to inspire your own use of regular expressions:
Pattern Description
The procedure for replacing characters with tabs, new lines, and spaces is the same
as the procedure for finding them, only the space, \t, and \n characters are typed into
the Replace With field of the Replace dialog, instead of the Find What field of the
Search dialog.
First, turn on Regular Expressions from the appropriate dialog. Then use the \x
notation to specify hexadecimal values. For example, to search for the form feed
character, you can use this string:
\x0C
(That’s backslash x zero c.) Make sure there are two digits following the x. If you want
to search for two consecutive bytes by hexadecimal value, string them together like
this:
\x0C\x0D
More information on setting and using UNIX EOLs can be found in the chapter
UNIX.
Selective Display
The Text menu has an option for Selective Display. Selective Display is a feature
that "collapses" or "folds" text in the current document so that only desired text is
displayed, and the remainder is hidden. The Selective Display menu item accesses
a dialog that has options for controlling which lines of the document are visible.
Selective Display
Pre-processed View
The Preprocessor directives option in the Selective Display dialog is a special
option for C/C++ users that find their source files cluttered with #ifdefs. The option
allows source code to be displayed exactly as the compiler will see it, while it is being
edited.
Applications that are written to run on more than one platform, or custom software
written for more than one company often use #ifdefs to avoid redundant
maintenance. If separate versions of a file are maintained for each of several
platforms or customers, each version needs to be changed whenever an
improvement is made to code that is common to all of them. #ifdefs are used to
maintain different versions in a single file. Then changes to common code only need
to be made once.
Selective Mode
Just press X when you want to restore the invisible lines. When you want to see
just the lines you have selected again, you can complete one of the following:
Each of the above tools has advantages and disadvantages when used for
navigational purposes. The next few paragraphs describe reasons why one might
choose one over another.
Browser
The CodeWright Browser uses Microsoft .BSC files that are produced when
compiling source code in Microsoft Developer Studio. It also uses compiled tags
databases produced by the TAGSW32 utility shipped with CodeWright. The browser
uses a graphical tree in a special tab of the Output Window to demonstrate
relationships and simplify locating necessary files or other pertinent information. If
you are compiling with Microsoft tools this method gives you the most information
about your code. However, you must be able to compile the code, and the
information is only as up-to-date as your most recent build.
Outline Symbols
The CodeWright Outline/Symbols feature has its own graphical tree interface in the
Outline tab (on the Project Window by default). It also uses the Symbols tab (on the
Output Window by default) and background parsing to let you view the most up-to-
date information about your project. Furthermore, Symbols support a large number
of languages and can be readily modified to add to or expand the browse capabilities
for new or existing languages supported by CodeWright.
Objects Window
The CodeWright Objects Window is a tab on the Project Window by default. It
displays a hierarchical view of C/C++, C# and Java symbols that are associated with
the name typed in the Identifier box at the top of the window. The Objects Window
can be used to view and browse code.
Click on a symbol in the Object Window to access the position in the source file at
which the symbol is defined.
Browser Support
The CodeWright Browser supports two kinds of browser databases:
n Microsoft format .BSC databases These are the databases generated by Microsoft
C/C++ 7.0 and later.
n Borland Compiled Tags databases These are the databases produced by the
TAGSW32 utility shipped with CodeWright. The Tags databases are given the
extension .PTG by convention.
The Browser is one of the windows available for viewing in the tabbed Output
Window (by default). It appears when you select Browse from the Project menu or
when you select the Browse tab on the Output Window. The Browser is actually
two windows side by side with its own toolbar at the top. The Tree window appears
on the left and the Inspect window appears on the right.
Press ! in the Browse window to receive help, press X at any time to leave the
window and return to the current edit window.
Selecting a Database
The first step in using the Browser is to select a database. If you have previously
defined a valid .BSC or .PTG file for the current project, that database is loaded when
you select Browse. You define the database for the project in the Directories tab of
the Project|Properties dialog. If you have not defined a database, or if you later
want to change databases, you may select a database by choosing the File Open
button on the Browser Toolbar.
As you traverse the tree, you will note that information about the selected node
appears in the Inspect window to the right. This window will list information such
as where the item is defined and where it is referenced, if this information is in the
database. You may move between the Tree window and the Inspect window by
either pressing the T key or clicking in the intended window.
Bitmap Description
Root information coming from the database.
A type definition.
The first file in the tree list will often be labeled <unknown>. These are functions
and other objects that are referenced, but whose source was not compiled along with
the project. The most common examples of this are the use of functions in the
Microsoft Foundation Classes, or other libraries.
Browser Toolbar
Here is how the Browser toolbar appears:
(usually a point of definition), you can press the (Go to) button on the
left of the toolbar. Simply pressing the g key will also take you to
whatever is selected in the Tree window.
n If you have selected a reference, a calling or called function in the Inspect
window, you may wish to press the key (Go to from Inspect) to go to
that reference or function.
String Search
Query Button
The first button to the right of the Search String combo box on the browser
toolbar is the Query button. You can initiate a query by pressing the button,
or by pressing the q key. Depending on the context, one of six query dialogs
will appear. An example dialog is shown below:
Button Purpose
Quick Search
The Quick Search button on the Browser toolbar is for when you are in a
normal edit window and want to look up the word at cursor in the browser
database. This step saving device acts the same as if you had typed the word
into the String Search combo box on the Browser toolbar and pressed E.
Called By / Calls To
When you have selected a function in the Tree window, you may view either a
list of functions that call it, or a list of functions it calls by pressing one of the
After changing the filter toggle settings, you will find that the new settings do
not take effect until you have performed some action, such as opening a branch
of the tree. To see the effect of the filter change on a branch you are already
viewing, collapse and re-expand the branch.
Tags Support
CodeWright has support for CTags and other Tags-generating programs whose
databases conform to the standard Tags format. The file TAGS.C (in the CodeWright
SDK) contains the functions that support this capability, and also defines the
standard Tags file format.
A standard Tags database adds browse-like capabilities to an editor that knows how
to read and use the database. If you see the name of a function on the screen and
need to know what that function does, CodeWright Tags functions allow you to
jump directly to the original location in the original buffer.
Tags Setup
To get CodeWright to generate and use Tags databases automatically requires the
following steps:
1. Create a project whose members are the files you want to scan for your Tags
database. Refer to the chapter on Projects, Project Spaces, and Workspaces for
information on creating a CodeWright project.
2. Define which files will hold your Tags data -- your standard Tags database and
your compiled database for use with the Browser. There are two entries on the
Directories tab of the Project Properties dialog that store the name and location
of these database files. The entries are listed as Browser Database, and Tag
Database. If you are using the CodeWright compiled tags utility, be sure to
enter a filename in the Browser Database field that employs the .PTG extension
rather than .BSC to avoid having the .BSC file overwritten by the browser
database generator.
3. Select Build Tags from the Build menu.
4. Use the Browser or TagFind function.
the Browser File Open button and browsing for the file. You will then be able to
traverse a tree of your Tags database, search the database, and do queries for
functions and other objects (barring friend classes). You will only be able to query
definitions, however. References (caller/calling trees) are not stored in the Tags
database. For more information about the TagsW32 utility provided with
CodeWright, see Appendix A at the end of this manual.
Symbols Window
If CodeWright doesn’t display anything in the Symbols Window it is likely that the
symbol is not contained in the database. There are two reasons that a symbol may
not be stored in the database:
n The symbols parser(s) (regular expression) does not match the string.
n It is not the Definition of the symbol (CodeWright doesn’t display References or
other uses of the symbol).
If the symbol being displayed is only located in one file, the associated code is
displayed in the window. If there is more than one symbol in several locations, a list
of files containing those locations will be displayed in the Symbols Window. The
locations can be selected from the list by double-clicking on a filename in order to
open the file in the buffer editing area. The cursor will be positioned at the indicated
location.
Symbol Scanning
The Symbols Window conducts a detect scan on listed files after a 3 second idle
period for several reasons:
n To determine if any of the time/date stamps on the files in the database have
changed.
n To determine if any newly-created functions need to be added to the database.
n To determine if any newly-added project files need to be added to the database.
Only if it detects these changes, does it go ahead and start updating the database. If
the symbols scan detects a keystroke, it will interrupt its detect scanning and begin
again where it left off on the next scan. The symbols scanning and updating can be
disabled (see Symbols Database below).
Outline Window
The symbol parser icons that might display in the Outline Window are identified in
the following list:
C Function
C++ Function
Prototype
Include
Procedure
Class
String
Variable
Constant
Definition
Preprocessor
Struct
Unknown
A single mouse-click on the symbol of interest displays information for that symbol
in the Symbols Window. A double-click also moves the edit window to the defining
location. When you single-click on a symbol listed in the Outline Window, as
described above, the view in your current edit window is not modified. This allows
you to browse symbol references without losing your place. If you double-click on a
symbol listed under one of the loaded files, your view in the current edit window
moves to that location, in addition to listing references in the Symbol Window.
As you load files or change edit windows, the Outline Window lists all open buffers
as folders, and if the Auto Expand/Collapse button is depressed (described below),
automatically expands the view of the current buffer to show its matches. Double-
clicking on any of the listed folder icons will always expand the outline view, if there
are symbols to be displayed for the file.
The symbols displayed in the Outline Window are listed in the order in which they
appear in the source file. They can also be displayed in alphabetical order, by
clicking the Sort button, as described below.
There are two buttons at the top of this Outline Window tab:
n Sort alphabetically sorts the list of symbols in the window when the button
is depressed.
If you have all the parser check boxes for a particular file type marked, you might
experience a delay when opening or closing files because of the scan process. If you
do, try disabling the Auto-Expand/Collapse button in the Outline Window, or
disabling some of the parser types (see configuration section below).
Symbol Parsers
Symbols, as you recall, are any element of the code for which a parser has been
written. Typically, these are Functions, Classes, Macros and the like. Symbol Parsers
are Regular Expression patterns that parse code-elements matching an expression.
Patterns can be developed using the CodeWright's Search mechanism.
You can add Symbol Parsers by creating the proper Regular Expression pattern, and
inserting it in the Outline Parsers dialog (access by pressing the Symbol Patterns
button in Tools|Customize|Language|CodeSense). The online help in the Outline
Parsers dialog provides information on configuring each of the items in this dialog,
and provides some tips on creating Regular Expressions. Regular Expressions are
also described, under the topic Regular Expressions in this chapter. Files are scanned
using these parsers.
The new symbols should appear in the Outline Window when files of the
appropriate file type are opened in CodeWright.
Symbols Database
As mentioned, parsers used to match and display symbols are defined in the Outline
Parser dialog accessed by clicking the Symbol Patterns button in the
Tools|Customize|Language|CodeSense dialog. They are specific to the selected file
type extension. Any symbols that are parsed are subsequently stored in the symbols
database.
There are two check boxes that apply to the symbols database file defined in the
Project|Properties|Directories dialog. The check boxes are available when the
Symbol File field is selected. The check boxes have the following functions:
Objects Window
The Objects Window is a tab on CodeWright Project Window by default. It is used to
view and browse code. It displays a hierarchical view of C/C++, C# and Java
objects/symbols that are associated with the name you typed in the window’s
Identifier box. The objects in the hierarchy can consist of C/C++, C# and Java
classes, functions, data, macros, types, etc. as they apply to the language being used.
Each object-type has its own image, as displayed in the Filter/Legend dialog (see the
topic Filter/Legend Dialog in this chapter).
Objects Window
See the topic CodeSense in the chapter Editing and Printing for more information.
Choose the item Filter/Legend on the Objects popup menu to access the Filter/
Legend popup menu:
Filter/Legend Popup
Filter/Legend Dialog
One of the items on the Filter/Legend popup menu is Filter/Legend. It accesses
the Filter/Legend dialog.
Filter/Legend
The Filter/Legend dialog serves some of the same purpose as the Filter/Legend
popup menu, providing the same list of Objects filters. The dialog also provides
another set of filters labeled Access, that provide additional control over
Objects filters in the following ways:
n By filtering objects according to public, private, and protected access
attributes.
n By filtering objects that are non-members.
For example, if one wanted to see only public classes in the Objects Window,
they would mark the item Classes in the list of Objects filters, then mark the
item Public in the list of Access filters.
When using Objects and Access filters in the Filter/Legend dialog, keep in
mind the following:
n Marking or unmarking any of the Objects filters in the Filter/Legend dialog
will mark or unmark the same filter on the Filter/Legend submenu.
n At least one Access filter must be marked in order for any marked Objects
filters to display in the Objects Window.
n At least one Objects filter must be marked for any marked Access filters.
Otherwise the Access filters are meaningless, and objects will not display.
The desired attributes for both local and global bookmarks are selected in the
Bookmarks tab:
n When bookmarks are visible (i.e. Show visible bookmarks options are turned
on), a marker appears in the left margin of each line that has a bookmark. (As
described in the section Graphical Bookmark Images.)
n When prompting is selected, a prompt for an optional bookmark name appears
when a bookmark is dropped. This option only applies for bookmarks that are
dropped using the applicable key combination for the current keymap.
n If you want to save both named and unnamed bookmarks in the Bookmark
Database when a file is closed (during a session or at the end), be sure to mark
Save named marks in database and Save unnamed marks in database in the
Local Bookmarks and/or Global Bookmarks group.
n The options in the Mark Database section control how saved bookmarks are
maintained in a database for future sessions.
n The Save Current Position and Restore Current Position options save and
restore the cursor position as it was when the bookmark information was last
saved in the database. These positions are maintained in the Bookmark
Database. The 'current position' entries in the database are never deleted unless
Delete entries older than threshold is checked, in which case the current age
specification applies.
Bookmarks Window
The Bookmarks Window is a tab on the Project Window (by default). It gives a view
of local and global bookmarks defined in your documents. Clicking on a bookmark
in the window moves you to the bookmark's document and location. Right-click on
a bookmark in the Bookmars Window to change its name and/or location on the
Modify Mark Attributes dialog.
The contents of the bookmarks database, and other bookmark options are found/
accessed on the Bookmarks tab of the Tools|Customize|Environment dialog (refer
to the previous section).
Global Bookmarks
Global bookmarks are listed on the Bookmarks Window under the Global
Bookmarks heading, regardless of the document they are located in. The entry for
the global bookmark shows:
n The bookmark number,
n The bookmark name, if one was given,
n The name of the document in which the bookmark is found.
Local Bookmarks
Local bookmarks are listed in the Bookmarks Window under the name of the
document in which they are found. The entry shows:
n The bookmark number,
n The bookmark name, if one was given.
Double-click on the document heading to make it the active edit buffer.
Button Links
Button Links are special action buttons that CodeWright lets you embed in your text
files. You may use them to view bitmapped images, bring up related documents or
spreadsheets, run macros or just to make notes. To any other editor, it is still just a
straight text file, and because the buttons are placed in comments, source code files
compile as they normally would. Button Links are a navigational tool in that they
maintain the current position of the file while the link goes to a different position or
file.
How it Works
You select the type of link and the text that will appear in the button. CodeWright
uses this information to create an index entry for that text, and places it into the text
file with a special 3-character prefix and suffix. Comment prefixes and suffixes are
used as you indicate. The index entry refers to an entry in a database that indicates
what the button link does.
Defining Buttons
Button Links are defined in the Insert Link dialog, which is accessed by clicking
Insert Link on the Edit menu. Enter your button’s text (which must be unique),
select the link type, and enter the appropriate text to be associated with the button.
The nature of the associated text depends on which link type you select.
Differencing
CodeWright has a fairly sophisticated differencing feature that can be used directly
from within the editor; it is not an external application. The CodeWright
Differencing feature offers several advantages over other differencing utilities:
3 You can edit text files and undo changes in Difference Window documents
much as you would in a regular edit window by enabling Edit mode . Edit
mode also has additional toolbar buttons for moving text between and within
windows. When you edit a document, the edited part of the document is
automatically re-compared.
3 From View mode, press to open the file that has focus and jump to the cursor
position.
3 You can identify changes and problems faster in your non-text files (.exe., .gif,
.bin, etc.) by differencing on a byte-by-byte binary basis, rather than line-by-line.
3 The Difference Controls allow for easy navigation between differences.
3 Entire directories can be differenced at one time.
3 You can generate metrics reports summarizing the Text File, Binary File or
Directory differences.
Interleaved Differencing
The CodeWright Interleaved comparison merges two documents and places them
into a new, separate document that can be edited and saved apart from the original
documents.
Note: When the Interleaved option is marked, the Show Sections, Copy
Sections, Intraline, and Words options in the dialog will become
disabled (those options are specifically related to Side-by-Side
Differencing).
Do the following in preparation for using Interleaved differencing:
Note: These options also apply to Side-by-Side Differencing, described later
in this chapter.
Interleaved Document
The title displayed in the interleaved document will be a combination of the names
of the Target and Reference files.
Example: If two files, FOO1.C and FOO2.C, are being compared using the
Interleaved option, the title of the resulting interleaved window
would look something like: FOO1.C->FOO2.C
The resulting interleaved document contains lines from both documents:
n The lines that are the same in both documents will have normal coloring in the
interleaved document.
n Lines that have been added to the Target file will be preceded by plus signs (+).
Lines that have been deleted will be preceded by minus signs (-). The added
and deleted lines will also be displayed in different colors from each other and
the rest of the text.
n An exclamation point (!) will precede those lines that differ in white space only,
if options to ignore white space have been chosen.
Side-by-Side Differencing
The Side-by-Side Difference is shown in a separate tab of the CodeWright Output
Window (labeled Difference). Editing is allowed in the Side-by-Side Difference
Window (in Edit mode), with buttons provided for navigating differences.
View Mode
When you are presented with the Side-by-Side Difference Window, it is initially
in "view only" mode. This mode allows you to see the differences, but not to
change the contents of either document. You may go to a location in either
document and edit the file in the normal editing window, but this will not be
reflected in the Differencing window. The window can be changed to "Edit"
mode by clicking on in the Side-by-Side Difference Window's toolbar.
There are several additional buttons on the "View mode" toolbar that are worth
describing. The buttons are described next (in order, from left to right).
n The Go To File and Position of Text Cursor button loads the file from
the window in which the cursor sits into a CodeWright buffer. The cursor is
positioned at the corresponding location, preparing the file for direct
editing.
3 Press the far right arrow to jump to the last difference in the two
files. Double-click this arrow to move to the bottom of the files.
Edit Mode
Toggle to Edit mode to edit text files directly in the Side-by-Side Difference
Window. Edit mode allows you to edit and undo changes in Difference
Window documents much as you would in a regular edit window. Edit mode
also has additional toolbar buttons for moving text between and within
windows.
Note: When you edit a document, the edited part of the document is
automatically re-compared. When you insert lines into one side
of the Difference Window, "deleted" lines are inserted into the
other side to keep both views synchronized.
The Edit mode buttons are described next (in order, from left to right).
n The Save Changes button saves the changes made to the current
compared document.
When you give focus to the document on the left in Edit Mode, the status
line message File: Reference will display; for the document on the right, the
message is File: Target. If this message is followed by an asterisk (e.g. File:
Reference*), you have unsaved changes (e.g. you copied lines from one file
to the other).
To save those changes, give focus to the appropriate file (in the example
given, this is the Reference file) and press on the Difference Window
toolbar. Note that lines marked as deleted are not present in the saved file.
n The Copy Changes to Document button copies the edits in the current
Difference Window to the corresponding document.
n The New Deleted Line button inserts newly "deleted" blank lines in
both windows. You may wish to do this in preparation to shifting lines up
or down. Once again, add as many deleted lines as necessary. They will not
show up in the saved file.
n The Move Selected Lines Up button moves the selected line up one
line. If no lines are selected, the current line is moved. To use this button,
there must be a deleted line above, or the line shifted must be a deleted
line.
n The Move Selected Lines Down button moves the selected line down
one line. If no lines are selected, the current line is moved. To use this
button, there must be a deleted line below, or the line shifted must be a
deleted line.
n The Change to View Mode button toggles the window back to View
mode, as described in the topic View Mode, in this chapter.
left and right . They are used to view the various areas of difference
between the two documents.
3 Press the far right arrow to jump to the last difference in the two
files. Double-click this arrow to move to the bottom of the files.
Keystroke Shortcuts
There are three key sequences for moving back and forth between the two
panes of the Side-by-Side Difference Windows:
A Print button is available from the View mode of the Side-by-Side Difference
Window when both sides of the Window are in the same mode.
A modified Print dialog entitled Print - Side by Side Difference displays. Printing
the contents of the Side-by-Side Difference Window is similar to printing a regular
document in two-up mode, except that the left side will contain the Reference
document/file, while the right side will contain the Target document/file.
Differences between the documents are shown as follows:
n Lines that are "deleted" in one side will display as a minus sign only.
n Lines that are "added" on one side will print, preceded by a plus sign.
n Lines that are modified will be preceded by an asterisk.
To set this up, select Binary from the File|Difference submenu. The Binary
Difference Analysis dialog displays:
Choose the files to be differenced as you would Text files. Unique settings include
the following:
n Min. Bytes per Match: Select a value in the Minimum Bytes per Match field to
ignore between 3 and 16 matching sequences of bytes. Since some files have the
same small sequence of bytes thousands of times, the algorithm might have to
test millions of possible matches between those small sequences.
Pick a larger size to allow the difference operation to run faster, or a smaller size
for higher differencing quality.
n Columns per Line and Bytes per Column: These fields allow you to control the
format and width of the output lines on the Binary Difference Window. The
following image uses the settings shown above of 4 columns per line and 4 bytes
per column.
The functionality on the Binary Difference Window mirrors that of the standard
Side-by-Side Difference Window, except that Edit mode is not available.
Directory Differencing
Directory Differencing (also referred to as "tree differencing") allows you to specify
two directories for comparison. Use the Directory Difference Analysis dialog to
request directory differencing. To access the dialog, select File|Difference|
Directories, or right-click on the Difference tab of the Output Window and select
Difference Directories.
CodeWright takes each file in the Reference directory and searches for the same file
in the Target directory. Check the box Include Subdirectories to include all
subdirectories of the Reference Path and Target Path in the directory comparison.
Results from the Directory Difference Analysis dialog are displayed on the Tree
Difference Window (found on the Difference tab of the Output Window). You can
also run a Directory Difference Report that describes the results. Refer to the
following sections.
3 The Reference File (on the left) has been revised more recently than the
Target File.
3 The Target File (on the right) has been revised more recently than the
Reference File.
n Show Directories with No Files: Check the Show Directories with No Files
option to display subdirectories of the Reference or Target directory on the Tree
Difference Window, even if the subdirectory contains no files. This option is
disabled if you have elected not to Include Subdirectories in the directory
comparison.
Right-click on any file in the tree to see a file-level context menu. Select the menu
option Copy File to copy the selected file from one directory to another.
Press at the top of the Tree Difference Window to show or hide the directory
tree you generated on the Directory Difference Analysis dialog. When the
directory tree is hidden (the button appears raised), the files currently being
compared will expand to fill the Difference Window, revealing more of each file.
Use the Previous Changed File or Next Changed File button to display a
Side-by-Side Difference on the previous/next file with differences in the
directory tree.
All other toolbar buttons are the same as used for Side-by-Side Differencing.
Context Menus
When you right-click on the root node image at the top of a directory tree on
the Tree Difference Window, a context menu presents various options for
manipulating the tree directory display (Rescan Directories, Expand/Collapse
Subdirectories, etc.). You can also select/deselect the various “Show” options to
change the types of matches that are included in the tree.
When you right-click on a file within the directory tree, file-level options are
displayed on a context menu. You can Show Text Differences or Show Binary
Differences for the highlighted file pair, rescan the selected file(s), edit the
Target or Reference file, or copy the selected file to another directory.
n This small tree image indicates the root node. The text shows the
Reference and Target directories used in the Directory Difference. Right-
click on this tree icon to display a directory-level context menu.
n The file exists in both directories, with the file in the Reference
directory being newer. Double-click on the item, or highlight and press
E, to run a Side-by-Side Difference on the file pair.
n The file exists in both directories, with the file in the Target directory
being newer. Double-click on the item, or highlight and press E, to
run a Side-by-Side Difference on the file pair.
Metrics Reports
There are two dialogs that allow you to run reports reflecting various metrics for files
or directories being compared:
n Create Difference Metrics Report Dialog - Based on the last differencing
operation performed, run a metrics report for Text, Binary and/or Directory
differences.
n File Difference Metrics Dialog - Select files to difference, or specify a list of
directories to search, comparing any matching file(s) to the Target file. Use
additional settings to filter the report results.
n Right-click on the smaller tree icon in the Tree Difference Window and select
Create Report from the popup menu.
n Press Cr with focus on either the tree directory or one of the files being
differenced.
The Create Difference Metrics Report dialog displays.
You can generate reports in ASCII text (by default), or in HTML format. If you mark
Send to Browser, a temporary file is loaded into the browser; if you leave it
unchecked, you may view the report in the CodeWright HTML WYSIWYG editor.
Each report shows the filters used and summarizes the Text File, Binary File or
Directory differences found.
3 The Text File Difference Report includes the number of modified, inserted and
deleted lines, and summaries of section, line and character changes.
Note that the Modified (before) row indicates the number of modified lines in
the Reference file that contain code, comments or blanks, while the Modfied
(after) row indicates the number of modified lines in the Target file that contain
code, comments or blanks.
3 The Binary File Difference report quantifies sections that have been modified,
inserted or deleted, gives the size of each file in bytes, and indicates the number
of bytes that have been unchanged, modified or inserted.
3 The Directory Difference Report provides a summary count of changed files,
then details which files have changed between the Reference and Target
directories.
The reports are created by the API macros DiffTextReport, DiffBinaryReport, and
DiffDirReport, respectively, and can be modified by making changes to the macros
on the Tools|API Macros dialog.
This dialog allows you run the same metrics reports described previously, but adds
the following functionality:
n Reference/Target File: Allows you to enter or browse for Reference and Target
files to be compared in the difference report, rather than automatically using the
files compared in the last differencing operation. Also choose whether the
default names should come from the Current Document or History Entries.
Merging
The Merge Files dialog allows you to specify three files for merge/comparison, and
the name of the file that is to contain the merged changes.
The Merge process is typically used to compare/merge the original (Base) file with
two modified versions of the file (Revision 1 and Revision 2), probably made by
different people. The new file that results (the Output File) will combine the
changes made in both revisions.
Note: You must specify all four filenames to enable the OK button. If you
only have an original file and one revision, the filename specified for
Base and Revision 1 can be the same; only the changes made in
Revision 2 would then be taken into account.
Merge Output
The Merge function will alert you if it found any conflicts in the two sets of changes
it is merging. If no conflicts were reported, editing the file is probably not necessary.
Chances are, you will want to look it over in any case. When you do have conflicts,
you will need to know how to find them in order to resolve them.
Merge uses a series of ten dashes to separate the conflict area from the rest of the file.
This enables you to search for conflicts in your file using the regular expression
"^----------". This pattern will match ten dashes at the beginning of a line. Each line
containing a message from the Merge function will begin in this manner. You will
need to delete these lines after resolving the conflict.
Once you have resolved the conflict and deleted the message lines you are ready to
search for any further conflicts.
This may at once appear to be magic, but it is not. Compared to the Base File, the
Merge function will see one set of changes that removes the bug, and another that
adds other changes. Since the Base File and the Revision 1 file both contain the bug,
the file without the bug (Revision 2) will look like a change made to a single revision.
As such, the bug fix will quite likely be automatically incorporated into the resulting
file.
Format Source
For your C, C++, C#, Java, HTML and XML source files, CodeWright provides
functionality called Format Source (available from the Text menu). This allows you
to select a block of code and reformat it (this is also known as beautifying the code).
n For C, C++, C# and Java, selected code is reformatted based on a set of criteria
you have pre-defined on the Tools|Customize|Language|Format dialog.
n For HTML and XML files, selected code is reformatted based on standard
coding conventions for these languages. No additional formatting criteria are
defined on the Tools|Customize|Language|Format dialog.
Tools|Customize|Language|Format
Check Spelling
Click the Spell Check… option on the Tools pull-down menu to access the Check
Spelling dialog. Extensive online help is available for specific Spell Check options;
search for the online topic Spell Check. The dialog has four tabs, which are described
below.
Tools|Spell Check|General
There is also an API that allows the specification of additional characters that should
be considered alphabetic and therefore allowed in words. The API is
void SpellWordChars(LPSTR charSet);
For more information on CodeWright APIs, consult Help|CodeWright API Library.
For example, marking With Digits tells the spell checker to check the spelling of
words containing digits. However, it will only work if digits are first known to be
parts of words. Therefore, when With Digits is marked, either or both Leading
Digit and/or Non-leading Digit must also be marked on the Word Format tab.
Tools|Spell Check|Advanced
The Language Options section controls how the spell-checker processes words
when searching for them in the dictionaries. The options are:
Possessives are stripped from words with forms similar to the following:
Example: Bordeaux' = Bordeaux
Lions' = Lion
Children's = Children
Strip Possessives will only work if the following option or combination of
options is enabled on the Word Format tab:
3 Possessive Forms, or
3 Both Embedded Apostrophe and Trailing Apostrophe, or
3 Possessive Forms, Embedded Apostrophe, and Trailing Apostrophe.
Dictionaries Dialog
Clicking the Edit Dictionaries button in the Check Spelling Dialog accesses the
Dictionaries dialog. The Dictionaries dialog is used for adding and editing
dictionaries that will be used by the spell-checker. The Dictionaries dialog imparts
the ability to do the following:
n Designate which dictionary to use for certain documents.
n Transfer words between the currently selected dictionary and a text file using
the Import and Export buttons.
n Create new spell-checker dictionaries on the fly in the New Dictionary dialog
(accessed by clicking the New File button in the Dictionaries dialog).
Dictionaries
The Sentry Spelling Checker engine uses both text and compressed dictionaries.
Some dictionaries are contained in the \SPELLCHK subdirectory of the CodeWright
home directory. The text dictionaries are faster to access but they use disk space less
efficiently for the amount of words they hold. For the standard language
dictionaries, the text dictionary contains hundreds of short and commonly used
words. The compressed dictionaries contain 100,000 or more other words. Text
dictionary entries should be in alphabetical order and are editable using any text
editor.
For more information on CodeWright dictionaries and their use, refer to subtopics
under the index heading Spell Check in the online help.
Toolbars
Several default toolbars are available in Tools|Customize|Toolbars dialog. Marking
the Visible option for any highlighted toolbar on the Toolbars tab turns the toolbar
on. Other toolbar options on the Toolbars tab are:
n Hide when application is inactive: The toolbar is only visible when CodeWright
is the active application. This is usually desirable for free-floating toolbars.
n Always on top: Specifies that, when free floating, the selected toolbar or
window will not allow itself to be covered up by other applications or windows.
n Allow Docking: When unmarked, the selected toolbar or window is prevented
from docking. If you have decided to use a toolbar or window exclusively in
free-floating mode, this will prevent accidental docking.
A brief description of the toolbars and windows in the Toolbars dialog is provided
next.
Refer to the section Detaching Project Window Tabs in the chapter Run CodeWright
for the First Time for more information.
n Output Window: The Output Window tabs are turned on and initially docked
on the bottom of the CodeWright screen. The Output Window has seven tabs by
default (Output, File Find, Search 1, Browse, Difference, Shell, and Symbols);
these tabs display such things as compiler output and results from various
search operations.
3 You may detach an individual tab of the Output Window by left-clicking on
the tab and dragging it off the window, or by right-clicking on the frame or
title bar and selecting Detach tab. Output Window tabs are treated as
toolbars, and may be free-floating or docked, set to auto-hide, etc.. As such
they are listed individually on the Toolbars tab of the Tools|Customize|
Toolbars dialog.
3 Within Output Window tabs, you have the ability to double-click or [Enter]
on a specific output line to jump to that point in the referenced document.
3 In addition to the default tabs, look for additional Search tabs (Search 2,
Search 3, etc.), and options for the Perl, AppBasic Edit, ClipView and FTP
Manager tabs once they have been loaded on the Tools|Customize|
Libraries dialog.
3 You may also show or hide individual Output Window tabs by right-
clicking on the frame of the Output Window (outside of any tabs), and
marking/unmarking tabs on the Output tabs submenu. From the
submenu, you will again only see optional tabs if their DLLs have been
loaded on the Tools|Customize|Libraries dialog.
3 To determine the ID of an Output Window tab at any given time, use the
API function OutputQTitleID.
The Output Window is described in various chapters of this manual.
Auto-hide Toolbars
CodeWright toolbars can be optionally set to auto-hide when they are docked. When
auto-hide is turned on, toolbars appear only when the mouse hovers over the area at
which they are hidden.
Project and Output Window toolbars have a pushpin button in the upper right-hand
corner that indicates the auto-hide status for the corresponding side of the screen. If
the push pin is horizontal, auto-hide is ON; if it is vertical, auto-hide is OFF. You can
toggle the auto-hide setting for a particular side of the screen (left, right, top or
bottom) using this pushpin, or by toggling the Auto-hide Toolbar setting on the
Tools|Customize|Toolbars|General dialog.
When a toolbar is hidden, a border with a small black arrow appears where the
toolbar should be. Running the mouse over any part of the border causes the mouse
cursor to change to an image of a hand. If the mouse cursor is allowed to maintain
that shape for a brief moment, the toolbar will appear. The size of the hidden
toolbar ’s border can be changed by modifying the number for Auto-hide window
size in Tools|Customize|Toolbars|General. Mark Display Docked Toolbar Titles to
have the names of auto-hidden toolbars display in the hidden toolbar ’s border.
CodeWright then creates a new toolbar for you. At this point the toolbar is empty.
You will need to move it, dock it, etc. You will also need to add buttons to it. The
latter is covered in the next topic, Adding and Changing Toolbar Buttons. The toolbar
information is stored in the CWRIGHT.INI file.
There are several categories of buttons in the dialog, listed in the Category window.
The category User-Defined Tools includes buttons with no pre-defined function
bindings, to which you can quickly bind your function.
All bitmaps that are available in the dialog for the buttons come from the
CWDLL32.DLL. If you have your own bitmaps you would like to add, you will
need to go to the Tools|Customize|Libraries dialog and load your DLL
containing the images.
As each historical response is displayed, you will note that it is highlighted. If you
issue an editing command, such as [Home], [Ins] or [End], the highlighting
disappears and you are permitted to continue editing the response. Press E to
accept the edited response at anytime. If, when the response is still highlighted, you
type characters, the typing replaces the highlighted text. This allows you to easily
type in a new response, if the one you are looking for isn't in the history.
Many prompt histories are saved between CodeWright sessions by default. The
information is saved in the State file. For more information about CodeWright State
files, refer to the Configuration Files & Command Line Parameters chapter of this
manual.
Customizing Menus
This section describes how to edit standard menus, submenus, menu items and
popup menus.
Menu Editor
You can change, delete and add menus and menu items through the Menu Editor on
the Tools|Customize| Environment|Menu dialog.
The dialog lists Menus and Menu Items, as described in the following topics.
Menus
Menus are the top-most selections on the Menu bar. They contain items and
submenus. You begin your modification of the menu by selecting a menu from the
list on the left.
n Up/Down: These buttons allow you to change the position of the menu relative
to other menus. Up and Down refer to the position in the list box. Up moves
the selected menu to the left on the menu bar, while Down moves the menu to
the right.
n Add Menu: The Add Menu button/dialog lets you add a menu to the
CodeWright menu bar. You must provide a name for the menu, a helpful
message to display when the menu is selected, and, optionally, one or more
functions to initialize the menu. The initialization functions are responsible for
disabling or checkmarking menu items as necessary.
n Change Menu Attributes: The Change Menu Attributes button/dialog is like
the Add Menu dialog, except that the attributes for the selected menu are
displayed for editing. You cannot change the ID of a menu.
n Delete: The Delete button deletes the selected menu. You could delete all
menus, if you wish. You would then find that you are unable to add them back
interactively, once you leave this dialog. (You couldn't get the dialog back.) If
the worst happens, you can restore the original menu by editing the
CodeWright configuration file, CWRIGHT.INI. Locate the [Menu] section of
the file and rename the section, or delete all lines under that section heading.
Operating on Submenus
To view or modify a submenu, you must double-click with the mouse on the
submenu (marked with a plus) in the list on the right. The submenu then
moves to the list on the left and is marked with a minus sign. You may then
operate on it as you would a menu, adding, moving and deleting items as
desired.
This dialog shows you information about the selected menu item such as its ID in
Hex, the function bound to it, etc. Before you start customizing, you will find that
the existing menu items are bound to functions that begin with a lowercase letter.
You cannot access these functions directly. They require special menu handlers and
can only be called from a DLL.
To successfully change the functionality of a menu item, you must:
n Bind the menu item to a function that begins with an uppercase letter. Any of
the CodeWright API functions should work, or your own functions (or macros),
provided they have met the criteria to be recognized by CodeWright (see the
topic Exporting Functions in the appendix Making and Modifying CodeWright
DLLs).
n Check the small checkbox labeled Non-standard handler when binding
functions that do not have a menu handler. You must check this box, or
CodeWright won’t handle your customization, and your menu items won’t
work.
5. In the Menu Item Text field, enter the desired text for the menu item.
6. In the Help String field, enter text for the menu item’s tool tip.
7. In the Key String field, enter a keyboard shortcut for this menu item.
Note: Entering a key string in the New Menu Item Attributes dialog does
not make the key string work. It must first be defined in the
Tools|Customize|Keyboard dialog. To learn more about customizing
keystrokes, see the topic Reassigning Keys and Mouse Actions.
8. In the Handler Function field, enter the function binding, beginning with an
uppercase letter.
9. Check the box labeled Non-standard handler.
10. Press OK. CodeWright assigns the menu ID in hex to the new item.
Note: If you prefer to use keystrokes instead of menus, any menu item can
be bound to a keystroke. Refer to the topic Reassigning Keys and
Mouse Actions, in this chapter.
4. In the Command: edit box, enter the command or executable file that the menu
item should launch. Press the right arrow for a list of pre-defined macros; press
the Browse (…) button to search for executable files. Remember that
CodeWright will shell to DOS in the directory specified on
Project|Properties|Directories|Working Directory when executing your
command line, so you may need to provide the complete path.
3. In the Popup Menu Editor, click File|New to create a new menu, or click
File|Open Menu File to open an existing menu. If a new menu is being created,
a new, empty menu will be opened in the editor. If an existing menu is opened,
the existing menu will appear in the editor.
Note: When opening an existing popup menu for editing, the Open Menu
or Menu File dialog appears. The name of the menu description file
has to be specified in the File box, and the name of the menu (for
example [Utilities]) has to be specified in the Menu box.
2. Fill in the necessary fields in the Menu Item dialog. They are defined as follows:
n Menu Item Text: This is the text that is seen on the popup menu. Any
character in the text that is preceded by the ampersand (&) acts as a key
accelerator for the item. Press the key for that character while the menu is
visible to access the item.
Example: In the preceding image, the string Hexidecimal is used to label
the menu item.
n Execute Function: This is the function that will be used for normal menu
items. The functions are called when the menu item is clicked. Most
exported CodeWright functions can be used.
Example: In the preceding image, the function WinDisplayMode is
used to execute the menu item command, placing the current
document in hex mode.
n Gray Function: Indicates availability of the menu item’s function. When
the menu item is gray, the function is not available.
Example: The Hexidecimal menu item does not require a Gray Function.
An example of a Gray Function would be the Terminate item
on the Perl popup menu; it is gray when a Perl macro is not
running. When a Perl macro is running, the menu item is used
to forcibly terminate the macro. The following function is
entered in the Gray Function field:
would display .
Before creating or modifying popup menus in CodeWright, there are some things to
know about the semantics of the information contained in popup menu description
files. Refer to the following paragraphs for information about popup menu
semantics. Note that all of the items that follow are valid when used from within the
Popup Menu Editor.
#if testFunction
menu description lines
#elseif testFunction
menu description lines
#else
menu description lines
#endif
The <test function> element is a function, similar to a Check Function or a
Gray Function, whose return value is used to determine whether or not to
include the following <menu description lines> in the popup. The
conditionals may be nested to an arbitrary depth.
As a shorthand notation, if the <test function> begins with a left parenthesis,
the entire <test function> string is passed to MacroEvaluate. (This shortcut
applies to all entries requiring a function spec: Execute Functions, Gray
Functions and Check Functions.)
'Include' mechanism
Sometimes different popup menus have common elements and it is useful to be
able to define those elements once and use that description many times. This is
possible using a special menu item in one of three forms:
@file
@file[menuName]
@[menuName]
The first form specifies a file to be included in its entirety. The second form
indicates a specific menu description contained in the specified file. The third
form specifies only the name of a menu; it assumes that the menu is in the file
containing the menu description line.
*functionName
DlgMenuExec <section>
Where:
<menu> - If the name starts with ‘[’, it is assumed to be a section in the .MNU
file, otherwise it is the name of the file to use (no sections in file).
<section> - A normal CodeWright section to execute out of the .MNU file. Use
ConfigFileRead() to read out of other files.
Refer to the following example:
Example: The [Utilities] section of CWRIGHT.MNU can be bound to
S-right-mouse click through the following key binding
command:
KmapAssign=’<Shift-Mouse_right_click>’
‘DlgMenuPopup [utilities]’
Using Keymaps
The CodeWright editor is several editors in one. In its "standard" mode, the
CodeWright keymap uses the Common User Access (CUA) key-command set. If you
have ever used a Windows editor before, such as NotePad or SysEdit, you will find
that you can guess many of the basic key commands. This command set offers a
number of shortcut keystrokes to bypass menus and perform various other tasks.
In all, CodeWright ships with six keymaps. The command sets are usually chosen at
the time of installation, but they can also be switched on the fly in the
Tools|Customize|Environment|Keymap dialog. Command sets may be selected
from the following choices.
n Microsoftâ Visual Studioâ .NET
n IBMâ CUAâ command set
n CUA (CodeWright 4.0)
n Borlandâ BRIEFâ command set (emulates the BRIEF editor, from Underware)
n vi command set (emulates the vi editor found on UNIX systems)
n Lugaruâ Epsilonä command set (emulates the Emacs-derived Epsilon editor
from Lugaru)
You can modify the functions that are executed when a keystroke is pressed using
the Tools|Customize|Keyboard dialog (see Binding Keystrokes to Functions or Macros).
Further discussion of the CUA and BRIEF command sets follow.
If you are familiar with CUA commands, you may doubt that CUA commands would
be easy to associate, and some commands are not. (It's hard to associate anything
with H$, you just have to memorize it.) You will find, however, that most
commands of this variety have a more memorable equivalent.
Mouse Commands
You can probably guess most of the things that you can do with a mouse in
CodeWright: click on menus, select text and so on. There may be a few things that
you wouldn't guess you could do with a mouse, and other things that you might
suspect you could do but do not know how. It is those things that are covered in this
section.
In some cases, the space available to move the mouse beyond the window edge is
limited, e.g. full screen mode. CodeWright provides some methods for gaining
control over scrolling speed in these cases. Control is gained via the C, S, and
A keys, under the following conditions:
n If none of the keys are pressed, scrolling speed is the default.
n If one of the keys is pressed, scrolling speed is twice as fast.
n If two keys are pressed, scrolling speed is four times as fast.
n If three keys are pressed, scrolling speed is 8 times as fast.
Closed Selections
You may elect to have selections that you make with the mouse be either closed or
open when you release the mouse button. A closed selection means you will not
change the selection size or shape when you move the cursor. Your keymap dictates
the initial setting for this option; you can change the initial setting with the Leave
Mouse Selections Open option on the Tools|Customize|Environment |Keymap
dialog.
Selections made with key commands are usually open; one end of the selection is
defined by the cursor position, and the selection moves with the cursor. Your
keymap may have a command to toggle a mouse or other selection open or closed.
Example: In the BRIEF-compatible keymap, toggle the selection open or
closed using the Fa command.
In the CUA keymap, toggle the selection open or closed using the
F. command.
To expand a closed selection, move the cursor to the new endpoint desired, and use
the applicable key command to toggle the selection open.
Note: The distinction between closed and open selections is not
meaningful in the CUA keymap unless you have turned on
persistent selections. Otherwise, CUA removes the selection,
whether closed or open, whenever you execute a cursor motion
command.
Column Marking
To make a column selection with the mouse, just click and drag with the right mouse
button instead of the left. Column blocks are always inclusive, regardless of which
keymap you are using.
Line Selections
There is an adjustable margin between the left edge of the buffer and the window
border. You can use this area for making line selections:
n Click with the mouse in this space to select the line to the right.
n Click and drag the mouse to select a series of lines -- even if the mouse happens
to stray from the margin.
Action Description
Next Message Have CodeWright process the next Build error message by
right-clicking in the message box at the left of the status
line.
You can also display a progress indicator on the status line to show the progress of
CodeWright operations. Use the SYSPROG_STATUSBAR flag within the API function
SysProgressStartEx to enable this functionality. More information on this function is
indexed under SysProgressStartEx in Help|CodeWright API Library.
n To move text between windows, complete the steps above but press S as
you drag. Be sure to click and hold the mouse button before pressing the S
key. Then drag and release the text.
n To perform a copy operation, complete the steps above, but press the F key
when you initiate the operation.
n To cancel a drag and drop operation after it has been commenced, move the
mouse cursor back over the selection and release the mouse button. A selection
cannot be copied or moved onto itself. The operation is then cancelled and the
selection removed.
n To disable text drag and drop, deselect the Drag and drop text with mouse
option on the Tools|Customize|Environment|General dialog.
If you already have files loaded in CodeWright, the files you drag and drop onto
CodeWright will be added to those already being edited:
n A window is created for each of the files dropped onto CodeWright if you have
checked the box One document per window on the Tools|Customize|
Environment|General dialog.
n If windows are not created, the window that was current will contain the first
file of those dropped.
Keymap-Specific Assignments
Now that you learned about CodeWright keymaps and mouse commands, you are
ready to make assignments specific to your keymap. Your main tool for doing this
will be the Assign Keys dialog. Keys can be modified using CodeWright API
functions, keystroke macros, AppBasic, Perl, or API Macros, or your own functions
from custom DLLs. Remember that custom functions need to be exported with a
LibExport call in the DLL’s _init function in order for the key assignment to work.
Otherwise, a “function not found” message will appear in the CodeWright status bar
when the keystroke is pressed. Refer to the appendix on Making and Modifying
CodeWright DLLs for more information on custom DLLs or Add-Ons.
If you are not happy with the way a certain operation is performed within a
keymap, you may want to try that operation in another keymap. (Select
Tools|Customize|Environment|Keymap and change the keymap selection for
testing purposes.) If you find that another keymap has a function that works more
appropriately, you can use it to replace the original keymap’s function. The change
is made in the Tools|Customize|Keyboard dialog. See Binding Keystrokes to
Functions or Macros, later in this chapter.
Keystroke Recording/Playback
Keystroke macros consist of a series of keystrokes that can be run sequentially as a
unit. The following sections describe how to make keystroke macros in CodeWright.
Note that keystroke macros are limited to actual keystrokes (mouse clicks won't be
accepted) and keystrokes entered into Windows dialog boxes cannot be recorded.
Saving a Macro
The Keystroke Macros dialog is used to create, edit, save, and delete named
keystroke macros.
Once the keystroke macro has been saved with a name, it can be used from the
CodeWright Tools|API Command dialog, or bound to a keystroke, button, or menu-
item simply by typing the name of the macro in the appropriate place. Named
keystroke macros can also be used in CodeWright AppBasic macros, Perl macros,
and API macros. For more information on macros, see the chapter on Extend
CodeWright.
2. Click the Functions Assistant arrow (just beneath the keyboard graphic) and
select the desired category of functions or macros. The selected category will
now display on the Assign Keys dialog. For example, select Functions.
3. If desired, use the Filter Combobox to further reduce the list of functions
displayed in the Functions combobox. Use either of the following methods:
n Enter characters, such as buf, to show only functions beginning with those
characters (e.g. BufEditFile, BufInsertChar).
6. Press the Assign button to complete the key assignment shown, and press OK
to exit the Assign Keys dialog.
Tools|Customize|Environment|File Options
Tools|Customize|Environment|Backup
The default backup specification, %b.bak dictates that the backup file be
made in the same directory as the original file, but bearing the extension
.BAK. Press the arrow at the end of the Global Backup Spec field for a
drop-down list of additional specification options; click on an item in the
list to automatically insert it in this field. The backup specification is only
used when backups are enabled. Refer to the topic Formatting the Backup
Specification, in this chapter, for more information.
n Auto-save Enable: Check this box to access options related to the auto-save
feature. This feature periodically saves changes to disk to avoid the
substantial loss of data that could otherwise result from a power outage or
other minor catastrophe. Normally these saves are performed using a
filename other than the original. This allows you to determine when you
are ready to overwrite the original file. You can have the auto-save feature
make saves based on elapsed time, keyboard inactivity, or both.
n Overwrite auto-save files without prompting: If Auto-save detects a file of
the same name as it wants to use, it checks to see if it is a file that it created
during the current session. If it is not, CodeWright prompts you before
overwriting. The file may not be an auto-save file at all, or it may be an
auto-save file from a session that terminated abnormally. In these cases,
you may wish to retain the file. On the downside, if you are not present to
respond to the prompt, the file will not be auto-saved. This checkbox
allows you to specify that the file be overwritten regardless of its origin
without prompting.
n Store Auto-save Options in Project File: Check this box to store auto-save
settings with the project that is currently open. If the box is checked but no
project is open, the selected options are stored as default settings for use
with future projects.
n The Destination section offers four options for controlling the directory
and file extension to be used for auto-saved files. Descriptions of the
options are as follows:
3 Use file's directory, save file.x as 'file.x_~' : Auto-saved files are saved
to the same directory as the file being edited. A tilde is used as the third
character of the extension. If the file being edited has only one
character in its extension, an underscore is used as the second
character of the auto-save filename.
Tools|Customize|Language|Options
2. In the Customize dialog navigation tree, highlight the extension of the desired
file type.
3. In the Backup spec field, enter a string that dictates how the name of a backup
file should be derived from the original filename. The default backup
specification, %b.bak dictates that the backup file be made in the same directory
as the original file, but bearing the extension .BAK. The backup specification is
only used when backups are enabled (the Make backups box is checked).
Refer to the topic Formatting the Backup Specification.
3. In the Document List box, select the document whose settings you wish to edit.
4. Check the box Make backups.
5. In the Spec field, enter a string that dictates how the name of a backup file
should be derived from the original filename. The default backup specification,
%b.bak dictates that the backup file be made in the same directory as the original
file, but bearing the extension .BAK. (Refer to the following topic, Formatting the
Backup Specification.)
Backup locations and the filenames used are controlled with formatting strings.
Formatting strings contain format controls and transformation patterns that tell
CodeWright how to deal with file names that are as yet unknown. Format controls
begin with a single percent sign ( % ). Any other text is treated literally.
Important: It is possible to specify a format that will result in an illegal filename.
CodeWright does not attempt to ensure that the resulting filename
is legal. When you attempt to backup the file, an error will occur,
just as if you had specified an illegal filename for saving a file.
Format Controls
The format controls available for use in backup formatting strings are listed in the
table below. Note that optional portions of these format controls are enclosed in
italicized square brackets. Examples are based on the output file C:\SRC\FOO.BAR:
You supply the pattern in two parts: the override pattern and the fill pattern:
n The override pattern specifies characters, each of which replaces characters at
the same position within the original root or extension string. The override
pattern also may limit the length of the resulting string.
n The fill pattern specifies characters to fill empty positions within the root or
extension string.
A single vertical bar ( | ) separates the override pattern from the fill pattern. If you
are supplying only the override pattern, you may omit the vertical bar. Supplying
only the fill pattern is pointless, since the resulting string will be empty.
The rules are the same for using transformation patterns, whether you are using
them on the root of a filename or its extension. There is one noteworthy difference
in their result, however. After the transformation is performed on an extension, the
resulting extension is examined. If the extension is not null, a dot is added to the
beginning of the extension. This is true whether or not the original extension was
null.
Override Pattern
There is a character in the override pattern for each character in the resulting
string. The character at each position may be either a valid filename character,
or a question mark ( ? ).
n If a filename character is specified, the specified character replaces the
character in the original string.
n If a question mark appears at a given position in the string, the character in
the original string is used.
n If no character appears in the override pattern for a given position (i.e., the
root is shorter than 8 characters or the extension is shorter than 3), the
resulting string is truncated at that position, even if you have supplied a fill
pattern.
Fill Pattern
The fill pattern may contain only valid filename characters. The character at a
given position in the pattern is used in the resulting string if that position in the
original string is empty (i.e., the original string is shorter than the fill pattern)
and a question mark is specified by the override pattern.
Transformation Pattern
Tools|Customize|Language|Options
2. In the Customize dialog navigation tree, click and highlight the extension for
the desired file type.
3. In the Document Options group, check the box Read-only. Files of the specified
type may not be edited, unless this setting is overridden on the Document/
Window Manager|General dialog, or the File|Open dialog.
Individual Files
To make an individual file read-only, complete the following steps.
1. Select the Windows item on the Window menu.
2. Choose the General tab.
File|Open
2. Browse to find the file you wish to open and click on the filename.
3. Check the box Open as read-only.
Creating Profiles
Profiles allow you to save a group of settings for subsequent connection to a
particular remote server. Logging in with a pre-defined profile saves time and effort
each time you launch an FTP session.
To create a new FTP profile, press the Connect button on the FTP Manager tab to
display the FTP Login dialog.
To create a profile:
4. When you are satisfied with the profile, press the Save Changes button to
add it to the Profiles list for future use.
n Press the Quick Connect button and select the desired profile from the drop-
down list. Your current profile will be checked.
3 If you checked Save Password when creating this profile, the system will
now attempt to log you into the remote host.
3 If you did not check Save Password, the FTP Login dialog will display with
the profile selected. Fill in the appropriate password and press Connect.
n Press the Connect button to display the FTP Login dialog. Select an existing
profile, make necessary changes (if any), and press Connect.
If you wish to log in to a remote server without using a profile, complete the
following:
1. Press the Connect button on the FTP Manager tab to display the FTP Login
dialog.
2. Press the New Profile button and answer No to the prompt to clear the fields
of any existing information.
3. Complete the FTP Login dialog as desired, and press Connect.
3. Use the Test Upload (Test Put) or Test Download (Test Get) buttons to
quickly preview what will happen when you begin the Put or Get operation.
4. When satisfied, proceed with the Upload (Put) or Download (Get). If you
wish to open downloaded files in CodeWright automatically, press to
download instead.
5. When the desired transfers are complete, press to disconnect from the
remote host, ending the FTP session.
n Put file(s) using base path: Transform the filename of each selected file in the
Local Files list using both the Local Base Directory and the Remote Base
Directory from the current profile, sending the file (using the resulting filename
and path) to the remote server.
n Receive Current Document: Press this button to get the latest copy of the
current file being edited from the Remote Base Directory specified in your
profile for this FTP server, if it exists. You will be prompted to log in first if you
are not connected.
n Send Current Document: Press this button to send the current file being
edited to the Remote Base Directory specified in your profile for this FTP
server, or to the root directory of the remote server if no Remote Base Directory
has been defined. You will be prompted to log in first if you are not connected.
n Receive Current Document with Path: Press this button to transform the
filename of the current file being edited, using both the Local Base Directory
and the Remote Base Directory specified in your profile for this FTP server. You
will Get the latest copy of the file you are editing from the remote server, using
the resulting filename and path. If you are not connected, you will be prompted
to log in.
n Login to Host: Press this button to display the FTP Login dialog.
For more information on specific buttons and fields, refer to the topics FTP: Manager
and FTP: Login in the CodeWright online help index (Help|Contents and Index).
The CodeMeeting tab is divided into four sections: a non-dockable toolbar, a Buddy
List, a Chat Window and a Chat Input box.
There are splitter bars between the Buddy List and Chat Window, and between the
Chat Window and Chat Input box, that become active when you move the mouse
cursor over them. These splitters allow you to resize the three windows.
you are in control). When the option is unchecked (default), you must press
each time you wish to start sharing a document.
n Show remote presence changes: Check this option if you want to know when
other users become available during your session (their names will be displayed
in boldface in the Buddy List).
n Beep when chat messages arrive: Check this option to have an audible
indication that a chat message has arrived from a connected user (if CodeWright
is active).
User Maintenance
Press the User Options button or right-click within the Buddy List to display a
popup menu of user-related items.
n For a user on your local area network, the Computer Name and Port Number
are usually sufficient information to make a connection. The Port Number you
enter for a remote user must match the one he has selected for his own in order
for you to initiate a connection with him. The default Port Number is 55555.
n If the other user is not on the local area network, enter the IP address of that
person’s machine (e.g. 192.111.111.11), along with the Port Number that person
has chosen for his own.
Note: If two users are on different local area networks (LANs), they will
probably need to take one of the following measures to establish a
connection, due to the fact that LANs are usually connected to the
Internet through a firewall:
3 Have the computer that receives the request for connection be
connected directly to the Internet (with no firewall).
3 Before making a CodeMeeting connection, have the computer
outside the LAN establish a virtual private network (VPN)
connection to the LAN of the other user.
n The Screen Name is the name that identifies a user in the Buddy List and Chat
Window on other connected users’ systems.
Deleting a User
To delete a user from your Buddy List, right-click on the user name and select Delete
User, confirming your decision at the prompt.
Press to make yourself available for connection. When users are available, their
names appear in a bold font in the Buddy List. The state of this button is saved
between sessions to allow users to automatically be available whenever CodeWright
is running.
Notes: To have CodeMeeting update the status of other users when they
become available during a session (making their user name bold in
the Buddy List), select the option Show remote presence changes on
the CodeMeeting Configuration dialog.
Creating a Connection
To create a connection, complete one of the following:
n Highlight the user ’s name in your Buddy List. Right-click, or press , and
select Make Connection.
When the button is depressed , the selected user is connected and the word
(Connected) follows their user name in the Buddy List.
If CodeWright is not the active application when a connection request (or chat
message) arrives, the CodeWright title bar and Windows Taskbar will flash, and a
balloon will pop up at the lower-right hand portion of your monitor. Click on the
balloon to dismiss it and activate CodeMeeting.
Press to indicate that you are away from your desk for CodeMeeting purposes.
The message “Away from desk” will be appended to your user name in the Buddy
List of each connected user.
Sending Messages
Once you have connected to one or more users, use the CodeMeeting “chat”
functionality to carry on an interactive, real-time conversation online. Note the
following:
1. Type each message in the Chat Input box at the bottom of the CodeMeeting tab,
and press or [Enter] to send the message. Your user name and the text of the
message will then display in the Chat Window.
2. Look for responses in the Chat Window, preceded by the sender ’s user name.
Note: Remember that the color of chat messages, user names, etc. is
controlled by the View Theme you select on the CodeMeeting
Configuration dialog.
List and de-select the Broadcast button . The word "private" and the selected
user's name will display after your user name for each transmission to indicate that
you are having a private conversation.
3 If you do not have a user selected when you initiate a private chat, or the
selected user is not available, you will be prompted to choose a user name on
the Pick a Connected User popup dialog.
If the Broadcast button is depressed (the default), your message will be broadcast to
all connected users.
Sharing Documents
CodeMeeting gives you the power to share documents with multiple CodeWright
users. Grant other users the ability to view or edit the current document in your
CodeWright edit window, or review their files on your machine. Document sharing
works for any remote or local user to whom you can make a successful connection.
If you are sharing another user ’s document, note that its title is followed by
“CodeMeeting” and the name of the document’s owner to remind you that the
document is being shared.
Press to begin or end sharing for the current document. If the button is
depressed, it indicates that the current document is shared; the document name is
shown beneath your user name in the Buddy List of all connected users.
Another user ’s document name can be preceded by one of the following icons:
3 The icon indicates that the shared document is available, but not currently
open.
Press again to end sharing; the document remains open only on your machine.
A non-owner can begin sharing a document by clicking on it in the Buddy List. The
non-owner presses to end sharing for the current document on their own
machine. The document will still be listed in the Buddy List, but closes on the non-
owner ’s machine.
Editing Control
Press to request/grant editing control of the document you are sharing.
When you request control, a dialog may appear on the other user ’s machine
allowing him to accept or decline releasing control (provided the other user has
marked Prompt before allowing remote editing on the CodeMeeting Configuration
dialog).
If the button is depressed, you have editing control. You can then press again to
grant control to a remote user (they will be notified by a message in the Chat
Window).
3 If you do not have a user selected when you attempt to grant control of the
current shared document, or the selected user is not available, you will be
prompted to choose a user name on the Pick a Connected User popup
dialog.
Per-Document Basis
Control over editing is on a per-document basis. The document owner has
initial control. To the user who has control, shared editing is just like normal
editing. Changes will be reflected on the systems of all users who are sharing
the document.
Reloading a Document
The document owner can invoke File|Reload to reload their file and abandon
another user ’s changes. Conversely, a non-owner who has made changes to a
file cannot reload the file to abandon their own changes.
Press to follow along when the selected user shares documents and switches
between them.
If you do not have a user selected when you press this button, or the selected user is
not available, you will be prompted to choose a user name on the Pick a Connected
User popup dialog.
Press to follow along within the current document when you are not in control
of editing. The document and its attributes will change to match those of the user
who has the control. All users who have locked the document see the same display
mode (i.e. normal, hex, wrapped, and selective display), invisible lines, current
position and any selection within the document.
If the button appears unlocked , you are free to view the shared document as
you wish.
Swap Blocks
CodeWright uses swap blocks to manage the memory allocated for an open, active
file. CodeWright is fairly conservative about the amount of memory it initially
allocates (100 8K blocks). When all of the swap blocks initially allocated are used up,
CodeWright starts swapping to disk. If you regularly work with large files, and you
have plenty of memory available, you should consider increasing the number of
swap blocks used by CodeWright.
Example: The default for swap blocks is 100 8K-swap blocks. You may want
to try increasing this (the maximum is 8192).
As block sizes increase, the speed of some edit operations may change somewhat.
Backup Files
You may not wish to have CodeWright make backup copies when working with very
large files. In most cases this can be both a waste of time and disk space.
To turn off backups for a specific file type, complete the following steps:
1. Choose the Tools|Customize|Language|Options dialog
Tools|Customize|Language|Options
2. In the Customize dialog navigation tree, select the file type(s) for which to turn
off backups.
3. Unmark the box labeled Make backups in the Document Options group.
Scroll Bars
To edit large files as soon as you load them, turn off scroll bars. It is too late to turn off
scroll bars after you have loaded the file, so you will want to make No Scrollbars the
default. To do this:
1. Select Tools|Customize|View Themes|General.
2. In the Window Attributes group, make sure that the Vertical Scrollbar and
Horizontal Scrollbar boxes are unchecked.
3. Click OK.
Pre-loading Files
When CodeWright pre-loads files, it loads the file completely into virtual memory,
which can slow things down if the file being loaded is fairly large. There are two
options that enable the CodeWright feature for pre-loading files. Make sure the
options are not marked if you want CodeWright to handle large files more efficiently.
To disable the preloading options:
1. Select the Tools|Customize|Environment|File Options dialog.
Tools|Customize|Environment|File Options
2. In the File Loading/Reloading section, make sure the options Preload file on
open and Preload non-local files on open are unchecked.
Tools|Customize|Language|Coloring
The File Rewrite Save Method offers the following advantages when saving large
files:
n Space normally needed for the temporary file (foo.000) is no longer required.
This minimizes the amount of memory needed when opening the file.
n Since the File Rewrite Save Method only writes out the changes made to the file
(as opposed to rewriting the whole file), the portions of the file that haven't
been modified won't be rewritten, reducing the time needed to save the file.
CodeWright extensibility tools consist of three macro languages (Perl, AppBasic, and
API Macros), and CodeWright DLLs that can be loaded interactively from the
Tools|Customize|Libraries dialog. The tools are provided in the event that
CodeWright doesn't already have the necessary functions for handling the task at
hand. They can be used together (i.e. a macro that uses a function from a DLL or
another macro, or vice versa), or on their own.
3 The advantage of using macros is that they can be used on the fly, without the
added complexity of compiling.
3 The advantage of using DLL Add-Ons is that they are more flexible, and can be
written in any programming language that is capable of creating DLLs.
This chapter first describes some of the more technical aspects of using the
CodeWright API from the Command Key. It then goes into detail about Perl,
AppBasic, and, API Macros. Finally, it provides some details on creating a keymap
command set. For information on DLLs, refer to Appendix B - Making and Modifying
CodeWright DLLs.
The assumption going into this chapter is that the user has some familiarity with
CodeWright. In particular, it is assumed that there is some familiarity with the
CodeWright API, and the methods used to assign API functions to keystrokes,
buttons, and/or menu items.
CodeWright API
CodeWright has a multitude of API functions that can be used interactively from
within the interface (i.e. from Tools|API Command, or attached to menu items,
buttons, or keystrokes). APIs can also be used in custom macros and DLLs designed
for extending CodeWright. Various chapters in this manual have discussed the
process of using APIs from within the CodeWright interface.
To use the CodeWright API, you need to at least know the name of a function you
want to execute. The online help (Help|CodeWright API Library) is the place to
learn more about the CodeWright API and specific functions.
If you are trying to avoid learning any more about the CodeWright API than you
have to, make sure you have checked various dialogs and menu entries to see if what
you are trying to do can be done through a menu.
Here is an example of how such a command might look, just before sending the
command off for processing:
?BufQModifiedCount
When the return type is a numeric value, CodeWright displays that number on the
status line in both decimal and hexadecimal notation. If the return type is a pointer
to a string, CodeWright displays the contents of that string.
The example below begins an inclusive selection, using one of the labels listed in the
online help:
n MarkBeginSel( SELECTION_INCLUSIVE )
Operator Operation
( ) Grouping
- Unary Minus
~ Bitwise Complement
! Logical NOT
/ Division
* Multiplication
% Modulus
- Subtraction
+ Addition
== Equivalence
!= Non-Equivalence
^ Bitwise Exclusive OR
| Bitwise OR
|| Logical OR
A Macro Language provides a method for creating macro source code, which may
contain control structures and variables. Macros are normally interpreted at
runtime. CodeWright has three macro languages for extending its program.
The following table describes some pros and cons for the languages. The languages
themselves are discussed in the sections Perl, AppBasic, and API (C-like) Macros.
Perl Macros Perl, along with JavaScript, is perhaps the most popular
language for writing extensions to web pages. The
syntax is similar to C or AWK, but it has many built-in
features for the Internet.
Perl is least suitable for writing simple functions for
assignment to keys because of the time it takes for the
interpreter to initially load. It does, however, allow Perl
programmers to program in a familiar language, using
familiar extensions and libraries. The CodeWright
version of Perl is based on the Gnu-released Perl
interpreter. You'll find it on a tab of the Output
Window (by default) once you have loaded the
appropriate library.
Where is it Defined?
Once an extension has been created (whether the extension is a macro or a DLL),
there is an opportunity for confusion as to exactly where the function being executed
is coming from. It could be a CodeWright built-in function, a CodeWright DLL
function, an AppBasic macro, a Perl sub, a keystroke macro or an API macro. The
command LibFunctionExistsWhere() helps resolve the ambiguity.
Function Response
BufQCurrentLine Built-Ins:BufQCurrentLine
DlgPrint cwdialog:DlgPrint
MyPerlFunc cwPerli:myPerl!MyPerlFunc
_jav_init _jav_init->cwstart:_java_init
The last example shows the response where a replacement function exists. The Perl
example shows that both the Perl script filename and the sub name are given. For
non-LibExported functions, i.e. those connected by responding to
EVENT_LIB_EXISTS_FAILED and EVENT_LIB_EXEC_FAILED, the 'where' string
is supplied by the responder to a new event EVENT_LIB_EXISTS_WHERE.
Perl
This section describes the CodeWright Perl macro language.
There are two useful ways of looking at a Perl script. One is to look at Perl as an
entity that may be executed in its entirety to perform the task specified by the
operations of the script. Another way of looking at the script is as a collection of
macros, each subroutine being a macro in its own right. Using Perl with
CodeWright, you can make use of CodeWright custom facilities that reinforce these
views as needed. They are described under the topic Loading and Running Scripts.
If you have not already installed a command line version of Perl, we have included a
copy of the ActiveWare 3.15 build of Perl 5.0 for Win32, PW32I315.EXE in the
\PERLW32 directory on the CodeWright CD.
The CWP.DLL is a Perl extension module that provides access to CodeWright API
functions from within Perl scripts. In general, you can use any of the CodeWright
API functions listed in the online help, except for those whose data types are
incompatible with Perl. For a list of available CodeWright API functions, see the
contents of the CWP.PM file.
Perl scripts are usually packaged in text files bearing a .PL extension. A Perl script
consists of a 'main' section, and zero or more subroutine definitions. The main
section is defined as any code not contained within subroutine definitions.
Example: The following Perl macro contains everything in its main section:
use CWP;
$filename = CWP::BufQFilename;
$filespec = "%p%r%e";
$newname = CWP::TransformFilename($filename,
$filespec);
$newname =~ tr/\\/\//;
$newname =~ tr/A-Z/a-z/;
CWP::LibFunctionExec "SetStringMacro(UNIXFILE,
$newname, 0)";
Perl Window
The Perl tab on the Output Window acts as a virtual console for the Perl interpreter.
That is, it replaces the stdin, stdout, and stderr devices. You can scroll through the
output of Perl scripts in this window. There is a limit on how many lines of output
will be retained in this window. The default is 100 lines. You will find this setting in
the Tools|Perl Macros|Properties dialog.
You can find the settings for these colors on the Tools|Customize|View
Themes|Colors dialog, for the View Theme labeled “Output Window”.
The Properties item on the popup menu brings up a dialog that lets you control how
Perl interacts with CodeWright. This is where you specify options you would
otherwise provide to Perl on its command line, when invoking it from the shell
prompt.
There are a variety of choices from which to select an input source and output
destination including the Perl Window, the current buffer, the clipboard, the current
scrap buffer, and the current selection.
Input source and output destination can also be set from within a Perl Script. See the
file UPCASE.PL in the \MACROS subdirectory of the CodeWright installation
directory for an example of how this is done.
Online Help
The Perl Manual by Larry Wall is supplied in online form, in the help file PERL.HLP.
The topics in this file are part of the CodeWright standard help system. This means
that you can get Perl function help by placing the cursor on the name of the function
and pressing C!. You can also press ! with the cursor in the Perl Window to
get other Perl help.
In both of these cases, you may include additional 'command line' parameters. All
text following the syntactical elements shown in the two commands is broken down
into 'parameters' using normal CodeWright command line parsing rules, with
respect to spaces, quotes, escapes, etc.
If you just want to execute a simple Perl script that can be typed in one line use:
PerlExecStr 'Perl-string'
These commands will load the script, execute it, and unload it automatically.
You'll need to use the CWP:: prefix on CodeWright functions to reference them,
unless you take further steps (described later). This prefix tells Perl that the
following function name is present in the CWP module. As an example, to find out
where the cursor is on in the current document, you could use the CodeWright
BufQCurrentLine API in the following manner:
$line = CWP::BufQCurrentLine();
Constants that are held in the CodeWright lookup table can be accessed using a
special function. For example, to see if there is a column selection present you could
use:
if (CWP::MarkQSelType() ==
CWP::CWConst("SELECTION_COLUMN"))
{
}
A special function is also provided to execute any built-in or any function made
available through LibExport. This function is similar to the CodeWright API function
LibFunctionExec. An example follows:
CWP::CWExec("ConfigFileRead", "[Editor]", 0);
This is equivalent to:
CWP::LibFunctionExec("ConfigFileRead [Editor] 0");
The primary difference is that in the latter example, the string will be parsed to
separate it into parameters to be passed to the function. In the former, the
parameters are explicitly segregated.
When running a script in debug mode, there are three important requirements:
n You should only use debug mode when invoking scripts with PerlExec on the
API command line.
n The script must not already have been loaded by CodeWright prior to using the
PerlExec command (meaning the script cannot be loaded from the Interpreters
box or by the Tools|Perl macros...|Load macros... popup dialog). If it is loaded,
unload it before attempting debug mode.
n Ensure that you have completed executing the script in debug mode before
attempting to run the script again.
Avoiding Ambiguity
The same subroutine name may appear in several Perl scripts. CodeWright therefore
provides a mechanism to specify which Perl script you're referencing.
Example: Suppose that both SCRIPT1.PL and SCRIPT2.PL have a sub
MyPerlFunc. You don’t know which subroutine will be executed if
you simply invoke MyPerlFunc.
One way to avoid this problem is to right-click the Perl tab and bring up the
Interpreters dialog. Select the script you intend to call, and click its subroutine in the
subroutine list.
Without this specific invocation, the loading order usually determines which
function will be executed if both an AppBasic script and a Perl script contain a given
function name.
3 Generally, the first macro loaded will be the one to execute.
To determine the current I/O mode, simply call CWPerlIO with a mode value of
-1. In all cases, the return value is the prevailing 'mode' immediately prior to the
call. This function is useful to make a Perl script that responds differently
depending on certain prevailing conditions.
Filename Purpose
CWPERLI.MNU Menu file that holds the menus for the right mouse click in
the Perl tab of the Output Window.
These files are found in the CodeWright \PerlLib subdirectory after installation:
Filename Purpose
If you want certain .PL files to be accessible to CodeWright (e.g. a math library), put
them in the \PERLIB subdirectory of the CodeWright home directory, or specify a
path to them on the Tools|Perl Macros|Properties dialog. For the latter, make sure
the path you specify does not contain .PLL files needed by the CodeWright Perl
Interpreter.
AppBasic
This section explains how to use the AppBasic Macro Language in CodeWright to
create your own macro functions.
AppBasic Environment
Two Editors
You can select one of two editors for editing your AppBasic source code:
CodeWright, or the Rich Text Editor.
n If you use CodeWright, you get the benefits of standard keystrokes and
advanced features. If you use the Rich Text Editor, you get a very close
emulation of the Visual Basic editor, including automatic case correction.
n You can select which editor appears in the AppBasic Edit Window by enabling
or disabling the Rich Text Editor. You will find this setting on the
Tools|AppBasic Macros|View menu.
Special Keybindings
The following keybindings are in effect in the Rich Text Editor and cannot be
changed. When using the CodeWright Editor in AppBasic these keybindings are
only valid when you have a .CWB file current. Otherwise, they revert to your
original keybinding for your default keymap.
Keystroke Operation
C+ A View Macro
% Debug Run
X Debug Pause
C+ - File Close
The other toolbar is one of the CodeWright dockable toolbars. You can position it
anywhere on your screen, or dock it against any edge of the CodeWright Client Area.
We refer to this as the AppBasic toolbar, to avoid confusion. You can enable this
toolbar via the Tools|Customize|Toolbars dialog.
Popup Menu
When you right-click in the AppBasic Edit Window, a popup menu offers a number
of additional options. If you don't find what you are looking for on a toolbar, or the
Tools menu, check out this menu.
Online Help
Online help is available for the AppBasic Edit Window, the AppBasic Language, and
its built-in functions:
n For help on using the AppBasic Edit Window, or language syntax, press the
Help button on the AppBasic Edit Window toolbar.
n For help on functions or subroutines, press the ! key anytime the cursor is in
the AppBasic Edit Window. CodeWright will attempt to bring up help for the
word at the cursor. If there is no word at the cursor, you can still browse a list of
available functions and subroutines.
UserDialog Editor
AppBasic comes with its own dialog editor. A UserDialog is a dialog defined in a
macro program. It is described within a Begin Dialog...End Dialog block. To
create or edit a UserDialog graphically, place the cursor in a UserDialog block and
Object Browser
The Object Browser shows information about all the available special data types,
particularly for OLE Automation. Select the label that you wish to look up, and click
If no label is selected, or the label is not found in the known libraries, the edit box at
the top of the dialog will be empty. You may still browse the existing data types and
methods.
You can define and create Functions or Subs in the Module Properties dialog
before or after creating a Handler. The handler must be added at some point,
however, for the function to be called from CodeWright.
3. When you have finished adding your functions, select OK. Then, on the
Modules Properties dialog, select Add. The Add Handler dialog displays.
Creating a Handler
To create a Handler:
n In the Add Handlers dialog, name your function and declare its type.
Note: Functions and Subroutines must start with a letter and can then
be followed by an underscore or letter.
n Type in any parameters you wish.
Note: At this time, parameters cannot be added later, to do this you
must delete the function and add it again.
toolbar .
n Press the Run Current Macro button on the AppBasic toolbar
.
n Right-click the mouse in the AppBasic Edit Window and
select Run.
9. After running the macro, go to the CodeWright menu Tools|API
Command and type:
DoThis
10. Click OK. A message box should appear with the words “This is a
test” in it.
The Proc list shows all the procedures for the current object. Selecting a procedure
that is not bold inserts the proper procedure definition for that procedure.
Handlers you added in the Properties dialog will appear in the Object and Proc list.
Example: You create a function named Srch_Backwards(), then the Object
list contains Srch and the Proc list contains Backwards.
The underscore divides the function name between the Object and
Proc lists.
firstTime = True
End If
End Sub
toggled on/off, using the button on the AppBasic Edit Window toolbar .
UserDialog Editor
End Sub
Rem See DialogFunc help topic for more information.
Private Function DoThisTest(DlgItem$, Action%, SuppValue%)
As Boolean
Select Case Action%
Case 1 ' Dialog box initialization
Case 2 ' Value changing or button pressed
Rem DoThisTest = True ' Prevent button press from
closing dialog
Case 3 ' TextBox or ComboBox text changed
Case 4 ' Focus changed
Case 5 ' Idle
Rem DoThisTest = True ' Continue getting idle actions
End Select
End Function
The code within this subroutine will be run when the module is put into Run mode.
Once a module is debugged, it can be loaded without being in AppBasic. The
CodeWright API command cwbLoadFile “FileName” will load the module and put
it in run mode without being shown in AppBasic. You can bind the command
cwbLoadFile “FileName” to a key, or add it to the [Editor] section of your
CWRIGHT.INI configuration file to load it during start up.
The functions that are executed when a specified event occurs are called Event
Handlers. Since most events originate with CodeWright API functions, writing your
own event handler gives you access to the CodeWright core. You can change the
way critical functions work without rewriting CodeWright.
You can use events by following the three steps listed below:
1. Select the event that represents the action in which you wish to intervene.
An event handler list can be found in the online help; select Help|CodeWright
API Library and search in the index under Event: Using Events. The sample
event handler program ties itself to the event that occurs when a character is
entered into a CodeWright buffer.
2. Write an appropriate event handler function for that event. (The EventHandler
definition must be “Global” or the event handler will become unregistered.)
3. Register the function for execution at the event with EventRegister.
Set X=EventRegister(EVENT_CHAR_INSERTED, EVENT_NORMAL,
"EventTestHandler")
'{{CWBASIC_LOADERINFO
' cwbAddHandler 'Private Function EventTestHandler(ID As Long,
' Datap As Long) As Integer', '%F'
' cwbAddHandler 'Private Sub EventTestRemove()', '%F'
'}}CWBASIC_LOADERINFO
Into button. The Immediate, Watch, Stack and Loaded tabs will then
appear above the Edit Window. You can also press * to enter this mode if you
are using the RTF editor, instead of the default CodeWright edit window (Tools
|AppBasic Macros|View|Rich Text Editor).
n Call the Sub or Function so that you reach the Breakpoint you have set. You can
do this by selecting API Command from the Tools menu and entering the name
of the Sub or Function.
Break Points
Toggle a break point on the current line by pressing .
Note: When you are debugging the macro and have hit a break point,
notifications will be disabled in the other tabs in the Output Window.
For example, if you have hit a break point in the macro and then you
do a multiple source search, double-clicking in the current Search
Window (e.g. Search 1) will be disabled until you have stopped the
macro.
The Watch Window displays the variables, functions and expressions that are
calculated. Each time execution pauses, the value of each line in the Watch Window
is updated.
n Press E to update all of the values displayed, to reflect any changes you
have made.
Object Browser
The Object Browser shows information about all the special data types that are
available.
You can get to the Object Browser by pressing any of the following:
This configuration can also be set by right-clicking over the AppBasic Edit Window,
and then selecting View from the popup menu.
The first example will cause the toolbar to be hidden. The second example
will show the toolbar. Any positive integer value for the parameter will
display the toolbar.
n cwbShowProcDisplay(int nShow)
This function will hide/show the Object and Proc dropdown lists.
Example:
cwbShowProcDisplay(0)
cwbShowProcDisplay(1)
The first example will cause the Object and Proc dropdown lists to be hidden.
The second example displays them. Any positive integer value for the
parameter will display the Object and Proc dropdown Lists.
Commands
cmdFileNew = 0 cmdFileOpen = 1 cmdFileSave = 2
n cwbShowToolbar(int nShow)
Hide/Show AppBasic Edit Window toolbar.
n cwbShowProcDisplay(int nShow)
Hide/Show Object and Proc drop-down lists.
CodeWright API Commands are function calls that can be made interactively. This
means that they may be assigned to keys, menu items, buttons, popup context
menus, and issued from the API command line. CodeWright API Macros build upon
this capability to provide a quick and simple way to write extensions for
CodeWright.
If you have previously used, or read about using API Commands interactively, a few
differences should be noted if they are being used from API macros:
n You can nest API Commands as parameters to other API Commands in macros.
n All functions must be followed by opening and closing parentheses around the
parameter list, if any.
n Commas must separate parameters.
A number of API macros are supplied with CodeWright. The supplied macros can be
viewed in one of the following ways:
n Select the appropriate macro from the drop-down list under the Name edit box
in Tools|API Macros. The macro is then displayed in the dialog for viewing or
editing purposes.
n Open the file CWRIGHT.MAC into CodeWright, then locate a desired macro for
viewing or editing.
A ChromaCoding lexer called API Macro has been developed to make working with
the language easier. Without any special changes you should be able to:
n Load the CWRIGHT.MAC file into CodeWright.
n See it correctly ChromaCoded.
n Compile it with the menu or button.
n Parse errors from the Output tab of the Output Window.
For more information on Lexers, refer to the topic ChromaCoding Lexers in the chapter
View Themes and Language Support.
API Macros
Creating a Macro
To create an API macro in the API Macros dialog:
1. Give the macro a name in the Name edit box.
2. Type in the API commands you wish to execute into the Edit box.
3. Press the Save button. Press the Run button to send away the dialog and
execute the current macro at the cursor position of the current document. Any
unsaved edits are automatically saved by default.
Editing a Macro
To edit a macro previously created, select its name from the Name listbox. The text of
the macro will appear in the Edit box and you can proceed to make your changes.
Press either Run or Save to save your changes to disk; Run will also run the macro.
Each time a macro is saved, it is checked for errors. If there are errors, use the four
buttons at the lower left of the dialog to parse the position and text for each error.
Running a Macro
The obvious way to run a macro is from the menu or dialog. Macros can also be
executed from within CodeWright in as many ways as API functions can be. Just use
the macro’s name, and optionally its parameters, like CodeWright API functions.
Language Definition
For more information on the API Macro language, see the following discussions on:
n Comments
n Identifier Naming Rules
n Data Types for Variables
n Declaring Variables and Arrays
n Literal Values
n Array Initializers
n Automatic Type Conversion
n Expressions
n Statements and Statement Blocks
n Program Flow Control Structures
n Run-time Error Handling
n CodeWright Event Handling
n Special API Macro Functions
n Difference between API Macros and C
n String Functions
Arrays of either type (‘int’ or ‘string’) are also supported. An array is a variable
capable of storing one or more values. All of the values in the array must be of the
same type. The values stored in the array are called ‘array elements’.
static
Use the 'static' keyword directly before the 'int' or 'string' type keyword. Static
variables maintain their values between macro calls.
If you wish the initialized value of the variable to be non-zero, be sure to follow
it with an assignment expression. This expression cannot contain any macro or
function calls.
global
Use the 'global' keyword directly before the 'int' or 'string' type keyword. Like
static variables, global variables maintain their values between macro calls.
They have the additional benefit of being available in more than one macro.
Each macro that uses a ‘global’ type variable must declare it. For each
declaration, use the same assignment value for initialization. Otherwise the
starting value may be undetermined, since it would depend on which macro is
compiled (used) first.
Literal Values
Literal values can include numbers, characters and strings.
Character Literals
Character literals are just an alternate method of specifying a literal number.
Delimit character literals at the beginning and end with a single quote (').
Character literals usually contain one character but will have two or three if the
first one is the backslash (\) escape character. Use the backslash before a single
quote if you wish the single quote to represent the character literal value.
String Literals
String literals are sequences of characters that are delimited at the beginning
and end by the double quote (") character. To include the quote in the string,
precede it with the backslash (\) escape character.
Escape Sequences
The following are escape sequences for both string and character literals:
\0 NULL 0x00
\b Backspace 0x08
\\ Backslash
Array Initializers
Array initializers for API Macros take the form:
{<element_0>,<element_1,…<element_n}
n For arrays that have many elements, the '…' represents the repetition of the
pattern ‘<element_1>, <element_2>’ up to <element_n>. The ellipsis
cannot be used explicitly.
n There may be zero or more elements in an array initializer.
n Any valid expression can be used as an element in an array initializer. However,
character, number or string literals are commonly used.
n Array element types need not match the array variable that the array initializer
is used with. Types are converted as needed.
Array literals are valid operands and can be used in expressions with other
operands.
Example: The following is an example of combining an array declaration with
an array initializer:
int iArr[10] = {1,2,3}
In special cases like the previous example, where the array initializer has fewer
elements than the declaration size, the remaining elements are initialized to 0 (NULL
for string arrays). Otherwise, when an array type is assigned to an array variable, the
array variable takes the size of the array being assigned to it.
‘int’ array ‘int’ Make an array of size one with the ‘int’
at index zero.
‘string’ array ‘int’ Make an array of size one with the ‘int’
converted to a ‘string’ at index zero.
The last two conversion rules have a special option that allows the appended string
elements to be separated by a given string.
Use the API macro built-in function joinStr to specify and/or query this string.
Examples:
n Use a single space between each joined (appended) string element.
joinStr(" ");
n Query the current string used to join elements.
retStr = joinStr();
Assignment Operators
Operator Description
= Simple assignment
Numerical Operators
Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo (remainder)
| Bitwise OR
Operator Description
^ Bitwise Exclusive OR
~ Bitwise Complement
Logical Operators
Operator Description
== Equivalence
!= Non-equivalence
&& AND
|| OR
! Negation
String concatenation is the joining of two strings where the string following the
operator is appended to the string before the operator. If the left operand is of
type ‘string’, string concatenation is done; otherwise numerical addition is
done. The right operand is converted as needed for either form. This capability
makes it easy to compose output strings containing the descriptions and values
of variables.
For the logical comparison operators (>,<,>=,<=,!=,==) these steps are used:
1. Convert the operand with the more complex type to the one with simpler
type. (An array is more complex than an ‘int’ or ‘string’, a ‘string’ is more
complex than an ‘int’.)
2. Then if both operands are arrays:
a. Compare each element with the same index, from first to last, until the
elements do not match or no elements remain in one or both arrays.
b. If all elements match but one array has more elements, it is taken as
having the greater value.
Operator Description
Operator Description
Associativity indicates the order of evaluation when two operators have the
same precedence. For example, most operators evaluate starting at the left in an
expression, processing right.
()[] none
+- ~ ! ++ -- (all unary) R to L
* / % L to R
<< >> L to R
+ - L to R
== != L to R
& L to R
^ L to R
| L to R
&& L to R
|| L to R
? : (trinary operator) L to R
, (comma operator) L to R
Parentheses in Expressions
Left and right parentheses, '(' and ')', may be used to group expression parts to
set evaluation precedence.
Short Circuiting
The '&&' and the '||' operators have special evaluation rules. The idea of short-
circuiting is that often only the left operand needs to be executed and evaluated.
n For the '&&' operator, if the left operand evaluates as zero, the value of the
operation must be zero (FALSE) so the right operand can be ignored.
n For the '||' operator, if the left operand evaluates as non-zero, the value of
the operation must be one (TRUE), so the right operand can be ignored.
Function calls
Function calls, including those to CodeWright API functions and macros, take
the form:
<macro_name> (<parameter1>,<parameter2>,...<parameterN>)
The following rules apply:
n Spaces and tabs are allowed after the macro name and between parameters.
n Commas must separate parameters.
n You may supply fewer parameters than a function is defined to use. The
remaining parameters will be supplied for you as zeros or NULLs.
n Pass-by-value is the only way that parameters are passed to function calls
within an API macro; there is no pass-by-reference support at this time.
This means that parameters that would indirectly return a value by using a
pointer, such as the length parameter in the function SrchFind, are not
supported within API macros. To use SrchFind, for example, you must
either omit the length parameter or give it a NULL value.
See the discussion on Expressions, in this chapter, for more information on what
can be used as parameters. Macro recursion is supported.
For backward compatibility, if there is no specified macro return type, the return
value is optional. For what is allowed, see the section Expressions in this chapter.
If the expression does not evaluate to the type expected by the macro's defined
return type, the value is automatically converted. See the preceding discussion
on Automatic Type Conversion, in this chapter.
Statement blocks are a series of statements. They are normally used in conjunction
with control structures. Use curly braces '{' and '}', to begin and end statement
blocks, respectively. A statement block can be used anywhere a single statement can
be used.
Conditional statements
Examples of conditional statements include:
n ‘if ’ statement
if (<expression>)
<statement>;
n ‘if-else’ statement
if (<expression>)
<statement>;
else
<statement>;
The 'break' statement line following each 'case' section is optional. Without
a ‘break’, execution continues into the following 'case' or 'default' section.
The optional 'default' section is executed if none of the cases are matched by
the test expression. The braces are required.
continue;
The 'continue' statement causes execution to not finish the current iteration
of the innermost-containing loop; instead, the next iteration is begun. In
the 'while' and 'do-while' statements, the next evaluated is the <test
expression>. In the 'for' statement, the <incr_expression> is
evaluated next.
Ctrl-break stop
If you've written a locked loop in your macro, use the C -[Break] keystroke to
terminate it.
On events where the data is a pointer of type other than ‘LPSTR’, you can still trap
the event but will not be able to access the data.
String functions
Since library functions are not available in API Macros, a number of string functions
are made available through the CodeWright API for building and comparing strings.
n LPMSTR StringApnd( LPSTR str1, LPSTR str2 );
Appends str2 onto str1. Neither string is freed.
Normally, the _init function does not install the keymap. If it did, you would not be
able to load the DLL to have access to its functions without loading the keymap.
Keymap Function
The keymap function is the function that creates and installs the new keymap. To be
compatible with the DefaultKeymap function, this function must have the same
name as the root of the DLL in which it resides. For example, the CUA keymap is in
the file CUA.DLL and is installed with the CUA function.
Flag Initialization
One of the first things you will want to do in your keymap function is to set options
the way users of your keymap will expect to find them. For example, the BRIEF
keymap needs to allow assignments to [Alt] keys, and doesn't create a new window
for each new file that is loaded. If the users of your keymap will expect to have
vertical and horizontal scroll bars on their edit windows, now is the time to make
that happen.
There are several functions that will assist you in setting the options you require.
They are SysSetFlags, SysSetDefault, and SrchSetFlags:
n Use SysSetFlags to set options you might otherwise set from various
CodeWright dialogs.
n Use SysSetDefault to set up window and buffer settings the way you want,
even before any buffers or windows have been created.
n Use SrchSetFlags to set the default search settings.
You are not dictating with these settings how a user must operate. The settings you
create here may be overridden by settings stored in the configuration file or state file.
There are functions provided to take the drudgery out of making these assignments.
KmapAssignTypables and KmapAssignRange are your primary assistants. The
difference between these two functions is that the first makes assumptions about
what you want the keys to do, whereas the second allows you to specify the function
that is assigned to each key.
Keymap-Specific Assignments
Now you are ready to make assignments specific to your keymap. Your main tool in
doing this will be the function KmapAssign. Use the CodeWright API functions, or
create your own supporting functions to assign to keys. Remember that when you
create your own functions, you will need to export them with a LibExport call in the
DLL's _init function in order for the key assignment to work. Otherwise, you will
get a "function not found" message when you press the keystroke.
Menu Accelerators
The last step in creating your own keymap is to put strings indicating any "short cut"
keys or accelerators on the menu. You will rely on the MenuAddKeyString function
to do this.
Notes: The CodeWright SDK includes the C source code files and makefiles
for each of the keymap DLLs, allowing for further customization. If
you need more information on how to obtain the CodeWright SDK,
please contact a Sales Representative at [email protected].
Once the file-loading method has been established, there are some things that can be
done, and things to be aware of, when using CodeWright to edit UNIX files. The
following topics cover these issues:
n Converting File Type and EOL Characters
n Compiling UNIX Programs from CodeWright
n Preserving Filename Case, File Securities and File Links between UNIX and
Windows Environments
Notes: Only one type of conversion is allowed (e.g. you can't save a Mac file
as Unicode).
Macintosh, Unix and DOS option are only available if Auto-Sense
File EOL is marked in Tools|Customize|Environment|File Options;
Unicode and UTF-8 are only available if Auto-Detect File Encoding is
marked on the same dialog.
You can also open a file as Unicode or UTF-8 (among others) from the
File|Open dialog.
For the Macintosh file type, the EOL characters will appear just the same as for UNIX
(just a line feed); CodeWright converts the CR to the LF as it reads the file, and
converts the LF to the CR as it writes the file. If you search through a Macintosh file
in hex mode, you will therefore find UNIX style 0x0a characters instead of Mac style
0x0d characters.
Although you can search for a hexadecimal value (\x0A), it is better to use a regular
expression for this operation. See the topic Searching for control characters (binary/hex
data) in the chapter on Search and Replace and Navigational Tools for more information.
Example:
If you wanted to change your DOS EOL’s to UNIX EOL’s:
1. Mark the UNIX radio button in the EOL group for the appropriate file
type in Tools|Customize|Language|Options.
2. Go to the Search|Replace dialog.
3. Make sure you have the Regular Expression box checked.
4. Search for \n and Replace with \n. The meaning of the \n is a new line
(cr/lf or a lf).
Because the Macintosh EOL is a (cr) only, it is better to use \r when searching or
replacing it. To change your DOS EOL’s to Macintosh EOL’s:
1. Go to the Search|Replace dialog.
2. Make sure you have the Regular Expression box checked.
3. Search for \n and Replace with \r.
If you compile UNIX programs, you will need to do this outside of CodeWright, or
find a way to access your UNIX system from within CodeWright.
If your CodeWright executables are installed on a network, you will almost certainly
want to place your configuration file somewhere else. By placing your configuration
file in a private or local directory, you ensure that you will not be using or changing
someone else's configuration.
Here are the places that CodeWright looks, in the order of searching:
1. It looks on the command line to see if you specified the /c parameter.
2. It looks in your environment for a variable named CWINI.
The command line parameter, or the environment variable, will have an associated
string value when it is used to point to the configuration file. This string names the
directory in which the configuration file resides. It may also name the file itself.
Example: The string may take this form when specifying a directory:
D:\SOURCE\PROJECT1
If CodeWright does not find a configuration file at all, it will create one in the
working directory when it needs one. CodeWright has no problem running without
a configuration file, but it does notify you if one could not be found.
Configuration File
The configuration file normally contains information about the way you have set up
CodeWright. This information may be put there during installation, through
modifying the settings in dialog boxes, or by directly editing the configuration file.
In the latter case, the configuration file might contain almost any CodeWright
commands. The configuration file is named CWRIGHT.INI.
State File
The State file contains information about the buffers and windows you had open the
last time you exited CodeWright. It also contains the more transient information
about your CodeWright settings, such as your search options and responses to
prompts. It follows the same rules as a configuration file, but it is normally limited to
one section named [State]. This file is named CWRIGHT.PST.
As you change settings in the various dialog boxes, you are automatically updating
your configuration. You may select which file the dialogs use to update
configuration information: the configuration file or the project file. You may further
select which categories of information are kept in which file. For more information
on how to store configuration information with your project see Storing Configuration
Options with a Project in the chapter Projects, Project Spaces and Workspaces.
Example File
Here is an abbreviated example of a configuration file:
[DefaultKeymap]
DefaultKeymap=BRIEF
[KmapAssign]
KmapAssign=<Ctrl-`>, Preprocess
[LibPreload]
LibPreload=PRG.DLL
[Editor]
KeyDelay=1200
KeyRepeat=5
Autosave=20
SysSetFileLocking=30
[Colors]
ColorError=0xe0
ColorWarning=0xd4
SysSetDefault=DEFAULT_COLOR_TEXT,0x1f
SysSetDefault=DEFAULT_COLOR_SELECTION,0x9e
[Printer]
PrintFooter="-Page %p-"
PrintHeader="%f %d %t"
PrintFlags=145
PrintMarginBottom=0
PrintMarginRight=0
PrintMarginLeft=0
PrintMarginTop=0
[Definitions]
EvalStrAdd=DEBUG,1
[Compiler]
CompilerAssign='Borland C++','.c'
[DefaultKeymap] Section
The default key command is set to BRIEF. This will cause BRIEF.DLL to be
loaded and its function brief to be called.
[KmapAssign] Section
In the [KmapAssign] section, a key assignment is added to the default keymap.
The Preprocess function is assigned to the C Backquote (`) keystroke.
[LibPreload]
One of the supplemental language support DLLs is loaded for use.
[Editor] Section
The [Editor] section of the example configuration file sets the keyboard delay
and repeat rate. Auto-save is set to occur after 20 seconds of keyboard inactivity.
File locking is enabled for 30 file handles.
[Colors] Section
The [Colors] section of the example sets the color of error messages to black on
yellow, and the color of warning messages is set to red on gray. These are global
settings. The next two color settings may be set differently for each edit
window. For this reason, we do not use the functions ColorText and
ColorSelection to set the colors, but rather set what the default color will be.
You use the SysSetDefault functions when setting defaults for things that are
specific to individual buffers or windows. In this case, the color of text is set to
white on blue, and the highlight for the selection is set to yellow on light blue.
[Printer] Section
The [Printer] section and a number of other sections use private,
undocumented functions. The Print menu item within CodeWright controls
the contents of this section. You are not encouraged to modify the [Printer]
section.
[Definitions] Section
This section defines the label DEBUG and gives it a value of one. This label may
be used in numeric expressions processed by CodeWright, including those
given through the Command Key and the Preprocess function (#ifdefs).
If a project is loaded, CodeWright will look for calls such as EvalStrAdd in the
[Definitions] section of your *.pjt file instead.
All of the sections discussed above contain configurations that can normally be
set from within CodeWright. In most cases, it is not necessary to directly edit
CWRIGHT.INI.
Processing At Startup
When CodeWright is launched, the command line is processed before the
configuration file or the state file. This gives the command line the opportunity to
specify the location of these files. It also means there is some potential for the
configuration file to reverse the effects of a parameter specified on the command
line.
Order of Processing
The following sections of the configuration file are automatically read at startup in
the order given:
n [Menu]
n [DefaultKeymap]
n [KmapAssign]
n [LibPreload]
n [Editor]
n [VersionControl]
n [Template]
n [Colors]
n [Ribbon]
After the portions of the configuration file that are automatically read have been
processed, the state file is processed. This gives settings in the state file priority over
similar commands in the configuration file.
The functions under each of the section headings are executed in the order they are
listed. Regardless of the order in which the sections occur, however, the sections are
always executed in the same order. The [Printer], [Compiler],
[Definitions] and other sections are processed as needed.
Heading Functions
Colors Functions to set the colors for text, messages and so on.
This is done with the SysSetDefault function.
DefaultKeymap The function that sets the initial key command set, such
as BRIEF or CUA. For example, the statement
DefaultKeymap=BRIEF will cause CodeWright to
load BRIEF.DLL and call its keymap function, which it
assumes to be the same as the filename root -- BRIEF.
You may place any CodeWright function under any of the section headings, but
grouping functions logically under section headings will help ensure that the
functions are executed in their proper order. For example, you could place the
default keymap in the [Editor] section, but then the modifications and additions
made in the [KmapAssign] section would be lost when the keymap is loaded over
top of them.
User-Defined Sections
You may define other section headings and place other editor commands under
those sections. These commands will not be processed automatically at startup,
however.
Many functions you might want to create for assignment to a keystroke are a simple
sequence of functions to execute consecutively. Return values are not examined, and
no control structures are required. In most cases such tasks can more easily be
accomplished with the creation of a macro. However, they can also be done with
user-defined sections in the CWRIGHT.INI. A section can subsequently be assigned
to a keystroke in CodeWright.
After you have created this section in your configuration file, you could make a
key assignment like the one below, also in your configuration file:
[StackMarks]
MarkSavePos=
MarkRotatePos=
n By using [RotateMarks] instead of the restore position command,
restored positions are not lost, but rather moved to the other end of the list.
You can then continuously cycle through your saved positions.
n If you use [StackMarks] to save your current position, you will restore
positions in the same order you saved them instead of the reverse order in
which you saved them.
Together, these two sections give a functionality similar to that of Microsoft
PWB.
Scrap Buffers
This next example makes good use of the multiple scrap buffers in CodeWright.
For it to be useful, you must first define more than one scrap buffer. To do this,
enter a value of 2 or higher in the Number of Scrap Buffers field on the
Tools|Customize|Environment|Clipboard dialog.
[RingPaste]
ScrapPrev=
BufInsertScrap=
MsgMessage="Current scrap inserted"
When using these three sections in place of Copy, Cut and Paste, you get a last-in,
first-out ring of scrap buffers. Successive Copy or Cut operations (without an
intervening Paste) do not overwrite each other until you run out of scrap buffers.
Successive Paste operations let you paste the contents of each scrap buffer in the
reverse order they were used. The same functionality can more easily be achieved
using the Auto-increment scrap buffer option in the
Tools|Customize|Environment|Clipboard dialog.
State File
Another important CodeWright configuration file is the state file. The state file is
stored by default in the CodeWright home directory and is called CWRIGHT.PST.
CWRIGHT.PST records the condition of CodeWright at the time of exit.
Storing state information is turned on by default, but can be turned off in the
Tools|Customize|Environment|State dialog.
When a project is open, Window, Document and Mark information will be stored
with either the project (.pjt) or project space (.psp) file, as defined on the
Tools|Customize|Environment|State dialog. Other types of state information are
stored in the default state file CWRIGHT.PST.
Once again, if no location is dictated for the state file, and no existing file is found,
the file is created in the working directory. CodeWright can operate just fine without
a state file. In fact, you may turn off the saving of state information, and CodeWright
will ignore any state file and the information it contains.
Similar to the configuration file, the strings that give the location of the state file may
also dictate a name for the file. If the string names only a directory, the name
CWRIGHT.PST will be used. The following methods for setting the location of the
state file are all valid:
n Using the environment variable:
set CWPST=D:\BORLAND
n On the command line:
CW /sD:\BORLAND\CWRIGHT.PST
n In the CWRIGHT.INI file:
StateSetFilename=H:\HOME\ERICJ
CodeWright supports a number of command line parameters. You may add these
parameters to the command line by editing the file’s shortcut, or through the File
Properties selection in the Program Manager's menu. If you have multiple
CodeWright shortcuts or program items, the command line may be used to have
each operate differently.
The command line is processed before the configuration or state files have been
read. This has the following effects:
n It allows the command line to specify configuration and state file locations.
n It allows configuration and state files to override command line specifications.
This is not normally a problem, but possible conflicts are noted in the
descriptions below.
Filenames
You may specify any number of files to edit on the command line, limited only by
the command line length. You may use wildcards to specify multiple files. These
files are loaded in addition to, rather than in place of, any named in the state file.
Parameters
Consider whether you wish to allow the configuration file to be read before or after
each parameter that you specify. The configuration file may in some cases cause a
command line parameter to be ineffective if the parameter is processed first.
There are upper case and lower case versions of each of the command line
parameters, wherever applicable.
n Parameters specified with a lower case character will be processed before the
configuration file is read.
n Parameters that use an upper case character will be processed after the
configuration file is read.
Examples:
n '-Processor=1' limits
CodeWright to CPU 0.
n '-Processor=2' limits
CodeWright to CPU 1.
n '-Processor=3' limits
CodeWright to CPU 0 and
CPU 1.
Command Files
A command file is a file that may contain any valid command line parameters,
including additional command files. CodeWright identifies filenames preceded by
an @ sign as command files. Command files are formatted in the following way:
@<commandFile>
Command files are useful for overcoming command line length limits and also for
creating reusable, logical groupings of filenames and parameters.
White space or new lines may separate parameters within a command file. New
lines are often used to promote readability.
TAGSW32 is based on the GNU Tags program written by John Kerchival. The
primary changes made to it are to allow output in the Borland Compiled Tags
format. This is the -p option, which is the only option we have added. Other
options are as described in the TAGS.DOC file supplied with the GNU Tags program
and provided with CodeWright.
Example: TAGSW32 {[OPTIONS] [SOURCEFILE|@LISTFILE]}
-h,-?
Obtain a detailed help screen directed to standard output.
@LISTFILE
Use LISTFILE as a "response" file. This file lists input filenames (with or without
wildcards) one at a time. Filenames may be separated by a plus sign (+), a comma (,),
a semicolon (;), or by whitespace.
In addition, comments are allowed within the LISTFILE. Comments are delimited
by placing a pound sign '#' before the comment. This is very similar to comments
allowed in a makefile, except that comments are allowed on any line or at the end of
any line, start at the '#' and go to the end of the current line. There must be at least
one character between the filename and the comment character [i.e. a plus sign (+),
a comma (,), a semicolon (;), or whitespace] to differentiate between the beginning of
a comment and a filename character (since '#' is a valid element of a filename).
-tTAGFILE
Add new generated tags to TAGFILE. This file may or may not exist. All tags from
TAGFILE that were derived from files currently being parsed will be removed
during the merge phase. This tagfile is assumed to be in one of this utility's output
formats. If sorting is specified, then new tags will be merged in correct order with
current case sensitivity. Otherwise, tags will be placed at the beginning of the new
resulting tag file (this will result in quicker responses during tag searches while
editing). If -m or -s are used, this switch is ignored (all output is to stdout). The
behavior regarding existing files is determined by the case of the switch as follows:
-t (lower case) creates and outputs to a file overwriting any currently existing
file.
-T (upper case) merges all output to the tagfile if there is an already existing file.
-pCOMPILEFILE
Convert output tag file (specified by -t) into a compiled file suitable for use with
CodeWright. The output flag (-t) and the CodeWright output format flags (-oc) must
be specified for this flag, otherwise it is ignored.
-lLOGFILE
Output all activity to LOGFILE. The log file will be created in a LISTFILE format (i.e.
suitable as input using the @LISTFILE syntax). The behavior regarding existing files
is determined by the case of the switch as follows:
-l (lower case) creates and outputs to a file overwriting any currently existing
file.
-L (upper case) appends all output to the logfile if there is an already existing
file.
-o[options]
This switch is used to determine the output format to the output stream.
[options] may be one of the following:
e Epsilon (>= V6.0) tag format
( tokenString {tab} fileName {tab} characterOffset {tab} lineText )
This format is used by the Epsilon editor (V6.x) created by Lugaru Software and
specifies the token identifier, the file name (including full path, normally), the
character offset of the beginning character (starting at character 0) and the text
of the line on which that offset is located.
-a[options]
This switch is used to specify the types of tokens for which tags are generated for
tagging of assembly files. All token types are tagged as the default ( -afdlmsu ).
Source modules are expected in 80x86 assembly using MASM/TASM syntax. The
location of the -a switch on the command line is important. All files (and files found
in LISTFILEs) will be tagged using assembly tagging (and the options specified on
that switch) until another -a or -c switch is found. Order is not important for the
options to this switch. Possible values for [options] follow:
-c[options]
This switch is used to detail the token types to tag in C and C++ source files. All
token types are tagged by default ( -cdmstekuvcfpxi ). Source files are expected in
standard ANSI 2.0 C/C++ syntax. The location of the -c switch on the command
line is important. All files (and files found in LISTFILEs) will be tagged using C
tagging (and the options specified on that switch) until another -a or -c switch is
found. Order is not important for the options to this switch. Possible values for
[options] follow:
-d
This flag specifies that all input listfiles and exclude response files should be deleted
once parsed. This allows an automated list file generation that is cleaned up by the
tags package. See description of LISTFILE that follows.
-q
This is the quiet switch and will suppress normal status output to stderr and
program version information.
-r
This switch will suppress the default output of the full file path name and will
specify the use of relative pathnames in the generated output.
-n
This switch will suppress sorting of the tag output (often used in conjunction with
GNU or Epsilon style tags).
-i
This switch specifies the use of a case sensitive sort (normally a case insensitive sort
is used). Although the character 'i' is normally used for switching to a case
insensitive behavior, it differs in this instance.
Source code for most CodeWright DLLs is provided with purchase of the
CodeWright SDK. The SDK also installs a \SAMPLE subdirectory that contains
source code for an essentially empty DLL, which can easily be modified to add any
function desired.
This section has three major provisions for changing or adding capabilities to
CodeWright through DLLs:
n It provides direction to the source code to be changed or added to.
n It provides some assistance for making the changes or additions.
n It provides tips on how to compile and make use of the changes or additions
that have been made.
External to the primary executable are several Dynamically Linked Libraries (DLLs)
which provide services in several areas:
n Core services.
n Supplemental language support.
n Keyboard command sets
n Auxiliary services.
CWSTART DLL
The main DLL that starts CodeWright is named CWSTART.DLL. It performs
numerous initialization tasks, such as loading other DLLs and reading the
configuration file. The source code to CWSTART.DLL is provided in the CodeWright
SDK. Many of the extension functions are defined in this DLL. To utilize them in
your own source code you will need to include the header file CWSTART.H, which is
in CodeWright's \CWSTART subdirectory.
The file descriptions below will help you locate the functions provided in the various
source files for CWSTART.
Language Features
File Description
LANGUAGE.C The file that contains the engine for language specific
features, such as ChromaCoding, Template Expansion, and
Language Indenting. It relies on a series of functions being
defined elsewhere that incorporate the corresponding
filename extension into the function name (e.g., _c_indent(),
_pas_indent() ).
File Description
Utilities
File Description
CONFIG.C Contains the functions that read, write and process the
configuration file.
File Description
STATE.C Contains the functions that read, write and process the
state file.
Error Parsing
File Description
ERRORFIX.C This file contains the engine that drives the various error
parsers for different compilers and languages.
ERRINFO.C This file contains the actual error parsers for the various
compilers.
Macros
File Description
BRACE.C The source code file for the CodeWright brace matching
features, including the functions Brace, BraceMatch and
BraceMatchNext.
File Description
REPEAT.C Contains the source code for the function Repeat, which
repeats a command a specified number of times.
TAGS.C The source file for the functions that support the CTags
features.
CWDIALOG DLL
Many of the CodeWright dialog functions are contained in the file
CWDIALOG.DLL. This library contains the dialog functions that support the
menuing and other interactive operations. The source code for the CWDIALOG
DLL is supplied with CodeWright.
There are a number of functions in this DLL that allow you to access the dialogs on
the menu directly. It is sometimes useful to assign these functions directly to keys, or
to call them from your own source code. These functions are the functions
beginning with Dlg... and Print. To use these functions, just include the file
CWDIALOG.H into your C source code. You will find this file in the CodeWright
CWDIALOG subdirectory.
CWHELP DLL
The CWHELP.DLL contains the functions that access the various Help libraries used
by CodeWright. These include the contextual help for the editor, the CodeWright
API function help, and the Microsoft Windows API (SDK) help, if you have it. The
name of the DLL is CWHELP.DLL.
DLLs continue to provide other language support features such as brace expansion,
smart indenting, and so on. For C/C++, C#, Java, Pascal, HTML, and Assembly, this
type of support is built into the CodeWright CWSTART DLL, and is therefore
available by default when CodeWright loads. Additional DLLs are also available to
provide this kind of support for other languages. Unlike CWSTART, however, these
DLLs are not loaded in CodeWright automatically when it loads. If they are needed,
you can load them manually by placing a checkmark next to the appropriate item in
Tools|Customize|Libraries. Here is a description of the language support DLLs that
can be loaded manually:
DLL Description
The source code for the above DLLs is provided is provided with the CodeWright
SDK. Additional language DLLs and source code are also available on the
CodeWright CD (in the Add-Ons directory), and on our website at
http://www.codewright.com.
When you enable a DLL, it adds a statement to your CodeWright configuration file
(CWRIGHT.INI). Here are example load statements for these DLLs:
[LibPreload]
LibPreload=PRG.DLL
LibPreload=SC.DLL
LibPreload=COB.DLL
LibPreload=BAS.DLL
LibPreload=CWPERL.DLL
LibPreload=CWHTML.DLL
LibPreload=CWXML.DLL
The preceding statements load the DLLs and make the functions in them
immediately available for use. This does have the effect of slowing the initial loading
of CodeWright. An alternative is to use LibAutoLoad rather than LibPreload. This
will cause the DLLs to be loaded only on demand. It does, however, require listing
all of the functions in the DLL in the statement. See the description of this function
for details under Help|CodeWright API Library.
Auxiliary Services
The Auxiliary Services or DLLs provide support for supplemental features. These
features or groups of features are generally provided in separate DLLs. The source
code for each DLL, if provided, is in a subdirectory within the CodeWright home
directory. Each subdirectory is given a name that is the same as the root name of the
DLL.
DLL Description
CWLDRAW.DLL This DLL allows remapping the keyboard so that you can
draw lines and boxes in your file, using the IBM OEM
character set. You must be using OEMfixed, 8514oem,
terminal, or similar font. If not, these lines will be
displayed as international characters. It is not loaded
automatically.
CWTAGS.DLL This DLL supports the use of the Borland compiled Tags
databases with the Browser. It is loaded as needed.
Sample DLL
As mentioned, the source code for creating an essentially empty sample DLL is
included with the CodeWright SDK. You will find it in the SAMPLE subdirectory
installed by the SDK. You can put some flesh on this skeleton, or you may use it as
an example of what elements go in to a CodeWright DLL.
Exporting Functions
The functions in a DLL, and the parameters for each, must be registered with
CodeWright before you can make full use of them. If you don't register them with
CodeWright, you will not be able to assign them to a key or call them from the API
Command Key. You register or export the functions with the LibExport function.
This is in addition to any export declarations required by the programming
language.
For example, you might want to change the function that moves the cursor ahead in
increments of a word. You can be relatively certain that this function is going to be
called as the result of some key command.
If you were less certain about what other routines might be using the function, you
would need to consider the effects of your changes on those other routines. If you
are in serious doubt about what routines may be relying upon the function, it is best
not to change it. Instead, create a new function that is called when you want it, and
leave the old function in place for the routines that use it.
If you create a new file for your functions, you will have to be sure it uses the
necessary header files (CWSTART.H, CWDIALOG.H, CWHELP.H...), and that it is
included in the compile and link.
Recompiling a DLL
Once you have installed the CodeWright SDK, part of the CodeWright directory
structure is a miniature of that used by most C compilers. There is an \INCLUDE
subdirectory that contains header files, a \LIB subdirectory to contain .LIB files, and
subdirectories to contain the source code for each of the CodeWright DLLs you can
rebuild. The \INCLUDE and \LIB subdirectories must be made known to your
compiler and linker. You can do this manually, or through the use of a MAKE utility
or Project file, if your compiler supports these things.
Adding Files
Groups of related files have been defined as macros toward the beginning of each
makefile. This facilitates operating on the filenames as a group. Also, if you choose
to place the source code for some extensions to CodeWright in a separate file, you
can readily add those filenames to the macro definitions. If the makefile employs a
linker response file, such as CWSTART.LNK, don't forget to add your file to the list in
the response file so that it will get linked in.
Similar requirements apply to your Link command. Begin with your basic Link
command line for producing a Windows DLL. The libraries in the CodeWright \LIB
subdirectory must be linked with the other objects. A standard .DEF file has been
supplied for each DLL.
Link Libraries
The makefiles provided make reference to certain libraries in the linker command.
You may find it useful to know the purpose of each of these libraries in case you
have a different version of the same compiler or would like to construct a similar
command line for a compiler not supported.
The libraries used in this link command usually include LIBW.LIB, OLDNAMES,
LDLLCEW.LIB and CWRIGHT.LIB. The files LIBW.LIB and CWRIGHT.LIB are
import libraries. They don't contain any object code themselves, but rather tell
where the routines may be accessed at runtime:
n LIBW.LIB points to addresses in USER.EXE, GDI.EXE and other executables that
provide the Windows API.
n CWRIGHT.LIB points to addresses in the CodeWright kernel that support the
CodeWright API.
You may need to link in other import libraries at times, for example, if you are
making direct calls to routines in CWSTART.DLL, CWMATCH.DLL or a DLL of your
own creation. If you don't have an import library (.LIB) file corresponding to the
DLL you are using, you can create one with the ILIB utility supplied.
LDLLCEW.LIB
The library LDLLCEW.LIB contains object code to use when creating Large
Memory Model Windows DLLs. Depending on your installation of Microsoft C,
you may find that your Large Memory Model library is named LDLLCAW.LIB
instead. Alternately, you may find that you have not installed any large model
library at all. If so, you can run the setup program that came with your compiler
to add to your installation. If you use a library intended for any other memory
model, you are guaranteed to have a program that doesn't work right and will
probably crash Windows.
OLDNAMES.LIB
The library OLDNAMES.LIB is included to avoid unresolved externals. This is
because Microsoft changed the names of some of their library routines. See
your MSC 7.0 README file for details. If you are using an older version of the
Microsoft compiler, you should remove this library from your command line.
Borland Link
Below is a portion of the input script for TLINK that is included at compile time for
Borland C/C++:
..\lib\cwright.lib+
import.lib+
cwl.lib
You may need to link in other import libraries at times, for example, if you are
making direct calls to routines in CWSTART.DLL, or a DLL of your own creation. If
you don't have an import library (.LIB) file corresponding to the DLL you are using,
you can create one with the ILIB utility supplied.
The third library CWL.LIB contains object code to use when creating Large Memory
Model Windows DLLs. This library was named CWINL.LIB in versions prior to 3.0.
Use only a Large Memory Model library intended for Windows for this purpose.
Your DLL will need all of the same parts described in the preceding section
Dissecting a CodeWright DLL, regardless of what language you use to produce it. Be
sure to compile using a Large Memory Model. You need Far calls and pointers for
things to work properly.
If your DLL just contains some additional subroutines you want to have available,
you have a couple of options:
n Always load the functions at startup-time, OR
n Tell CodeWright to load them when needed.
The following examples assume that you have put your DLL in the CodeWright
home directory, or in a directory to which your CWLIB environment variable points.
This option requires that you supply the names of the functions in the DLL, which
may be called. For more information on configuration files, refer to the chapter
Configuration Files and Command Line Flags, in this manual.
Index 507
Running the Macro 424 Borland C++ Builder File
Special Keybindings 415 Synchronization 233
User Dialog Editor 421 Borland Link 504
Window Configuration 429 Brace 106
assemblies 201 Align 108
Assign Keys dialog 358 automatic positioning 108
Auto Sync Makefile/ Visual Studio Brace 106
Workspace 167 Brace Expansion 108
Auto-hide BraceFindEx 107
Toolbars 334 BraceMatch 106
auto-list members BraceMatchNext 106
CodeSense 122 Expansion 91, 108
Auto-parameter Info highlighting 106
CodeSense 124 kissing 107
Auto-Save Settings 367 locating 107
Auxiliary Services 498 locating square brackets 107
matching 105
B matching parentheses 107
parenthesis locating 107
back to previous document position BraceFind 107
55 BraceMatch 106, 107
Backup Files 371, 475 BraceMatchNext 106
Backups break
Format Controls 372 a long search 256
Formatting the Backup Specifica- Break Points 425
tion 371 AppBasic 426
Global 367 BRIEF 64, 354, 398
Individual Files 370 Command Set 352
Specific File Types 370 Keymap 352
Turning off 393 Browse
Balloon C++, C# and Java 285
CodeMeeting Notification 387 Object 417, 427
Beautifying Code 320 Browser
Format Source 87 Database 171
Bi-directional synchronization 239 Filter Toggle Buttons 277
Binary Files Inspect window 273
Omit Matches from Search Results Jump to Code 275
247 Objects Window 272
Binding Keystrokes to Functions or Query Buttons 275
Macros 360 Selecting a Database 273
Block Alignment 111 String Search 275
Bookmarks 171 Support 272
Current Position 293 Toolbar 273, 274
Global 292 Traversing the Tree 273
Local 292 Tree window 273
Saving Unnamed and. Named 293 Tree, expand or collapse 273
Window 293 Window 273
508 Index
Browsing Matching 261
using Microsoft .BSC files 271 Chat
BSC file 273 With other CodeWright Users 50
Bufsethexascii 399 ChromaCoding 434, 493
Build 190, 191, 201, 206 .INI Files 74
Command Line 176 Adding a New File Type 88
Tool 181 COBOL 141
Utilities 174 color-timing 86
Build Menu 39 enable coloring 88
builds 201 for embedded languages 86
Button File 171 maximum number of
Button Links 171 comment-lines 86
Comment prefixes 295 Numbers 81
Defining buttons 295 Regular Expressions 81, 82
How it works 295 Search Output 249
Insert Link 38 Side-by-Side Difference Window
What you see 295 302
Buttons 38, 295 Strings 80
action 38, 295 Use to Restrict Searches 22, 253
Adding and Changing Toolbar ChromaCoding Lexer Settings
Buttons 336 Default 75
Binding a Function to a Button 337 Dialog 75
Information File 338 Dialog (Comments tab) 79
Dialog (Numbers tab) 81
C Dialog (Strings tab) 80
Dialog (Words tab) 78
C Item Settings 79
CodeSense Support 113 List Settings 79
Language Operators 399 ChromaCoding Lexers 43, 74, 85
Language Support 84 add keywords 78
C# add operators 78
CodeSense Support 113 Adding Comment Delimiters 79
Language Support 84 adding keywords from a file 78
C++ Adding Numbers 81
Browse 285 Delete keywords 78
CodeSense Support 113 Deleting Lexers 83
Language Support 84 Digits field 82
Call Tree 287 Exclude Text from Coloring 77
Called By 276 Identifier Characters 76
Calls To 276 Identifiers 76
CARP.PM 413 Lexer names 75
Case Multi-line Comment 80
Changing Upper, Lower 40 Regular Expressions 13
Centering text 40 Single Line Comments 80
Changing Existing Functions 501 user-defined keywords 78
Character Class browser 285
Classes 76, 82, 262 Clipboard 147
Index 509
Multiple 147 ANSI translation 124
Tab 147 Auto-list Members 122
Viewer 148 Auto-parameter Info 124
ClipView Tab on the Output Window Auto-type information 123
48, 148 C, C++, C# and Java 113
Closed Selections 354 Create library database 117
COBOL 142 Current Document Lookups 115
Automatic Time/Date Stamp 143 database files 120
Automatically Continue Strings 144 delete library database 118
ChromaCoding support 141 edit library database 117
Column 72 142 Extended Functionality 124
Comments only after column 72 Filter Lookups by File Type 119
142 from files that are open in
DLL 141 CodeWright 115
Line Number Handling 143 libraries 116
Resequence Line Numbers 142 Library Database Properties 114
Toggle comment 143 Main Features 121
Validate Line Number Sequence Maximum Cache Size for Lookups
144 127
Code Name Completion 121
Beautification 320 parser priority 118
Reformatting 87 Project Database Properties 114
Review from Different Locations 50 Symbol Lookups 127
Code Composer Troubleshooting 128
Bi-directional synchronization 239 Unicode translation 124
synchronization 237 CodeWright
CodeFolio Snippets 50, 91, 99 Registering 31
adding 102 Source Code Modules in SDK 89,
Adding or Removing Directories 491
104 CodeWright API 398
Code Snippet Properties Dialog 103 Functions 63, 405
Creating a Snippet from Clipboard Use functions interactively 63
or Document Selection 102 CodeWright Event Handling 451
Deleting or Renaming 103 CodeWright Libraries 66, 74
directories 99 CodeWright SDK 89, 491
Directory on File|New Dialog 36 Collapse text 268
Editing 104 Colors 69
Executing 101 changing colors 70
Properties Dialog 103 changing individual screen
Tab on Project Window 50 elements 70
using 99 changing whole background only
CodeMeeting 70
Chat Window 50 ChromaCoding Lexers 74
File Sharing 50 for embedded languages 86
Notification Balloon 387 Restrict searches based on
Tab on Project Window 50 ChromaCoding 22, 253
CodeSense 44, 113
510 Index
Side-by-Side Difference Commands 202
Window 302 directory structure 204
Synchronize text background 70 Name 202
Columns Name (creating, deleting) 202
Formatting 40 setting up 201
Marking 354 Conditional statements
Selection 354 API Macros 448
Combo Box History Lists 339 CONFIG.PM 413
Combo box lists 339 Configuration
Command Files 482 Hierarchy 198
Command Key 64, 106, 269, 398, 475 Project Files 465
API Command Prompt 64 Reading settings from other
BRIEF keymap 64 files 173
CUA keymap 64 Wizards 32
examples 399 Configuration and State
using 64 Command Line Parameters 475
VI keymap 64 introduction to 464
command line length limits 185 Configuration File 4, 477, 478, 480
Command Line Parameters 4, 475 Command Line Parameter 464
Command Files 482 Contents and Purpose 464
Order of Processing 476 Example 466
Samples 477 Location 463
Types 476 Options (Dialogs and Functions)
Command Options 182 472
Commands Processing at Startup 468
Build, Rebuild, Debug, Execute, User-Defined Sections 470
Compile 39 Constants
Find Next Error 39 Return Value 399
Comments 129 Tab Completion at the Command
API Macros 435 Prompt 64
Comment Box 129 Control Structures
Comment Boxes 91 API Macros 448
comments and comment boxes 87 Convert Files to Supported File Types
inserting 39 458
Restrict searches to 22, 253 Copy 146, 356
Common User Access 351 Core Services 493
Compact Mode 269 CPAN 414
Compile 201, 206 Create a Document Dialog 36
command line compilers 174 Create New Document Dialog 36
Specified Target 204 Creating
Tools 178, 202 API Macros 433
Utilities 174 ChromaCoding Lexer 75
Compile and Link Options 503 Perl Scripts 405
compiled tags database (.ptg) 171 Project 161
Compiler 191, 202, 203 Windows With A Mouse 357
command line 203 Ctags Support 277
command line length limits 185 CUA 64, 351, 352, 354, 398
Index 511
Keymap 352 CWRIGHT.PST 481
CUA Keymap 352 CWSTART.DLL 493
Cursor CWSTART.H 493, 501
Placement After Search 265
Custom Error Parsers 189 D
making 190
Custom tools 44, 179, 201 -d flag 410
creating 179 data types 417, 427
Customization 401 Debug 201
Using your own DLL 505 Compile 191, 201
Customization Button Debugging
CodeWright Status Bar 41 Your AppBasic Macro 425
Customize Dialog Default
Environment option 66 Backup Specification 372
Customize|Language 84, 85, 110, 112, Keymap 478
370, 372, 374 default 333
Customize|Libraries Dialog 74 DefaultKeymap 505
Customizing the CodeWright Delphi File Synchronization 231
Interface DeTab 110
Dockable Toolbars and Windows Detachable Tabs
331 Project Window 332, 333
Keymaps 351 Differencing
Menus 339 Advantages 297
Mouse Commands 353 Analysis Dialog (Interleaved) 298
Toolbars and Buttons 336 Difference Analysis Dialog
cwbLoadFile 424, 428 (Side-by-Side) 300
cwbShowProcDisplay 429, 431 Directories 309
cwbShowToolbar 429, 431 Directory Difference Analysis
cwbUnloadFile 428 Dialog 309
CWConst 411 Directory Differencing Output 311
CWD 246 Ignore Whitespace 299
CWDDE.DLL 499 Interleaved 298
CWDIALOG DLL 496 Interleaved Document 300
CWDIALOG.H 496, 501 Interleaved Options 299
CWExec 412 Print from Side-by-Side Difference
CWHELP.H 501 Window 155, 307
CWLDRAW.DLL 499 Reference vs. Target File 299
CWP.DLL 409, 413 Side-by-Side 300
cwp.dll 405 Side-by-Side Difference Window
CWP.PM 405, 409, 413 301
CWP.XS 413 Side-by-Side Edit Mode 304
CWPERL.DLL 413 Side-by-Side Options 301
CWPERLI.DLL 413 Side-by-Side View Only Mode 302
CWPERLI.MNU 413 directories
CWPerlIO 412 differencing 309
CWRIGHT.INI 424, 429, 498 differencing output 311
CWRIGHT.MAC 432 Edit Search Path 172
512 Index
system files 170 DYNALOADER.PM 413
using to organize the Project Tab of
the Project Window 168 E
Displaying Return Values 398
Dissecting a CodeWright DLL 500 Edit
DLL Extensions 403 API Macros 433
DLLs 397 Menu 37
Compile and Link Options 503 Search Path 172
CWDIALOG.DLL 496 UserDialog 421
CWHELP.DLL 496 Elision 269
CWSTART 493 Email 8
Dynamic Link Libraries 66 embedded language support 86
Installing your DLL 505 EnTab 110
Link Libraries 503 Environment 69
Makefiles 502 Dialog and options 66
Organization of DLLs within Setting up the 204
CodeWright 492 Space 204
Recompiling 502 EOF
Source Code 401 Virtual Lines After 84
Supplemental Features 498 EOL
Supplemental Language Support Virtual Space After 84
497 Epsilon command set 352
Typical Contents 500 Error
Using your Own Custom DLLs 505 Find Next 39
DLLs/Libraries/ Add-Ons Error File 188
loading 43, 66 Error Handling
Dockable API Macros 451
Toolbars 417 error output 187, 190
Toolbars and Windows 331 accessing compiler, linker and as-
Document sembler 189
Difference between windows and Error Parsers 189, 190
documents 44 Error Parsing
Menu 40 Supporting Files 495
move forward and back 55 errors
Document/Window Manager Dialog accessing 187, 191
46 EvalExpression 411
DOS Evaluate Expression and Add Watch
Changing EOL 84 AppBasic 426
Save File as New Type 458 event handler 424
Drag and Drop EventHandler in AppBasic 424
Copy 356 Example Configuration File Settings
File Loading 357 AppBasic 430
Move 356 Exclusive Selection 353
Projects and Project Spaces 358 Execute 201
Text 356 Exiting and Macro return values
Visual Studio workspaces and API Macros 448
projects 358 Expand / Collapse 358
Index 513
Expanding And Collapsing Text 358 Type defined 84
EXPORTER.PM 413 File Sort Mode on the Project Tab of
Expression Evaluator 399 the Project Window 168
Expressions FILE.TPL 95
API Macros 441 Filename Component Macros 183, 184
ExtAssignTemplate 93 Uppercase vs. Lowercase 185
Extending CodeWright Filename Transformation 371, 372,
API Functions 397 373
Changing and Adding Functions Filenames 476
501 Short vs. Long 185
Core Services 493 Files
Creating New Keymap Command Auto-Save 367
Sets 455 Backups for Individual Files 370
Keyboard Command Sets 497 Backups for Specific File Types 370
Macro Languages and DLL Source Conversion to Supported File
Code 397, 491 Types 458
Macros, Macro Languages and delays when opening/closing 283
DLLs 401 File Manager 50
Supplemental Language Support File Open dialog functionality 50
497 Finding 36
Using your Own DLL 505 Formatting the Backup
Extensibility 401 Specification 371
Extension Global Backups and Auto-Save 367
File 171 loading 172
Override on Per-File Basis 46, 89 Loading and Validation 364
External documents/ programs- Open tab -- Project Window 55
accessing opening 172
Button Links 295 Opening as Read-only 376
ExtExpandTemplate 94 Organize by Directory on the
ExtSetTemplateMacro 97 Project Tab of the Project Window
168
F Organize by File Sort Mode 168
Organize by version control status
F1 key 168
Configuring MSVC HTML help 150 Override Extension 46, 89
Fast Find 256 Read-only Files for Specified File
Fax number 9 Types 375
feature 108 Read-only for Individual Files 375
File Reloading current file from disk 36
Alias Type 89 Saving Large Files 395
Grep 248 Sending via Email 36
Headers 91, 94, 101 Sharing 50
Icons in Project Tab of the Project Show File List on File Menu 43, 68
Window 213 Used by Perl for CodeWright 413
Menu 36 Working with Large Files 391
New 36 File-Validation 3
Override Extension 46 Fill Pattern 373
514 Index
Filter 290 Changing and Adding 501
Filters 37, 41
File|Filters dialog 37 G
project filters 168, 193
Find Fast 256 Get
Finding Files Files using Base Directories from
File Find tab 48 FTP Profile 379
first error 191 Files Using Directory Trees on FTP
Flag Initialization 455 Manager 379
Flags 476 Getting Started
Fmatch 469 API Macros 433
Fold text 268 Perl 404
Fonts 69 Grep
print fonts 70 Search and Replacement Edit Boxes
screen fonts 70 245
Format Selective Display 24
Controls 372
Source 39, 87, 320
Source Code on Language Dialog
H
321
forward to next document position 55 Handlers 418, 420
FTEE 205 Help
FTEE.EXE 203 accessing from other environments
FTP 28 148
FTP Manager Tab on the Output Compiled Microsoft HTML (.CHM)
Window 48, 378 Help Files 150
Get or Put from Directory Trees 379 configuring 148
Get or Put using Base Directories DLL 496
379 Index File Wizard 32
Login Dialog 377 InfoViewer 151
Profiles 377 Integrating with MSVC 5.0 (.IVT)
Put and Get 377 help 151
Toolbar 380 Menu 46
Full Screen MSVC 4.0 (.MVB) Help Files 151
Window menu 45 MSVC 6.0 HTML help integration
FUNCT.TPL 95 149
Function Visual Studio .NET HTML Help
Assign to Keystroke Combinations Integration 150
360 Hex
Tooltip with Parameters 124 Editing 145, 146
Function calls Mode 145
API Macros 447 Searching for hexadecimal values
Function Completion 267
at Command Prompt 64 Values 145
CodeSense 113 Hidden Characters
Function Headers 91, 94 making visible 70
Functions
Index 515
Hidden files Case Statements 111
Open tab-- Project Window 55 Prompted Slide In/Out 40
Hide Seek Indentation 110
text 268 Slide In 40
Highlight Slide Out 40
Current Parameter in Function Smart Indenting 110
Prototype Tooltip 124 indentation styles 111
Definition in Symbol’s Member List Insert
for Location 122 Braces 108
History Button Links 38
of document positions 55 Comment 129
of Responses 339 File 37
History of Document Positions 55 Function and File Headers 94, 101
Hotspots on the Status Line 355 functions 99
Hover Line Numbers 40
Tooltip with Function Prototype Link 295
124 Literal (Hex, Decimal, ASCII) 37
Tooltip with Symbol Definition 123 Insert/Edit User Dialog 421
HTML Installing Your DLL 505
Edit Mode by Default 133 Interleaved Differencing 298
Editing 130, 132 Internet Mail 8
Enable Editing in WYSIWYG Interpreters dialog 411
Window 133 Introduction 397, 491
language support 130 Iteration Qualifiers 263
popup menu 130 Iterative statements
Project Filter 140 API Macros 450
toolbar 130
turn on WYSIWYG 131 J
Using MSVC 6.0 Help Files 149
View 131 Java
WYSIWYG 132 Browse 285
WYSIWYG editor/viewer 131 CodeSense Support 113
jump to first error 191
I
K
Icons
Outline Window 281 Key Assignments 469, 478
Identifier Characters Key Command
First Field and Follow Field 76 Command Completion 64
Identifiers 76 Keyboard
if-else statement 448 Assign Keys 360
Importing names into Perl’s Command Sets 497
namespace 409 Keymap Function 455
Inclusive or Exclusive Selection 353 Keymaps 497
Incremental Searching 53, 257 Binding Keystrokes to Functions or
Indent 109 Macros 360
Alignment 111, 112
516 Index
BRIEF Key Commands 352 Creating a ChromaCoding Lexer 75
Creating New Keymap Command Creating a Language Support DLL
Sets 455 89
CUA Key Commands 352 enable coloring 88
Customizing 351 Language DLLs 74, 88
Customizing Keybindings 359 loading 74
Specific Assignments 456 setting configurations 83
Specific Keymap Assignments 358 user-defined keywords 78
Visual Studio .NET 3, 352 Large Files 391
Keystroke Macros 38, 171 Changing Block Size 392
Editor 360 Changing the Number of Swap
Keystrokes Blocks 391
modifying 358 Disabling File Pre-loading 394
keywords File Rewrite Save Method 396
from file 86 Saving 395
restrict searches to 22, 253 Swap Blocks Allotting Memory to
KmapAssign 456 Swap Blocks 391
Turning off Backups 393
L Turning Off Scroll Bars 393
Left Justify 40
Language Lexers 85
coloring 73 COBOL 142
coloring embedded 85, 86 Default Settings 75
Creating a Language Support LibExport 409, 418, 500
DLL 89 LibFunctionExec 98, 409, 418
Defining API Macros 434 LibFunctionExistsWhere 403
DLL 74, 88 Libraries/ Add-Ons/DLLs
Features, Supporting Files 493 loading 43, 66
Indenting 493 Line
Tools|Customize Dialog 43 Numbering 40
Language Dialog 92 Saver Alignment 112
ChromaCoding 85 Selections 354
Comments Tab 87 Link
DLL radio button 86 insert 295
Format Tab 87 Insert Button Link 38
Lexer radio button 85 Preserve between UNIX Files 462
Options Tab 84 Link Libraries 503
Symbols Tab 87 Borland Link 504
Tabs/Indenting Tab 85 Microsoft Link 504
Templates Tab 85 Literal
language support 73, 497 Insert Hex, Decimal, or ASCII
Adding a New File Type 88 Literal 37
additional language support 74 Load
Alias or map non-supported and Validate Files 363
languages to supported ones 88 Load Macros Dialog
ChromaCoding Lexers 74, 85 AppBasic 427
COBOL 141 loaded for execution 421
Index 517
Loading and running scripts Making Changes and Additions 501
Perl 407 Mark Database 171
Login Dialog MarkBeginSel 411
FTP 377 Maximum Cache Size, CodeSense
look 333 Lookups 127
Members tab of Project Properties
M Dialog 60, 164
Memory
Macintosh Block Size 392
Changing EOL 84 Cache to Speed CodeSense
Save File as New Type 458 Lookups 127
Macro File 171 Pre-loading Files 394
Macro Languages Swap Blocks 391
API (C-like) Macros 432 Menu Accelerators 456
AppBasic 414 Menu items 341
Comparison of Supported adding 341
Languages 402 deleting 341
Perl 404 separator 341
Macros MenuAddKeyString 456
Binding Keystrokes to Functions or Menus
Macros 360 adding 340
Creating a Macro in AppBasic 418 Adding a Menu Item 343
Debugging in AppBasic 425 Adding External Operations 344
Defined 401 Build Menu 39
In templates 94 changing position 340
Keystroke Macro Editor 360 Changing the Functionality of a
Loading a Perl Macro 407 Menu Item 342
Recording a Keystroke Macro 359 Customizing 339
run from Button Links 296 Defining a Popup Menu 344
Running AppBasic Macros 424 deleting 340
Supporting Files 495 Document Menu 40
Tools Menu options 40 Edit Menu 37
Using Macros vs. DLL Extensions Editing Menu Items and Submenus
403 341
MACROS subdirectory 405 Editing Top-Level Menus 340
Mail file lists 341
Sending Email to Support 8 File Menu 36
Sending files 36 Project Menu 38
make utilities 174 Search Menu 38
Makefiles 502, 503 Sending Menu Commands to
adding files to CodeWright projects Synchronized Environments 241
165 Text Menu 39
Auto-Sync 167 Tools Menu 40
Parsers 166 Merging Files 317
reading into projects 167 Output 319
Synchronize with CodeWright Removing Changes 320
projects 167 Messaging 50
518 Index
Metacharacters 262, 263, 264, 265, 266
Microsoft Browser Database (.BSC) N
171
Microsoft Link 504 Name Completion 112, 121
Microsoft Visual Studio Structs, Classes, Unions, Enums,
Bi-directional synchronization 239 Namespaces, Packages, Interfaces
Drag and drop workspaces and 122
projects 358 Symbol Members 122
Synchronization 229 name confusion 403
Microsoft Visual Studio Workspace Navigate
Auto Synchronize 167 move between documents 55
drag and drop to create project Newline Character 93, 261
space 164 Next Error 191
opening as project space 164 Nmake 181
Parsing 166 No Command Shell 182
Reading 166 note links 296
Modal User Dialog in AppBasic 421 NotePad 351
Modules Properties dialog 418, 419
Mouse 354, 357
Copying Text 357
O
Creating Windows With 357
Moving Text 357 O'Reilly Press 414
Mouse Commands 353 Object and Proc Drop Down Lists 420
Block Selection 353, 354 Object Browser 417, 427
Column Marking 354 Objects Window 272, 285
Copy and Move 356 Filter/Legend dialog 290
Creating Windows 357 OLE Automation 417
Expand/Collapse Sections of Text One Document per Window 45
358 Online Help
File Loading 357 AppBasic 417
Go to Symbol Definition 121, 122 Perl 406
Hover for Function Prototype 124 Open projects and project spaces 164
Hover for Symbol Definition 123 Open tab
scrolling speed 353 Project Window 53
Selecting Lines 354 option 41
Selecting Words 355 options 333
Status Line Actions 355 Outline Symbols 281
Text Drag and Drop 356 Auto-Expand Collapse 282
Move 356 Icons 281
MsgNotify 419 sorting 282
MSVC workspaces and projects Outline Window 272, 279, 281
Drag and drop 358 output
MSVC++ File Synchronization 229 capturing 182, 187, 205, 206
Multiple Sources Search Dialog 244 Output Window 47, 191, 248, 272, 273,
Multi-source search 405, 407, 418
Fast Find 256 AppBasic Edit tab 48, 414
Browse tab 48
Index 519
ClipView tab 48, 148 Perl.HLP 406
Difference tab 48 perl.org 414
File Find tab 48 PERL_IN_ 412
FTP Manager tab 48, 378 PERL5DB.PL 413
Output tab 48, 190, 206 PerlExec 407, 410
Perl tab 48, 405 PerlExecStr 407
Search tab 48 PerlExecSub 407
Shell tab 48 PerlRun 408
Symbols tab 48 PerlUnload 410
Override Pattern 373 Phone Number 9
PL extension 405
P Popup
Function Prototype 124
Parameters 476 Member List for Symbol 122
Function Prototype Tooltip 124 Name Completion or Go to
Parentheses Definition for Symbols 121
in Expressions (API Macros) 447 Symbol Definition 123
Locating 107 Popup Menu 344
Matching 107 AppBasic 417
paste 146 Perl 406
Pctags 278 Supporting Functions 351
Perl 397, 404 Version Control 215
books 414 Pre-loading Files 394
Options dialog 410 Preprocessor coloring
Popup menu 412 Ignore Remainder of Line 79
Tab on the Output Window 48 Preprocessor directives
Window 405 selective display 269
Perl Macro Language 404 PRG.DLL 498
Accessing CodeWright Functions Printing 152
409 color 153
Accessing Perl Functions 410 Configurations 152
already installed 405 date, timestamps, page number,
Creating and Editing Scripts 405 filename 154
Debug Mode 410 header and footer macros 154
Files used within CodeWright 413 Headers and Footers 154
help 406 line numbers 153
Importing Names into Perl's multi copy 153
Namespace 409 Paper Selection Override 153
Loading a Macro 407 Preview 153
Loading and Running Scripts 407 Side-by-Side Difference Window
Other Resources 414 155, 307
Perl Tab on Output Window 405 Wrap Long Lines 154
Pop-up Menu and Options 406 wrapping long lines 153
Special API Functions 411 Processing At Startup 468
Specifying the Intended Profiles
Subroutine 411 FTP 377
Unloading a Perl Macro 410 Project and Output Windows 47
520 Index
Project Files 198 Command lines 194
format 465 Command Options 182
loading 195 Compile commands 194
Options 472 Compiling 194
Project Menu 38 Compute Document Symbols 171
Project Properties Dialog 273 creating 161
Directories tab 170, 171 Custom tools 179
Errors tab 187 defined 157
Filter tab 192 Directories 193
Members tab 59, 163 Drag and drop 358
Tools tab 174, 179 drag and drop 164
Project Spaces 157, 158 filters 168, 192, 193, 195
creating 57, 58, 158 loading member files 195
Defined 158 opening or loading 164
Drag and Drop 164 Project Properties Dialog 60
Drag and drop 358 Properties for CodeSense Use 114
opening or loading 164 setting project configurations 60
selecting or changing 195 setting up project tools 181
Project Tools 174 Setup Checklist 193
Command Options 182 storing configuration settings with
Running in the Background 182 172
Project Window 49, 169, 272 synchronize with external
Bookmarks tab 50 makefiles/Workspaces 167
CodeFolio tab 50 use with version control 198
CodeMeeting tab 50 Working Directory 170, 171, 193
Detaching Tabs 332 Prompt for Arguments 182
Files tab 168 Prompts
Incremental Searching 53 System 42, 68
Objects tab 50, 272, 285 PTG file 273
Open tab 50, 53 Put
Outline tab 50 Files using Base Directories from
Project tab 49 FTP Profile 379
refresh 170, 214 Files using Directory Trees on FTP
StarTeam Tab (optional) 50, 223 Manager 379
version control 169 PWB 471
Version Control Icons 213
version control operations 169 Q
viewing version control status 170,
214 Quick Search 258, 276
Projects 157 quit
add files 59, 163 a long search 256
adding files from external make- Quoting 264, 265, 266
files/Workspaces 165
Associating Version Control
Projects with 211
R
Auto-Update Symbol Database 171,
285 Read User Makefile 166
Index 521
Read Visual Studio Workspace 166 Right Justify 40
README.TXT 8 Run mode 426
Read-Only Files 374 Running The Macro
By File 375 AppBasic 424
By Type 375
Set upon Opening 376 S
Rebuild 190, 191, 206
Recompiling a DLL 502 Sample EHTEST.CWB 425
Recording a Keystroke Macro 359 SAMPLE.DLL 499
Redirect Output 182 Save
Reference Groups and Replacement All Files automatically 182
Strings 265 Current File automatically 182
Registering CodeWright 31 Current Position 293
Regular Expressions 259, 263, 264, 265, Files with Auto-Save 367
266 Large Files 395
Alternation and Grouping 264 SC.DLL 498
Character Classes 262 Scrap Buffers 146, 147
ChromaCoding 13, 81, 82 Clipboard Tab 147
Escape Sequences 261 multiple 471
Escaping Characters in a Class 262 Viewer 148
Examples 266 scripting language
Iteration Qualifiers 263 coloring 86
Matching End Of Line 264 Scrollbars 69
metacharacters 260 Turning Off 393
Placing the Cursor 265 SDK for CodeWright 89, 491
positioning at Beginning/End of Search
Line 264 After Go To 277
Reference Groups and and Replace Dialog 244
Replacement Strings 265 ChromaCode Output 249
searching for more than one char- Color Limited 22, 253
acter 263 Editing Pattern List 249
special characters 259 for word at cursor 258
Reload 36 Ignore case 253
Replace Incremental 53, 257
Global replacement 252 Maximal match 253
Multiple Sources/files 245 Menu 38
Prompt options 252 Multiple Sources/ Files 245
Prompted replacement 252 Omit Binary File and Buffer
Single replacement 252 Matches 247
Replacement Options 251 on toolbar 259
resolve name ambiguity 403 Quick Search 258
resources Regular expression 253
CodeSense parser priority 118 Restrict to selection 255
Response File 185 Results in Output Window 245
Contents 185 Retain selection 254
Restore Current Position 293 Save Output between Sessions 249
Rich Text Editor 415, 429 Select matching string 254
522 Index
stopping or quitting 256 Send Mail 36
Subdirectories 247 Set As CWD 246
Text Files Only 247 SetStringMacro 187
Whole word 253 Setting Project Defaults 160
Search List 247 Shell Command
creating/modifying 250 Tools Menu option 41
Drive and Directory Lists 250 Show Loaded Modules dialog 421
File Pattern 250 Side-by-Side Differencing 300
Include Directory 250 Foreground and Background
List Editing Buttons 250 Colors 302
Patterns List 250 Printing 155, 307
Search multi-source Smart Indenting 110
Documents only 246 Snippets
Edit Modified Files 248 Add to New Document 36
Files and folders 246 Adding a Snippet to CodeFolio tree
Output Window 248 directory 102
Project 246 Adding or Removing a CodeFolio
Search Options 56, 244, 259 Snippet Directory 104
Case Sensitivity 38 Code Snippet Properties Dialog 103
Dialog 38, 244, 356 CodeFolio Tab on Project Window
Prompt On Replacement 38 50, 99
Regular Expressions 38 Creating a Snippet from Clipboard
Searching or Document Selection 102
background Thread 248 Deleting or Renaming CodeFolio
Binary/ hexadecimal data 267 Snippet 103
CWFGREP 249 Directories 99
direction 251 Editing a CodeFolio Snippet 104
Displaying and controlling Output Executing a Snippet into your
248 Document 99
Exclude Start Position 255 Sorting
incremental 257 Files on the Project Tab of the
listbox control 258 Project Window 168
newlines 267 Source Code Revision Control
Project Files 197 Maintenance Dialog 210
Regular Expressions 259 Source Files
sets of files 247 Code Review from Different
spaces/tabs 266 Locations 50
Subdirectories 247 Spaces
Wrap at beginning/end 255 Replace with Tabs 110
SELECTION_LINE 411 setting 109
Selections Special Characters 93
by Word 355 Special Keybindings
Closed 354 Appbasic 415
Line 354 speed
Selective Display 39, 268, 269 auto validating 366
preprocessor directives 269 CodeSense parser priority 118
save between CW sessions 271 increasing 171
Index 523
Spell Check 323 StrSubStr 454
Tools Menu option 41 StrTrim 454
Spell Check Dialog Submenus 341
Advanced Tab 326 adding 341
Documents Tab 328 Swap Blocks
General Tab 323 Changing the Number Allotted 391
Word Format Tab 324 Symbol
split window 69 File 171
SrchSetFlags 455 Hover for Tooltip Definition 123
Standard Toolbar 55 Lookups (CodeSense) 124
repeat last search button 56 Name Completion from Popup Di-
search for word under cursor alog 121
button 56 Parser Icons 281
StarTeam Parsers (making/creating) 283
Filter Options Dialog 50 Scanning 280
Integration in CodeWright 50 Symbolic macros 186
Setting Up CodeWright Integration Symbols 272, 279
223 Auto-Expand Collapse 282
Tab on the Project Window 50, 223 Auto-Update Symbol Database 171,
State File 339, 473, 476, 482 285
Contents 465, 474 Compute Document Symbols 171
Location 474 Configuring 283
Statements and Statement Blocks Displayed in Symbols Window 280
API Macros 448 making/creating 283
Status Bar Navigating and Using 282
Customization Shortcut 41 Parser 279
Status Line Sorting 282
Actions 355 Window 272, 279
Progress Indicator 355 Synchronization
stderr 405 Borland C++ Builder File Setup
stdin 405 233
stdout 405 Delphi Setup 231
Stop a long search 256 Initial Setup in CodeWright 225
StrAscii 454 Microsoft Visual Studio 229
StrFileMatch 454 MSVC++ Setup 229
StrFormatDate 454 Sending Menu Commands to
String functions Synchronized Environments 241
API Macros 453 Supported Environments 225
StringApnd 453 TI Code Composer Setup 237
StringCompare 454 Visual Basic Setup 235
StringICompare 454 Wizard 32
StringLength 454 syntax coloring
StringNApnd 454 Adding a New File Type 88
StringNCompare 454 adding keywords from a file 78
StringNICompare 454 Comments 79
StrItoA 454 Creating a ChromaCoding Lexer 75
StrLtrim 454
524 Index
Creating a Language Support non-language-specific 94
DLL 89 run from Button Links 295
enable coloring 88 special characters in 93
keywords 78 Special Chars In 93
Numbers 81 using macros in 94
operators 78 viewing 92
preprocessors 78 TERM.PM 413, 414
stop coloring certain items 78 Texas Instruments Code Composer
user-defined keywords 78 Bi-directional synchronization 239
SysEdit 351 synchronization 237
SysSetDefault 455 Text
SysSetFileLocking 466 Copy and Move 356
SysSetFlags 455 Drag and Drop 356
system files Expand/Collapse Sections of Text
directories 170 358
Link DB 171
T Menu 39
Restrict searches to 22, 253
Tab Completion for Functions and through 55
Constants 64 TI Code Composer Synchronization
Tabs 263, 264 237
controlling/customizing 85 Bi-directional synchronization 239
Replace with Spaces 110 Timestamps
setting 109 Open tab-- Project Window 55
showing tabs 70 Toolbar Search 56, 258, 356
Virtual Space Inside 84 Toolbars
Tags 4, 278, 483 Adding and Changing Buttons 336
Database 171, 278 Adding New Toolbars 336
Setup 278 Appbasic 417
Support 272, 277 Auto-hide 334
Tagfind Function 278 Binding a Function to a Button 337
TagNext 278 Buttons 171
TagPrev 278 Customization 44
Using Database 278 Customizing 336
TagsW32 272, 483 Default Toolbars 331
Technical Support 8 Docking and moving 335
Telephone Number 9 Enabling and Disabling 335
Template Expansion 85, 91, 493 forward and back button 55
Template macros FTP 380
list of 96 Options 331
Templates Standard toolbar 55
abbreviations that trigger 92 Tools
Add to New Document 36 Custom 44
creating and modifying 92 Tools Menu 40
example 94 Adding External Program/
ExtAssignTemplate 93 Operation Links 344
for language constructs 92 API Command 63, 398
Index 525
Tooltip Converting Individual Files 458
Function Parameters 124 Utilities
Hover for Symbol Definition 123 Supporting Files 494
Transformation Tools Menu options 41
Fill Pattern 373
Override Pattern 373 V
TransformFilename 454
Tree Control Variables
Incremental Searching 53 API Macros 435
Tree Differencing 309 VCS tool 180
Output Window 311 VDOS 182
Window 311 capturing output 206
Troubleshooting Version Control 169, 174, 209
CodeSense Lookups 128 Adding CodeWright Project Files to
TYPEMAP 413 an SCC Provider Project 213
Adding Version Control Files to a
U CodeWright Project 212
Associating Version Control
Undo 37, 55 Projects with CodeWright Projects
Unicode 211
Auto-detect 42, 68, 365 Configuring SCC Provider Support
CodeSense translation 124 222
Converting Individual Files 458 Current Project Tree List 214
Unindented Alignment 112 Customizing Version Control Com-
UNIX mands 219
Changing EOL 84, 460 File Icons 213
Compiling from CodeWright 461 Integration Methods 217
Enabling Auto-Sense File Type Location of the SCC Provider DLLs
EOL 458 223
File Conversion 458 Maintenance Dialog 210
File Securities 461 Making Your Own Popup Menu
File Transfer using FTP 377 216
Filename Case 461 Menu 209
Preserve Links between UNIX Files Modifying the Standard Popup
462 Menu 215
Recommendations for Running Project Tab of the Project Window
CodeWright with UNIX 457 214
Update Configuration Files checkbox Sorting on the Project Tab of the
173 Project Window 168
User-defined commands Source Code Control Provider 222
Open tab--Project Window 55 StarTeam Integration in Code-
user-defined keywords 78 Wright 223
UserDialog 417 Toolbar 214
Editor 417, 421 Tools Menu option 41
Using the Tags Database 278 User-defined Popup Menu 215
UTF-8 Using Command Line Version
Auto-detect 42, 68, 365 Control Provider 218
526 Index
Using Multiple Configuration/ Whitespace
Project Files 216 Ignore during Differencing 299
Utilities 174 Wild Cards
vi command set 352 File Filters 37
View Themes Wildcard Patterns 37
Defaults 71 Win32 systems 414
Synchronize text background 70 Window Menu 44
View Themes Dialog 70 Windows
Colors tab 70 Attributes 69
Font tab 70 Creating with a Mouse 357
General tab 69 Difference between windows and
Visibles tab 70 documents 44
Virtual Space Docking and Moving 335
After End of File 84 move forward and back 55
After EOLs 84 One Document Per window 42, 68
Inside Tabs 84 split into multiple panes 69
visibles Windows Explorer 357
making visible 70 Windows XP
Visual Basic Synchronization 235 Enable Visual Styles 35
Visual Studio Wizards
Bi-directional synchronization 239 configuration 32
Synchronization 229 Word
Visual Studio .NET Completion 113
HTML Help Integration 150 Selections 355
Keymap 3, 352 Wrap 40
Visual Studio Workspaces Working Directory 170, 171, 464, 481
creating CodeWright projects from Workspaces 157, 158
165 Closing Windows 197
drag and drop to create project creating 196
space 164, 358 defined 158
open or load to create project space Deleting Buffers 197
164 loading 197
Visual Styles saving 196
Enable for Windows XP and Code- saving automatically 197
Wright 35 updating current 197
WYSIWYG HTML
W Editing 131
turn on 131
Web browser interface
turn on 131 X
Web Page 8
Editing 132 XML
turn on editing 131 Browser View 138
turn on viewing 131 Format Source 140
Viewing 131 Project Filter 140
WYSIWYG editor 131 Source Code View 137
Where is it Defined? 403 Split Window View 134
Index 527
Split Window Viewer module 135
Template Expansion 139
XSL Transformation View 138
XP
Enable Visual Styles for Windows
and CodeWright 35
XSL
Template Expansion 139
Transformation View 138
XSUBPP.PL 413
528 Index