viewer/grphics.cpp

Go to the documentation of this file.
00001 
00020 #include          "mfcpch.h"
00021 #include          <stdlib.h>
00022 #include          <string.h>
00023 #ifdef __UNIX__
00024 #include          <signal.h>
00025 #endif
00026 #include          "grphics.h"
00027 //#include                                      "sbderrs.h"
00028 //#include                                      "grpherr.h"
00029 #include          "grphshm.h"
00030 #include          "evntlst.h"
00031 
00032 #define XSIZE_INCREMENT   8
00033 #define YSIZE_INCREMENT   30
00034 
00035 void def_overlap_picture_ops(BOOL8 update);
00036 
00037 WINCREATEFUNC create_func = WINFD::create;
00038 void (*overlap_func) (BOOL8) = def_overlap_picture_ops;
00039 
00068 WINDOW WINFD::create(
00069                      const char *name,
00070                      INT8 window_type,
00071                      INT16 xpos,
00072                      INT16 ypos,
00073                      INT16 xsize,
00074                      INT16 ysize,
00075                      float xmin,
00076                      float xmax,
00077                      float ymin,
00078                      float ymax,
00079                      BOOL8 downon,
00080                      BOOL8 moveon,
00081                      BOOL8 upon,
00082                      BOOL8 keyon) {
00083   INT16 fd;                      //integer index
00084   CREATEOP *newop;               /*create structure */
00085   WINDOW win;                    //output
00086 
00087 #ifdef NO_X_WINDOWS
00088    return NO_WINDOW;
00089 #endif
00090 
00091   if (xmin == xmax || ymin == ymax)
00092     return NO_WINDOW;
00093   if (maxsbfd == 0) {
00094     maxsbfd = 1;                 /*don't use 0 */
00095     start_sbdaemon();  /*startup daemon */
00096   }
00097 
00098                                  /*find a free one */
00099   for (fd = 1; fd < maxsbfd && sbfds[fd].used; fd++);
00100   if (fd == maxsbfd) {           /*need a new one */
00101     if (maxsbfd == MAXWINDOWS)
00102       return NO_WINDOW;
00103     maxsbfd++;
00104   }
00105   win = &sbfds[fd];              //this
00106   win->fd = fd;
00107   win->used = TRUE;              /*it is in use */
00108   win->downevent = downon;
00109   win->moveevent = moveon;
00110   win->upevent = upon;
00111   win->keyevent = keyon;
00112   win->click_handler = NULL;
00113   win->selection_handler = NULL;
00114   win->key_handler = NULL;
00115   win->destroy_handler = NULL;
00116   win->events = NULL;
00117   win->lastevent = NULL;
00118 
00119   newop = (CREATEOP *) getshm (sizeof (CREATEOP));
00120   if (newop != NULL) {
00121     newop->header.fd = fd;       /*file descriptor */
00122     newop->type = CREATE;        /*set operator type */
00123     newop->window_type = window_type;
00124                                  /*copy window name */
00125     strncpy (newop->name, name, MAXWINDOWNAME - 1);
00126     newop->name[MAXWINDOWNAME - 1] = '\0';
00127     newop->xpos = xpos;
00128     newop->ypos = ypos;
00129     newop->xsize = xsize;
00130     newop->ysize = ysize;
00131     newop->xmin = xmin;
00132     newop->xmax = xmax;
00133     newop->ymin = ymin;
00134     newop->ymax = ymax;
00135     newop->downon = downon;
00136     newop->moveon = moveon;
00137     newop->upon = upon;
00138     newop->keyon = keyon;
00139   }
00140   return win;                    /*file descriptor */
00141 }
00142 
00150 void WINFD::Line_color_index(
00151       COLOUR index  /*index to use */
00152       ) {
00153   ONEOP *newop;                  /*message structure */
00154 
00155                                  /*get some space */
00156   newop = (ONEOP *) getshm (sizeof (ONEOP));
00157   if (newop != NULL) {
00158     newop->header.fd = fd;       /*send the fd */
00159     newop->type = LINECOLOUR;    /*send the operator */
00160     newop->param.p.i = index;    /*set parameter */
00161   }
00162 }
00163 
00164 
00170 void WINFD::Perimeter_color_index(
00171                                   COLOUR index  /*index to use */
00172                                  ) {
00173   ONEOP *newop;                  /*message structure */
00174 
00175                                  /*get some space */
00176   newop = (ONEOP *) getshm (sizeof (ONEOP));
00177   if (newop != NULL) {
00178     newop->header.fd = fd;       /*send the fd */
00179                                  /*send the operator */
00180     newop->type = PERIMETERCOLOUR;
00181     newop->param.p.i = index;    /*set parameter */
00182   }
00183 }
00184 
00185 
00191 void WINFD::Fill_color_index(
00192                              COLOUR index  /*index to use */
00193                             ) {
00194   ONEOP *newop;                  /*message structure */
00195 
00196                                  /*get some space */
00197   newop = (ONEOP *) getshm (sizeof (ONEOP));
00198   if (newop != NULL) {
00199     newop->header.fd = fd;       /*send the fd */
00200     newop->type = FILLCOLOUR;    /*send the operator */
00201     newop->param.p.i = index;    /*set parameter */
00202   }
00203 }
00204 
00205 
00211 void WINFD::Fill_color(
00212                        UINT8 red,
00213                        UINT8 green,
00214                        UINT8 blue) {
00215   ONEOP *newop;                  /*message structure */
00216   UINT32 packed_colour;
00217 
00218   packed_colour = (blue << 24) + (green << 16) + (red << 8);
00219                                  /*get some space */
00220   newop = (ONEOP *) getshm (sizeof (ONEOP));
00221   if (newop != NULL) {
00222     newop->header.fd = fd;       /*send the fd */
00223     newop->type = FILLCOLOUR;    /*send the operator */
00224                                  /*set parameter */
00225     newop->param.p.i = (INT32) packed_colour;
00226   }
00227 }
00228 
00229 
00235 void WINFD::Marker_color_index(
00236                                COLOUR index  /*index to use */
00237                               ) {
00238   ONEOP *newop;                  /*message structure */
00239 
00240                                  /*get some space */
00241   newop = (ONEOP *) getshm (sizeof (ONEOP));
00242   if (newop != NULL) {
00243     newop->header.fd = fd;       /*send the fd */
00244     newop->type = MARKERCOLOUR;  /*send the operator */
00245     newop->param.p.i = index;    /*set parameter */
00246   }
00247 }
00248 
00249 
00255 void WINFD::Text_color_index(
00256                              COLOUR index  /*index to use */
00257                             ) {
00258   ONEOP *newop;                  /*message structure */
00259 
00260                                  /*get some space */
00261   newop = (ONEOP *) getshm (sizeof (ONEOP));
00262   if (newop != NULL) {
00263     newop->header.fd = fd;       /*send the fd */
00264     newop->type = TEXTCOLOUR;    /*send the operator */
00265     newop->param.p.i = index;    /*set parameter */
00266   }
00267 }
00268 
00269 
00275 void WINFD::Text_font_index(
00276                             INT16 index  /*index to use */
00277                            ) {
00278   ONEOP *newop;                  /*message structure */
00279 
00280                                  /*get some space */
00281   newop = (ONEOP *) getshm (sizeof (ONEOP));
00282   if (newop != NULL) {
00283     newop->header.fd = fd;       /*send the fd */
00284     newop->type = TEXTFONT;      /*send the operator */
00285     newop->param.p.i = index;    /*set parameter */
00286   }
00287 }
00288 
00289 
00295 void WINFD::Character_height(
00296                              float height  /*height to use */
00297                             ) {
00298   ONEOP *newop;                  /*message structure */
00299 
00300                                  /*get some space */
00301   newop = (ONEOP *) getshm (sizeof (ONEOP));
00302   if (newop != NULL) {
00303     newop->header.fd = fd;       /*send the fd */
00304     newop->type = CHARHEIGHT;    /*send the operator */
00305     newop->param.p.f = height;   /*set parameter */
00306   }
00307 }
00308 
00309 
00315 void WINFD::Line_type(
00316                       INT16 style  /*style to use */
00317                      ) {
00318   ONEOP *newop;                  /*message structure */
00319 
00320                                  /*get some space */
00321   newop = (ONEOP *) getshm (sizeof (ONEOP));
00322   if (newop != NULL) {
00323     newop->header.fd = fd;       /*send the fd */
00324     newop->type = LINETYPE;      /*send the operator */
00325     newop->param.p.i = style;    /*set parameter */
00326   }
00327 }
00328 
00329 
00335 void WINFD::Marker_type(
00336                         INT16 type  /*type to use */
00337                        ) {
00338   ONEOP *newop;                  /*message structure */
00339 
00340                                  /*get some space */
00341   newop = (ONEOP *) getshm (sizeof (ONEOP));
00342   if (newop != NULL) {
00343     newop->header.fd = fd;       /*send the fd */
00344     newop->type = MARKERTYPE;    /*send the operator */
00345     newop->param.p.i = type;     /*set parameter */
00346   }
00347 }
00348 
00349 
00355 void WINFD::Interior_style(
00356                            INT16 style,  /*style to use */
00357                            INT16 edged   /*draw edge or not */
00358                           ) {
00359   TWOOP *newop;                  /*message structure */
00360 
00361                                  /*get some space */
00362   newop = (TWOOP *) getshm (sizeof (TWOOP));
00363   if (newop != NULL) {
00364     newop->header.fd = fd;       /*send the fd */
00365     newop->type = INTERIORSTYLE; /*send the operator */
00366     newop->param.p[0].i = style; /*set parameter */
00367     newop->param.p[1].i = edged;
00368   }
00369 }
00370 
00371 
00377 void WINFD::Marker_size(
00378                         float size  /*size to use */
00379                        ) {
00380   TWOOP *newop;                  /*message structure */
00381 
00382                                  /*get some space */
00383   newop = (TWOOP *) getshm (sizeof (TWOOP));
00384   if (newop != NULL) {
00385     newop->header.fd = fd;       /*send the fd */
00386     newop->type = MARKERSIZE;    /*send the operator */
00387     newop->param.p[0].f = size;  /*set parameter */
00388     newop->param.p[1].i = FALSE;
00389   }
00390 }
00391 
00392 
00398 void WINFD::Move2d(
00399                    float x,  /*coords to move to */
00400                    float y   /*coords to move to */
00401                   ) {
00402   TWOOP *newop;                  /*message structure */
00403 
00404                                  /*get some space */
00405   newop = (TWOOP *) getshm (sizeof (TWOOP));
00406   if (newop != NULL) {
00407     newop->header.fd = fd;       /*send the fd */
00408     newop->type = MOVE2D;        /*send the operator */
00409     newop->param.p[0].f = x;     /*set parameters */
00410     newop->param.p[1].f = y;
00411   }
00412 }
00413 
00414 
00420 void WINFD::Draw2d(
00421                    float x,  /*coords to draw to */
00422                    float y   /*coords to draw to */
00423                   ) {
00424   TWOOP *newop;                  /*message structure */
00425 
00426                                  /*get some space */
00427   newop = (TWOOP *) getshm (sizeof (TWOOP));
00428   if (newop != NULL) {
00429     newop->header.fd = fd;       /*send the fd */
00430     newop->type = DRAW2D;        /*send the operator */
00431     newop->param.p[0].f = x;     /*set parameters */
00432     newop->param.p[1].f = y;
00433   }
00434 }
00435 
00436 
00442 void WINFD::Rectangle(
00443                       float x1,  /*coords to draw to */
00444                       float y1,  /*coords to draw to */
00445                       float x2,  /*coords to draw to */
00446                       float y2   /*coords to draw to */
00447                      ) {
00448   FOUROP *newop;                 /*message structure */
00449 
00450                                  /*get some space */
00451   newop = (FOUROP *) getshm (sizeof (FOUROP));
00452   if (newop != NULL) {
00453     newop->header.fd = fd;       /*send the fd */
00454     newop->type = RECTANGLE;     /*send the operator */
00455     newop->param.p[0].f = x1;    /*set parameters */
00456     newop->param.p[1].f = y1;
00457     newop->param.p[2].f = x2;
00458     newop->param.p[3].f = y2;
00459   }
00460 }
00461 
00462 
00468 void WINFD::Text_alignment(
00469                            INT32 h_select,  //horizontal
00470                            INT32 v_select,  //vertical
00471                            float horiz,     /*coords to draw to */
00472                            float vert       /*coords to draw to */
00473                           ) {
00474 #ifndef WXSBSERVANT
00475   FOUROP *newop;                 /*message structure */
00476 
00477                                  /*get some space */
00478   newop = (FOUROP *) getshm (sizeof (FOUROP));
00479   if (newop != NULL) {
00480     newop->header.fd = fd;       /*send the fd */
00481     newop->type = TEXT_ALIGNMENT;/*send the operator */
00482     newop->param.p[0].i = h_select;
00483     newop->param.p[1].i = v_select;
00484     newop->param.p[2].f = horiz;
00485     newop->param.p[3].f = vert;
00486   }
00487 #else // WXSBSERVANT
00488 #endif //WXSBSERVANT
00489 }
00490 
00491 
00497 void
00498 WINFD::Polyline2d (
00499 float clist[],                   /*coordinate list */
00500 INT16 numpts,                    /*number of coords */
00501 INT16 flags                      /*does it have move/draws */
00502 ) {
00503   POLYOP *newop;                 /*message structure */
00504   INT32 floatcount;              /*no of floats */
00505 
00506   floatcount = flags ? numpts * 3/*move/draw flags in */
00507     : numpts * 2;                /*no move/draw flags */
00508                                  /*get some space */
00509   newop = (POLYOP *) getshm (sizeof (POLYOP) + sizeof (float) * (floatcount - 1));
00510   if (newop != NULL) {
00511     newop->header.fd = fd;       /*send the fd */
00512     newop->type = POLYLINE2D;    /*send the operator */
00513                                  /*pointer to array */
00514     newop->param.clist = newop->clist;
00515     newop->param.numpts = numpts;/*other params */
00516     newop->param.flags = flags;
00517     memcpy (newop->clist, clist, (UINT32) floatcount * sizeof (float));
00518   }
00519 }
00520 
00521 
00527 void
00528 WINFD::Polygon2d (
00529 float clist[],                   /*coordinate list */
00530 INT16 numpts,                    /*number of coords */
00531 INT16 flags                      /*does it have move/draws */
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 = POLYGON2D;     /*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 }
00550 
00551 
00557 void
00558 WINFD::Polymarker2d (
00559 float clist[],                   /*coordinate list */
00560 INT16 numpts,                    /*number of coords */
00561 INT16 flags                      /*does it have move/draws */
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 = POLYMARKER2D;  /*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 }
00580 
00581 
00587 void WINFD::Text2d(
00588                    float x,             /*coords of text */
00589                    float y,
00590                    const char *string,  /*text to draw */
00591                    INT16 xform,         /*transform */
00592                    INT16 more           /*more text? */
00593                   ) {
00594   TEXTOP *newop;                 /*message structure */
00595   INT16 length;                  /*length of string */
00596 
00597   length = strlen (string) + 1;  /*include null */
00598   length += 3;
00599   length &= ~3;                  /*round up to words */
00600                                  /*get some space */
00601   newop = (TEXTOP *) getshm (sizeof (TEXTOP) + length - 4);
00602   if (newop != NULL) {
00603     newop->header.fd = fd;       /*send the fd */
00604     newop->type = TEXT2D;        /*send the operator */
00605     newop->param.x = x;          /*copy parameters */
00606     newop->param.y = y;
00607     newop->param.string = newop->chars;
00608     newop->param.xform = xform;
00609     newop->param.more = more;
00610                                  /*copy the string */
00611     strcpy (newop->chars, string);
00612   }
00613 }
00614 
00615 
00621 void WINFD::Append_text(
00622                         const char *string,  /*text to draw */
00623                         INT16 xform,         /*transform */
00624                         INT16 more           /*more text? */
00625                        ) {
00626   APPENDOP *newop;               /*message structure */
00627   INT16 length;                  /*length of string */
00628 
00629   length = strlen (string) + 1;  /*include null */
00630   length += 3;
00631   length &= ~3;                  /*round up to words */
00632                                  /*get some space */
00633   newop = (APPENDOP *) getshm (sizeof (APPENDOP) + length - 4);
00634   if (newop != NULL) {
00635     newop->header.fd = fd;       /*send the fd */
00636     newop->type = APPENDTEXT;    /*send the operator */
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 }
00644 
00645 
00651 void WINFD::Ellipse(
00652                     float x_radius,  /*radii of ellipse */
00653                     float y_radius,  /*radii of ellipse */
00654                     float x_center,  /*centre of ellipse */
00655                     float y_center,  /*centre of ellipse */
00656                     float rotation   /*rotation of ellipse */
00657                    ) {
00658   EIGHTOP *newop;                /*message structure */
00659 
00660                                  /*get some space */
00661   newop = (EIGHTOP *) getshm (sizeof (EIGHTOP));
00662   if (newop != NULL) {
00663     newop->header.fd = fd;       /*send the fd */
00664     newop->type = ELLIPSE;       /*send the operator */
00665                                  /*set parameters */
00666     newop->param.p[0].f = x_radius;
00667     newop->param.p[1].f = y_radius;
00668     newop->param.p[2].f = x_center;
00669     newop->param.p[3].f = y_center;
00670     newop->param.p[4].f = rotation;
00671   }
00672 }
00673 
00674 
00680 void WINFD::Arc(
00681                 float x_radius,   /*radii of arc */
00682                 float y_radius,   /*radii of arc */
00683                 float x_center,   /*centre of arc */
00684                 float y_center,   /*centre of arc */
00685                 float start,      /*ends of arc */
00686                 float stop,       /*ends of arc */
00687                 float rotation,   /*rotation of arc */
00688                 INT16 close_type  /*type of closure */
00689                ) {
00690   EIGHTOP *newop;                /*message structure */
00691 
00692                                  /*get some space */
00693   newop = (EIGHTOP *) getshm (sizeof (EIGHTOP));
00694   if (newop != NULL) {
00695     newop->header.fd = fd;       /*send the fd */
00696     newop->type = ARC;           /*send the operator */
00697                                  /*set parameters */
00698     newop->param.p[0].f = x_radius;
00699     newop->param.p[1].f = y_radius;
00700     newop->param.p[2].f = x_center;
00701     newop->param.p[3].f = y_center;
00702     newop->param.p[4].f = start;
00703     newop->param.p[5].f = stop;
00704     newop->param.p[6].f = rotation;
00705     newop->param.p[7].i = close_type;
00706   }
00707 }
00708 
00709 
00713 WINFD::WINFD() {  //constructor
00714   fd = -1;
00715   used = FALSE;
00716   downevent = FALSE;
00717   moveevent = FALSE;
00718   upevent = FALSE;
00719   keyevent = FALSE;
00720   click_handler = NULL;
00721   selection_handler = NULL;
00722   key_handler = NULL;
00723   destroy_handler = NULL;
00724   events = NULL;
00725   lastevent = NULL;
00726 }
00727 
00728 
00729 WINFD::~WINFD () {
00730 }
00731 
00732 
00738 void WINFD::Destroy_window() {
00739   ONEOP *newop;                  /*destroy structure */
00740 
00741   if (fd < 1 || fd > maxsbfd || sbfds[fd].used == FALSE) {
00742     return;
00743   }
00744   else {
00745     Clear_event_queue(); 
00746     sbfds[fd].used = FALSE;      /*it is not in use */
00747     sbfds[fd].click_handler = NULL;
00748 
00749     newop = (ONEOP *) getshm (sizeof (ONEOP));
00750     if (newop != NULL) {
00751       newop->header.fd = fd;     /*file descriptor */
00752       newop->type = DESTROY;     /*set operator type */
00753     }
00754   }
00755 }
00756 
00757 
00763 void WINFD::Clear_event_queue() {
00764   INT16 fd;                      //current window
00765   GRAPHICS_EVENT *event;         /*current event */
00766   GRAPHICS_EVENT *nextevent;     /*next in list */
00767 
00768   if (this == NULL) {
00769     for (fd = 1; fd < maxsbfd; fd++) {
00770       if (sbfds[fd].used) {
00771         sbfds[fd].Clear_event_queue ();
00772       }
00773     }
00774   }
00775   else {
00776     for (event = events; event != NULL; event = nextevent) {
00777       nextevent = event->next;
00778       delete event;              //free them all
00779     }
00780     events = NULL;               /*there are none now */
00781   }
00782 }
00783 
00784 
00790 void WINFD::Clear_view_surface() {
00791   ONEOP *newop;                  /*message structure */
00792 
00793                                  /*get some space */
00794   newop = (ONEOP *) getshm (sizeof (ONEOP));
00795   if (newop != NULL) {
00796     newop->header.fd = fd;       /*send the fd */
00797     newop->type = CLEAR;         /*send the operator */
00798   }
00799 }
00800 
00801 
00807 void WINFD::Re_compute_colourmap() {
00808   ONEOP *newop;                  /*message structure */
00809 
00810                                  /*get some space */
00811   newop = (ONEOP *) getshm (sizeof (ONEOP));
00812   if (newop != NULL) {
00813     newop->header.fd = fd;       /*send the fd */
00814     newop->type = RE_COMP_COLMAP;/*send the operator */
00815   }
00816   /*
00817     ONE DAY THE PC VERSION WILL SUPPORT COLOUR - BUT NOT TODAY
00818 
00819     Among the things that will need doing is to change the size of..
00820       PCSTUBSPEC           stubspecs[SYNCWIN+1];
00821     in pcsbdg.[ch] to RE_COMP_COLMAP+1
00822   */
00823 }
00824 
00825 
00831 void WINFD::Vdc_extent(
00832                        float Xmin,  /*min values */
00833                        float Ymin,  /*min values */
00834                        float Xmax,  /*max values */
00835                        float Ymax   /*max values */
00836                       ) {
00837   EIGHTOP *newop;                /*message structure */
00838 
00839                                  /*get some space */
00840   newop = (EIGHTOP *) getshm (sizeof (EIGHTOP));
00841   if (newop != NULL) {
00842     newop->header.fd = fd;       /*send the fd */
00843     newop->type = VDCEXTENT;     /*send the operator */
00844     newop->param.p[0].f = Xmin;  /*set parameters */
00845     newop->param.p[1].f = Ymin;
00846     newop->param.p[2].f = 0.0f;
00847     newop->param.p[3].f = Xmax;
00848     newop->param.p[4].f = Ymax;
00849     newop->param.p[5].f = 0.0f;
00850   }
00851 }
00852 
00853 
00859 void WINFD::Set_echo(
00860                      ECHO_TYPE echo_type,  //type of echo
00861                      float xorig,          /*min values */
00862                      float yorig           /*min values */
00863                     ) {
00864   FOUROP *newop;                 /*message structure */
00865 
00866                                  /*get some space */
00867   newop = (FOUROP *) getshm (sizeof (FOUROP));
00868   if (newop != NULL) {
00869     newop->header.fd = fd;       /*send the fd */
00870     newop->type = SETECHO;       /*send the operator */
00871     newop->param.p[0].i = echo_type;
00872     newop->param.p[1].f = xorig;
00873     newop->param.p[2].f = yorig;
00874   }
00875 }
00876 
00877 
00886 DLLSYM void def_overlap_picture_ops(
00887                                     BOOL8 update  /*send make_ */
00888                                    ) {
00889   ONEOP *newop;                  /*message structure */
00890   INT16 fd;                      /*file descriptor */
00891 
00892   if (update) {
00893     for (fd = 1; fd < maxsbfd; fd++) {
00894       if (sbfds[fd].used) {
00895                                  /*get some space */
00896         newop = (ONEOP *) getshm (sizeof (ONEOP));
00897         if (newop != NULL) {
00898           newop->header.fd = fd; /*send the fd */
00899                                  /*send the operator */
00900           newop->type = MAKECURRENT;
00901         }
00902       }
00903     }
00904   }
00905   kick_daemon(FLUSH_OUT);  /*empty shm */
00906 }
00907 
00908 
00916 void WINFD::Make_picture_current() {
00917   ONEOP *newop;                  /*message structure */
00918 
00919   if (this == NULL || fd <= 0) {
00920     overlap_picture_ops(TRUE); 
00921   }
00922   else {
00923                                  /*get some space */
00924     newop = (ONEOP *) getshm (sizeof (ONEOP));
00925     if (newop != NULL) {
00926       newop->header.fd = fd;     /*send the fd */
00927       newop->type = MAKECURRENT; /*send the operator */
00928       kick_daemon(FLUSH_IN);  /*empty shm */
00929     }
00930   }
00931 }
00932 
00933 
00939 void WINFD::Synchronize_windows(
00940                                 WINDOW fd2  //other window
00941                                ) {
00942   ONEOP *newop;                  /*message structure */
00943 
00944                                  /*get some space */
00945   newop = (ONEOP *) getshm (sizeof (ONEOP));
00946   if (newop != NULL) {
00947     newop->header.fd = fd;       /*send the fd */
00948     newop->type = SYNCWIN;       /*send the operator */
00949     newop->param.p.i = fd2->fd;  /*set parameter */
00950   }
00951 }
00952 
00953 
00961 void WINFD::Set_click_handler(
00962                               EVENT_HANDLER handler
00963                              ) {
00964   click_handler = handler;       //remember it
00965 }
00966 
00967 
00975 void WINFD::Set_selection_handler(
00976                                   EVENT_HANDLER handler
00977                                  ) {
00978   selection_handler = handler;   //remember it
00979 }
00980 
00981 
00989 void WINFD::Set_key_handler(
00990                             EVENT_HANDLER handler
00991                            ) {
00992   key_handler = handler;         //remember it
00993 }
00994 
00995 
01003 void WINFD::Set_destroy_handler(
01004                                 EVENT_HANDLER handler
01005                                ) {
01006   destroy_handler = handler;     //remember it
01007 }
01008 
01009 #ifdef WXSBSERVANT
01010 
01011 #endif //WXSBSERVANT

Generated on Wed Feb 28 19:49:12 2007 for Tesseract by  doxygen 1.5.1