• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

gcw.h

Go to the documentation of this file.
00001 // gcw - PLplot Gnome Canvas Widget device driver.
00002 //
00003 // Copyright (C) 2004, 2005  Thomas J. Duck
00004 // Copyright (C) 2004  Rafael Laboissiere
00005 // All rights reserved.
00006 //
00007 // NOTICE
00008 //
00009 // This library is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU Lesser General Public
00011 // License as published by the Free Software Foundation; either
00012 // version 2.1 of the License, or (at your option) any later version.
00013 //
00014 // This library is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
00022 // USA
00023 //
00024 
00025 #ifndef __GCW_H__
00026 #define __GCW_H__
00027 
00028 #include "plDevs.h"
00029 #include "plplotP.h"
00030 #include "drivers.h"
00031 
00032 #include <math.h>
00033 #include <stdio.h>
00034 #include <sys/stat.h>
00035 
00036 #include <glib.h>
00037 #include <gtk/gtk.h>
00038 #include <libgnomecanvas/libgnomecanvas.h>
00039 #include <libart_lgpl/libart.h>
00040 #include <libgnomeprint/gnome-print.h>
00041 
00042 
00043 // #define DEBUG_GCW_1
00044 // #define DEBUG_GCW_2
00045 // #define ASSERT_GCW
00046 
00047 
00048 //--------------------------------------------------------------------------
00049 // GcwPLdev - the PLplot device structure for the GCW driver
00050 
00051 typedef struct
00052 {
00053     GnomeCanvas     * canvas;           // The canvas to draw on
00054     GdkPixmap       * background;       // The background
00055     GdkGC           * gc;               // A graphics context for the pixmap
00056 
00057     GnomeCanvasGroup* group_visible;    // Visible group, removed at next eop
00058     GnomeCanvasGroup* group_hidden;     // Hidden group --> visible at eop
00059     GnomeCanvasGroup* group_persistent; // Persistent group, at from and never erased
00060 
00061     gboolean        use_persistence;    // Flags the persistent group should be used,
00062                                         // and that it and the background should not be
00063                                         // erased when the page is advanced.
00064                                         //
00065 
00066     GtkWidget  * window;                // A window used in standalone mode
00067     GtkWidget  * notebook;              // A notebook pager in the window
00068     GtkWidget  * statusbar;             // A statusbar for the window
00069     GtkWidget  * filew;                 // A file widget chooser when Save is pressed
00070 
00071     guint32    color;                   // Current pen color
00072     GdkColor   bgcolor;                 // Background color (shouldn't change)
00073     GdkColormap* colormap;              // The gdk colormap for the canvas
00074 
00075     PLINT      width;                   // Width of the canvas in device pixels
00076     PLINT      height;                  // Height of the canvas in device pixels
00077 
00078     PLINT      pen_color;               // Current pen color
00079     PLINT      pen_width;               // Current pen width
00080 
00081     gboolean   use_pixmap;              // Flags pixmap use for lines and fills
00082     gboolean   pixmap_has_data;         // Flags that the pixmap has data
00083 
00084     gboolean   plstate_width;           // Flags indicating change of state before
00085     gboolean   plstate_color0;          //  device is fully initialized
00086     gboolean   plstate_color1;
00087 
00088     gboolean   allow_resize; // Flags whether device resizing is allowed
00089 } GcwPLdev;
00090 
00091 
00092 //--------------------------------------------------------------------------
00093 // Physical dimension constants used by the driver
00094 
00095 // Virtual coordinate scaling parameter, used to do calculations at
00096 // higher resolution.  Chosen to be 32 for consistency with the PLplot
00097 // metafile (see plplotP.h).
00098 //
00099 // The trick here is to do everything in device coordinates on the driver
00100 // side, but report/receive everything in virtual coordinates to/from the
00101 // PLplot core.
00102 //
00103 #define VSCALE                   ( 32. )
00104 
00105 // pixels per mm
00106 #define DEVICE_PIXELS_PER_MM     ( 3.4 )
00107 #define VIRTUAL_PIXELS_PER_MM    ( DEVICE_PIXELS_PER_MM * VSCALE )
00108 
00109 // mm per inch
00110 #define MM_PER_IN                ( 25.4 )
00111 
00112 // pixels per inch
00113 #define DEVICE_PIXELS_PER_IN     ( DEVICE_PIXELS_PER_MM * MM_PER_IN )
00114 #define VIRTUAL_PIXELS_PER_IN    ( VIRTUAL_PIXELS_PER_MM * MM_PER_IN )
00115 
00116 // Default dimensions of the canvas (in inches)
00117 #define CANVAS_WIDTH             ( 10. )
00118 #define CANVAS_HEIGHT            ( 7.5 )
00119 
00120 // The zoom factor for 100% zoom in
00121 #define ZOOM100                  ( 1.0 )
00122 #define ZOOMSTEP                 ( 1.25 )
00123 
00124 
00125 //--------------------------------------------------------------------------
00126 // GCW "Gnome Canvas Widget" Library prototypes (see gcw-lib.c)
00127 
00128 // Public_functions
00129 
00130 void gcw_use_text( PLINT use_text );
00131 void gcw_use_pixmap( PLINT use_pixmap );
00132 void gcw_use_hrshsym( PLINT use_hrshsym );
00133 
00134 // Private functions
00135 
00136 void gcw_debug( char* msg );
00137 PLDLLIMPEXP_GNOME2 void gcw_set_gdk_color();
00138 PLDLLIMPEXP_GNOME2 void gcw_clear_background();
00139 PLDLLIMPEXP_GNOME2 void gcw_init_canvas( GnomeCanvas* canvas );
00140 PLDLLIMPEXP_GNOME2 void gcw_install_canvas( GnomeCanvas *canvas );
00141 PLDLLIMPEXP_GNOME2 void gcw_set_device_size( PLINT width, PLINT height );
00142 void gcw_set_canvas_size( GnomeCanvas* canvas, PLINT width, PLINT height );
00143 void gcw_set_canvas_zoom( GnomeCanvas* canvas, PLFLT magnification );
00144 void gcw_use_persistence( PLINT use_persistence );
00145 
00146 #endif // __GCW_H__

Generated on Wed Oct 12 2011 20:42:21 for PLplot by  doxygen 1.7.1