DEFINITION MODULE EasyAbout;
(*******************************************************************
Module EasyAbout (Version 1.0)
Copyright (c) 2001-2006 by Andreas Fischlin and ETH Zurich.
Purpose Utilities to manage an about procedure
of an application.
Remarks --
Programming
o Design
Andreas Fischlin 11/04/2001
o Implementation
Andreas Fischlin 11/04/2001
ETH Zurich
Systems Ecology
CHN E 35.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND
URLs:
<mailto:RAMSES@env.ethz.ch>
<http://www.sysecol.ethz.ch>
<http://www.sysecol.ethz.ch/SimSoftware/RAMSES>
Last revision of definition: 13/06/2002 AF
*******************************************************************)
CONST
undefpictureID = 0;
PROCEDURE DeclareAbout(title: ARRAY OF CHAR; bodyText: PROC;
titleSize, aboutWidth, aboutHeight,
leftMargin, rightMargin, pictureID: INTEGER);
(*
Declares the about procedure having the title 'title' and the
body text as generated by procedure bodyText. The title is
written in bold and expanded style. In case the actual
argument 'title' is the empty string, no title is generated.
The bodyText may use any routines from DMWindIO, but
typically statements simply call WriteCenteredLn in a
sequence. titleSize is the font size with which the title
text is written (use 20 or 12). aboutWidth and aboutHeight
define the size of the about window in pixels. leftMargin
and rightMargin specify the width of the the left and right
margins in characters (cf. CellWidth() from DMWindIO). If
pictureID is different from undefpictureID, then the
predefined pricture referred to by pictureID is displayed in
the centre of the about window. It is assumed that the
needed picture can be found following the default search
strategy (file name is the empty string). Actually
DMWindIO.DisplayPredefinedPicture is called, see module
DMWindIO for further details. You may use all mechanisms to
draw and write at the same time in any combination.
Sample code:
CONST aboutPicID = 3100;
PROCEDURE BodyText;
VAR i: INTEGER;
BEGIN
(* skip title and authors in default picture *)
FOR i := 1 TO 6 DO WriteCenteredLn("") END(*FOR*);
(* write version *)
WriteCenteredLn("V 1.0 (11.Apr.2001)");
END BodyText;
DeclareAbout("RAMSES HFIO Package", BodyText, 19, 336, 158,
8, 3, aboutPictID);
*)
PROCEDURE WriteCenteredLn (s: ARRAY OF CHAR);
(*
Write string s on a line of the about procedure in centered
alignment mode
*)
PROCEDURE WriteLeftAdjLn (s: ARRAY OF CHAR);
(*
Write string s on a line of the about procedure in left
alignment mode
*)
PROCEDURE WriteRightAdjLn (s: ARRAY OF CHAR);
(*
Write string s on a line of the about procedure in right
alignment mode
*)
PROCEDURE OneLineUp;
(*
Next call to WriteCenteredLn, WriteLeftAdjLn, or WriteRightAdjLn
will write on the same line as has been written before.
*)
PROCEDURE SetMargins(leftMargin, rightMargin: INTEGER);
(*
Set margins for subsequent writing by WriteLeftAdjLn and
WriteRightAdjLn
*)
PROCEDURE NoBodyText;
END EasyAbout.