"Fossies" - the Fresh Open Source Software Archive

Member "gfsview-snapshot-121130/view/gfkgl2D.h" (30 Nov 2012, 2834 Bytes) of package /linux/privat/gfsview-snapshot-121130.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "gfkgl2D.h" see the Fossies "Dox" file reference documentation.

    1 /* Gerris - The GNU Flow Solver
    2  * Copyright (C) 2001-2004 National Institute of Water and Atmospheric
    3  * Research
    4  *
    5  * This program is free software; you can redistribute it and/or
    6  * modify it under the terms of the GNU General Public License as
    7  * published by the Free Software Foundation; either version 2 of the
    8  * License, or (at your option) any later version.
    9  *
   10  * This program is distributed in the hope that it will be useful,
   11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   13  * General Public License for more details.
   14  *
   15  * You should have received a copy of the GNU General Public License
   16  * along with this program; if not, write to the Free Software
   17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   18  * 02111-1307, USA.  
   19  */
   20 
   21 /* GfkGl2D: Object */
   22 
   23 static gchar * gl2D_pickinfo (GfkGl * gl, gboolean motion)
   24 {
   25   FttVector p = GFS_GL2D (gl->gl)->pickedpos;
   26   GfkGl2D * gl2 = GFK_GL2D (gl);
   27 
   28   g_free (gl2->pickinfo);
   29   if (fabs (p.x) < 1e-10) p.x = 0.;
   30   if (fabs (p.y) < 1e-10) p.y = 0.;
   31   gfs_simulation_map_inverse (gl->gl->sim, &p);
   32   gl2->pickinfo = g_strdup_printf ("(%.8f,%.8f)", p.x, p.y);
   33   return gl2->pickinfo;
   34 }
   35 
   36 static void gl2D_init (GfkGl2D * object)
   37 {
   38   object->params = create_gl2D_params ();
   39   object->n.x = 0.; object->n.y = 0.; object->n.z = 1.;
   40   gfk_gl_prepend_params (GFK_GL (object), object->params, gtk_label_new ("2D Plane"));
   41 }
   42 
   43 /* GfkGlSolid: Object */
   44 
   45 static void gl_solid_init (GfkGl * gl)
   46 {
   47   gtk_widget_set_sensitive (lookup_widget_params (gl->properties, "shading_label"), FALSE);
   48   gtk_widget_set_sensitive (lookup_widget_params (gl->properties, "shading"), FALSE);
   49 }
   50 
   51 static gchar * gl_solid_name (GfkGlClass * klass)
   52 {
   53   static gchar name[] = "Solid";
   54   return name;
   55 }
   56 
   57 static GtkWidget * gl_solid_icon (GfkGlClass * klass)
   58 {
   59   return create_pixmap (NULL, "solid-16x16.png");
   60 }
   61 
   62 static void gl_solid_class_init (GfkGlClass * klass)
   63 {
   64   klass->gl_class = gfs_gl_solid_class ();
   65   klass->name = gl_solid_name;
   66   klass->icon = gl_solid_icon;
   67 }
   68 
   69 GfkGlClass * gfk_gl_solid_class (void)
   70 {
   71   static GfkGlClass * klass = NULL;
   72 
   73   if (klass == NULL) {
   74     GtsObjectClassInfo gfk_gl_solid_info = {
   75       "GfkGlSolid",
   76       sizeof (GfkGl),
   77       sizeof (GfkGlClass),
   78       (GtsObjectClassInitFunc) gl_solid_class_init,
   79       (GtsObjectInitFunc) gl_solid_init,
   80       (GtsArgSetFunc) NULL,
   81       (GtsArgGetFunc) NULL
   82     };
   83     klass = gts_object_class_new (GTS_OBJECT_CLASS (gfk_gl_class ()), &gfk_gl_solid_info);
   84   }
   85 
   86   return klass;
   87 }
   88 
   89 /* GfkGlFractions: Object */
   90 
   91 static void gl_fractions_init (GfkGl * gl)
   92 {
   93   gtk_widget_set_sensitive (lookup_widget_params (gl->properties, "shading_label"), FALSE);
   94   gtk_widget_set_sensitive (lookup_widget_params (gl->properties, "shading"), FALSE);
   95 }
   96