TSP: The Transport Sample Protocol



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

plotwindow.h

00001 /* GTK - The GIMP Toolkit
00002  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 #ifndef __PLOTWINDOW_H__
00020 #define __PLOTWINDOW_H__
00021 
00022 
00023 #include <gdk/gdk.h>
00024 #include <gtk/gtkwidget.h>
00025 #ifndef __OpenBSD__
00026 #include <values.h>
00027 #endif /* ! __OpenBSD__ */
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif /* __cplusplus */
00032   
00033 
00034 #define RTP_MIN_RANGE 1E-100
00035 #define RTP_MIN_RES 1E-12
00036 
00037 typedef struct _DoublePoint {
00038   double x,y;
00039 } DoublePoint;
00040 
00041 typedef struct _PixelPoint {
00042   int x,y;
00043 } PixelPoint;
00044 
00045 
00046 typedef struct _BBox {
00047   gdouble minX, maxX, minY, maxY;
00048 } BBox;
00049 
00050 typedef struct _RtpMapping {
00051   double xscale, yscale;
00052   double xbias, ybias;
00053   BBox viewPort;
00054 } RtpMapping;
00055 
00056 typedef struct _draw_grids_args {
00057   void *pw;
00058   GdkEventExpose *event;
00059   GdkGC *gc;
00060   BBox viewPort;
00061   GdkDrawable * drawable;
00062 } draw_grids_args;
00063 
00064 
00065   typedef struct _PW_Mapping {
00066     gdouble x_len;
00067     gdouble y_len;
00068     gdouble x_scale;
00069     gdouble y_scale;
00070     gdouble x_bias;
00071     gdouble y_bias;
00072     gint x_scroll_len;
00073   } PW_Mapping;
00074 
00075 
00076   typedef struct _array_sample_t
00077   {
00078     DoublePoint* samples;
00079     int          nb_sample;
00080     int          current;
00081     int          first;
00082     int          max_nb_sample;
00083   }array_sample_t;
00084 
00085   /***********************
00086    *  Plot Window Widget
00087    ***********************/
00088 #define PLOTWINDOW(obj)          GTK_CHECK_CAST (obj, plotwindow_get_type (), PlotWindow)
00089 #define PLOTWINDOW_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, plotwindow_get_type (), PlotWindowClass)
00090 #define IS_PLOTWINDOW(obj)       GTK_CHECK_TYPE (obj, plotwindow_get_type ())
00091 
00092 
00093 #define PLOTWINDOW_PREFERRED_WIDTH 100
00094 #define PLOTWINDOW_PREFERRED_HEIGHT 100
00095   typedef struct _PlotWindow PlotWindow;
00096   typedef struct _PlotWindowClass PlotWindowClass;
00097 
00098 #define BUFFER_SIZE 1024
00099 
00100   
00101   struct _PlotWindow {
00102     GtkWidget widget;
00103 
00106     int time_mode;
00107     gdouble duration_sec;
00108     gdouble scroll_duration;
00109 
00110     array_sample_t array_sample;
00111     GdkPoint* points;
00112 
00113     PW_Mapping mapping;
00114     BBox all_points_bbox;   
00115 
00116     int scale_dirty;
00117     gboolean data_dirty;
00118 
00119     DoublePoint prev_pt;
00120     int prev_pt_exists;
00121 
00122     const gchar* title;
00123     BBox view_port;
00124     int fd_input;
00125     
00126     GdkPixmap *ready_buffer;
00127     GdkGC *buffer_gc;
00128     GdkGC *clear_gc;
00129     GdkGC *point_gc;
00130     GdkGC *scroll_gc;
00131     GdkGC *axis_gc;
00132     GdkGC *box_gc;
00133 
00134     GdkFont *small_font;
00135     GdkFont *big_font;
00136 
00137     //  pthread_mutex_t data_points_mutex;
00138     pthread_t acquire_data_thread;
00139     pthread_t background_drawing_thread;
00140     
00141     /*  BBox _allPointsBBox; // Bounding box of all points received
00142         BBox _trackingPort;
00143         enum {AUTO_SCALE, USER_FIXED, TRACKING} _viewMode;*/
00144   };
00145 
00146   struct _PlotWindowClass {
00147     GtkWidgetClass parent_class;
00148   };
00149   
00150 
00151   GtkType plotwindow_get_type (void);
00152   GtkWidget* plotwindow_new (void);
00153   void display_rendered_scene (PlotWindow *pw, GdkEventExpose *event);
00154 
00155   void add_point(PlotWindow* pw, DoublePoint* pt);
00156 
00157   void set_time_mode(PlotWindow* pw, double duration_sec, double frequency_hz);
00158 
00159 
00160 
00161 #ifdef __cplusplus
00162 }
00163 #endif /* __cplusplus */
00164 
00165 #endif /* __PLOTWINDOW_H__ */
00166 
Framework Home Page.

Beware !! TSP wave is coming...