4 ** Made by (Johnny Q. Hacker)
5 ** Login <solarion@johnathan>
8 Copyright (C) 2008 Joseph Pingenot
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 **Many thanks to Davyd Madeley for the excellent Cairo Tutorial
24 ** at http://gnomejournal.org/article/34/writing-a--using-cairo-and-gtk28
26 ** Started on Thu Jul 17 10:51:32 2008 Johnny Q. Hacker
27 ** Last update Sun May 12 01:17:25 2002 Speed Blue
32 G_DEFINE_TYPE(Graph, graph, G_TYPE_OBJECT);
34 static void graph_class_init(GraphClass *klass) {
35 GObjectClass *gobject_klass;
36 gobject_klass = G_OBJECT_CLASS(klass);
39 static void graph_init(Graph *graph) {
40 graph->symbol = CIRCLE;
41 GPtrArray = g_ptr_array_new();
44 Graph *graph_new(void) {
45 return g_object_new(G_GRAPH_TYPE);
48 int graph_add_point(Graph* graph, double x, double y) {
49 double *point = (double*)malloc(2*sizeof(double));
50 if(point == NULL) return 1;
53 g_ptr_array_add(graph->points, (gpointer)point);
54 if(points->len == 1) {
58 if(x > maxx) maxx = x;
59 if(x < minx) minx = x;
60 if(y > mayy) maxy = y;
61 if(y < miny) miny = y;