TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

gdisp_defaultPlot.c

Go to the documentation of this file.
00001 
00043 /*
00044  * Forbid Drag and Drop operations.
00045  */
00046 #undef GD_DEFAULT_PLOT_HAS_DND
00047 
00048 
00049 /*
00050  * System includes.
00051  */
00052 #include <stdio.h>
00053 #include <stdlib.h>
00054 #include <assert.h>
00055 #include <string.h>
00056 #include <errno.h>
00057 
00058 
00059 /*
00060  * GDISP+ includes.
00061  */
00062 #include "gdisp_kernel.h"
00063 #include "gdisp_prototypes.h"
00064 
00065 #include "gdisp_defaultPlot.h"
00066 #if defined(GD_DEFAULT_PLOT_HAS_DND)
00067 #  include "gdisp_dragAndDrop.h"
00068 #endif
00069 
00070 
00071 /*
00072  --------------------------------------------------------------------
00073                              STATIC ROUTINES
00074  --------------------------------------------------------------------
00075 */
00076 
00077 
00078 #if defined(GD_DEFAULT_PLOT_HAS_DND)
00079 
00080 
00081 /*
00082  * DND "drag_begin" handler : this is called whenever a drag starts.
00083  */
00084 static void
00085 gdisp_beginDNDCallback (GtkWidget      *graphicArea,
00086                         GdkDragContext *dragContext,
00087                         gpointer        data)
00088 {
00089 
00090   Kernel_T *kernel = (Kernel_T*)data;
00091 
00092   /*
00093    * Put any needed drag begin setup code here.
00094    */
00095   assert(kernel);
00096   assert(dragContext);
00097 
00098 #if defined(_DND_DEBUG_)
00099   fprintf(stdout,"begin DND Callback for default plot graphic area.\n");
00100   fflush (stdout);
00101 #endif
00102 
00103 }
00104 
00105 
00106 /*
00107  * DND "drag_end" handler : this is called when a drag and drop has
00108  * completed. So this function is the last one to be called in
00109  * any given DND operation.
00110  */
00111 static void
00112 gdisp_endDNDCallback (GtkWidget      *graphicArea,
00113                       GdkDragContext *dragContext,
00114                       gpointer        data)
00115 {
00116 
00117   Kernel_T *kernel = (Kernel_T*)data;
00118 
00119   /*
00120    * Put any needed drag end cleanup code here.
00121    */
00122   assert(kernel);
00123   assert(dragContext);
00124 
00125 #if defined(_DND_DEBUG_)
00126   fprintf(stdout,"end DND Callback for default plot graphic area.\n");
00127   fflush (stdout);
00128 #endif
00129 
00130 }
00131 
00132 
00133 /*
00134  * DND "drag_motion" handler is called whenever the pointer is
00135  * dragging over the target widget.
00136  */
00137 static gboolean
00138 gdisp_dragMotionDNDCallback (GtkWidget      *graphicArea,
00139                              GdkDragContext *dragContext,
00140                              gint            x,
00141                              gint            y,
00142                              guint           time,
00143                              gpointer        data)
00144 {
00145 
00146   Kernel_T *kernel = (Kernel_T*)data;
00147 
00148   /*
00149    * Put any needed drag motion code here.
00150    */
00151   assert(kernel);
00152   assert(dragContext);
00153 
00154 #if defined(_DND_DEBUG_)
00155   fprintf(stdout,"data Motion DND Callback for default plot graphic area.\n");
00156   fflush (stdout);
00157 #endif
00158 
00159   /*
00160    * Set drag status to COPY action.
00161    */
00162   gdk_drag_status(dragContext,
00163                   GDK_ACTION_COPY,
00164                   time);
00165 
00166   return FALSE;
00167 
00168 }
00169 
00170 
00171 /*
00172  * DND "drag_data_get" handler, for handling requests for DND
00173  * data on the specified widget. This function is called when
00174  * there is need for DND data on the source, so this function is
00175  * responsable for setting up the dynamic data exchange buffer
00176  * (DDE as sometimes it is called) and sending it out.
00177  */
00178 static void
00179 gdisp_dataRequestDNDCallback (GtkWidget        *graphicArea,
00180                               GdkDragContext   *dragContext,
00181                               GtkSelectionData *selectionData,
00182                               guint             entryInfo,
00183                               guint             time,
00184                               gpointer          data)
00185 {
00186 
00187   Kernel_T *kernel = (Kernel_T*)data;
00188 
00189   /*
00190    * Put any needed data request code here.
00191    */
00192   assert(kernel);
00193   assert(dragContext);
00194 
00195 #if defined(_DND_DEBUG_)
00196   fprintf(stdout,"data Request DND Callback for default plot graphic area.\n");
00197   fflush (stdout);
00198 #endif
00199 
00200   /*
00201    * Nothing to be done here because no drag operation from the
00202    * graphic area.
00203    */
00204 
00205 }
00206 
00207 
00208 /*
00209  * DND "drag_data_received" handler. When 'gdisp_dataRequestDNDCallback'
00210  * calls 'gtk_selection_data_set()' to send out the data, this function
00211  * receives it and is responsible for handling it.
00212  *
00213  * This is also the only DND callback function where the given
00214  * inputs may reflect those of the drop target, so we need to check
00215  * if this is the same structure or not.
00216  */
00217 static void
00218 gdisp_dataReceivedDNDCallback (GtkWidget        *graphicArea,
00219                                GdkDragContext   *dragContext,
00220                                gint              x,
00221                                gint              y,
00222                                GtkSelectionData *selectionData,
00223                                guint             entryInfo,
00224                                guint             time,
00225                                gpointer          data)
00226 {
00227 
00228   Kernel_T      *kernel     =      (Kernel_T*)data;
00229   gchar         *action     =         (gchar*)NULL;
00230   DefaultPlot_T *plot       = (DefaultPlot_T*)NULL;
00231 
00232 
00233   /*
00234    * Put any needed data received code here.
00235    */
00236   assert(kernel);
00237   assert(dragContext);
00238 
00239 #if defined(_DND_DEBUG_)
00240   fprintf(stdout,"data Receive DND Callback for default plot graphic area.\n");
00241   fflush (stdout);
00242 #endif
00243 
00244   /*
00245    * Important, check if we actually got data.
00246    * Sometimes errors occur and 'selectionData' is NULL.
00247    */
00248   if (selectionData == (GtkSelectionData*)NULL) {
00249 
00250     return;
00251 
00252   }
00253   if (selectionData->length < 0) {
00254 
00255     return;
00256 
00257   }
00258 
00259   /*
00260    * Now check if the data format type is one that we support
00261    * (remember, data format type, not data type).
00262    *
00263    * We check this by testing if info matches one of the info
00264    * values that we have defined.
00265    *
00266    * Note that we can also iterate through the atoms in :
00267    *
00268    *  GList *glist = dragContext->targets;
00269    *
00270    *  while (glist != (GList*)NULL) {
00271    *
00272    *    gchar *name = gdk_atom_name((GdkAtom)glist->data);
00273    *
00274    *    ... strcmp the name to see if it matches one that we support...
00275    *
00276    *    glist = glist->next;
00277    *
00278    *  }
00279    *
00280    */
00281   if (entryInfo == GD_DND_TARGET_INFO) {
00282 
00283     /*
00284      * Pick up what action to perform.
00285      */
00286     action = (gchar*)selectionData->data;
00287     if (strcmp(action,GD_DND_SYMBOL_LIST_EXCHANGE) ==0) {
00288 
00289       fprintf(stdout,"--PLOT-- %s --PLOT-- \n",action);
00290       fflush (stdout);
00291 
00292       plot = (DefaultPlot_T*)gtk_object_get_data(GTK_OBJECT(graphicArea),
00293                                                  "plotPointer");
00294 
00295     }
00296     else {
00297 
00298       /* nothing else is supported by now */
00299 
00300     }
00301 
00302   } /* test on 'entryInfo' */
00303 
00304 }
00305 
00306 
00307 /*
00308  * DND "drag_data_delete" handler, this function is called when
00309  * the data on the source `should' be deleted (ie if the DND was
00310  * a move).
00311  */
00312 static void
00313 gdisp_dataDestroyedDNDCallback (GtkWidget      *graphicArea,
00314                                 GdkDragContext *dragContext,
00315                                 gpointer        data)
00316 {
00317 
00318   Kernel_T *kernel = (Kernel_T*)data;
00319 
00320   /*
00321    * Put any needed data destroyed code here.
00322    */
00323   assert(kernel);
00324   assert(dragContext);
00325 
00326 #if defined(_DND_DEBUG_)
00327   fprintf(stdout,"data Destroy DND Callback for default plot graphic area.\n");
00328   fflush (stdout);
00329 #endif
00330 
00331   /*
00332    * This procedure does nothing because there is nothing to be done here.
00333    * No drag operation from the graphic area.
00334    */
00335 
00336 }
00337 
00338 
00339 #endif /* GD_DEFAULT_PLOT_HAS_DND */
00340 
00341 
00342 /*
00343  * Redraw graphic area content.
00344  */
00345 static void
00346 gdisp_defaultPlotDrawGraphicArea (Kernel_T      *kernel,
00347                                   DefaultPlot_T *plot)
00348 {
00349 
00350   gchar   *scratchMessage = "*scratch*";
00351   gint     scratchWidth   = 0;
00352   GdkFont *scratchFont    = kernel->fonts[GD_FONT_MEDIUM][GD_FONT_FIXED];
00353 
00354 
00355   /*
00356    * By now, just paint a rectangle.
00357    * Write "*scratch*" in the middle of the graphic area.
00358    */
00359   if (plot->dpHasFocus == TRUE) {
00360 
00361     gdk_gc_set_foreground(plot->dpGContext,
00362                           &kernel->colors[155]);
00363 
00364   }
00365   else {
00366 
00367     gdk_gc_set_foreground(plot->dpGContext,
00368                           &kernel->colors[150]);
00369 
00370   }
00371 
00372   gdk_draw_rectangle(plot->dpArea->window,
00373                      plot->dpGContext,
00374                      TRUE, /* rectangle is filled */
00375                      0,
00376                      0,
00377                      plot->dpArea->allocation.width,
00378                      plot->dpArea->allocation.height);
00379 
00380   gdk_gc_set_foreground(plot->dpGContext,
00381                         &kernel->colors[42]);
00382 
00383   gdk_draw_rectangle(plot->dpArea->window,
00384                      plot->dpGContext,
00385                      FALSE, /* rectangle is not filled */
00386                      0,
00387                      0,
00388                      plot->dpArea->allocation.width  - 1,
00389                      plot->dpArea->allocation.height - 1);
00390 
00391   scratchWidth = gdk_string_width(scratchFont,
00392                                   scratchMessage);
00393 
00394   gdk_draw_string(plot->dpArea->window,
00395                   scratchFont,
00396                   plot->dpGContext,
00397                   (plot->dpArea->allocation.width - scratchWidth) / 2,
00398                   plot->dpArea->allocation.height / 2,
00399                   scratchMessage);
00400 }
00401 
00402 
00403 /*
00404  * Treat 'expose' X event.
00405  * What shall I do when the graphic area has to be refreshed ?
00406  */
00407 static gboolean
00408 gdisp_defaultPlotExpose (GtkWidget       *area,
00409                          GdkEventExpose  *event,
00410                          gpointer         data)
00411 {
00412 
00413   Kernel_T      *kernel =      (Kernel_T*)data;
00414   DefaultPlot_T *plot   = (DefaultPlot_T*)NULL;
00415 
00416   /*
00417    * Graphic area has now to be repainted.
00418    */
00419   plot = (DefaultPlot_T*)gtk_object_get_data(GTK_OBJECT(area),
00420                                              "plotPointer");
00421 
00422 #if defined(NEED_CLEARING_THE_AREA)
00423   gdk_window_clear_area(area->window,
00424                         event->area.x,
00425                         event->area.y,
00426                         event->area.width,
00427                         event->area.height);
00428 #endif
00429 
00430   gdk_gc_set_clip_rectangle(plot->dpGContext,
00431                             &event->area);
00432 
00433   gdisp_defaultPlotDrawGraphicArea(kernel,plot);
00434 
00435   gdk_gc_set_clip_rectangle(plot->dpGContext,
00436                             (GdkRectangle*)NULL);
00437 
00438   return TRUE;
00439 
00440 }
00441 
00442 
00443 /*
00444  * Treat 'enter-notify' X event.
00445  * What shall I do when the mouse enters the graphic area ?
00446  */
00447 static gboolean
00448 gdisp_defaultPlotEnterNotify (GtkWidget        *area,
00449                               GdkEventCrossing *event,
00450                               gpointer          data)
00451 {
00452 
00453   Kernel_T      *kernel =      (Kernel_T*)data;
00454   DefaultPlot_T *plot   = (DefaultPlot_T*)NULL;
00455 
00456   /*
00457    * Graphic area has now the focus.
00458    */
00459   plot = (DefaultPlot_T*)gtk_object_get_data(GTK_OBJECT(area),
00460                                              "plotPointer");
00461 
00462   plot->dpHasFocus = TRUE;
00463   gdisp_defaultPlotDrawGraphicArea(kernel,plot);
00464 
00465   return TRUE;
00466 
00467 }
00468 
00469 
00470 /*
00471  * Treat 'leave-notify' X event.
00472  * What shall I do when the mouse leaves the graphic area ?
00473  */
00474 static gboolean
00475 gdisp_defaultPlotLeaveNotify (GtkWidget        *area,
00476                               GdkEventCrossing *event,
00477                               gpointer          data)
00478 {
00479 
00480   Kernel_T      *kernel =      (Kernel_T*)data;
00481   DefaultPlot_T *plot   = (DefaultPlot_T*)NULL;
00482 
00483   /*
00484    * Graphic area has lost the focus.
00485    */
00486   plot = (DefaultPlot_T*)gtk_object_get_data(GTK_OBJECT(area),
00487                                              "plotPointer");
00488 
00489   plot->dpHasFocus = FALSE;
00490   gdisp_defaultPlotDrawGraphicArea(kernel,plot);
00491 
00492   return TRUE;
00493 
00494 }
00495 
00496 
00497 /*
00498  * Create a 'default plot' by providing an opaque structure to the
00499  * caller. This opaque structure will be given as an argument to all
00500  * plot function. These functions remain generic.
00501  */
00502 static void*
00503 gdisp_createDefaultPlot (Kernel_T *kernel)
00504 {
00505 
00506   DefaultPlot_T  *plot = (DefaultPlot_T*)NULL;
00507 #if defined(GD_DEFAULT_PLOT_HAS_DND)
00508   GtkTargetEntry  targetEntry;
00509 #endif
00510 
00511 
00512   /*
00513    * Dynamic allocation.
00514    */
00515   plot = g_malloc0(sizeof(DefaultPlot_T));
00516   assert(plot);
00517 
00518   /*
00519    * Few initialisations.
00520    */
00521   plot->dpHasFocus = FALSE;
00522   plot->dpType     = GD_PLOT_DEFAULT;
00523 
00524   /*
00525    * Create a single graphic area.
00526    */
00527   plot->dpArea = gtk_drawing_area_new();
00528 
00529   /*
00530    * Activate signals.
00531    */
00532   gtk_widget_set_events(plot->dpArea,
00533                         GDK_POINTER_MOTION_MASK      |
00534                         GDK_POINTER_MOTION_HINT_MASK |
00535                         GDK_ENTER_NOTIFY_MASK        |
00536                         GDK_LEAVE_NOTIFY_MASK          );
00537 
00538   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00539                      "expose_event",
00540                      (GtkSignalFunc)gdisp_defaultPlotExpose,
00541                      (gpointer)kernel);
00542 
00543   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00544                      "enter_notify_event",
00545                      (GtkSignalFunc)gdisp_defaultPlotEnterNotify,
00546                      (gpointer)kernel);
00547 
00548   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00549                      "leave_notify_event",
00550                      (GtkSignalFunc)gdisp_defaultPlotLeaveNotify,
00551                      (gpointer)kernel);
00552 
00553   gtk_object_set_data(GTK_OBJECT(plot->dpArea),
00554                       "plotPointer",
00555                       (gpointer)plot);
00556 
00557 
00558 #if defined(GD_DEFAULT_PLOT_HAS_DND)
00559 
00560 
00561   /*
00562    * Drag And Drop settings.
00563    * Set up the 'graphic area' as a potential DND destination.
00564    * First we set up 'targetEntry' which is a structure which specifies
00565    * the kinds (which we define) of drops accepted on this widget.
00566    */
00567   targetEntry.target = GD_DND_TARGET_NAME;
00568   targetEntry.flags  = 0;
00569   targetEntry.info   = GD_DND_TARGET_INFO;
00570 
00571   /*
00572    * Set the drag destination for this widget, using the
00573    * above target entry types, accept only copies.
00574    */
00575   gtk_drag_dest_set(plot->dpArea,
00576                     GTK_DEST_DEFAULT_MOTION    |
00577                     GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP,
00578                     &targetEntry,
00579                     sizeof(targetEntry) / sizeof(GtkTargetEntry),
00580                     GDK_ACTION_COPY);
00581 
00582   /*
00583    * Set DND signals on 'cList'.
00584    */
00585   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00586                      "drag_begin",
00587                      GTK_SIGNAL_FUNC(gdisp_beginDNDCallback),
00588                      kernel);
00589 
00590   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00591                      "drag_end",
00592                      GTK_SIGNAL_FUNC(gdisp_endDNDCallback),
00593                      kernel);
00594 
00595   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00596                      "drag_motion",
00597                      GTK_SIGNAL_FUNC(gdisp_dragMotionDNDCallback),
00598                      kernel);
00599 
00600   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00601                      "drag_data_get",
00602                      GTK_SIGNAL_FUNC(gdisp_dataRequestDNDCallback),
00603                      kernel);
00604 
00605   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00606                      "drag_data_received",
00607                      GTK_SIGNAL_FUNC(gdisp_dataReceivedDNDCallback),
00608                      kernel);
00609 
00610   gtk_signal_connect(GTK_OBJECT(plot->dpArea),
00611                      "drag_data_delete",
00612                      GTK_SIGNAL_FUNC(gdisp_dataDestroyedDNDCallback),
00613                      kernel);
00614 
00615 
00616 #endif /* GD_DEFAULT_PLOT_HAS_DND */
00617 
00618 
00619   /*
00620    * Create a graphic context specific to this plot.
00621    */
00622   plot->dpGContext =
00623     gdk_gc_new(GTK_WIDGET(kernel->widgets.mainBoardWindow)->window);
00624 
00625 
00626   /*
00627    * Return the opaque structure.
00628    */
00629   return (void*)plot;
00630 
00631 }
00632 
00633 
00634 /*
00635  * Destroy a 'default' plot opaque structure.
00636  */
00637 static void
00638 gdisp_destroyDefaultPlot(Kernel_T *kernel,
00639                          void     *data)
00640 {
00641 
00642   DefaultPlot_T *plot = (DefaultPlot_T*)data;
00643 
00644   /*
00645    * Now destroy everything.
00646    */
00647   gdk_gc_destroy    (plot->dpGContext);
00648   gtk_widget_destroy(plot->dpArea    );
00649 
00650   /*
00651    * Free opaque structure.
00652    */
00653   memset(plot,0,sizeof(DefaultPlot_T));
00654   g_free(plot);
00655 
00656 }
00657 
00658 
00659 /*
00660  * Record the identity of the parent widget.
00661  */
00662 static void
00663 gdisp_setParentWidget (Kernel_T  *kernel,
00664                        void      *data,
00665                        GtkWidget *parent)
00666 {
00667 
00668   DefaultPlot_T *plot = (DefaultPlot_T*)data;
00669 
00670   /*
00671    * Record my parent widget.
00672    */
00673   plot->dpParent = parent;
00674 
00675 }
00676 
00677 
00678 /*
00679  * Record initial dimensions provided by the calling process.
00680  */
00681 static void
00682 gdisp_setDefaultPlotInitialDimensions (Kernel_T *kernel,
00683                                        void     *data,
00684                                        guint     width,
00685                                        guint     height)
00686 {
00687 
00688   DefaultPlot_T *plot = (DefaultPlot_T*)data;
00689 
00690   plot->dpAreaWidth  = width;
00691   plot->dpAreaHeight = height;
00692 
00693 }
00694 
00695 
00696 /*
00697  * Give back to the calling process the top level widget
00698  * in order to be inserted in a possible container for further
00699  * dynamic X management.
00700  */
00701 static GtkWidget*
00702 gdisp_getDefaultPlotTopLevelWidget (Kernel_T  *kernel,
00703                                     void      *data)
00704 {
00705 
00706   DefaultPlot_T *plot = (DefaultPlot_T*)data;
00707 
00708   return (GtkWidget*)plot->dpArea;
00709 
00710 }
00711 
00712 
00713 /*
00714  * By now, the 'default plot' widgets are created, but not shown yet.
00715  * Show them here.
00716  */
00717 static void
00718 gdisp_showDefaultPlot (Kernel_T  *kernel,
00719                        void      *data)
00720 {
00721 
00722   DefaultPlot_T *plot = (DefaultPlot_T*)data;
00723 
00724   /*
00725    * Now show everything.
00726    */
00727   gtk_widget_show(plot->dpArea);
00728 
00729 }
00730 
00731 
00732 /*
00733  * Return to calling process what king of plot we are.
00734  */
00735 static PlotType_T
00736 gdisp_getDefaultPlotType (Kernel_T *kernel,
00737                           void     *data)
00738 {
00739 
00740   DefaultPlot_T *plot = (DefaultPlot_T*)data;
00741 
00742   /*
00743    * Must be GD_PLOT_DEFAULT. See 'create' routine.
00744    */
00745   return plot->dpType;
00746 
00747 }
00748 
00749 
00750 /*
00751  * Record any incoming symbols.
00752  */
00753 static void
00754 gdisp_addSymbolsToDefaultPlot (Kernel_T *kernel,
00755                                void     *data,
00756                                GList    *symbolList,
00757                                guchar    zoneId)
00758 {
00759 
00760   /*
00761    * Nothing to be done on default plot.
00762    */
00763 
00764 }
00765 
00766 
00767 /*
00768  * Broadcast all symbols.
00769  */
00770 static GList*
00771 gdisp_getSymbolsFromDefaultPlot (Kernel_T *kernel,
00772                                  void     *data,
00773                                  gchar     axis)
00774 {
00775 
00776   /*
00777    * Nothing to be done on default plot.
00778    */
00779 
00780   return (GList*)NULL;
00781 
00782 }
00783 
00784 
00785 /*
00786  * Real time Starting Step Action.
00787  */
00788 static gboolean
00789 gdisp_startStepOnDefaultPlot (Kernel_T *kernel,
00790                               void     *data)
00791 {
00792 
00793   /*
00794    * Nothing to be done on default plot, except that we must
00795    * return TRUE to the calling procedure in order to allow the general
00796    * step management to proceed.
00797    *
00798    * Returning FALSE means that our plot is not enabled to perform its
00799    * step operations, because of this or that...
00800    */
00801   return TRUE;
00802 
00803 }
00804 
00805 
00806 /*
00807  * Real time Step Action.
00808  */
00809 static void
00810 gdisp_stepOnDefaultPlot (Kernel_T *kernel,
00811                          void     *data)
00812 {
00813 
00814   /*
00815    * Nothing to be done on default plot.
00816    */
00817 
00818 }
00819 
00820 
00821 /*
00822  * Real time Starting Step Action.
00823  */
00824 static void
00825 gdisp_stopStepOnDefaultPlot (Kernel_T *kernel,
00826                              void     *data)
00827 {
00828 
00829   /*
00830    * Nothing to be done on default plot.
00831    */
00832 
00833 }
00834 
00835 
00836 /*
00837  * Get back to the calling procedure my information.
00838  */
00839 static void
00840 gdisp_getDefaultPlotInformation (Kernel_T         *kernel,
00841                                  PlotSystemInfo_T *information)
00842 {
00843 
00844   /*
00845    *   - Name,
00846    *   - Formula,
00847    *   - Descripton for tooltip purpose.
00848    */
00849   information->psName        = "Default";
00850   information->psFormula     = (gchar*)NULL;
00851   information->psDescription = "Dummy plot for graphic page creation";
00852 
00853 }
00854 
00855 
00856 /*
00857  * Get back to the calling procedure my period, expressed in milliseconds.
00858  * CAUTION : The period must be an exact multiple of 10.
00859  *           Should not be lower than 100.
00860  */
00861 static guint
00862 gdisp_getDefaultPlotPeriod (Kernel_T *kernel,
00863                             void     *data)
00864 {
00865 
00866   /*
00867    * My period is pure science fiction...
00868    */
00869   return G_MAXINT; /* in order to avoid disturbing other plots */
00870 
00871 }
00872 
00873 
00874 /*
00875  * Get back the zones that have been defined on that plot.
00876  */
00877 static GArray*
00878 gdisp_getDefaultPlotDropZones (Kernel_T *kernel)
00879 {
00880 
00881   /*
00882    * No zones on default plots.
00883    */
00884   return (GArray*)NULL;
00885 
00886 }
00887 
00888 
00889 /*
00890  * This procedure is called whenever all symbols have been time-tagged
00891  * by the corresponding provider sampling thread.
00892  * The last value of all symbols can now be retreived by the graphic plot.
00893  *
00894  * CAUTION : This procedure is called in another thread, compared to all
00895  * other procedures of the graphic plot that are called by GTK main thread.
00896  */
00897 static void
00898 gdisp_treatDefaultPlotSymbolValues (Kernel_T *kernel,
00899                                     void     *data)
00900 {
00901 
00902   /*
00903    * Nothing to be done here for text plot, because the last
00904    * value of all symbols is retrieved in the "step" procedure.
00905    */
00906 
00907 }
00908 
00909 
00910 /*
00911  --------------------------------------------------------------------
00912                              PUBLIC ROUTINES
00913  --------------------------------------------------------------------
00914 */
00915 
00916 
00917 void
00918 gdisp_initDefaultPlotSystem (Kernel_T     *kernel,
00919                              PlotSystem_T *plotSystem)
00920 {
00921 
00922   /*
00923    * We must here provide all 'defaultPlot' private functions
00924    * that remain 'static' here, but accessible from everywhere
00925    * via the kernel.
00926    */
00927   plotSystem->psCreate            = gdisp_createDefaultPlot;
00928   plotSystem->psDestroy           = gdisp_destroyDefaultPlot;
00929   plotSystem->psSetParent         = gdisp_setParentWidget;
00930   plotSystem->psGetTopLevelWidget = gdisp_getDefaultPlotTopLevelWidget;
00931   plotSystem->psShow              = gdisp_showDefaultPlot;
00932   plotSystem->psGetType           = gdisp_getDefaultPlotType;
00933   plotSystem->psAddSymbols        = gdisp_addSymbolsToDefaultPlot;
00934   plotSystem->psSetDimensions     = gdisp_setDefaultPlotInitialDimensions;
00935   plotSystem->psGetSymbols        = gdisp_getSymbolsFromDefaultPlot;
00936   plotSystem->psStartStep         = gdisp_startStepOnDefaultPlot;
00937   plotSystem->psStep              = gdisp_stepOnDefaultPlot;
00938   plotSystem->psStopStep          = gdisp_stopStepOnDefaultPlot;
00939   plotSystem->psGetInformation    = gdisp_getDefaultPlotInformation;
00940   plotSystem->psTreatSymbolValues = gdisp_treatDefaultPlotSymbolValues;
00941   plotSystem->psGetPeriod         = gdisp_getDefaultPlotPeriod;
00942   plotSystem->psGetDropZones      = gdisp_getDefaultPlotDropZones;
00943 
00944 }
00945 
Framework Home Page.

Beware !! TSP wave is coming...