If you've ever created a custom tool for the Borland C++ 4.0 Integrated Development Environment (IDE), you've probably noticed that the tool is available only within the project that was open when you created the tool. If you want to use this tool with another project, the obvious solution is to create the tool in that project as well.
However, if you've created more than one tool, re-creating
each one in a different project can be time-consuming. Fortunately,
you can force the IDE to save the tool description text in a format
that you can copy between projects. In this article, we'll
show you how to do this, and how to copy a tool from one project
to another.
Normally, the Borland C++ IDE saves information specific to a project within the project file itself. Unfortunately, the project files are basically binary information in a format that's not easy to edit.
Instead, you can force the IDE to save project information as a text file. To enable text-format settings files, you'll need to open the BCW.INI file and add two new settings: ReadAsText=1 and SaveAsText=1.
Now the IDE will create a text-format settings file for a given project whenever you close the project from the IDE. To help you recognize them, the text-format settings files have a PDL extension.
To create a PDL file for the project containing a tool you want to copy (the source project), you'll open and then close the source project from the IDE. To create a PDL file for the project you want to copy the tool into (the target project), you'll open and then close the target project from the IDE. (If you want to use a tool in all new projects, see Tools for new projects.)
At this point, both projects will have corresponding PDL files that contain each project's IDE settings. Since the files are simple text files, you'll be able to copy the tool description text from one PDL file to the other using any text editor.
Next, you'll open the source project's PDL file and locate the section that describes the IDE tools. From this section, you'll copy the text that describes the custom tool you want to copy to the other project.
Finally, you'll open the target project's PDL file and locate the IDE tools section. Here, you'll paste the descriptive text for the custom tool.
Once you've saved the target project's PDL file,
you'll be able to use the custom tool when you open the
target project from the IDE. Now let's apply this technique
in a simple example.
First, launch Windows and choose Run... from the File
menu of the Project Manager. When the Run dialog box appears,
enter
notepad \windows\bcw.ini
in the Command Line entry field and click OK.
When the Notepad - BCW.INI window appears, locate the label [Project]
if it exists in the file. If this section doesn't exist,
enter
[Project]
at the end of the file.
Immediately after the [Project] label, enter
ReadAsText=1 SaveAsText=1
When you finish, this section of the file should resemble the
lines shown in Figure A.
Figure A - You change the BCW.INI file to enable text-format settings files.
Save the changes to the BCW.INI file by choosing Save from the File menu. Then, quit Notepad by choosing Exit from the File menu.
Next, launch the Borland C++ 4.0 IDE. When the IDE's main
window appears, open the WHELLO example project by choosing Open
Project... from the Project menu and entering the following
in the File Name entry field of the Open Project File dialog box:
\bc4\examples\windows\whello\whello.ide
Click OK to open the project.
When the project window appears, choose Tools... from the Options menu. In the Tools dialog box, click the New... button.
In the Tool Options dialog box that appears, enter the tool settings shown in Figure B. When you finish, click OK to save the new custom tool. Choose Close to close the Tools dialog box.
Figure B - You use the Tool Options dialog box to create a new custom tool.
Now, choose Open Project... from the Project menu. In
the File Name entry field of the Open Project File dialog box,
enter
\bc4\examples\windows\ffind\ffind.ide
Click OK to save the settings file for the WHELLO project. Then, choose Close Project from the Project menu to save the settings file for the FFIND project.
Now, open the settings file for the FFIND project by choosing
Open... from the File menu. In the File Name entry field
of the Open A File dialog box, enter
\bc4\examples\windows\ffind\ffind.pdl
and click the OK button. When the edit window for the FFIND.PDL
file appears, locate the section of the file that contains
{ SubSystem = Tool }
and position the cursor ahead of the right brace (}).
Next, reopen the settings file for the WHELLO project by choosing
Open... from the File menu. Enter
\bc4\examples\windows\whello\whello.pdl
in the File Name entry field of the Open A File dialog box, and
click the OK button. When the edit window for WHELLO.PDL appears,
locate the section of the file that contains the lines
{ Tool = "Notepad" { Category = Transfer } { Path = "notepad.exe" } { MenuText = "Notepad" } { SearchPath = SourcePath } { ToolFlag = ToolsMenu } }
and select this entire section.
Copy this text to the Clipboard by choosing Copy from the Edit menu. Now, close the WHELLO.PDL file by double-clicking on its System menu icon.
When the edit window for FFIND.PDL reappears, choose Paste from the Edit menu to add the text description of the Notepad tool to the FFIND project's settings file. When you finish, the Tool section of your FFIND.PDL file should resemble the one that appears in Figure C.
Figure C - You can copy IDE tools between the settings files of different projects.
Choose Save from the File menu to add the Notepad tool to the FFIND project's settings file. Close the edit window for the FFIND.PDL file by double-clicking on its System menu icon.
Finally, reopen the FFIND project. When the project window appears,
click on the Tool menu to confirm that the new Notepad tool is
now available from within the FFIND project. Choose Exit from
the File menu to quit the IDE.
By creating your own tools, you can customize the IDE. By using
the technique we've described here, you can use tools you
created in one project in other projects.
Copyright (c) 1996 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Publishing Company.