Skip to content
Snippets Groups Projects
Commit aa69a266 authored by Oliver Sander's avatar Oliver Sander
Browse files

merge documentation from separate .doc file into the actual header --> yields more consistency

[[Imported from SVN: r8305]]
parent 7fed8771
No related branches found
No related tags found
No related merge requests found
......@@ -67,124 +67,6 @@ D*/
/*D
OUTPUTDEVICE - data structure to define an interface to output devices
PURPOSE:
The struct 'OUTPUTDEVICE' defines an interface to an output device with
graphics capabilites. ug uses a default output device which usually is your
computer monitor. Additionally there can be defined several other output devices.
Up to now there is implemented an interface to XWindows of UNIX and to the
Macintosh OS with the possibilties of window handling and plotting.
They serve as default output device.
Another output is the 'meta' ouput device. This is a format to write graphics commands
to file which later can be view with the 'xugv' tool or that can be translated to PostScript
format using the 'm2ps' tool. It is a lean storage format
suited quite well for producing and viewing "films" with many pictures of time dependent solutions.
It is also a helpful tool for production runs on large problems which often will run
in batch mode.
In the near future probably also a PostScript output device will exist.
The output device struct requires functions for opening, closing, activating and updating
a window on the device. Then there is a collection of graphics functions to set color,
line width move the cursor, draw lines and higher level functions to plot filled polygons
and text.
Additionally there is information specified on the color palette used and some standard
colors are defined.
DEFINITION:
.vb
// abstract graphical output device
struct outputdevice {
// This is an environment variable
ENVVAR v;
// properties
long black; // value for black
long white; // value for white
long red; // value for red
long green; // value for green
long blue; // value for blue
long cyan; // value for cyan
long orange; // value for orange
long yellow; // value for yellow
long darkyellow; // value for yellow
long magenta; // value for magenta
short hasPalette; // 1 if device has a color lookup table
long range; // # of possible color indices
long spectrumStart; // usable range for a continuous
long spectrumEnd; // color spectrum
DOUBLE PixelRatio; // ratio of (physical) hight to width of a pixel
// pointers to basic drawing functions
void (*Move) (SHORT_POINT); // move in device coordinates
void (*Draw) (SHORT_POINT); // draw from current point to given
void (*Polyline) (SHORT_POINT *, INT ); // draw a polyline
void (*InversePolyline) (SHORT_POINT *, INT );
// draw an inverted polyline
void (*Polygon) (SHORT_POINT *, INT ); // fill a polygon w. curr. col
void (*InversePolygon) (SHORT_POINT *, INT );
// invert a polygon w. curr. col
void (*ErasePolygon) (SHORT_POINT *, INT );
// erase a polygon w. curr. col
void (*Polymark) (short, SHORT_POINT *);// place markers
void (*Text) (const char *, INT); // draw text in current size/font
void (*CenteredText) (SHORT_POINT, const char *, INT);
// draw text centered at x,y
// possible text modes are
// TEXT_REGULAR and TEXT_INVERSE
// (the last argument)
void (*ClearViewPort)(void); // clear a view port
// pointers to set functions
void (*SetLineWidth) (short); // line width in pixels (points)
void (*SetTextSize) (short); // text size in pixels (points)
void (*SetMarker) (short); // set marker id
void (*SetMarkerSize) (short); // marker size in pixels (points)
void (*SetColor) (long); // arg is index or direct col value
void (*SetPaletteEntry) (long,short,short,short);
// set index to value
void (*SetNewPalette) (long,long,short*,short*,short*);
// replace entry
// pointers to miscellaneous functions
void (*GetPaletteEntry) (long,short *,short *,short *);
// read color table
void (*Flush) (void); // flush graphics buffer
// operations for managing windows
OpenOutputPtr OpenOutput; // function to open a window
CloseOutputPtr CloseOutput; // function to close a window
ActivateOutputPtr ActivateOutput; // function to activate window
UpdateOutputPtr UpdateOutput; // function to draw outline with tool
// and info box
};
typedef struct outputdevice OUTPUTDEVICE;
// type for device coordinates
typedef struct
{
short x;
short y;
} SHORT_POINT ;
// identification of windows
typedef INT WINDOWID;
// function types exported by OUTPUTDEVICE
typedef WINDOWID (*OpenOutputPtr) (const char *title,
INT x, INT y, INT width, INT height,
INT *Global_LL, INT *Global_UR, INT *Local_LL, INT *Local_UR, INT *error);
typedef INT (*CloseOutputPtr) (WINDOWID win);
typedef INT (*ActivateOutputPtr) (WINDOWID win);
typedef INT (*UpdateOutputPtr) (WINDOWID win, char *s, INT tool);
.ve
STRUCT COMPONENTS:
We only explain the function pointers together with their arguments and types in correct order.
......@@ -198,7 +80,7 @@ typedef INT (*UpdateOutputPtr) (WINDOWID win, char *s, INT tool);
. ErasePolygon - erase filled polygon (closed) connecting 'SHORT_POINT points[], INT nPoints' in total
. Polymark - plot 'short nMarkers' at 'SHORT_POINT points[]'
. Text - write text at 'SHORT_POINT position' with 'INT mode' TEXT_REGULAR or TEXT_INVERSE
. CenteredText - write centered text at'SHORT_POINT position' with 'INT mode' TEXT_REGULAR or TEXT_INVERSE
. CenteredText - write centered text at 'SHORT_POINT position' with 'INT mode' TEXT_REGULAR or TEXT_INVERSE
. ClearViewPort - clear the whole view port of the window
. SetLineWidth - set current line width to 'short width'
. SetTextSize - set current text size to 'short size'
......@@ -228,118 +110,3 @@ typedef INT (*UpdateOutputPtr) (WINDOWID win, char *s, INT tool);
D*/
/****************************************************************************/
/****************************************************************************/
/*D
EVENT - data structure for the ug event handling
PURPOSE:
The event handling of ug defines several possible event types the interface
function 'GetNextUGEvent' can return to 'ProcessEvent'. Depending on the
event type data are transferred by the corresponding component in the union.
The events are distinguished by the 'Type' component in the 'EVENT'
DEFINITION:
.vb
typedef union {
INT Type;
NO_UGEVENT NoEvent;
TERM_GOAWAY_EVENT TermGoAway;
TERM_CMDKEY_EVENT TermCmdKey;
TERM_STRING_EVENT TermString;
DOC_GOAWAY_EVENT DocGoAway;
DOC_ACTIVATE_EVENT DocActivate;
DOC_DRAG_EVENT DocDrag;
DOC_GROW_EVENT DocGrow;
DOC_CHANGETOOL_EVENT DocChangeTool;
DOC_CONTENTCLICK_EVENT DocContentClick;
DOC_UPDATE_EVENT DocUpdate;
} EVENT;
typedef struct { // no event
INT Type; // event type
// data
INT InterfaceEvent; // 1 if the interface event was handled
} NO_UGEVENT;
typedef struct { // go away event for terminal window
INT Type; // event type
} TERM_GOAWAY_EVENT;
typedef struct { // cmd key event for terminal window
INT Type; // event type
// data
char CmdKey; // character from keyboard
} TERM_CMDKEY_EVENT;
typedef struct { // string event for terminal window
INT Type; // event type
// data
char String[INPUTBUFFERLEN]; // string from keyboard
} TERM_STRING_EVENT;
typedef struct { // go away event for view
INT Type; // event type
// data
WINDOWID win; // the window
} DOC_GOAWAY_EVENT;
typedef struct { // activate event for view
INT Type; // event type
// data
WINDOWID win; // the window
} DOC_ACTIVATE_EVENT;
typedef struct { // drag event for view
INT Type; // event type
// data
WINDOWID win; // the window
INT Global_LL[2]; // new absolute position of window on screen
INT Global_UR[2]; //
} DOC_DRAG_EVENT;
typedef struct { // grow event for view
INT Type; // event type
// data
WINDOWID win; // the window
INT Global_LL[2]; // new absolute position of window on screen
INT Global_UR[2]; //
INT Local_LL[2]; // range of pixels used for plotting (view port)
INT Local_UR[2]; //
} DOC_GROW_EVENT;
typedef struct { // change tool event for view
INT Type; // event type
// data
WINDOWID win; // the window
INT Tool; // change to that tool
} DOC_CHANGETOOL_EVENT;
typedef struct { // content click event for view
INT Type; // event type
// data
WINDOWID win; // the window
INT MousePosition[2]; // mouse position
} DOC_CONTENTCLICK_EVENT;
typedef struct { // update event for view
INT Type; // event type
// data
WINDOWID win; // the window
} DOC_UPDATE_EVENT;
.ve
SEE ALSO:
ProcessEvent, GetNextUGEvent
D*/
/****************************************************************************/
......@@ -130,11 +130,11 @@ enum UG_PALETTE {
/* */
/****************************************************************************/
/* identification of windows, used to carry a pointer (xif, ppm, ps)
/** \brief Identification of windows, used to carry a pointer (xif, ppm, ps)
or INT (rif) */
typedef void* WINDOWID;
/* type for device coordinates */
/** \brief Type for device coordinates */
typedef struct
{
short x;
......@@ -147,13 +147,38 @@ typedef INT (*CloseOutputPtr)(WINDOWID win);
typedef INT (*ActivateOutputPtr)(WINDOWID win);
typedef INT (*UpdateOutputPtr)(WINDOWID win, INT tool);
/* abstract graphical output device */
/** \brief Data structure to define an interface to output devices
The struct 'OUTPUTDEVICE' defines an interface to an output device with
graphics capabilites. ug uses a default output device which usually is your
computer monitor. Additionally there can be defined several other output devices.
Up to now there is implemented an interface to XWindows of UNIX and to the
Macintosh OS with the possibilties of window handling and plotting.
They serve as default output device.
Another output is the 'meta' ouput device. This is a format to write graphics commands
to file which later can be view with the 'xugv' tool or that can be translated to PostScript
format using the 'm2ps' tool. It is a lean storage format
suited quite well for producing and viewing "films" with many pictures of time dependent solutions.
It is also a helpful tool for production runs on large problems which often will run
in batch mode.
In the near future probably also a PostScript output device will exist.
The output device struct requires functions for opening, closing, activating and updating
a window on the device. Then there is a collection of graphics functions to set color,
line width move the cursor, draw lines and higher level functions to plot filled polygons
and text.
Additionally there is information specified on the color palette used and some standard
colors are defined.
*/
struct outputdevice {
/* This is an environment variable */
/** \brief This is an environment variable */
ENVVAR v;
/* properties */
long black; /* value for black */
long gray; /* value for gray */
long white; /* value for white */
......@@ -212,8 +237,8 @@ struct outputdevice {
/* event structure */
typedef struct { /* no event */
/** \brief No event */
typedef struct {
INT Type; /* event type */
/* data */
......@@ -222,39 +247,45 @@ typedef struct { /* no event
INT Mouse[2]; /* current mouse coord (rel. to window) */
} NO_UGEVENT;
typedef struct { /* go away event for terminal window */
/** \brief Go away event for terminal window */
typedef struct {
INT Type; /* event type */
} TERM_GOAWAY_EVENT;
typedef struct { /* cmd key event for terminal window */
/** \brief Cmd key event for terminal window */
typedef struct {
INT Type; /* event type */
/* data */
char CmdKey; /* character from keyboard */
} TERM_CMDKEY_EVENT;
typedef struct { /* string event for terminal window */
/** \brief String event for terminal window */
typedef struct {
INT Type; /* event type */
/* data */
char String[INPUTBUFFERLEN]; /* string from keyboard */
} TERM_STRING_EVENT;
typedef struct { /* go away event for view */
/** \brief Go away event for view */
typedef struct {
INT Type; /* event type */
/* data */
WINDOWID win; /* the window */
} DOC_GOAWAY_EVENT;
typedef struct { /* activate event for view */
/** \brief Activate event for view */
typedef struct {
INT Type; /* event type */
/* data */
WINDOWID win; /* the window */
} DOC_ACTIVATE_EVENT;
typedef struct { /* drag event for view */
/** \brief Drag event for view */
typedef struct {
INT Type; /* event type */
/* data */
......@@ -263,7 +294,8 @@ typedef struct { /* drag event for view
INT Global_UR[2]; /* */
} DOC_DRAG_EVENT;
typedef struct { /* grow event for view */
/** \brief Grow event for view */
typedef struct {
INT Type; /* event type */
/* data */
......@@ -274,7 +306,8 @@ typedef struct { /* grow event for view
INT Local_UR[2]; /* */
} DOC_GROW_EVENT;
typedef struct { /* change tool event for view */
/** \brief Change tool event for view */
typedef struct {
INT Type; /* event type */
/* data */
......@@ -283,7 +316,8 @@ typedef struct { /* change tool event for
INT MousePosition[2]; /* mouse position */
} DOC_CHANGETOOL_EVENT;
typedef struct { /* content click event for view */
/** \brief Content click event for view */
typedef struct {
INT Type; /* event type */
/* data */
......@@ -291,13 +325,21 @@ typedef struct { /* content click event f
INT MousePosition[2]; /* mouse position */
} DOC_CONTENTCLICK_EVENT;
typedef struct { /* update event for view */
/** \brief Update event for view */
typedef struct {
INT Type; /* event type */
/* data */
WINDOWID win; /* the window */
} DOC_UPDATE_EVENT;
/** \brief Data structure for the ug event handling
The event handling of ug defines several possible event types the interface
function 'GetNextUGEvent' can return to 'ProcessEvent'. Depending on the
event type data are transferred by the corresponding component in the union.
The events are distinguished by the 'Type' component in the 'EVENT'
*/
typedef union {
INT Type;
NO_UGEVENT NoEvent;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment