WINFD Class Reference

#include <grphics.h>

List of all members.


Detailed Description

Starbase related.

Constructors for WINFD are host dependent to match different implementations and are intended to be called only by create_window. Use create_window to make a window.

Fmg: Any chance someone with wxWindows experience could take a look at nearby code and see how much effort it would be to 'adapt' it to use wxWindows?

Definition at line 101 of file grphics.h.

Public Member Functions

Static Public Member Functions

Protected Attributes

Private Member Functions

Private Attributes

Friends


Constructor & Destructor Documentation

WINFD::WINFD (  ) 

Constructor to initialize a WINFD entry.

Definition at line 743 of file _grphics.cpp.

References click_handler, destroy_handler, downevent, events, FALSE, fd, key_handler, keyevent, lastevent, moveevent, NULL, selection_handler, upevent, and used.

00743              {  //constructor
00744   fd = -1;
00745   used = FALSE;
00746   downevent = FALSE;
00747   moveevent = FALSE;
00748   upevent = FALSE;
00749   keyevent = FALSE;
00750   click_handler = NULL;
00751   selection_handler = NULL;
00752   key_handler = NULL;
00753   destroy_handler = NULL;
00754   events = NULL;
00755   lastevent = NULL;
00756 }

WINFD::~WINFD (  )  [virtual]

Definition at line 759 of file _grphics.cpp.

00759                {
00760 }


Member Function Documentation

void WINFD::Append_text ( const char *  string,
INT16  xform,
INT16  more 
)

append a string

Draw a text string using current font, colour, height.

Definition at line 651 of file _grphics.cpp.

References APPENDTEXT, APPENDOP::chars, fd, HEADUNION::fd, getshm(), APPENDOP::header, APPENDPARAM::more, NULL, APPENDOP::param, APPENDPARAM::string, APPENDOP::type, and APPENDPARAM::xform.

00655                          {
00656   APPENDOP *newop;               /*message structure */
00657   INT16 length;                  /*length of string */
00658 
00659   length = strlen (string) + 1;  /*include null */
00660   length += 3;
00661   length &= ~3;                  /*round up to words */
00662                                  /*get some space */
00663   newop = (APPENDOP *) getshm (sizeof (APPENDOP) + length - 4);
00664   if (newop != NULL) {
00665     newop->header.fd = fd;       /*send the fd */
00666     newop->type = APPENDTEXT;    /*send the operator */
00667     newop->param.string = newop->chars;
00668     newop->param.xform = xform;
00669     newop->param.more = more;
00670                                  /*copy the string */
00671     strcpy (newop->chars, string);
00672   }
00673 }

void WINFD::Arc ( float  x_radius,
float  y_radius,
float  x_center,
float  y_center,
float  start,
float  stop,
float  rotation,
INT16  close_type 
) [virtual]

draw an arc

Draw an arc using current perimeter/interior controls.

Definition at line 710 of file _grphics.cpp.

References ARC, PARAMUNION::f, fd, HEADUNION::fd, getshm(), EIGHTOP::header, PARAMUNION::i, NULL, EIGHTPARAMS::p, EIGHTOP::param, and EIGHTOP::type.

00719                  {
00720   EIGHTOP *newop;                /*message structure */
00721 
00722                                  /*get some space */
00723   newop = (EIGHTOP *) getshm (sizeof (EIGHTOP));
00724   if (newop != NULL) {
00725     newop->header.fd = fd;       /*send the fd */
00726     newop->type = ARC;           /*send the operator */
00727                                  /*set parameters */
00728     newop->param.p[0].f = x_radius;
00729     newop->param.p[1].f = y_radius;
00730     newop->param.p[2].f = x_center;
00731     newop->param.p[3].f = y_center;
00732     newop->param.p[4].f = start;
00733     newop->param.p[5].f = stop;
00734     newop->param.p[6].f = rotation;
00735     newop->param.p[7].i = close_type;
00736   }
00737 }

void WINFD::Character_height ( float  height  )  [virtual]

set text height

Set the VDC height of subsequent text.

Definition at line 325 of file _grphics.cpp.

References CHARHEIGHT, PARAMUNION::f, fd, HEADUNION::fd, getshm(), ONEOP::header, NULL, ONEPARAM::p, ONEOP::param, and ONEOP::type.

00327                               {
00328   ONEOP *newop;                  /*message structure */
00329 
00330                                  /*get some space */
00331   newop = (ONEOP *) getshm (sizeof (ONEOP));
00332   if (newop != NULL) {
00333     newop->header.fd = fd;       /*send the fd */
00334     newop->type = CHARHEIGHT;    /*send the operator */
00335     newop->param.p.f = height;   /*set parameter */
00336   }
00337 }

void WINFD::Clear_event_queue (  )  [virtual]

clear events

Clear the queue of events for this window.

Definition at line 793 of file _grphics.cpp.

References events, fd, maxsbfd, graphicsevent::next, NULL, sbfds, and used.

Referenced by Destroy_window().

00793                               {
00794   INT16 fd;                      //current window
00795   GRAPHICS_EVENT *event;         /*current event */
00796   GRAPHICS_EVENT *nextevent;     /*next in list */
00797 
00798   if (this == NULL) {
00799     for (fd = 1; fd < maxsbfd; fd++) {
00800       if (sbfds[fd].used) {
00801         sbfds[fd].Clear_event_queue ();
00802       }
00803     }
00804   }
00805   else {
00806     for (event = events; event != NULL; event = nextevent) {
00807       nextevent = event->next;
00808       delete event;              //free them all
00809     }
00810     events = NULL;               /*there are none now */
00811   }
00812 }

void WINFD::Clear_view_surface (  )  [virtual]

clear window

Clear the window and empty the display list, discarding images also.

Definition at line 820 of file _grphics.cpp.

References CLEAR, fd, HEADUNION::fd, getshm(), ONEOP::header, NULL, and ONEOP::type.

Referenced by c_clear_window().

00820                                {
00821   ONEOP *newop;                  /*message structure */
00822 
00823                                  /*get some space */
00824   newop = (ONEOP *) getshm (sizeof (ONEOP));
00825   if (newop != NULL) {
00826     newop->header.fd = fd;       /*send the fd */
00827     newop->type = CLEAR;         /*send the operator */
00828   }
00829 }

WINDOW WINFD::create ( const char *  name,
INT8  window_type,
INT16  xpos,
INT16  ypos,
INT16  xsize,
INT16  ysize,
float  xmin,
float  xmax,
float  ymin,
float  ymax,
BOOL8  downon,
BOOL8  moveon,
BOOL8  upon,
BOOL8  keyon 
) [static]

Create a window.

Parameters:
name Name/title of window
indow_type type of window
xpos coords of window
ypos coords of window
xsize size of window
ysize size of window
xmin scrolling limit
xmax to stop users
ymin getting lost in
ymax empty space
downon Events wanted
moveon 
upon 
keyon 
Returns:
reference ID
Create a window and register event handlers on the window. The return "file descriptor" is used in subsequent starbase primitives to refer to this window.

Example: name="Blobs", window_type=1, xpos=520, ypos=10, xsize=500, ysize=128, xmin=-1000, xmax=1000, ymin=0, ymax=256, downon=1, moveon=0, upon=0, keyon=1

Definition at line 98 of file _grphics.cpp.

References click_handler, CREATE, destroy_handler, downevent, CREATEOP::downon, events, HEADUNION::fd, fd, getshm(), CREATEOP::header, key_handler, keyevent, CREATEOP::keyon, lastevent, maxsbfd, MAXWINDOWNAME, MAXWINDOWS, moveevent, CREATEOP::moveon, CREATEOP::name, NO_WINDOW, NULL, sbfds, selection_handler, start_sbdaemon(), TRUE, CREATEOP::type, upevent, CREATEOP::upon, used, CREATEOP::window_type, CREATEOP::xmax, CREATEOP::xmin, CREATEOP::xpos, CREATEOP::xsize, CREATEOP::ymax, CREATEOP::ymin, CREATEOP::ypos, and CREATEOP::ysize.

00112                                   {
00113   INT16 fd;                      //integer index
00114   CREATEOP *newop;               /*create structure */
00115   WINDOW win;                    //output
00116 
00117 #ifdef NO_X_WINDOWS
00118    return NO_WINDOW;
00119 #endif
00120 
00121   if (xmin == xmax || ymin == ymax)
00122     return NO_WINDOW;
00123   if (maxsbfd == 0) {
00124     maxsbfd = 1;                 /*don't use 0 */
00125     start_sbdaemon();  /*startup daemon */
00126   }
00127 
00128                                  /*find a free one */
00129   for (fd = 1; fd < maxsbfd && sbfds[fd].used; fd++);
00130   if (fd == maxsbfd) {           /*need a new one */
00131     if (maxsbfd == MAXWINDOWS)
00132       return NO_WINDOW;
00133     maxsbfd++;
00134   }
00135   win = &sbfds[fd];              //this
00136   win->fd = fd;
00137   win->used = TRUE;              /*it is in use */
00138   win->downevent = downon;
00139   win->moveevent = moveon;
00140   win->upevent = upon;
00141   win->keyevent = keyon;
00142   win->click_handler = NULL;
00143   win->selection_handler = NULL;
00144   win->key_handler = NULL;
00145   win->destroy_handler = NULL;
00146   win->events = NULL;
00147   win->lastevent = NULL;
00148 
00149   newop = (CREATEOP *) getshm (sizeof (CREATEOP));
00150   if (newop != NULL) {
00151     newop->header.fd = fd;       /*file descriptor */
00152     newop->type = CREATE;        /*set operator type */
00153     newop->window_type = window_type;
00154                                  /*copy window name */
00155     strncpy (newop->name, name, MAXWINDOWNAME - 1);
00156     newop->name[MAXWINDOWNAME - 1] = '\0';
00157     newop->xpos = xpos;
00158     newop->ypos = ypos;
00159     newop->xsize = xsize;
00160     newop->ysize = ysize;
00161     newop->xmin = xmin;
00162     newop->xmax = xmax;
00163     newop->ymin = ymin;
00164     newop->ymax = ymax;
00165     newop->downon = downon;
00166     newop->moveon = moveon;
00167     newop->upon = upon;
00168     newop->keyon = keyon;
00169   }
00170   return win;                    /*file descriptor */
00171 }

void WINFD::Destroy_window (  )  [virtual]

destroy a window

Destroy a window and free the file descriptor

Definition at line 768 of file _grphics.cpp.

References Clear_event_queue(), click_handler, DESTROY, FALSE, HEADUNION::fd, fd, getshm(), ONEOP::header, maxsbfd, NULL, sbfds, ONEOP::type, and used.

00768                            {
00769   ONEOP *newop;                  /*destroy structure */
00770 
00771   if (fd < 1 || fd > maxsbfd || sbfds[fd].used == FALSE) {
00772     return;
00773   }
00774   else {
00775     Clear_event_queue(); 
00776     sbfds[fd].used = FALSE;      /*it is not in use */
00777     sbfds[fd].click_handler = NULL;
00778 
00779     newop = (ONEOP *) getshm (sizeof (ONEOP));
00780     if (newop != NULL) {
00781       newop->header.fd = fd;     /*file descriptor */
00782       newop->type = DESTROY;     /*set operator type */
00783     }
00784   }
00785 }

void WINFD::Draw2d ( float  x,
float  y 
) [virtual]

draw the pen

Draw from current position to the given position using the current colour

Definition at line 450 of file _grphics.cpp.

References DRAW2D, PARAMUNION::f, fd, HEADUNION::fd, getshm(), TWOOP::header, NULL, TWOPARAMS::p, TWOOP::param, and TWOOP::type.

Referenced by c_draw().

00453                     {
00454   TWOOP *newop;                  /*message structure */
00455 
00456                                  /*get some space */
00457   newop = (TWOOP *) getshm (sizeof (TWOOP));
00458   if (newop != NULL) {
00459     newop->header.fd = fd;       /*send the fd */
00460     newop->type = DRAW2D;        /*send the operator */
00461     newop->param.p[0].f = x;     /*set parameters */
00462     newop->param.p[1].f = y;
00463   }
00464 }

void WINFD::Ellipse ( float  x_radius,
float  y_radius,
float  x_center,
float  y_center,
float  rotation 
) [virtual]

draw an ellipse

Draw an ellipse using current perimeter/interior controls.

Definition at line 681 of file _grphics.cpp.

References ELLIPSE, PARAMUNION::f, fd, HEADUNION::fd, getshm(), EIGHTOP::header, NULL, EIGHTPARAMS::p, EIGHTOP::param, and EIGHTOP::type.

00687                      {
00688   EIGHTOP *newop;                /*message structure */
00689 
00690                                  /*get some space */
00691   newop = (EIGHTOP *) getshm (sizeof (EIGHTOP));
00692   if (newop != NULL) {
00693     newop->header.fd = fd;       /*send the fd */
00694     newop->type = ELLIPSE;       /*send the operator */
00695                                  /*set parameters */
00696     newop->param.p[0].f = x_radius;
00697     newop->param.p[1].f = y_radius;
00698     newop->param.p[2].f = x_center;
00699     newop->param.p[3].f = y_center;
00700     newop->param.p[4].f = rotation;
00701   }
00702 }

void WINFD::Fill_color ( UINT8  red,
UINT8  green,
UINT8  blue 
) [virtual]

set fill colour

Set the RGB colour for drawing fills with.

Definition at line 241 of file _grphics.cpp.

References fd, HEADUNION::fd, FILLCOLOUR, getshm(), ONEOP::header, PARAMUNION::i, NULL, ONEPARAM::p, ONEOP::param, and ONEOP::type.

00244                                    {
00245   ONEOP *newop;                  /*message structure */
00246   UINT32 packed_colour;
00247 
00248   packed_colour = (blue << 24) + (green << 16) + (red << 8);
00249                                  /*get some space */
00250   newop = (ONEOP *) getshm (sizeof (ONEOP));
00251   if (newop != NULL) {
00252     newop->header.fd = fd;       /*send the fd */
00253     newop->type = FILLCOLOUR;    /*send the operator */
00254                                  /*set parameter */
00255     newop->param.p.i = (INT32) packed_colour;
00256   }
00257 }

void WINFD::Fill_color_index ( COLOUR  index  )  [virtual]

Set fill colour.

Set the colour map index for drawing fills with.

Definition at line 221 of file _grphics.cpp.

References fd, HEADUNION::fd, FILLCOLOUR, getshm(), ONEOP::header, PARAMUNION::i, NULL, ONEPARAM::p, ONEOP::param, and ONEOP::type.

00223                               {
00224   ONEOP *newop;                  /*message structure */
00225 
00226                                  /*get some space */
00227   newop = (ONEOP *) getshm (sizeof (ONEOP));
00228   if (newop != NULL) {
00229     newop->header.fd = fd;       /*send the fd */
00230     newop->type = FILLCOLOUR;    /*send the operator */
00231     newop->param.p.i = index;    /*set parameter */
00232   }
00233 }

void WINFD::get_core_lock (  )  [inline, private]

Definition at line 274 of file grphics.h.

00274                          { 
00275     }                            //wait for lock

INT16 WINFD::get_fd (  )  [inline]

Definition at line 235 of file grphics.h.

Referenced by def_await_event(), and def_show_sub_image().

00235                    {  //access
00236       return fd;
00237     }

void WINFD::get_lock (  )  [inline, private]

Definition at line 268 of file grphics.h.

00268                     { 
00269     }                            //wait for lock

void WINFD::get_lock_for_draw (  )  [inline, private]

Definition at line 270 of file grphics.h.

00270                              { 
00271     }                            //kill draw thread

void WINFD::Interior_style ( INT16  style,
INT16  edged 
) [virtual]

set polygon style

Set the fill type and boundary presence for arcs, ellipses etc.

Definition at line 385 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), TWOOP::header, PARAMUNION::i, INTERIORSTYLE, NULL, TWOPARAMS::p, TWOOP::param, and TWOOP::type.

00388                             {
00389   TWOOP *newop;                  /*message structure */
00390 
00391                                  /*get some space */
00392   newop = (TWOOP *) getshm (sizeof (TWOOP));
00393   if (newop != NULL) {
00394     newop->header.fd = fd;       /*send the fd */
00395     newop->type = INTERIORSTYLE; /*send the operator */
00396     newop->param.p[0].i = style; /*set parameter */
00397     newop->param.p[1].i = edged;
00398   }
00399 }

void WINFD::Line_color_index ( COLOUR  index  )  [virtual]

Set line colour.

Set the colour map index for drawing lines with.

Definition at line 180 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, LINECOLOUR, NULL, ONEPARAM::p, ONEOP::param, and ONEOP::type.

Referenced by c_line_color_index().

00182                               {
00183   ONEOP *newop;                  /*message structure */
00184 
00185                                  /*get some space */
00186   newop = (ONEOP *) getshm (sizeof (ONEOP));
00187   if (newop != NULL) {
00188     newop->header.fd = fd;       /*send the fd */
00189     newop->type = LINECOLOUR;    /*send the operator */
00190     newop->param.p.i = index;    /*set parameter */
00191   }
00192 }

void WINFD::Line_type ( INT16  style  )  [virtual]

set line type

Set the line type for all subsequent lines.

Definition at line 345 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, LINETYPE, NULL, ONEPARAM::p, ONEOP::param, and ONEOP::type.

00347                        {
00348   ONEOP *newop;                  /*message structure */
00349 
00350                                  /*get some space */
00351   newop = (ONEOP *) getshm (sizeof (ONEOP));
00352   if (newop != NULL) {
00353     newop->header.fd = fd;       /*send the fd */
00354     newop->type = LINETYPE;      /*send the operator */
00355     newop->param.p.i = style;    /*set parameter */
00356   }
00357 }

void WINFD::Make_picture_current (  )  [virtual]

update window

Clear the buffer and make sure the image is up-to-date.

If a window of 0 is given, all windows are updated.

Definition at line 946 of file _grphics.cpp.

References HEADUNION::fd, fd, FLUSH_IN, getshm(), ONEOP::header, kick_daemon(), MAKECURRENT, NULL, overlap_picture_ops, TRUE, and ONEOP::type.

Referenced by c_make_current().

00946                                  {
00947   ONEOP *newop;                  /*message structure */
00948 
00949   if (this == NULL || fd <= 0) {
00950     overlap_picture_ops(TRUE); 
00951   }
00952   else {
00953                                  /*get some space */
00954     newop = (ONEOP *) getshm (sizeof (ONEOP));
00955     if (newop != NULL) {
00956       newop->header.fd = fd;     /*send the fd */
00957       newop->type = MAKECURRENT; /*send the operator */
00958       kick_daemon(FLUSH_IN);  /*empty shm */
00959     }
00960   }
00961 }

void WINFD::Marker_color_index ( COLOUR  index  )  [virtual]

set marker colour

Set the colour map index for drawing markers with.

Definition at line 265 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, MARKERCOLOUR, NULL, ONEPARAM::p, ONEOP::param, and ONEOP::type.

00267                                 {
00268   ONEOP *newop;                  /*message structure */
00269 
00270                                  /*get some space */
00271   newop = (ONEOP *) getshm (sizeof (ONEOP));
00272   if (newop != NULL) {
00273     newop->header.fd = fd;       /*send the fd */
00274     newop->type = MARKERCOLOUR;  /*send the operator */
00275     newop->param.p.i = index;    /*set parameter */
00276   }
00277 }

void WINFD::Marker_size ( float  size  )  [virtual]

set marker size

Set the size of markers in polymarker2d.

Definition at line 407 of file _grphics.cpp.

References PARAMUNION::f, FALSE, fd, HEADUNION::fd, getshm(), TWOOP::header, PARAMUNION::i, MARKERSIZE, NULL, TWOPARAMS::p, TWOOP::param, and TWOOP::type.

00409                          {
00410   TWOOP *newop;                  /*message structure */
00411 
00412                                  /*get some space */
00413   newop = (TWOOP *) getshm (sizeof (TWOOP));
00414   if (newop != NULL) {
00415     newop->header.fd = fd;       /*send the fd */
00416     newop->type = MARKERSIZE;    /*send the operator */
00417     newop->param.p[0].f = size;  /*set parameter */
00418     newop->param.p[1].i = FALSE;
00419   }
00420 }

void WINFD::Marker_type ( INT16  type  )  [virtual]

set marker type

Set the marker type for all subsequent lines.

Definition at line 365 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, MARKERTYPE, NULL, ONEPARAM::p, ONEOP::param, and ONEOP::type.

00367                          {
00368   ONEOP *newop;                  /*message structure */
00369 
00370                                  /*get some space */
00371   newop = (ONEOP *) getshm (sizeof (ONEOP));
00372   if (newop != NULL) {
00373     newop->header.fd = fd;       /*send the fd */
00374     newop->type = MARKERTYPE;    /*send the operator */
00375     newop->param.p.i = type;     /*set parameter */
00376   }
00377 }

void WINFD::Move2d ( float  x,
float  y 
) [virtual]

move the pen

Move the pen to the given position.

Definition at line 428 of file _grphics.cpp.

References PARAMUNION::f, fd, HEADUNION::fd, getshm(), TWOOP::header, MOVE2D, NULL, TWOPARAMS::p, TWOOP::param, and TWOOP::type.

Referenced by c_move().

00431                     {
00432   TWOOP *newop;                  /*message structure */
00433 
00434                                  /*get some space */
00435   newop = (TWOOP *) getshm (sizeof (TWOOP));
00436   if (newop != NULL) {
00437     newop->header.fd = fd;       /*send the fd */
00438     newop->type = MOVE2D;        /*send the operator */
00439     newop->param.p[0].f = x;     /*set parameters */
00440     newop->param.p[1].f = y;
00441   }
00442 }

void WINFD::Perimeter_color_index ( COLOUR  index  )  [virtual]

Set perimeter colour.

Set the colour map index for drawing perimeters with.

Definition at line 200 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, NULL, ONEPARAM::p, ONEOP::param, PERIMETERCOLOUR, and ONEOP::type.

00202                                    {
00203   ONEOP *newop;                  /*message structure */
00204 
00205                                  /*get some space */
00206   newop = (ONEOP *) getshm (sizeof (ONEOP));
00207   if (newop != NULL) {
00208     newop->header.fd = fd;       /*send the fd */
00209                                  /*send the operator */
00210     newop->type = PERIMETERCOLOUR;
00211     newop->param.p.i = index;    /*set parameter */
00212   }
00213 }

void WINFD::Polygon2d ( float  clist[],
INT16  numpts,
INT16  flags 
) [virtual]

draw a polygon

Draw a polygon using current line colour/type.

Definition at line 558 of file _grphics.cpp.

References POLYOP::clist, POLYPARAM::clist, fd, HEADUNION::fd, POLYPARAM::flags, getshm(), POLYOP::header, NULL, POLYPARAM::numpts, POLYOP::param, POLYGON2D, and POLYOP::type.

00562   {
00563   POLYOP *newop;                 /*message structure */
00564   INT32 floatcount;              /*no of floats */
00565 
00566   floatcount = flags ? numpts * 3/*move/draw flags in */
00567     : numpts * 2;                /*no move/draw flags */
00568                                  /*get some space */
00569   newop = (POLYOP *) getshm (sizeof (POLYOP) + sizeof (float) * (floatcount - 1));
00570   if (newop != NULL) {
00571     newop->header.fd = fd;       /*send the fd */
00572     newop->type = POLYGON2D;     /*send the operator */
00573                                  /*pointer to array */
00574     newop->param.clist = newop->clist;
00575     newop->param.numpts = numpts;/*other params */
00576     newop->param.flags = flags;
00577     memcpy (newop->clist, clist, (UINT32) floatcount * sizeof (float));
00578   }
00579 }

void WINFD::Polyline2d ( float  clist[],
INT16  numpts,
INT16  flags 
) [virtual]

draw a polyline

Draw a polyline using current line colour/type.

Definition at line 528 of file _grphics.cpp.

References POLYOP::clist, POLYPARAM::clist, fd, HEADUNION::fd, POLYPARAM::flags, getshm(), POLYOP::header, NULL, POLYPARAM::numpts, POLYOP::param, POLYLINE2D, and POLYOP::type.

00532   {
00533   POLYOP *newop;                 /*message structure */
00534   INT32 floatcount;              /*no of floats */
00535 
00536   floatcount = flags ? numpts * 3/*move/draw flags in */
00537     : numpts * 2;                /*no move/draw flags */
00538                                  /*get some space */
00539   newop = (POLYOP *) getshm (sizeof (POLYOP) + sizeof (float) * (floatcount - 1));
00540   if (newop != NULL) {
00541     newop->header.fd = fd;       /*send the fd */
00542     newop->type = POLYLINE2D;    /*send the operator */
00543                                  /*pointer to array */
00544     newop->param.clist = newop->clist;
00545     newop->param.numpts = numpts;/*other params */
00546     newop->param.flags = flags;
00547     memcpy (newop->clist, clist, (UINT32) floatcount * sizeof (float));
00548   }
00549 }

void WINFD::Polymarker2d ( float  clist[],
INT16  numpts,
INT16  flags 
) [virtual]

draw a polymarker

Draw a polymarker using current marker colour/type.

Definition at line 588 of file _grphics.cpp.

References POLYOP::clist, POLYPARAM::clist, fd, HEADUNION::fd, POLYPARAM::flags, getshm(), POLYOP::header, NULL, POLYPARAM::numpts, POLYOP::param, POLYMARKER2D, and POLYOP::type.

00592   {
00593   POLYOP *newop;                 /*message structure */
00594   INT32 floatcount;              /*no of floats */
00595 
00596   floatcount = flags ? numpts * 3/*move/draw flags in */
00597     : numpts * 2;                /*no move/draw flags */
00598                                  /*get some space */
00599   newop = (POLYOP *) getshm (sizeof (POLYOP) + sizeof (float) * (floatcount - 1));
00600   if (newop != NULL) {
00601     newop->header.fd = fd;       /*send the fd */
00602     newop->type = POLYMARKER2D;  /*send the operator */
00603                                  /*pointer to array */
00604     newop->param.clist = newop->clist;
00605     newop->param.numpts = numpts;/*other params */
00606     newop->param.flags = flags;
00607     memcpy (newop->clist, clist, (UINT32) floatcount * sizeof (float));
00608   }
00609 }

void WINFD::Re_compute_colourmap (  )  [virtual]

recalc colormap

Tell SBD to recalc_colourmap for this window.

Definition at line 837 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, NULL, RE_COMP_COLMAP, and ONEOP::type.

00837                                  {
00838   ONEOP *newop;                  /*message structure */
00839 
00840                                  /*get some space */
00841   newop = (ONEOP *) getshm (sizeof (ONEOP));
00842   if (newop != NULL) {
00843     newop->header.fd = fd;       /*send the fd */
00844     newop->type = RE_COMP_COLMAP;/*send the operator */
00845   }
00846   /*
00847     ONE DAY THE PC VERSION WILL SUPPORT COLOUR - BUT NOT TODAY
00848 
00849     Among the things that will need doing is to change the size of..
00850       PCSTUBSPEC           stubspecs[SYNCWIN+1];
00851     in pcsbdg.[ch] to RE_COMP_COLMAP+1
00852   */
00853 }

void WINFD::Rectangle ( float  x1,
float  y1,
float  x2,
float  y2 
) [virtual]

draw a rectangle

Draw a rectangle using current perimeter/interior controls.

Definition at line 472 of file _grphics.cpp.

References PARAMUNION::f, fd, HEADUNION::fd, getshm(), FOUROP::header, NULL, FOURPARAMS::p, FOUROP::param, RECTANGLE, and FOUROP::type.

00477                        {
00478   FOUROP *newop;                 /*message structure */
00479 
00480                                  /*get some space */
00481   newop = (FOUROP *) getshm (sizeof (FOUROP));
00482   if (newop != NULL) {
00483     newop->header.fd = fd;       /*send the fd */
00484     newop->type = RECTANGLE;     /*send the operator */
00485     newop->param.p[0].f = x1;    /*set parameters */
00486     newop->param.p[1].f = y1;
00487     newop->param.p[2].f = x2;
00488     newop->param.p[3].f = y2;
00489   }
00490 }

void WINFD::release_core_lock (  )  [inline, private]

Definition at line 276 of file grphics.h.

00276                              { 
00277     }                            //let it go

void WINFD::release_lock (  )  [inline, private]

Definition at line 272 of file grphics.h.

00272                         { 
00273     }                            //let it go

void WINFD::Set_click_handler ( EVENT_HANDLER  handler  ) 

set callback for clicks

Parameters:
handler Handler function
Set a callback function for click events.

Definition at line 991 of file _grphics.cpp.

References click_handler.

00993                                {
00994   click_handler = handler;       //remember it
00995 }

void WINFD::Set_destroy_handler ( EVENT_HANDLER  handler  ) 

set callback for destroy

Parameters:
handler Handler function
Set a callback function for destroy events.

Definition at line 1033 of file _grphics.cpp.

References destroy_handler.

01035                                  {
01036   destroy_handler = handler;     //remember it
01037 }

void WINFD::Set_echo ( ECHO_TYPE  echo_type,
float  xorig,
float  yorig 
)

set window echo

Set the starbase echo/cursor.

Definition at line 889 of file _grphics.cpp.

References PARAMUNION::f, fd, HEADUNION::fd, getshm(), FOUROP::header, PARAMUNION::i, NULL, FOURPARAMS::p, FOUROP::param, SETECHO, and FOUROP::type.

00893                       {
00894   FOUROP *newop;                 /*message structure */
00895 
00896                                  /*get some space */
00897   newop = (FOUROP *) getshm (sizeof (FOUROP));
00898   if (newop != NULL) {
00899     newop->header.fd = fd;       /*send the fd */
00900     newop->type = SETECHO;       /*send the operator */
00901     newop->param.p[0].i = echo_type;
00902     newop->param.p[1].f = xorig;
00903     newop->param.p[2].f = yorig;
00904   }
00905 }

void WINFD::Set_key_handler ( EVENT_HANDLER  handler  ) 

set callback for key

Parameters:
handler Handler function
Set a callback function for key events.

Definition at line 1019 of file _grphics.cpp.

References key_handler.

01021                              {
01022   key_handler = handler;         //remember it
01023 }

void WINFD::Set_selection_handler ( EVENT_HANDLER  handler  ) 

set callback for selection

Parameters:
handler Handler function
Set a callback function for selection events.

Definition at line 1005 of file _grphics.cpp.

References selection_handler.

01007                                    {
01008   selection_handler = handler;   //remember it
01009 }

void WINFD::Synchronize_windows ( WINDOW  fd2  )  [virtual]

set line colour

Make zoom, scroll and resize operations ripple over other window(s).

Definition at line 969 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, NULL, ONEPARAM::p, ONEOP::param, SYNCWIN, and ONEOP::type.

00971                                  {
00972   ONEOP *newop;                  /*message structure */
00973 
00974                                  /*get some space */
00975   newop = (ONEOP *) getshm (sizeof (ONEOP));
00976   if (newop != NULL) {
00977     newop->header.fd = fd;       /*send the fd */
00978     newop->type = SYNCWIN;       /*send the operator */
00979     newop->param.p.i = fd2->fd;  /*set parameter */
00980   }
00981 }

void WINFD::Text2d ( float  x,
float  y,
const char *  string,
INT16  xform,
INT16  more 
) [virtual]

draw a string

Draw a text string using current font, colour, height.

Definition at line 617 of file _grphics.cpp.

References TEXTOP::chars, fd, HEADUNION::fd, getshm(), TEXTOP::header, TEXTPARAM::more, NULL, TEXTOP::param, TEXTPARAM::string, TEXT2D, TEXTOP::type, TEXTPARAM::x, TEXTPARAM::xform, and TEXTPARAM::y.

00623                     {
00624   TEXTOP *newop;                 /*message structure */
00625   INT16 length;                  /*length of string */
00626 
00627   length = strlen (string) + 1;  /*include null */
00628   length += 3;
00629   length &= ~3;                  /*round up to words */
00630                                  /*get some space */
00631   newop = (TEXTOP *) getshm (sizeof (TEXTOP) + length - 4);
00632   if (newop != NULL) {
00633     newop->header.fd = fd;       /*send the fd */
00634     newop->type = TEXT2D;        /*send the operator */
00635     newop->param.x = x;          /*copy parameters */
00636     newop->param.y = y;
00637     newop->param.string = newop->chars;
00638     newop->param.xform = xform;
00639     newop->param.more = more;
00640                                  /*copy the string */
00641     strcpy (newop->chars, string);
00642   }
00643 }

void WINFD::Text_alignment ( INT32  h_select,
INT32  v_select,
float  horiz,
float  vert 
) [virtual]

draw a rectangle

Control text position.

Definition at line 498 of file _grphics.cpp.

References PARAMUNION::f, fd, HEADUNION::fd, getshm(), FOUROP::header, PARAMUNION::i, NULL, FOURPARAMS::p, FOUROP::param, TEXT_ALIGNMENT, and FOUROP::type.

00503                             {
00504 #ifndef WXSBSERVANT
00505   FOUROP *newop;                 /*message structure */
00506 
00507                                  /*get some space */
00508   newop = (FOUROP *) getshm (sizeof (FOUROP));
00509   if (newop != NULL) {
00510     newop->header.fd = fd;       /*send the fd */
00511     newop->type = TEXT_ALIGNMENT;/*send the operator */
00512     newop->param.p[0].i = h_select;
00513     newop->param.p[1].i = v_select;
00514     newop->param.p[2].f = horiz;
00515     newop->param.p[3].f = vert;
00516   }
00517 #else // WXSBSERVANT
00518 #endif //WXSBSERVANT
00519 }

void WINFD::Text_color_index ( COLOUR  index  )  [virtual]

set text colour

Set the colour map index for drawing texts with.

Definition at line 285 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, NULL, ONEPARAM::p, ONEOP::param, TEXTCOLOUR, and ONEOP::type.

00287                               {
00288   ONEOP *newop;                  /*message structure */
00289 
00290                                  /*get some space */
00291   newop = (ONEOP *) getshm (sizeof (ONEOP));
00292   if (newop != NULL) {
00293     newop->header.fd = fd;       /*send the fd */
00294     newop->type = TEXTCOLOUR;    /*send the operator */
00295     newop->param.p.i = index;    /*set parameter */
00296   }
00297 }

void WINFD::Text_font_index ( INT16  index  )  [virtual]

set text font

Set the text font index for drawing texts with.

Definition at line 305 of file _grphics.cpp.

References fd, HEADUNION::fd, getshm(), ONEOP::header, PARAMUNION::i, NULL, ONEPARAM::p, ONEOP::param, TEXTFONT, and ONEOP::type.

00307                              {
00308   ONEOP *newop;                  /*message structure */
00309 
00310                                  /*get some space */
00311   newop = (ONEOP *) getshm (sizeof (ONEOP));
00312   if (newop != NULL) {
00313     newop->header.fd = fd;       /*send the fd */
00314     newop->type = TEXTFONT;      /*send the operator */
00315     newop->param.p.i = index;    /*set parameter */
00316   }
00317 }

void WINFD::Vdc_extent ( float  Xmin,
float  Ymin,
float  Xmax,
float  Ymax 
) [virtual]

Set window focus.

Shift/scale the window to focus on the given region.

Definition at line 861 of file _grphics.cpp.

References PARAMUNION::f, fd, HEADUNION::fd, getshm(), EIGHTOP::header, NULL, EIGHTPARAMS::p, EIGHTOP::param, EIGHTOP::type, and VDCEXTENT.

00866                         {
00867   EIGHTOP *newop;                /*message structure */
00868 
00869                                  /*get some space */
00870   newop = (EIGHTOP *) getshm (sizeof (EIGHTOP));
00871   if (newop != NULL) {
00872     newop->header.fd = fd;       /*send the fd */
00873     newop->type = VDCEXTENT;     /*send the operator */
00874     newop->param.p[0].f = Xmin;  /*set parameters */
00875     newop->param.p[1].f = Ymin;
00876     newop->param.p[2].f = 0.0f;
00877     newop->param.p[3].f = Xmax;
00878     newop->param.p[4].f = Ymax;
00879     newop->param.p[5].f = 0.0f;
00880   }
00881 }


Friends And Related Function Documentation

void add_event ( GRAPHICS_EVENT event  )  [friend]

Adds an event from the sbdaemon to the correct event queue.

Definition at line 211 of file evntlst.cpp.

00213                 {
00214   GRAPHICS_EVENT *newevent;      /*new event */
00215   EVENT_HANDLER handler;         //avoid race hazards
00216   GRAPHICS_EVENT sel_event;      //selection
00217                                  //last button down
00218   static GRAPHICS_EVENT last_down;
00219 
00220   #ifdef __UNIX__
00221   static FILE *eventsout = NULL; //output file
00222   static STRING outname;         //output name
00223 
00224                                  //doing anything
00225   if (events_logfile.string ()[0] != '\0' || eventsout != NULL) {
00226     if (eventsout != NULL        //already open
00227     && outname != (STRING &) events_logfile) {
00228       fclose(eventsout);  //finished that one
00229       eventsout = NULL;
00230     }
00231                                  //needs opening
00232     if (eventsout == NULL && events_logfile.string ()[0] != '\0') {
00233                                  //save name
00234       outname = events_logfile.string ();
00235       if ((eventsout = fopen (outname.string (), "w")) == NULL)
00236         CANTOPENFILE.error ("add_event", LOG, outname.string ());
00237     }
00238     if (eventsout != NULL)
00239       fprintf (eventsout, "%d %d(%f,%f) on %d\n",
00240         event->type, event->key, event->x, event->y, event->fildes);
00241   }
00242   #endif
00243   //      fprintf(stderr,"Received event of type %d at (%f,%f) on %d\n",
00244   //              event->type,event->x,event->y,event->fildes);
00245   event->fd = &sbfds[event->fildes];
00246   switch (event->type) {
00247     case DOWN_EVENT:
00248       last_down = *event;        //save it
00249       handler = sbfds[event->fildes].click_handler;
00250       if (handler != NULL) {
00251         (*handler) (event);
00252         return;                  //done it
00253       }
00254       break;
00255     case UP_EVENT:
00256       sel_event = *event;
00257       if (last_down.x > event->x)
00258         sel_event.xmax = last_down.x;
00259       else {
00260         sel_event.xmax = event->x;
00261         sel_event.x = last_down.x;
00262       }
00263       if (last_down.y > event->y)
00264         sel_event.ymax = last_down.y;
00265       else {
00266         sel_event.ymax = event->y;
00267         sel_event.y = last_down.y;
00268       }
00269       handler = sbfds[event->fildes].selection_handler;
00270       if (handler != NULL) {
00271         (*handler) (&sel_event);
00272         return;                  //done it
00273       }
00274       break;
00275     case KEYPRESS_EVENT:
00276       handler = sbfds[event->fildes].key_handler;
00277       if (handler != NULL) {
00278         (*handler) (event);
00279         return;                  //done it
00280       }
00281       break;
00282     case DESTROY_EVENT:
00283       handler = sbfds[event->fildes].destroy_handler;
00284       if (handler != NULL) {
00285         (*handler) (event);
00286         //                      return;                                                                         //done it
00287       }
00288       break;
00289   }
00290   lock_events(); 
00291   newevent = new GRAPHICS_EVENT;
00292   if (newevent != NULL) {
00293     *newevent = *event;          /*copy event */
00294                                  /*first event */
00295     if (sbfds[event->fildes].events == NULL)
00296       sbfds[event->fildes].events = newevent;
00297     else
00298                                  /*add to end */
00299       sbfds[event->fildes].lastevent->next = newevent;
00300                                  /*is new end */
00301     sbfds[event->fildes].lastevent = newevent;
00302     newevent->next = NULL;
00303   }
00304   event_waiting = TRUE;          //added to queue
00305   unlock_events(); 
00306 }

void def_overlap_picture_ops ( BOOL8  update  )  [friend]

flush output

Clear the output buffer without waiting for acknowledge response.

If update is TRUE, make_picture_currents are issued on all windows, but they are still not waited for.

GRAPHICS_EVENT* search_event_queue ( INT16 fd,
INT8  event_type 
) [friend]

Search for event.

Search the event queue(s) for events of a particular type. If found, it is removed from the queue and returned.

GRAPHICS_EVENT* search_single_queue ( INT16  fd,
INT8  event_type 
) [friend]

Search for event.

Search the event queue for events of a particular type. If found, it is removed from the queue and returned.


Member Data Documentation

EVENT_HANDLER WINFD::click_handler [protected]

Definition at line 261 of file grphics.h.

Referenced by add_event(), create(), Destroy_window(), Set_click_handler(), and WINFD().

EVENT_HANDLER WINFD::destroy_handler [protected]

Definition at line 266 of file grphics.h.

Referenced by add_event(), create(), Set_destroy_handler(), and WINFD().

BOOL8 WINFD::downevent [private]

Definition at line 281 of file grphics.h.

Referenced by create(), and WINFD().

GRAPHICS_EVENT* WINFD::events [private]

Definition at line 285 of file grphics.h.

Referenced by add_event(), Clear_event_queue(), create(), search_single_queue(), and WINFD().

INT16 WINFD::fd [private]

Definition at line 279 of file grphics.h.

Referenced by Append_text(), Arc(), Character_height(), Clear_event_queue(), Clear_view_surface(), create(), Destroy_window(), Draw2d(), Ellipse(), Fill_color(), Fill_color_index(), Interior_style(), Line_color_index(), Line_type(), Make_picture_current(), Marker_color_index(), Marker_size(), Marker_type(), Move2d(), Perimeter_color_index(), Polygon2d(), Polyline2d(), Polymarker2d(), Re_compute_colourmap(), Rectangle(), Set_echo(), Synchronize_windows(), Text2d(), Text_alignment(), Text_color_index(), Text_font_index(), Vdc_extent(), and WINFD().

EVENT_HANDLER WINFD::key_handler [protected]

Definition at line 264 of file grphics.h.

Referenced by add_event(), create(), Set_key_handler(), and WINFD().

BOOL8 WINFD::keyevent [private]

Definition at line 284 of file grphics.h.

Referenced by create(), and WINFD().

GRAPHICS_EVENT* WINFD::lastevent [private]

Definition at line 286 of file grphics.h.

Referenced by add_event(), create(), and WINFD().

BOOL8 WINFD::moveevent [private]

Definition at line 282 of file grphics.h.

Referenced by create(), and WINFD().

EVENT_HANDLER WINFD::selection_handler [protected]

Definition at line 263 of file grphics.h.

Referenced by add_event(), create(), Set_selection_handler(), and WINFD().

BOOL8 WINFD::upevent [private]

Definition at line 283 of file grphics.h.

Referenced by create(), and WINFD().

BOOL8 WINFD::used [private]

Definition at line 280 of file grphics.h.

Referenced by Clear_event_queue(), create(), Destroy_window(), and WINFD().


The documentation for this class was generated from the following files:
Generated on Wed Feb 28 19:49:35 2007 for Tesseract by  doxygen 1.5.1