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.
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.
The file menu only has an Exit command, which closes vgen.
The Generate menu selects which type of code you want to generate. These are duplicated on the tool bar.
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 V library 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.
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.