The V C++ GUI Framework User Guide:V Applications

From EDM2
Jump to: navigation, search

Contents

Miscellaneous Utilites

bmp2vbm

The utility bmp2vbm converts a Window or OS/2 .bmp format bitmap file into a .vbm Vicon bitmap format file. The .vbm file is then used with a vIcon object definition. The bmp2vbm utility will not convert all .bmp files. Specifically, it can't handle old format .bmp files, nor can it handle compressed .bmp files.

Windows has many tools to generate .bmp files. For X, the widely available tool xv can generate .bmp files from various source formats.

Bmp2vbm is a command line tool - run it from a Unix prompt, or from an MSDOS box on Windows. The command line format is: bmp2vbm inputname outputname iconname. You should specify only the base file names: bmp2vbm will automatically supply the .bmp and .vbm extension. The iconname specifies the name used to generate the date (e.g., iconname_bits).

Other Utilites

The directory v/icons includes over 30 different monochrome icons in .vbm format suitable for building command pane tool bars. Most of these icons were derived from various Windows sources, and I would encourage their use for the standard functions they define. Some of these include creating a new file (new.vbm), opening an existing file (open.vbm), cut, copy, and paste (*.vbm), printing (print.vbm), and so on.

There is a demo program in the v/icons directory that can be compiled and used to see what all the icons look like. All the icons are 16 by 16 bits, and will match standard buttons in height on Windows. The height of standard buttons on X depends on the default system font.

As usual, contributions of other Vicons is more than welcome. I hope to build up the icons directory to several hundred icons.

V Application Generator

The V Application Generator will automatically generate C++ code needed to build a simple V application. It has several options that let you specify the name of the application, the name of your derived classes, and what V interface elements to include in the application. The V Application Generator, vgen, does not generate code that does any real work, it just provides a very good starting skeleton program to build your application.

On approach for beginning a new V application is to copy one of the example programs, and modify it. Vgen has the advantage of allowing a certain amount of customization with names and interface elements included in the basic skeleton program.

Vgen will generate the skeleton code and a makefile compatible with GNU make. On the Windows version, vgen will generate a makefile compatible with mingw32. If you use a different compiler, it is up to you to build a project file for your compiler. This is usually a very trivial operation.

Once you have generated and compiled the skeleton application, you can modify the code to build your own application. It is highly recommend that you start every new V application this way to get a consistency in the structure of the code.

Overview

Vgen is a very simple program to use. You run it, and then select if you are generating a standard V\ application skeleton, or if you are generating an extra dialog skeleton to add to an existing application.

The most common use of vgen is to generate a standard V\ application skeleton. This consists of a derived vCommandWindow class with a simple menu bar, a command pane with a sample button, a derived vCanvasPane, and a status pane. The standard V skeleton also allows you to generate a modeless and a modal dialog. You can specify the name of the classes you want to use, as well as the file names to use for each of the generated files. The standard files generated include a file for the derived vApp class, a file for the derived vCmdWindow class, a file for the derived vCanvasPane class, and files for the dialogs. Vgen also generates a GNU compatible makefile.

Vgen also will generate extra copies of dialogs. You can specify the class name of the dialog, and then generate a skeleton file. These dialogs must be added manually to the basic skeleton application.

The remainder of the reference manual will explain each menu item and each dialog.

File Menu

The file menu only has an Exit command, which closes vgen.

Generate Menu

The Generate menu selects which type of code you want to generate. These are duplicated on the tool bar.

Generate:Standard Application

This option brings up a dialog that controls the generation of a standard V application. This section will explain each option contained on the Standard V App dialog.

When vgen generates a skeleton application, it uses some fixed conventions for naming derived classes and file names. The Application Base Name input lets you specify the base name of each class. The default base name is my. Thus, vgen will generate the derived class names myApp, myCmdWindow, myCanvasPane or myTextCanvasPane, myDialog, and myModalDialog.

The File Base Name input lets you control the base name of the generated code files. If you intend to do development for Windows, it is recommended that you specify a name that follows the 8 character limit on file base names. Using the default my file base name, vgen will generate the files myapp.cpp and myapp.h, mycmdw.cpp and mycmdw.h, mycnv.cpp and mycnv.h, mydlg.cpp and mydlg.h, and mymdlg.cpp and mymdlg.h. If you generate a makefile, it will be called makefile.my.

The generate dialog allows you to control which interface elements are included in the generated code. The first section of the dialog controls the Command Window options. You can elect to include a tool bar and a status bar. You can also include code that shows the date and time on the status bar if you wish. You can control if the code generates Windows MDI or SDI model code (this has no effect on the X code). The command window class includes a short, standard menu bar that you can later modify to add your own menu items. You can also specify a title that will appear in the app's title bar. Finally, you can have vgen generate code that implements a vTimer in the CommandWindow. This is most likely to be useful for OpenGL apps.

The second section of the dialog controls the generation of the canvas pane. You can generate a canvas pane derived from a vCanvasPane, a vTextCanvasPane, or a vBaseGLCanvasPane. You also have the choice of no canvas pane at all. If you select no canvas pane, then your app must have a tool bar. You can elect to show the vertical or horizontal scroll bars by default.

You can also control generation of a modal and a modeless dialog. If you include these, code to activate the dialogs will be included in the menu bar. You will usually modify that code to activate the dialogs in a manner needed by your application.

You also have the option of generating a GNU make compatible makefile. The make file needs to know where the v/include and Vlibrary files are found on your system. On Unix-like systems, the default vgen assumes that these will be located in /usr/local/v. There is a variable, HOMEV in the makefile that sets this path. If V is found in a different place, you can change it in the generate dialog, or you can change an ifdef in the source code and recompile vgen. In the MS-Windows version, vgen assumes you are using mingw32 installed on C:, with the Vlibraries and includes also installed in the mingw32 path.

Finally, you can control where the generated files are written. The Set Save Path brings up the standard file selection dialog for where to save the myapp.cpp file. That file and the others will be saved in whatever directory you specify. If you don't specify a save path, the files will be saved in the startup directory.

When you have made all your selections, the Generate button will generate the skeleton application.

Generate:Extra Dialog

Many applications need more than one modeless or one modal dialog. Vgen's solution to this is not super sophisticated, but it is easier than modifying an existing dialog from scratch. The Extra Dialog generate command allows you to generate extra dialog classes that you can then manually add to your main application. The dialogs generated are just like the dialogs that the generate standard app builds, but with a different base name. The options in this dialog include set the class and file base names, the title, modal or modeless, and the save path.


V Icon Editor

The V Icon Editor The V Icon Editor is a tool used to create and modify icons. It is intended chiefly to create icons for the various V controls that use icons. It has many editing features found in other icon or bitmap editors, but because it is intended chiefly as an icon editor, it is limited to icons with a maximum size of 150 pixels square and will easily manipulate up to 64 colors, although it will display icons with up to 256 colors. Typically, however, icons tend to be less than 64 pixels square, and use a limited number of colors.

The current version of the V Icon Editor will handle the native VVBM icon format, as well as XBM and XPM X Windows format files, and Windows BMP format files, so files generated by the X and Windows host platforms can be easily edited and converted to VBM format.

The V Icon Editor was originally developed as a team project for the Spring, 1996 Software Engineering class at the University of New Mexico by Philip Eckenroth, Mike Tipping, Marilee Padilla, and John Fredric Jr. Masciantoni. It has been heavily enhanced by Bruce Wampler. Although this program makes use of many V\ features, as a largely student project, the quality of the code is somewhat variable, especially in its use of objects.

Overview

The icon editor functions very much like other similar programs, and should be easy to use. This guide is not intended as a complete tutorial, but more as a brief, but complete, reference.

The V Icon Editor will usually be called viconed. It may be started with the name of a file to edit on the command line.

The interface to the V Icon Editor consists of a standard menu bar, two tool bars, a drawing canvas, and a status bar. The most common operations are supported by the tool bars (which, for the most part, duplicate menu commands). The drawing canvas shows an enlarged view of the icon as well as an actual size view of the icon. The enlarged view may be zoomed to several sizes, and displayed with or without a grid. The remainder of this guide will describe each menu command, and other features that can be invoked from the tool bars.

You draw an icon using one of three types of brushes: the normal brush, the text brush, and the copy/paste brush. The brush will draw in one of several shapes. Not all shapes work with all three brushes, but you can get some interesting effects using the text or copy/paste brush to draw a line or rectangle, for example. The normal brush also has a choice of several sizes and styles. Drawing with the left mouse button uses the foreground color, while drawing with the right mouse button selects the background color. Colors are selected with the color selection dialog.

File Menu

The File menu generally includes commands needed to open, close, and manipulate icon files.

File:New

This will create a new icon using the current canvas. If the current icon has been changed, you will be asked if you want to save it. Then you will be prompted for the size of the new icon. A blank icon of the specified size will be created, and the color palette initialized to a set of default colors.

File:Open

This command is used to open an existing icon in one of the supported formats. If the current drawing canvas has been edited or had an icon loaded, a new canvas window will be opened. The color palette for the canvas window will be initialized to the colors used in the opened icon.

The format of the icon is determined by the file extension. VBM is the native Vbitmap format, and is the format required by the various Vicon controls. The current version only supports the 1 and 8 bit VBM formats. Viconed also supports the X Windows XBM monochrome bitmap files, and XPM color pixmap files (up to about 90 colors). The Windows BMP bitmap format is supported for 8-bit bitmaps. All icons are limited to a maximum of 150 by 150 pixels.

File:Save

This will save the current icon. If the icon was new, you will be prompted for a file name.

File:Save as

You will be prompted for a name to save the current icon. The format of the saved icon is determined by the file extension. VBM specifies the standard V icon format. Viconed will automatically save either the monochrome 1-bit VBM format, or the 256 color mapped 8-bit VBM format. The 24-bit VBM format is not supported. The other formats supported include X XBM monochrome bitmaps, and X XPM color pixmaps up to about 90 colors. The Windows BMP bitmap format is supported for 8-bit bitmaps.

When viconed saves an icon, it will minimize the size of the color map used in the file.

File:Close

This will close the current icon, asking you if you want to save it if it has changed, and then clear the drawing canvas, ready to create a new icon, or open another icon.

File:About

This displays a dialog with information about viconed.

File:Exit

All open icons will be closed, with save prompts as needed, and viconed will exit.

Edit Menu

The current version of viconed does not yet support standard cut, copy, and paste operations. (It does have copy/paste brush support described later.)

Edit:Undo

This will undo the last operation that changed the icon. Only one level of undo is supported.

Edit:Clear

This will clear the current icon to the background color. A clear is not undoable!

Edit:Resize

You can resize the existing icon to a new size. The upper left corner of the current icon will remain constant. If you specify a smaller icon, you will lose the lower and right portions. If you specify a bigger size, then the current icon will become the upper left corner of the new icon. You may find the copy/paste brush useful when resizing an icon.

Draw Menu

The Draw menu is used to select the shape of the brush. The normal brush will draw the selected shape using the current normal brush style. The text brush will draw the shape using the current text. The copy/paste brush will draw the shape using the copied shape.

Using the left button selects the foreground color, while the right button selects the background color.

The shape selections are duplicated on the tool bar for easy interaction.

Draw:Point

This draws a single point, or instance of the text or copy/paste brush. Holding the mouse button down and moving will draw a series of points.

Draw:Line

The button press selects the starting point of the line, and the release selects the end point.

Draw:Rectangle

The button press selects the first corner of the rectangle, and the release the opposite corner. If snap is on, then this will draw a square.

Draw:Rounded Rectangle

This is a rounded rectangle instead of a square cornered rectangle.

Draw:Ellipse

This draws an ellipse, or a circle with snap on.

Draw:Pick Color

This lets you pick a color from the current icon. Pressing the left button will make the color under the cursor the current foreground color, while the right button will pick the background color. Using the pick color (a dropper icon on the tool bar) is often easier than using the color selection dialog.

Draw:Fill

This will fill the closed area with the foreground or background color depending on the mouse button pressed.

Draw:Refresh Image

Normally, this command should not be needed, but it will cause the icon to be redrawn.

Draw:Show Grid

This will turn on or off the display of the drawing grid.

Brush Menu

These select the type of brush to use. Brush selection is duplicated on the tool bar.

All three brushes actually use the same mechanism - a general brush that can hold a pattern to draw onto the icon. A regular brush is usually a pattern of a single pixel, but can be any of the patterns supported by the brush style dialog. The text brush uses text to make the pattern. The copy/paste brush set the pattern based on a selection from the current icon.

You can get some interesting effects by using different brush shapes (point, rectangle, etc.) when drawing with any of the brushes. Using the point shape and then dragging with the mouse held pressed can yield shadow effects, for example.

Brush:Regular Brush

The regular brush draws the currently selected shape using the current regular brush style. The styles include a single pixel point, as well as square, line, and circular shapes of various sizes. The regular brush style is selected from the brush dialog, which is toggled on and off from the tool bar.

Brush:Text Brush

When you select the text brush, you will be prompted for some text, which will then become the brush. You can then position the text, and press the right or left mouse to draw the text in the icon.

Currently, only upper and lower case alphanumerics are supported, and some of the letters don't quite look right.

Brush:Copy/Paste Brush

Right after you select the copy/paste brush, you will need to select an area of the current icon to "copy". This then becomes the brush, and you then draw the brush into the icon by pressing the right or left mouse buttons.

Zoom Menu

Vicone will display the icon zoomed from two up to 32 times the size of the actual icon. Use the zoom menu to select the zoom factor.

Tool Bars

There are two tool bars in the viconed interface. The first tool bar shows the current foreground and background colors on the left side. The next icon on this tool bar is the "snap" toggle. When pressed, drawing with the rectangle brush shape will draw squares, and the ellipse shape will draw circles. The next icon is the brush toggle, and will display the brush style dialog. The next icon is the color selection toggle, and will display the color selection dialog. These three toggles do not have corresponding entries on the menus. The right end of the first tool bar show three toggles to select the regular, text, and copy/paste brushes.

The second tool bar contains buttons for clear and undo, as well as toggles for selecting the brush shape. All these are duplicates of menu commands.

Color Selection Dialog

The color selection dialog is used to pick and select foreground and background colors. Internally, viconed uses 256 colors for each icon pixel. Depending on the color resolution of your display, all 256 colors may or may not be available. Typically, icons do not use very many colors, so this shouldn't matter.

The color selection dialog shows a large color square showing the current selection color. Two buttons next to the current color square are used to apply the current selection color to the foreground or background color.

Below that is a palette of 64 small color buttons arranged in 4 rows of 16. Selecting one of these buttons make it the current selection color. Viconed supplies 64 default colors for new icons. Again, depending on the color resolution of you color display, these may or may not show as 64 colors. When a new icon is loaded, its colors are used to load the color selection color palette. Most icons won't use 64 colors, and unused colors are filled with black.

Below the palette are three sliders that can be used to change the color. Select a palette button to change, then use the sliders to adjust the red, green, and blue. You can also press the small red, green, or blue button next to the sliders to enter a specific value for that color component. The reset button will reset the palette entry back to its original color.

Note that even though the color selection dialog only has 64 entries, the colors shown do not necessarily have any relation to the colors used in the icon. The colors in the icon are set by the foreground and background colors. You can use the sliders to specify any color, and then apply it to the foreground or background color. The color selection dialog allows you to easily pick any one of the 64 palette colors.

Use only standard, basic colors in icons (black, white, red, green, blue, etc.) to minimize the impact on the color maps used on systems with color resolutions of 256 or less.

V IDE - Release 0.7

The V Integrated Development Environment

VIDE is the V Integrated Development Environment for the GNU g++ compiler and the standard Sun Java Development Kit. The current release is Beta 0.7. Executables for MS-Windows 9x/NT and Linux (glibc) are available for download.

VIDE has been designed by a programmer for programmers. It makes the task of developing software for C/C++, Java, and HTML much easier than using a command line mode. It is easy to learn, so it is a good tool for the beginner. It also has the critical features needed to enhance the productivity of the experienced programmer.

While VIDE doesn't have every feature found in many commercial development systems, it is an ongoing project, with more features included in each release. And best of all, VIDE is free! The source code is available under the GNU Public License (GPL), so you can help add even more features if you want.

The main features in the current release of VIDE include:

  • An important part of an IDE is a good editor. The VIDE editor is a very good editor designed for the programmer. Editor features include:
    • Syntax Highlighting for C/C++, Java, and HTML.
    • Several menu-selectable editor command sets, including:
      • A generic modeless command set, similar to many Windows editors.
      • Vi - the standard Unix editor, with extensions.
      • The See editor command set, an editor designed and used by Bruce Wampler, the author of V and VIDE.
      • Others easily added by extending a C++ class.
    • Formats C/C++ and Java code
    • Powerful command macro capability
  • Project Files - specify source files, compiler options, and other details required for g++ or Java. Project files simplify and hide most of the details of using the underlying tools.
  • Supports development of both C/C++ with the GNU gcc/g++ compiler for MS-Windows and Linux, (OS/2 environment soon), as well as the Java development using the Sun JDK.
  • Uses standard GNU make to build projects for g++, and the standard features of the JDK to build Java projects.
  • Point and click to go to errors in source files.
  • Integrated support for GNU gdb debugger for C/C++. Common tasks, such as stepping through a program, are fully integrated, yet all the features of gdb are available through a command line window.
  • Integrated support for Sun jdb for Java in NEXT release.
  • Integrated support for the V GUI for C++, including the V app generator and the V icon editor.
  • Extra support for HTML development. While VIDE doesn't support WYSIWYG HTML development, you can send the current HTML file to your browser for immediate viewing. Future versions will include more HTML features such as table generation and image sizing.
  • Includes extensive HTML based help. Covers VIDE, GNU utilities, C/C++ libraries, HTML, and more. The help files are available for separate download. You can see a complete online version of the help package here.

The executable version of VIDE is totally freeware. Use it, share it, do whatever you want. The source of VIDE falls under the GNU General Public License, and is normally included with the V GUI distribution. See the file COPYING included with the distribution for more information. Its development is not always in phase with the current V distribution, so there will be additional releases of executable versions as they become available. With the added support for Java, it is likely that the standalone executable version will see broader use than the source version included with V.

This program is provided on an "as is" basis, without warranty of any kind. The entire risk as to the quality and performance of the program is borne by you.

Features that are planned for the near future include:

  • Integration with the jdb debugger.
  • Support for more editor command sets, including Emacs.
  • Integrated spelling checking.
  • Support for CVS/RCS.
  • Code templates.
  • Predefined Project files for various configurations - GUI, console, Mingw32, Cygnus, etc.

This document describes how to use VIDE. Because the process is slightly different for C/C++ and Java, there is a brief tutorial section for each language. Following the tutorials, all the commands available from the menus are described.

VIDE Overview

The design of VIDE has been somewhat evolutionary, but you should find that it is not that much different than other IDEs you may have used. Because VIDE is a free, open source program, it probably lacks some of the polish of commercial IDEs. However, it is still quite functional, and it is really easier to develop programs with it than it is to use a command line interface.

Generally, any application you write will consist of various source files (with associated header files for C/C++), and required data files. These files are generally dependent on each other. By defining a VIDE Project for your application, all the file dependencies are automatically handled. The standard tool make is used for C/C++ files, while the JDK Java compiler automatically handles dependencies.

Using VIDE, the normal work cycle goes:

  1. Design your application. VIDE currently has no capabilities to help with this stage.
  2. Start VIDE, and create a Project File. This will include all source files, compiler options, and other information needed to compile your application.
  3. Build your project. This stage compiles your source into object code. Compilation errors are displayed in the status window, and you can simply right-click on the error to go to the offending line in your source code. After making corrections, you repeat this step until all compilation and linking errors are removed.
  4. Run your program. VIDE Release 0.4 has added support for the gdb debugger for C/C++. However, VIDE currently does not support the jdb debugger for Java, but it will with the next release.
  5. Write documentation for your application. VIDE has syntax highlighting for HTML to make that job easier.

Using VIDE for C/C++ with GNU gcc/g++

General procedures

The only C/C++ compiler VIDE is currently designed to work with is the GNU g++, either on a Unix-like system, or on MS-Windows with the egcs g++ compiler. (VIDE will work with either the mingw32 version of egcs, or the Cygnus B20.1 (or later) version.) Functionality of VIDE for g++ is based on standard GNU makefiles. VIDE uses a standard GNU make Makefile to build your project. Thus, you must have a Makefile defined. This Makefile can be one created automatically by VIDE itself from your Project file, one generated by the vgen V application generator, or even one you've written yourself. If you have your own Makefile, then you probably won't need to use a VIDE Project.

VIDE assumes you have your gcc/g++ compiler already installed on your system and the PATH correctly set. For Unix/Linux systems, this is a given. If you are using a MS-Windows version (Mingw32 egcs or Cygnus egcs), then you must follow the instructions provided with their distributions. You might find it helpful to copy the VIDE executable to the /bin directory that has your g++ compiler. VIDE requires GNU make (it is not compatible with some other versions of make), the GNU C/C++ compiler (preferably egcs) and associated utilities, and the GNU gdb debugger. You also may want the V utilities vgen and viconed.

Once you start VIDE, the first action normally is to open a VIDE Project or select a Makefile. The opening window is the message window, and is used to output the results of your make.

Once you've opened a project or specified a Makefile, you can build your project with the Build:Make C++ menu command, or click on the Make button on the tool bar. This runs the make utility with the default target (often "all"). VIDE first runs the Makefile in dry run mode. It uses that output to then run the commands generated. It intercepts the error messages for g++ and put them in the message window. You can then right-click the error line, and VIDE will open up the file in question, and put the cursor on the offending line. This all assumes that the source and makefile are in the same directory. VIDE also assumes all your files have unique names (i.e., you don't have files in your project with the same name but in different directories). After you correct the problem, rerun make.

You can also make a specific target in your makefile by using the Make menu: Make:Make <target>. If you include a "clean" target in your Makefile, Make:Make Clean will run make clean. (The Makefile generated by VIDE from a Project has a "clean" target.)

The tools menu allows you to run your program. If you are using a VIDE Project, then Tools:Run project will run the project you just built. If you are using your own Makefile, then Tools:Run project will prompt you for the file to run.

VIDE C/C++ Projects

When you are first creating a new project (or moving an existing program to VIDE), click on the Project:New C++ Project menu. You will get a dialog box with various tabbed items. Set the names you want in the Names tab. Then add source files using the Files tab. You can set defines as needed in the other tabs. Once you have added the files needed, VIDE will create a Makefile suitable to compile your project with g++.

Names

This pane lets you set the target name for the executable. You can also change the name of the generated Makefile. Usually, you will use g++ as the compiler. The Compiler Flags line lets you pass switches to the compiler, such as -O for optimize, or whatever. The linker flags are passed to the linker, and default to what you need to compile V programs with g++. The HOMEV value is required for V programs, and specifies where the V GUI libraries and include files are found.

You may have to change some of the default switches for your specific compiler or operating system. You should only have to do this once for a project. If you will be creating other projects, you can save a template project in a file of your choice, and then use it as a starting point for new projects.

On MS-Windows, to build console apps, remove the -mwindows loader switch. Delete the -lV -lcomclt32 switch.

Files

This lets you add the names of the source files included in the project. Click ADD, and files are added without any path name. If you need to add a relative (or absolute) path, select the file, and click Edit to hand edit the entry. Click Del to delete the selected entry. Until V adds multi-line selection (someday soon), you have to add files one at a time.

Paths

This lets you specify the directory for the source files, the directory where you want object files to be generated, and the directory where the binary should be written to. You can also list paths for include and library directories. These are passed to g++ as the appropriate switches.

Defines

There is a pool of definitions that you can have used during make time by adding them to the Active Definitions list using the ">" button between the lists. The pool will stay constant, while the Active side can be a bit more dynamic as you work with your project. Note that you have to supply the full g++ definition switch: -DFOO or -UNOTFOO.

Options

Anything you add to this list will be written to the generated Makefile after the standard definitions. You could use it to define your own symbols, or whatever. If you know about Makefiles, you can edit the V project file directly to add targets that aren't generated automatically. The .vpj file is a plain text file, and the various sections are labeled more or less clearly. Using these two mechanisms, you can build complicated makefiles which will be automatically generated as you edit the project file.

For example, if you want to add a Windows resource file to your project, you could add a line something like:


//% Section 3 - OPTIONS # Add in .o for resource 
EXOBJS += $(oDir)/viderc.o //%end-options 


either with the Project editor, or directly into the .vpj file. Then, with the standard editor, edit the .vpj file and add:


//% Section 16 - USER TARGETS # Define a target for the resource
file $(oDir)/viderc.o:      vide.rc vide.ico vwindow.ico
        windres vide.rc $(oDir)/viderc.o
//%end-user-targets 


OK, I know that seems inconsistent - you should be able to add in both with the Project editor, or have to edit the .vpj file directly for both. I'll fix that in the future. I also intend to add better integrated support for resource files directly. Same for libs and dlls. Next version...

Using VIDE for Java with Sun's JDK

General procedures

VIDE has been designed to work with Sun's JDK. The default values assume the conventions of JDK 1.2 (Java 2), but it should be easy to change the default values to whatever is required by earlier JDKs. It is also possible that VIDE might work with IBM's Java tools, but that hasn't been tested. VIDE assumes you have correctly installed JDK according to Sun's instructions, and have appropriately set whatever environment variables you need.

VIDE interfaces with the command line versions of the tools provided with JDK. VIDE lets the JDK compiler javac handle all the file dependencies. In VIDE, you work with the name of the main class, e.g., MyNeatJavaProgram, which would be found in the file MyNeatJavaProgram.java. Because of the capabilities of JDK, a VIDE Java Project file is somewhat less complex than a C/C++ Project file.

Once you start VIDE, the first action normally is to open a VIDE Java Project or select a Java source file. The opening window is the message window, and is used to output the results of your compiles. If you have a small Java application (not an applet), you can simply specify the name of the top level Java class file, and don't need to use a VIDE Java Project. However, for if you have an applet or need to specify compiler options, you will need to create a new Java Project file.

Once you've opened a project or specified a Java source file, you can compile your project with the Build:Compile Java menu command, or click on the Make/Compile button on the tool bar. This runs the Java compiler, javac. The results of the compile are shown in the message window. If you get an error, you can usually right click on the error line and the source file will be loaded into an edit window, and the cursor placed on the offending line. with an existing program), click on the Project->New C++ Project menu. You will get a dialog box with various tabbed items. Set the names you want in the Names tab. Then add source files using the Files tab. You can set defines as needed in the other tabs. Once you have added the files needed, VIDE will create a Makefile suitable to compile your project with g++.

VIDE Java Projects

When you are first creating a new project (or moving an existing program to VIDE), click on the Project->New Java Project menu. You will get a dialog box with various tabbed items. You will only need to use the Main and Files tabs for most projects. Once you've specified the required information, you can compile your project as described earlier.

Main

This pane lets you specify the name of your application or applet. This should be the Java Class name of the top class. You don't need to add .java or other extension. If you are creating an applet, then you need to specify the name of the file with the HTML code that runs your applet. When you run an applet, VIDE uses JDK's appletviewer.

If you have JDK 1.2, you usually won't need to use the CLASSPATH setting. However, earlier JDKs and some circumstances may require the CLASSPATH to be specified. This is passed to the compiler and interpreter via switches.

Files

This lets you specify which files are included in your project, as well as the source directory. In fact, VIDE really doesn't use this information in this version. (It simply uses the app name specified in the Main tab.) However, the information will be used in later versions.

Compiler

This pane lets you specify which Java compiler to use. It is almost always javac, but you can change it for other development environments. The Compiler Switch Pool has the standard switches supported by JDK 1.2. Click the > button to use a switch. You can add your own switches to the Pool if you need to (for other JDKs, for example).

Interpreter

This pane lets you specify the interpreter. It is usually java for Java apps. Using javaw will run your application without showing a console window. If you have an applet, you must specify the HTML source in the Main pane, which will cause appletviewer to be used.

Debugger

VIDE currently does not support the jdb debugger. However, when it does, this pane will let you specify options.

VIDE Help System

VIDE now includes a Help menu. Most of the help is supplied in a separate distribution file, and is in HTML format. V Help uses your default Web Browser to show the help files.

I have attempted to collect the most useful documentation I could find for the various GNU C++ tools. If you download and install the Help files, you should have a very complete and useful set of documents for C, C++, and Java programming at your finger tips. See [#install Installing VIDE] for more instructions on how to install VIDE help.

If there are other HTML based documents you would like added to the VIDE distribution, please let me know.

VIDE Command Summary

This section provides a summary of the all the VIDE commands available from the menus.

File Menu

The File menu is used for source files. Use the Project menu to open and edit project files.

File:New

Create a new source file. Syntax highlighting doesn't take effect until you've done a File:Save as and repainted the screen.

File:Open...

Open an existing file.

File:View...

Open an existing file for viewing. The file is read-only, and you won't be able to make any changes.

File:Save

Save the current file to disk.

File:Save as...

Save the current file using a new name you will specify.

File:Close

This will close the existing file. If you've made any changes, you will be prompted if you want to save them.

File:Save All

Saves all currently open files.

File:Save/Close

Save the current file, then close it.

File:Send to Browser

Save the current file, then open it with default browser. This command has a quick and dirty implementation, and it passes just the default file name to the system routine that opens the browser. Thus, this command can fail if the file doesn't have a full path qualification. This can happen when you type a file name in directly to the file open dialog. On MS-Windows, you must have .htm and .html files associated properly with your browser. This command won't do anything for not HTML files. This usually happened automatically.

File:Exit

Exit from VIDE.

Edit Menu

The edit menu has some basic commands to edit text in the current file.

Edit:Undo

Restores the last text deleted. Only one level. Doesn't undo insertions or position changes. Also, doesn't undo deletions greater than 8K characters.

Edit:Cut

Delete the highlighted text, and copy it to the clipboard. Standard GUI operation - use mouse to highlight region of text, then cut

Edit:Copy

Copy highlighted text to clipboard.

Edit:Paste

Paste the text on the clipboard to the current text position.

Edit:Find...

Find a text pattern in the file. Brings up a dialog.

Edit:Find Next

Find the next occurrence of the current pattern in the file.

Edit:Replace...

Find a pattern in the file, and replace it with a new one. Brings up a dialog.

Edit:Find Matching Paren

If the cursor is over a paren character, i.e., ()[]{}, the cursor will be moved to the matching opposite paren.

Edit:Edit Help

Displays a list of the command supported by the current editor command set.

Project Menu

Project:Open

Open an existing project file. Project files all have a .vpj extension. VIDE automatically detects C/C++ or Java projects.

Project:New C++ Project

This will create a new C/C++ project. The options on the dialog are described in the C/C++ section above.

Project:New Java Project

This will create a new Java project. The options on the dialog are described in the Java section above.

Project:Edit

Edit the currently open project.

Project:Close

Save and close the currently open project.

Project:Save as...

Save the current project under a new name. This is useful for creating "template" projects that have specific settings for your development environment. These templates can be opened later, then saved under a new name again for the real project.

Project:Rebuild Makefile

OK, I admit it. VIDE doesn't handle all cases of changes to your files. If you add a new #include to a source file, for example, VIDE won't automatically rebuild the Makefile to add this new dependency. This command helps get around that problem.

Project:Select Makefile or Java file

Use this to specify a standard Makefile or a Java source file instead of a VIDE project. In this case, the Makefile will be run, or the Java source passed to the Java compiler.

Build Menu

Used to build and compile projects.

Build:Make C++/Compile Java

Build the project. This command first saves all your open files. It then runs make for C/C++ projects, or the Java compiler for Java projects. Errors are displayed in the message window, and you can go directly to the error by right-clicking on the error line in the message window.

Build:Make Clean

Runs make clean to clean old object files, etc. Used only for C/C++ projects.

Build:Make <Target>

Runs make to make the target you specify. Used only for C/C++ projects.

Build:Make Debug

Will build a debug version. Not currently implemented.

Build:Stop Make

For C/C++ makes, will stop the make after the current file is finished being compiled.

Debug Menu

In general, the commands on the debug menu (and the equivalents on the tool bar) work very similarly for the gdb and jdb debuggers. Please see the Debugging with VIDE section later in this document.

Debug:Start Debugger

Opens a new command window to interface to the debugger. Will use the current executable file.

Debug:Set Breakpoint

Set a breakpoint at the current line in the editor window. To use this (and other commands that use the "current line"), first get focus to the editor window of the source file you want to work with. Then go to the line you want to work with, either with the mouse or cursor movement commands. Finally, select this menu command or the equivalent command on the tool bar.

Debug:Delete Breakpoint

Delete the breakpoint set at the current line. This command isn't as easy to use as it could be because the editor doesn't highlight lines with breakpoints. The current version doesn't keep its own list of breakpoints, but relies on the debugger. Thus, you have to know in advance which line you want to debug. It is sometimes easier to just use the debugger command line interface for this. I hope this one gets better in the future.

Debug:Show Breakpoints

Show all set breakpoints. Uses native debugger commands for this.

Debug:Delete All Breakpoints

Delete all set breakpoints.

Debug:Run program

Run the program being debugged from the start. You will usually want to set some breakpoints first.

Debug:Step over statement

Step over the current statement. If the statement is a function call, the program will break after the function has returned.

Debug:Step into statement

Step into the current statement. This will break at the first statement of a called function. For non-function calls, this will have the same effect as the step over command.

Debug:Continue to line

Continue running the program until the current line in the editor window is reached.

Debug:Continue program

Continue running program until the next breakpoint is reached.

Debug:Kill program

Stop execution of the running program.

Debug:Show call stack

Display the call stack.

Debug:Inspect variable

Display the value of the variable highlighted in the editor window. The variable must be available in the current context of the running program. To use this command, use the mouse to highlight the variable name you want to inspect. Then click this command or the tool bar button.

Debug:Debugger help

Show debugger help. Uses debugger native help.

Tools Menu

Tools:Run program w/ args

Runs a specified program. Allows you to specify arguments to the program.

Tools:Run project

Runs the program from the existing project. Note: VIDE does not check to recompile before running an object.

Tools:Run OS Shell

Runs a basic OS shell.

Tools:V App Gen

Runs the V tool V App Gen.

Tools:V Icon Editor

Runs the V Icon Editor.

Options Menu

Options:Editor

This brings up a dialog that lets you set some options for VIDE and the editor. These settings are saved in a standard system place. For example, they are saved in C:/windows/vide.ini on MS-Windows. They will be in $(HOME)/.viderc on Linux or other Unix-like systems.

The options include:

  • AutoSave - VIDE will automatically save changed versions of edited files every N minutes. Use 0 for no autosave. Note: while autosave might save a lot of lost work for you sometime, it can have problems, too. VIDE only keeps the current copy of your file. After you have saved the file, either by a manual save, or by autosave, previous versions of your file are lost. If you quit the editor, and answer no to saving changes, you won't necessarily get back to your original file if you have autosave on.
  • Tab Spacing - the number of spaces for each TAB character. The most widely used value is 8.
  • Help and Java Paths - This is where VIDE can find the Help file, and where you've installed Java.
  • Editor - emulation. Select which editor command set you want to use.
    • [#standardeditor Standard Editor]
    • [#seeeditor See]
    • [#vieditor Vi] The editor emulation changes for new edit windows you open. The editor you chose will be saved in the preferences file.
  • Make backup file - if this is checked, VIDE will make a backup version of the original file. The backup will retain the original name and extension, but add a ".bak" to the name. For example, "foo.cpp" will be saved as "foo.cpp.bak". This feature can be handy when used in conjunction with AutoSave to be sure there is an unchanged copy of the original file.

Options:Font

Lets you specify the font used in the display window. The font will change in the current window, and in future windows, but not in already open windows. The font you chose will be saved in the preferences file.

Help Menu

Help:VIDE

Opens your browser with this file.

Help:Editor Command Set

Shows a dialog box with a command summary of the editor command set currently being used.

Help:GNU, Other Tools

Opens your browser with the VIDE Help System page. This contains links to various GNU software, g++, libraries, and HTML. This is the page distributed as the VIDE Help Package.

Help:WIN32 API

This will try to open the Borland WIN32 API .hlp file. The hlp format file should be available at Windows API Reference from Borland.

Help:V GUI

Opens the V GUI Reference Manual.

Help:Java

Opens the Sun JDK Help pages. You must set the Java help path in the Options:Editor menu, and download the help files from Sun.

Help:HTML

Opens a guide to HTML tags.

Help:HTML - CSS

Opens a guide to HTML Cascading Style Sheets.

Window Menu

Standard MS-Windows Window menu.

The VIDE Editor

The VIDE editor is based on the V TextEditor class. It has syntax highlighting for C, C++, Java, and HTML files.

The current version of VIDE supports several command sets. The default is a generic modeless command set typical of most GUI editors. The second command set is based on the See editor which is the editor I've been using for 20 years. It is not well known - yet. There is also a very good emulation for Vi that will keep your fingers happy if you use Vi. An Emacs emulation is likely in the future.

One attribute of the VIDE editor is how it handles lines wider than the window. It does not use a horizontal scroll bar. Instead, as you move right on long lines, the text will automatically shift to show more of the line.

The Generic Editor

The generic command set of the VIDE editor is very similar to those found in many GUI based text editors. It is modeless. Commands are either special keys (e.g., arrow keys), or control keys (indicated by a ^ or Ctrl). Several commands use a meta modifier, Ctrl-A (^A) as a prefix. You can enter counts (noted by an "n") for commands by first pressing the Esc key, then a count, then the command. Not all commands are supported by command keys, and require you to use the menus (replace, for example). Unfortunately, not all the features supported by the See and Vi editors are found in the generic editor. This may change.

The Generic Command Set

Key Command Description
Esc Prefix to enter count n
Movement Commands
Arrow keys Standard function
nLeft Move left [^L]
nCtl-Left Move left a word
nUp Move up [^U]
nShft-Up Move up to beg of line
nRight Move right [^R]
nCtl-Right Move right a word
nDown Move down [^D]
nShft-Down Move down to beg of line
Home Goto beg of line [^A,]
Ctrl-Home Goto beg of file
End Goto end of line [^A.]
Ctrl-End Goto end of file
nPgUp Move a screenful up
nCtrl-PgUp Scroll a screenful up
nPgDn Move a screenful down
nCtrl-PgDn Scroll a screenful down
Searching commands
^A[ Balance match
^F Find pattern
Shift-^F Find next
Insertion Commands
n^AIns Insert char with value of n
n^O Open a new blank line
Ins Toggle insert/overtype
Editing commands
^ABkspace Delete to line begin [^A']
^ADel Delete to line end [^A\]
nShft-^C Fold case
^C Copy highlight to clipboard
^V Paste from clipboard
^X Cut highlight to clipboard
nBkspace Delete previous char
nDel Delete next char
nShft-Del Delete line
Misc. commands
^AM Center Cursor in screen
^Av Repaint screen
n^G Goto line n
n^K Kill line
n^P Pretty print code.

The pretty print command will format C/C++, and Java code according to the V style conventions. To use this command, start on a code line that is indented how you want it. After that, 'n' lines will be formatted based on the starting indentation. This command is very useful if you use the V indent style. Some aspects of formatting will be settable in future versions to support slight modifications to the V style.

The See Editor

The command set of the See editor dates back to the late 1970's. The editor was originally called TVX, and the command set was modeled after the TECO editor. See, like Vi, has command mode and insert mode, and is normally in command mode. The commands are mnemonic. U for up, L for left, F for find, etc. It is very good for touch typists, and minimizes the need to move your fingers from the home row of the keyboard. If you don't have a favorite editor yet, or if you don't have a command mode editor you like, consider giving the See command set a try. It is really an efficient way to edit.

To use the See command set, start VIDE and select 'See' in the Options->Editor dialog. VIDE will remember your selection.

See is normally in Command mode. You can supply a count value to many commands by entering a value before the command. For example, entering 35d will move down 35 lines. When you enter insert mode, values you type are inserted until you press the Esc key. The f find command lets you enter a find pattern that is echoed on the status line, and can include tabs. Press Esc to begin the search. The F version of find displays a dialog to enter the pattern.

In most cases, you can use a standard dedicated key (such as the arrow keys) as well as the equivalent mnemonic See command. You can highlight text with the mouse, and cut and paste in the usual fashion.

The See Command Set

Key Command Description
Movement Commands
nl Move left [Left Arrow]
nr Move right [Right Arrow]
nu Move up to beginning of line [Shft-Up]
nd Move down to beginning of line
n^U Move up [Up Arrow]
n^D Move down [Down Arrow]
n[ Move left a word
nTab Move right a word [Ctrl-Right]
n^P Move a screenful up [PgUp]
np Move a screenful down [PgDn]
, Goto beginning of line [Home]
. Goto end of line [End]
b Goto beginning of file [Ctrl-Home]
e Goto end of file [Ctrl-End]
j Jump back to previous location. This is an easy way to get back to where you were before a find command, or a large movement.
n^L Goto line n
m Center Cursor in screen.
nn note (mark) location n. Locations go from 1 to 25. This is a bookmark feature.
n^N Goto noted location n
nCtrl-PgUp Scroll a screenful up
nCtrl-PgDn Scroll a screenful down
Searching commands
n] Balance match. Find the matching
paren, bracket, or brace.
f Find pattern (non-dialog). The pattern is echoed on the status line and is terminated with an Esc.
F Find pattern (dialog)
; Find next
^F Find/replace (dialog)
Insertion Commands
ni Insert char with value of n. This lets you enter Escapes or other non-printing characters.
i Enter insert mode
Esc Exit from Insert Mode
^O Toggle insert/overtype [Ins]
no Open a new blank line
Kill/change commands
^C Copy highlight to clipboard
^V Paste from clipboard
^X Cut highlight to clipboard
' Delete to line beginning
\" Delete to line end
n^K Kill line
n~ Toggle case
/ Kill 'last thing'. The 'last thing' is determined by the previous command. Commands that set the last thing include find, move a word, save, append, and get. Thus, a common way to perform a replace is to find a pattern, then use '=' to insert the replacement.
= Change 'last thing'. Delete last thing and enter insert mode.
nt Tidy (prettyprint) n lines. This will format C/C++, and Java code according to the V style conventions. To use this command, start on a code line that is indented how you want it. After that, 'n' lines will be formatted based on the starting indentation. This command is very useful if you use the V indent style. Some aspects of formatting will be settable in future versions to support slight modifications to the V style.
nBackspace Delete previous character
nDel Delete next character
Save buffer commands
ns Save n lines in save buffer. See provides a buffer that allows you to save lines. Using the save buffer is often easier than cut and paste. After saving lines, you can use the '/' delete last thing command to delete the lines you just saved. The See save buffer is independent of the clipboard, and is local for each file being edited.
na Append n lines to save buffer
g Get contents of save buffer. Inserts the contents of the save buffer at the current location.
y Yank file to save buffer. This is an easy way to import text from an external file.
^y Write save buffer to file. This lets you save part of your file in a new external file. Using 'y' and '^y' is often an easy to copy parts of one file to another, or include standard text into new files.
Macros
\<a-z> Set register to use (a-z)
q Record keystrokes in Q-Register until ^Q
n@ Execute current Q-Register N times
Misc. commands
v Repaint screen
 ? Help
^Q Save and close

Macros

The See and Vi emulations support a simple, yet powerful macro facility. (This feature will be added to the generic editor soon.) There are 26 buffers called "Q-Registers". You can record character keystrokes into any of the Q-registers, and then execute those characters as a set of commands. A set of commands like this is often called a macro. (Note: you cannot record special keys such as the arrow keys, etc.) You can enter any See or Vi command into the editor, including find patterns and insertion strings.

Even though VIDE has a search and replace function on the menu, you can do the same thing with a Q-register macro. Consider the following set of See commands:
fthe$=THE$
The '$' represents the Esc key. You would enter this macro by selecting a Q-Register (e.g., \a to select Q-Register 'a'), entering a 'q' command, then entering the command sequence, and ending the recording the sequence with a Control-Q (^Q). The characters you enter will be echoed on the status bar (which will indicate you are recording). Then execute the macro (22 times, for example):
\a22@
The next 22 occurrences of 'the' will be changed to 'THE'. The corresponding command in Vi would be: /the<CR>xiTHE$ where '<CR>' is a Return, and '$' is 'Escape'. Then execute it with 22@a. Note that in this emulation of Vi, 'x' will delete the pattern just found.

If you want to execute the macro for the whole file, give a very large count. The macro will exit after any command, such as a find, fails.

This is a See example for placing a '**�' at the beginning of every line that contains the word 'special'.

\aqfspecial$,i**�$d^Q and execute \a1000@

The same function in Vi:

qa/special<CR>0i** $j0^Q and execute 1000@a

Future additions

Things missing from the editor that WILL be included in future versions:

  • Auto indent for C/C++ code
  • Selectable highlight colors
  • Formatted source code printing
  • Automatic Code formatting to the V standard

The Vi Editor Emulation

VIDE now includes an emulation of the Vi command set. The emulation is not yet complete, and it is likely it will never be a complete emulation of Vi. However, it is a pretty good "finger memory" emulation. For the most part, the right things will happen when you edit using your automatic "finger memory" of Vi commands. This emulation should improve over time. See the limitations section for a description of the current limitations and differences of this emulation.

To use the Vi emulation set, start VIDE and select 'Vi' in the Options->Editor dialog. VIDE will remember your selection.

The Vi Command Set

(* after cmd means emulation not exact)
Key Command Description
*** Movement Commands ***
h,<Left> cursor N chars to the left
j,<Down> cursor N lines downward
k,<Up> cursor N lines up
l,<Right>,<Space> cursor N chars to the right
m<a-z> set mark <a-z> at cursor position
CTRL-D scroll Down N lines (default: half a screen)
CTRL-U scroll N lines Upwards (default: half a screen)
CTRL-B,<PageUp> scroll N screens Backwards
CTRL-F,<PageDown> scroll N screens Forward
<CR> cursor to the first CHAR N lines lower
0 cursor to the first char of the line
$ cursor to the end of Nth next line
<Home> line beginning
<CTRL-Home> file beginning
<End> line end
<CTRL-End> file end
B* cursor N WORDS backward ['word' not same]
"b cursor N words backward
`<a-z> cursor to the first CHAR on the line with mark <a-z>
`` cursor to the position before latest jump
'<a-z> cursor to the first CHAR on the line with mark <a-z>
'' cursor to first CHAR of line where cursor was before latest jump
<MouseClick> move cursor to the mouse click position
*** Searching commands ***
/{pattern}<CR> search forward for {pattern}
/<CR> search forward for {pattern} of last search
 ?{pattern}<CR> search backward for {pattern}
 ?<CR> search backward for {pattern} of last search
N repeat the latest '/' or '?' in opposite direction
n repeat the latest '/' or '?'
 % go to matching paren (){}[]
*** Insertion Commands ***
A append text after the end of the line
a append text after the cursor
i,<Insert> insert text before the cursor (until Esc)
O begin a new line above cursor and insert text
o begin a new line below the cursor and insert text
R* toggle replace mode: overtype existing characters [just toggle]
CTRL-C Copy to clipboard
CTRL-V Paste from clipboard
CTRL-X Cut to clipboard
*** Kill/change commands ***
C change from cursor position to end of line, and N-1 more
cc delete N lines and start insert
c[bBhjklwW$0] delete Nmotion and start insert
D delete chars under cursor until end of line and N-1 more
dd delete N lines
d[bBhjklwW$0] delete Nmotion
J* Join 2 lines [2 lines only]
S delete N lines and start insert;
s (substitute) delete N characters and start insert
u undo changes
X, <BS>* delete N characters before the cursor
x, delete N characters under and after cursor
~ switch case of N characters under cursor
*** Yank buffer commands ***
P put the text on line before cursor
p put the text on line after the cursor
Y* yank N lines; synonym for 'yy' [cursor at end]
y< read file into yank buffer
y> write yank buffer to file
*** Misc. commands ***
CTRL-L redraw screen
ZZ save file and close window
gm center cursor in screen
gt format N lines of C/C++/Java code
"<a-z> set q-reg/buff for next op
["<a-z>]q record to q-register until ^Q
["<a-z>]@ execute q-register N times

Emulation Limitations

As much as possible, this emulation tries to do the same thing Vi would do with the same command. Probably one of the main things missing in this emulation is the total lack of Ex support, i.e., there are no ":" commands supported. In fact, this should be a minor limitation as there are usually menu commands that support the most important ":" equivalents. You can also record [#macros macros] that can duplicate many of the functions typically done with ":" commands.

Another major difference is the lack of support for a count for insert and find operations. Thus, "5ifoo$" will not insert 5 instances of "foo". This is true for some other commands as well. Generally, if you enter a command expecting some kind of repeated operation, and the VIDE Vi emulation does not support repeat, then the operation will be done only once. Again, you can use macros to get around this limitation.

The following list summarizes some of the other differences in how this emulation works.

  • c and d commands are somewhat limited. The currently motions supported after the 'c' or 'd' include: 'b', 'B', 'h', 'j', 'k', 'l', 'w', 'W', '$', '0', as well as the 'cc' and 'dd' forms. Currently, only the full line motions add text to the yank buffer. Most of the other somewhat obscure motion commands used with 'c' and 'd' can often be done using the mouse to cut and paste.
  • The y command currently supports only the 'yy' form of the command. In addition, the new VIDE version commands 'y<' and 'y>' have been added. These are used to support external files. Use 'y<' to read an external file into the yank buffer, and 'y>' to save the contents of the yank buffer to an external file.
  • The Backspace key deletes the character in front of the cursor like almost all other apps you are likely to use instead of moving left. A little note: The backspace key is really CTRL-H. For consistency, the original Vi used CTRL-H and 'h' as left cursor. Now why are 'h', 'j', 'k', and 'l' used for cursor movements? Because the computer lab at UCB where Vi was written had mostly ADM-3a terminals. (ADM-3a terminals were far cheaper than most other terminals available at the time.) And the 'H', 'J', 'K', and 'L' keys had cursor arrows printed on each of them. Thus, the "hjkl" commands for cursor motion.
  • Cut, Copy, and Paste are implemented using the standard system clipboard. The standard 'CTRL-X', 'CTRL-C', and 'CTRL-V' commands are used to support clipboard operations.
  • The find commands will highlight the pattern found. If you press 'X' or 'x' while the pattern is still highlighted, the pattern will be deleted. While this is different than standard Vi, it is really handy for search and replace.
  • This emulation doesn't use the visual '$' marker for some kinds of edits on partial lines, it just does the edits. Another left over from the ADM-3a days, I think.
  • Left and right cursor movements flow to the adjacent lines. The V editor class just doesn't support movement limited to one line.
  • The 'J' command will only join 2 lines.
  • The find command ('/') echoes the pattern on the status bar, and not in the text window. You can use an 'Esc' to terminate the pattern as well as a 'CR'. Find does not support regular expressions. Selecting find from the tool bar or menu brings up a dialog box instead of using the status bar.
  • Use menu command or the tool bar button for find/replace.
  • The 'gt' command formats C, C++, and Java code. See a more complete description of the See 't' command. Right now, the formatting is limited to the V standard, but support for other styles will likely be added.
  • The 'R' command toggles Insert and Overtype mode. It doesn't force overtype (replace) mode.
  • The '%' command works a bit differently. It currently only supports paren-like characters, and you must place the cursor on the paren you want to match.
  • The cursor doesn't change shape for Insert and Normal modes. The mode is shown on the status bar.
  • You need to use the menus to load and save files.
  • VIDE's concept of a 'word' is different than Vi's. There is no difference between 'w' and 'W', for example. This might get fixed. Because you get visual feedback, this probably isn't a big problem.
  • The Vi emulation was built starting with the See command interpreter code. This saved lots and lots of work with minimal compatibility issues. One however, involves counts. The current code can't distinguish from the default count of 1 and an explicitly entered count of 1. Thus, commands that use default counts might not work correctly when explicitly given a count of 1. For example, the 'G' command can't go to line 1 -- it goes to the last line.
  • The 'gm' command is used to center text on the screen.

The following list summarizes most of the Vi features that have not yet been implemented. They are likely to be added in future releases.

  • The '.' command is not supported. I hope I can figure out a way to add it, but the basic V editing class is not very compatible with this command.
  • There is only one yank buffer. Named buffers are not yet supported.
  • If there are Vi features that are important to you, please let me know by e-mail, and I will try to add them. I won't add ':' command support, but I may add the equivalent support via an extended command set. If some of the emulated commands don't quite work how you expect, let me know and I will try to make them work more closely to Vi.
  • If you really want to add some features (like ':' support), the source code is available! Fix away!

Debugging with VIDE

VIDE supports GNU gdb and will support the Sun jdb debuggers when the all the Java are finished. The VIDE interface to the debuggers is of minimalist design. The goal is to make using the native debuggers as easier as possible for casual users, while maintaining the full power of the debugger for experienced users. VIDE accomplishes this by showing a command window interface to the debugger. You can enter any native debugger command in this window, and thus have full access to all debugger features.

VIDE makes using the debugger easier by providing menu and tool bar commands for the most often used commands. And most importantly, VIDE will open the source file in an editor window and highlight the current execution line on breakpoints or steps. It is very easy to trace program execution by setting breakpoints, and clicking on the Step over or Step into tool bar buttons. VIDE also allows you to inspect variable values by highlighting the variable in the source and clicking the inspect button.

Debugging C/C++ with gdb

To debug C/C++ programs with gdb, you must first compile the program with debugging information. This is accomplished with the -g switch on the compile line. The current version of VIDE does not provide automatic generation of debug or release makefiles. The easiest way to define VIDE projects for both debug and release versions is to use the Project:Save Project as... command. First, define a release version of the project. Then, using that project as a template, change the switches as needed for your debug version, and save the project under a different name.

The full power of gdb is available in the debugger command window. You may enter any standard gdb command after the "(gdb)" prompt. In fact, there really is limited interaction between VIDE and gdb. VIDE starts gdb using the "-f" switch, which causes gdb to send a special output sequence after each break, which VIDE then uses to open and display the highlighted break line. Other than that, there is really no interaction between the two. The main disadvantage to this is the somewhat limited ability of VIDE to disable breakpoints.

Limitations with gdb

  • [All versions] If you edit a file that just had the breakpoint highlighted, the highlight disappears. The breakpoint highlight is generated at the time of the break, and is temporary.
  • [MS-Windows 9x/NT] Output from console applications isn't properly displayed in the gdb command window. If you run gdb from a command window, the output is displayed as it is generated. With the VIDE gdb command window, the output from the running program is not displayed until the very end when the program terminates. I have no idea why gdb behaves like this, but it must have something to do with the way I use CreateProcess. Any help on this problem would be appreciated.
  • [MS-Windows NT] On Windows NT, gdb seems to bring up a message dialog trying to open some file over the network. I don't have a networked NT machine, so I don't know if this is a general gdb feature or what, but gdb seems to work if you just press the appropriate button to ignore the problem when the dialog is displayed.
  • [MS-Windows 9x] There is some problem using the V GUI library and gdb on Windows 9x platforms. The debugger gets a memory fault and dies before any V statements are reached. I think this must be a bug in gdb, but no one has been able to find the problem yet. You CAN use gdb with V GUI programs on Windows NT.

Debugging Java with jdb

The VIDE/jdb interface has not yet been implemented.

Limitations with jdb

The VIDE/jdb interface has not yet been implemented.

Known VIDE problems

If you run VIDE on NT from a desktop icon, there is a problem running the egcs mingw32 compiler. You need to run VIDE from a Command console window. I'm working on this. This is not a problem on Win9x, nor is it a problem with the Cygnus B20 compiler.

There seems to be bug in gdb with DLLs. If you load too many, gdb dies. This is mostly a problem on Windows9x when debugging V GUI applications, but it may also be a problem on NT if you load too many DLLs. I'm trying to work with the maintainers to fix this problem.

Errors generated by the compiler are passed via two temporary files. Sometimes these files are not deleted, and are left behind on the hard disk. If two instances of VIDE are running, it is possible to have an access conflict to these files from one of the instances. This can prevent builds with error messages from displaying those messages in the message window.

If g++ has a fatal error, it can hang VIDE. Because all files are saved right before running g++, there is no data loss.

The syntax highlighting doesn't work right for multi-line "/* comment */" style comments. If the lines between the opening "/*" and the closing "*/" have a "*" as the first character (which is the normal convention for Java programs!), syntax highlighting works correctly. Otherwise, those lines will not get the comment highlight. This is purely a cosmetic problem, but is unlikely to be fixed because of difficulties imposed by the internal structure used by the editor.

The tidy/prettyprint command doesn't handle the last case of a switch properly. This won't be fixed. Also note that the formatting is based on the indent of the previous line, so you must start at a known good indent point.

Installing VIDE

It is probably easiest to use a pre-compiled version of VIDE. The VIDE executable binary is a complete static program. It does not use any external files or DLLs. You can place the binary where ever you want. However, you might want to install VIDE to its own directory tree. This is most likely to be compatible with later versions of VIDE. For now, the tree just includes /vide/bin and /vide/help. You can run VIDE from the desktop without setting a PATH, but if you use V and want to start the Appgen and Icon editor from within VIDE, then those programs must be on your PATH. If you are using mostly GNU gcc/g++, then you may want to install the VIDE executables on the same /bin directory the compiler is on. If you are using Java, then you can create a /vide directory for the VIDE system. You may want to add a desktop shortcut if you use it a lot. There is no install or uninstall provided or needed.

If you want to use the help files, you will need to download the separate help file archive. It is best to install the help files in the /vide/help directory. After you've installed the help files, you will need to use the VIDE Options:Editor command to set the path to the help files.

VIDE doe not provide Java help. You will need to find and download the Sun JDK yourself. Then use the VIDE Options->Editor menu command to set the Java directory.

If you are building VIDE from the V distribution, then apply the above comments to the version you build. If you want to use the V appgen program, or the V Icon Editor, you need to get those from the V distribution.

Help make VIDE better!

The V IDE is GPL freeware. It has been written using the V C++ GUI framework. I get no compensation for either V or VIDE, so please don't get too fussy about features or problems. I welcome bug reports and requests for new features, but I make no promises.

My goal for VIDE is to make it a great alternative to Emacs. I know Emacs will do almost anything you would ever want, but the learning curve is huge. VIDE is much more GUI oriented, and I want to keep it simple enough for beginning programmers to use.

So, even more welcome than bug reports would be offers to help add features to VIDE! Since the source code for both V and VIDE are GPL and LGPL, they are available for enhancement. If you would like to make contributions to VIDE, please contact me directly by e-mail. VIDE is currently ahead of the V GUI release cycle, so I will need to provide you with the latest versions of all the source code.

I welcome any contributions or ideas, but right now the following projects:

  • Support for other editor command sets. My goal is not to provide exact clones of other editors, but to provide the basic commands of other editors at a "finger memory" level. It is fairly easy to add a new editor command interpreter. I spent less than two days writing the Vi emulation. Because I use the See command set myself, it is a bit hard for me to write a command interpreter for other editors that provide true "finger memory" compatibility. I hope the Vi emulation meets this kind of compatibility. I'd like to see an emulation for Emacs, but any emulation is welcome. I think the emulation will be better if it is written by someone who actually uses that editor.
  • Spelling checking.
  • An interface to CVS.
  • An interface to grep.
  • A class browser for both C++ and Java. I have a stand alone V C++ browser that could serve as a starting point.
  • An interface to other Java tools such as Javadoc.
  • An interface to Jikes.

If you'd like to help on any of these projects, please contact me and I will do everything I can to help you get started.

No Warranty

This program is provided on an "as is" basis, without warranty of any kind. The entire risk as to the quality and performance of the program is borne by you.