Next: , Previous: GUI Overview, Up: GUI



7.2 Windows

VRR has several windows, mostly non-modal and independent on one another. When VRR starts, the Main Window is opened and if the user closes it, he terminates the program.

Most VRR windows have a “common ancestor” – the window structures begin with several data members common for all. These include window type identification, a Scheme proxy and a status bar with a status bar ID. Most window data structures are defined in the gui/main.h file.

     #define WIN_O_MAGIC u8 type; SCM proxy; \
                         GtkWidget * statusbar; gint context_id
     
     /* The ancestor */
     struct window { WIN_O_MAGIC; };
     
     /* A window */
     struct wnd_univ_browser
     {
         WIN_O_MAGIC;
         ...
     };

The ancestor structure is used, for example, in the context (see The Context), for status bar messages and error messages. Usually, when an error occurs during an action not connected to any fixed window, the message is output into the status bar of the current context window.

In the following subsections, we describe the most important VRR windows. However, we will not describe all windows in detail, as there is nothing very interesting on the windows themselves. All the interesting features – the Command Structure, property editors, GO Factory – are described in their own sections.

VRR also provides some macros for the “Open file” and “Save file” dialogs. They store the last used directories (one for each) and update them automatically. The save dialog also asks if to overwrite an existing file. They can be found in the gui/dialogs.h and gui/dialogs.c files.

     OPEN_DLG_START(_title, _extra_widget, _filename)
     OPEN_DLG_END
     
     SAVE_DLG_START(_title, _extra_widget, _filename)
     SAVE_DLG_END

and a SUGGEST_FILENAME(_o, _ext, _output) macro which generates the suggested save filename for the given object, extension and the last used save directory. They are used like this:

     OPEN_DLG_START( "Open file ...", NULL, NULL )
     {
         // now do something with each filename selected
         // the current filename is 'filenames[i]'
     }
     OPEN_DLG_END
     
     SUGGEST_FILENAME( document, "pdf", sugname );
     
     SAVE_DLG_START( "Export PDF file ...", table, sugname )
     {
         // use the one filename 'filename'
     }
     SAVE_DLG_END