grwnd.exe
The following is obsoleted and left for reference only.
The latest version of GrWin is available
here.
Is the graphics engine for the GrWin graphics library, with which almost all the features of GrWin, graphics, event handlings, printings, clip boards, etc., are implemented.
When an instance of grwnd.exe is launched a main (frame) window appears on the display and then calling a series of GrWin routines corresponding graphics objects are drawn serially on a client window opening within the frame window.
An instance of grwnd.exe is created when
- launched manually from command line or from explorer, etc.,
- the initialization routine GWinit or GWinitx is called explicitly in a program,
- the initialization routine is called implicitly from the first call to GWopen or GWopenx.
Attributes such as sizes and positions of the frame window of a grwnd.exe can be specified with command line options for grwnd.exe or in a call to GWinitx with its arguments almost equivalent to the command line options.
Unless you want to specify some of these options, the third method above is the simplest and recommended.
These options can be specified by several methods described below.
From the menu bar of each frame window you can do closing, erasing and printing using a printer, etc., to an active client window as well as specifying the starting options. Important features of grwnd.exe are described as follows:
Starting options for grwnd.exe
As grwnd.exe has a reasonable default setting there is usually no need to specify starting options for it.
If you want to customize them an initialization file ( .ini ) as well as command line options can be used.
An initialization file is a text file with the extension .ini in which items for an initial setting of grwnd.exe are described.
The destination .ini file is searched in the following order:
- the file specified from [help] → [Starting options] at the menu bar of grwnd.exe launched in advance.
This also enables you to create and/or modify an .ini file interactively even if no .ini file exists.
- the file XXX.ini specified in the command line of grwnd.exe with arbitrary XXX
- YYY.ini in the same folder with the same base name YYY as the application YYY.exe
- grwnd.ini in the folder specified with the environment parameter GRWINDIR
- grwnd.ini in the same folder as the application
- grwnd.ini in the same folder as grwnd.exe
If none found the default setting is used.
Writing an .ini file all the available items must be in the [Defaults] section.
A sample .ini file, equivalent to the default setting, is as follows:
-
[Defaults]
Storing=1
Buffering=1
StatusBar=1
Inquiring=0
Landscape=1
#Width=800
#Height=560
#PointX=0
#PointY=0
#DefaultDPI=300
MaxDPI=300
#ArrangeMode=2
#ShowMode=10
#ZOrder=1
Here the characters after '#' in a line are ignored as a comment.
It should be noted that the upper limit of dpi values assumed in making an internal bitmap is specified with the MaxDPI.
In the Bitmap mode with the Buffering being ON and DefaultDPI option not set, the assumed bitmap size depends on your current working printer, and a huge bitmap internally to be created may cause your computer being unstable.
So do not set a too large value ( > 600 ) to the MaxDPI item unless you do know what you are doing.
All the available items appear in the sample above, and you would guess meanings of them seeing the [Starting options] dialog or referring the next description about the command line options.
Command line options for grwnd.exe
The graphics engine grwnd.exe, which may be launched manually in advance of any GrWin application, has commandline options as follows:
Usage: grwnd [Options] [file.ini] [file1] [file2] ...
Options ( <..> = an integer) :
-p<X>,<Y> |
Sets the position (X,Y) of the top-left corner of the main frame window in the screen coordinate. |
-s<W>,<H> |
Sets the size (W,H) of the bounding rectangle of the main frame window in the screen coordinate. |
-[dpi]<N> |
Sets the default dpi value ( N <= 1200 ) for bitmaps, etc. |
-a<N> |
Arranges the child windows with a mode number N (= 1..4),
beeing equivalent to GWarrange (N). |
|
1: -cascade, 2: -horizontal, 3: -vertical, 4: -iconarrange |
-m<N> |
Sets the show state of the main frame window with a mode number N (= 0..14), beeing equivalent to GWshowfr (N). |
|
0: -hide, 1: -maximize, 2: -minimize, 3: -restore, 4: -show,
|
---|
|
5: -showmaximized, 6: -showminimized, 7: -showminnoactive,
|
---|
|
8: -showna, 9: -shownoactive, 10: -shownormal,
|
---|
|
11: -topmost, 12: -notopmost, 13: -top, 14: -bottom |
-z<N> |
Sets the Z-order of the main frame window with a mode number N (= 1..4), beeing equivalent to GWshowfr (N+10). |
|
1: -topmost, 2: -notopmost, 3: -top, 4: -bottom |
-t or -T | Turns the storing mode ON or OFF. |
-b or -B | Turns the buffering mode ON or OFF. |
-r or -R | Turns showing the status bar ON or OFF. |
-i or -I | Turns the inquiring mode ON or OFF. |
-l or -L | Turns the landscape printer mode ON or OFF. |
Coordinate systems
For each client window, grwnd.exe assumes an entire drawing rectangle, the paper, and the logical device coordinate system (LDCS) fixed on it.
The origin of the LDCS is at the top-left of the paper, the horizontal axis is taken to the right, and the vertical to the bottom.
On printing, the unit in the LDCS is mapped to 1 pixel on the printer if the MaxDPI value is greater than the value for the printer, otherwise a suitable scaling is made.
The paper size can be specified in opening the window and is kept fixed usually.
In an another coordinate system, the normalized logical coordinate system (NLCS),
the size of the paper is normalized so as to give the unit length of the shorter side of the paper with preserving the aspect ratio.
The origin is at the bottom-left of the paper in the NLCS with the vertical axis to the top.
The view port is a temporal drawing rectangle set inside the paper defined by calling GWVPORT to specify the bottom-left and the top-right corners in the NLCS.
The world coordinate system (WCS) is the user's coordinate system defined by calling GWINDOW to give the coordinates of the bottom-left and the top-right corners of the view port in this coordinate system. Almost all routines of the GrWin Library assume this WCS.
View modes
grwnd.exe has five view modes [Bitmap], [Isotropic], [Fit], [Total] and [Zoom in], and one of the modes for the active client window can be selected interactively from [Mode] at the menu bar, or by calling a routine GWVWMOD in an application. See for further details the descriptions for the submenu items for [Mode] below.
Printing
As grwnd.exe uses standard printing procedures for Windows, you can print the resultant or a snapshot of a graphics window drawn by your application using your running printer on Windows.
So the quality of the resultant printed matter depends on the quality of the printer and the printer driver used, provided the storing mode is set on.
When the storing mode is set off but the buffering mode is on, a bitmap used as an internal buffer is printed with a suitable scaling.
Many printer and printer drivers seem not to support "Fill Bounded Area" function (see GWFLOOD).
Printed result depends on which view mode is selected, and can be previewed from [File] -> [Print Preview].
You can choose a printer and/or set miscellaneous printer modes up from [File] -> [Print Setup].
Outputs in metafile format
grwnd.exe supports the enhanced metafile format ( *.emf ) on output.
Metafiles can be readily embedded in documents without loss of quality if you are using MS-Word or one of many other applications that support metafiles.
See below to know how to get outputs in the enhanced metafile format.
Clipboard
grwnd.exe supports Windows clipboard, you can copy image of a view of the active window to the clipboard and import the clipboard to a image data available in the library. See for further details the descriptions for the submenu items for [Edit] and the user's manual.
Pause and abort
Usually grwnd.exe works passively by receiving commands from an application to which the GrWin Library is linked, and it interprets each of them to draw graphics objects on client windows. In some cases where unexpected result was displayed or the execution time is too long, etc., you may want to pause or abort the application as soon as possible. To this end [View] -> [Pause/Abort] is useful. See the corresponding descriptions below for further information.
Status bar
The frame window has a status bar at the bottom, which can be turned on or off by selecting [View] -> [Status bar].
The status bar has seven panes to display information of the current window; the first is for messages, the second for window number and the mouse cursor position in the LDCS, the third for the current view in the LDCS and the fourth is for the current number of the objects stored in memory.
Menu bar
Activating a client window some interactive operations to the client window or the associated application can be done from the menu bar of the frame window. The menu bar has the following submenus:
- [File] ->
- [Open]: Open a saved data file and draw it on a new client window.
- [Close]: Close the active client window.
- [Save]: Save the active client window. The specified name is used if GROPENX had been calld, or a default file name is used otherwise.
- [Save as]: Save the data displayed on the active client window to a file with the name specified by a file dialog.
To save the data in the enhanced metafile format set the extention of the file name 'emf'.
- [Print]: Print the active client window. The size printed on a paper depends on the view mode described below, and usually [View] -> [Bitmap] is used.
- [Print Preview]: Preview a printing image.
- [Print Setup]: Set up the printer. Usually the landscape mode is selected from here.
- [Exit]: Close the all windows including the frame window and exit. This should not be used customarily and instead use GWQUIT in each application, because it could make unexpected error messages and memory leaks in some conditions.
- [Edit] ->
- [Copy]: Copy the active current view onto the Windows clipboard as a device independent bitmap(DIB). A DIB image on the clipboard can be handled many Windows applications such as paint.exe.
- [Import Clipboard]: Import a DIB image on the clipboard into an internal array for bitmaps with the bitmap number 0, and the imported DIB image is shown on a dialog box when the inquiring mode is ON.
- [View] ->
- [Pause/Abort]: Popup a message box and pause the application associated with the active client window until a button clicked. When the Yes button is clicked the application is aborted, or continue the job when No button clicked.
- [Replay]: Redraws the active client window in the replay mode where all the object are used to replay an animation for example.
- [Redraw]: Redraws the active client window. In contrast to [Replay], minimum objects are used to refresh a rectangle on the display surface using backgrownds and the buffer, if any.
- [Flushing]: Flushes all suspended objects belonging to the active client window.
- [Clear All]: Clears the active client window and deletes all the objects belonging to it. This is equivalent to call GWERASE.
- [Storing]: Toggle setting the storing mode. Turning this mode ON, drawn graphic objects are stored in memory for later uses such as printings and many aspects of redraws.
- [Buffering]: Toggle setting the buffering mode. Turning this mode ON, redrawings of complicated graphic objects or scrollings in the [Bitmap] mode described below can be done faster.
- [Status Bar]: Toggle displaying the status bar.
- [Inquiring]: Toggle setting the inquiring mode. When this mode is ON, a dialog box appears on deleting the objects or on importing a DIB image on the clipboard
- [Mode] ->
- [Bitmap]: The unit of the LDCS matchs 1 pixel on the display.
Usually, the drawing area in the LDCS (the paper) is larger than the current view size of the client window, and the view can be scrolled by the horizontal and the vertical scroll bar to see everywhere on the paper.
The aspect ratio is preserved on the display.
- [Isotropic]: The view port is displayed as large as possible with preserving the aspect ratio in the current view of the client window.
- [Fit]: The bounding rectangle for all drawn objects is fit onto the current view of the client window.
The aspect ratio is not preserved on the display.
- [Total]: The whole paper is fit onto the current view of the client window.
The aspect ratio is not preserved on the display.
- [Zoom in]: Zoom in on any area of the paper. When selected this mode, the crosshairs cursor appears and you can drag (move mouse with the left mouse button down) it to select any area bounded with a rubber band.
This operation can be repeated again and again, and may be useful in such a case where mouse coordinates are captured in a certain high precision.
- [Window] ->
- [Fit Frame]: Fits the frame size to the current view of the client window with the size of the view unchanged.
- [Top Most]: Places the frame window at topmost.
- All the other submenu items are common in Windows applications.
- [Options] ->
- [Text Font]: Popup a font dialog to set attributes of the current text font associated with the active window.
- [Symbol Font]: Popup a font dialog to set attributes of the current symbol font associated with the active window.
- [Foreground Color]: Popup a color dialog to set the current foreground color associated with the active window. This is useful to make custom colors.
- [Background Color]: Popup a color dialog to set the current background color associated with the active window.
- [Help] ->
- No help available currently.
Clicking [Starting options] opens a dialog box to set starting options.
The version of this grwnd.exe is shown with [About grwnd...].
With [Library Manual] the User's Manual for the Library opens provided a web browser is associated with '.html'.
Tsuguhiro TAMARIBUCHI <tamari@grwin.com>
Last modified: Tue Jun 24 23:56:22 JST 2003