~ubuntu-branches/debian/sid/genius/sid

« back to all changes in this revision

Viewing changes to gtkextra/gtkplotcanvasplot.c

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2014-04-07 15:43:04 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20140407154304-21r03zdnfc571kz0
Tags: 1.0.17-1
* Take over package from pkg-gnome
* New upstream release. Closes: #716731
* Bump standards version.
* Update Vcs fields to Git.
* Move to single-debian-patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Boston, MA 02111-1307, USA.
18
18
 */
19
19
 
 
20
/**
 
21
 * SECTION: gtkplotcanvasplot
 
22
 * @short_description: 
 
23
 *
 
24
 * FIXME:: need long description
 
25
 */
 
26
 
 
27
 
20
28
#include <stdlib.h>
21
29
#include <stdio.h>
22
30
#include <string.h>
65
73
extern GtkPlotCanvasPos possible_selection      (GtkAllocation area, 
66
74
                                                 gint x, gint y);
67
75
 
68
 
GtkType
 
76
GType
69
77
gtk_plot_canvas_plot_get_type (void)
70
78
{
71
 
  static GtkType plot_canvas_plot_type = 0;
 
79
  static GType plot_canvas_plot_type = 0;
72
80
 
73
81
  if (!plot_canvas_plot_type)
74
82
    {
75
 
      GtkTypeInfo plot_canvas_plot_info =
76
 
      {
77
 
        "GtkPlotCanvasPlot",
78
 
        sizeof (GtkPlotCanvasPlot),
79
 
        sizeof (GtkPlotCanvasPlotClass),
80
 
        (GtkClassInitFunc) gtk_plot_canvas_plot_class_init,
81
 
        (GtkObjectInitFunc) gtk_plot_canvas_plot_init,
82
 
        /* reserved 1*/ NULL,
83
 
        /* reserved 2 */ NULL,
84
 
        (GtkClassInitFunc) NULL,
85
 
      };
86
 
 
87
 
      plot_canvas_plot_type = gtk_type_unique (gtk_plot_canvas_child_get_type(), &plot_canvas_plot_info);
 
83
      plot_canvas_plot_type = g_type_register_static_simple (
 
84
                gtk_plot_canvas_child_get_type(),
 
85
                "GtkPlotCanvasPlot",
 
86
                sizeof (GtkPlotCanvasPlotClass),
 
87
                (GClassInitFunc) gtk_plot_canvas_plot_class_init,
 
88
                sizeof (GtkPlotCanvasPlot),
 
89
                (GInstanceInitFunc) gtk_plot_canvas_plot_init,
 
90
                0);
88
91
    }
89
92
  return plot_canvas_plot_type;
90
93
}
91
94
 
 
95
/**
 
96
 * gtk_plot_canvas_plot_new:
 
97
 * @plot: a #GtkPlot.
 
98
 *
 
99
 *
 
100
 *
 
101
 * Return value:
 
102
 */
92
103
GtkPlotCanvasChild*
93
104
gtk_plot_canvas_plot_new (GtkPlot *plot)
94
105
{
95
106
  GtkPlotCanvasPlot *child;
96
107
                                                                                
97
 
  child = gtk_type_new (gtk_plot_canvas_plot_get_type ());
 
108
  child = g_object_new (gtk_plot_canvas_plot_get_type (), NULL);
98
109
  child->plot = plot;
99
110
                                 
100
111
  return GTK_PLOT_CANVAS_CHILD (child);
117
128
{
118
129
  GtkObjectClass *object_class = (GtkObjectClass *)klass;
119
130
 
120
 
  parent_class = gtk_type_class (gtk_plot_canvas_child_get_type ());
 
131
  parent_class = g_type_class_ref (gtk_plot_canvas_child_get_type ());
121
132
 
122
133
  klass->draw = gtk_plot_canvas_plot_draw; 
123
134
  klass->move = gtk_plot_canvas_plot_move; 
135
146
gtk_plot_canvas_plot_destroy(GtkObject *object)
136
147
{
137
148
  GtkWidget *widget = GTK_WIDGET(GTK_PLOT_CANVAS_PLOT(object)->plot);
138
 
  gtk_widget_unref(widget);
 
149
  g_object_unref(widget);
139
150
  widget->parent = NULL;
140
151
}
141
152
 
149
160
  gint height = child->allocation.height;
150
161
  gdouble m = canvas->magnification;
151
162
  GtkPlotPC *pc;
 
163
  GtkAllocation allocation;
152
164
 
153
165
  if(width == 0 && height == 0) return;
154
166
 
155
167
  gtk_plot_set_drawable(plot, canvas->pixmap);
156
 
  GTK_WIDGET(plot)->allocation.x = 0;
157
 
  GTK_WIDGET(plot)->allocation.y = 0;
158
 
  GTK_WIDGET(plot)->allocation.width = canvas->pixmap_width;
159
 
  GTK_WIDGET(plot)->allocation.height = canvas->pixmap_height;
 
168
  allocation.x = 0;
 
169
  allocation.y = 0;
 
170
  allocation.width = canvas->pixmap_width;
 
171
  allocation.height = canvas->pixmap_height;
 
172
  gtk_widget_set_allocation(GTK_WIDGET(plot), &allocation);
160
173
  gtk_plot_set_magnification(plot, m);
161
174
  reset_plot_allocation(canvas, plot_child);
162
175
 
374
387
gtk_plot_canvas_plot_size_allocate      (GtkPlotCanvas *canvas,
375
388
                                         GtkPlotCanvasChild *child)
376
389
{
 
390
  GtkAllocation allocation;
377
391
  GtkPlot *plot = GTK_PLOT_CANVAS_PLOT(child)->plot;
378
392
  if(!plot) return;
379
393
 
380
394
  switch(GTK_PLOT_CANVAS_PLOT(child)->pos){
381
395
    case GTK_PLOT_CANVAS_PLOT_IN_PLOT:
382
396
    case GTK_PLOT_CANVAS_PLOT_OUT:
383
 
      GTK_WIDGET(plot)->allocation.x = 0;
384
 
      GTK_WIDGET(plot)->allocation.y = 0;
385
 
      GTK_WIDGET(plot)->allocation.width = canvas->pixmap_width;
386
 
      GTK_WIDGET(plot)->allocation.height = canvas->pixmap_height;
 
397
      allocation.x = 0;
 
398
      allocation.y = 0;
 
399
      allocation.width = canvas->pixmap_width;
 
400
      allocation.height = canvas->pixmap_height;
 
401
      gtk_widget_set_allocation(GTK_WIDGET(plot), &allocation);
387
402
 
388
403
      if(!GTK_WIDGET(plot)->parent) 
389
404
        gtk_widget_set_parent(GTK_WIDGET(plot), GTK_WIDGET(canvas));