Commit 3f8882ee authored by Arturo Espinosa's avatar Arturo Espinosa

More stuff

parent bf209b0c
......@@ -27,14 +27,23 @@ graph_SOURCES = \
graph-view-colbar.h \
graph-view-plot.c \
graph-view-plot.h \
graph-view-scatter.c \
graph-view-scatter.h \
graph-view-stock.c \
graph-view-stock.h \
layout.c \
layout.h \
layout-view.c \
layout-view.h \
main.c \
vector.c \
vector.h \
$(GRAPH_CORBA_GENERATED)
graph_LDADD = \
$(EXTRA_GNOME_LIBS) \
$(INTLLIBS)
BUILT_SOURCES = $(GRAPH_CORBA_GENERATED)
$(GRAPH_CORBA_GENERATED): my_graph_idl
......
......@@ -41,13 +41,13 @@ column_draw (ColbarDrawCtx *ctx, int item,
static void
graph_view_colbar_draw_nth_clustered (ColbarDrawCtx *ctx, int item)
{
const int n_series = ctx->graph->n_series;
const int n_series = ctx->graph->layout->n_series;
int item_base = item * ctx->units_per_slot;
int col_width = ctx->units_per_slot / n_series;
int i;
for (i = 0; i < n_series; i++){
GraphVector *vector = ctx->graph->vectors [i];
GraphVector *vector = ctx->graph->layout->vectors [i];
column_draw (
ctx, 0,
......@@ -60,14 +60,14 @@ graph_view_colbar_draw_nth_clustered (ColbarDrawCtx *ctx, int item)
static void
graph_view_colbar_draw_nth_stacked (ColbarDrawCtx *ctx, int item)
{
const int n_series = ctx->graph->n_series;
const int n_series = ctx->graph->layout->n_series;
int item_base = item * ctx->units_per_slot;
double last_pos = 0.0;
double last_neg = 0.0;
int i;
for (i = 0; i < n_series; i++){
GraphVector *vector = ctx->graph->vectors [i];
GraphVector *vector = ctx->graph->layout->vectors [i];
double v;
v = graph_vector_get_double (vector, item);
......@@ -92,7 +92,7 @@ graph_view_colbar_draw_nth_stacked (ColbarDrawCtx *ctx, int item)
static void
graph_view_colbar_draw_nth_stacked_full (ColbarDrawCtx *ctx, int item)
{
const int n_series = ctx->graph->n_series;
const int n_series = ctx->graph->layout->n_series;
int item_base = item * ctx->units_per_slot;
double last_pos, last_neg;
double total_pos, total_neg;
......@@ -104,7 +104,7 @@ graph_view_colbar_draw_nth_stacked_full (ColbarDrawCtx *ctx, int item)
last_pos = last_neg = 0.0;
for (i = 0; i < n_series; i++){
GraphVector *vector = ctx->graph->vectors [i];
GraphVector *vector = ctx->graph->layout->vectors [i];
values [i] = graph_vector_get_double (vector, item);
if (values [i] >= 0)
......
#include <config.h>
#include "Graph.h"
#include "graph.h"
#include "graph-view.h"
#include "graph-view-scatter.h"
void
graph_view_scatter_plot (GraphView *graph_view, GdkDrawable *drawable,
int x, int y, int width, int height)
{
}
#ifndef GRAPH_VIEW_SCATTER_H_
#define GRAPH_VIEW_SCATTER_H_
void graph_view_scatter_plot (GraphView *graph_view, GdkDrawable *drawable,
int x, int y, int width, int height);
#endif /* GRAPH_VIEW_SCATTER_H_ */
#include <config.h>
#include "Graph.h"
#include "graph.h"
#include "graph-view.h"
#include "graph-view-stock.h"
void
graph_view_stock_plot (GraphView *graph_view, GdkDrawable *drawable,
int x, int y, int width, int height)
{
}
#ifndef GRAPH_VIEW_STOCK_H_
#define GRAPH_VIEW_STOCK_H_
void graph_view_stock_plot (GraphView *graph_view, GdkDrawable *drawable,
int x, int y, int width, int height);
#endif /* GRAPH_VIEW_STOCK_H_ */
......@@ -63,7 +63,7 @@ graph_compute_divisions (Graph *graph)
for (i = 0; i < n; i++){
int l;
l = graph_vector_count (graph->vectors [i]);
l = graph_vector_count (graph->layout->vectors [i]);
if (l > len)
len = l;
......@@ -95,7 +95,7 @@ graph_compute_dimensions (Graph *graph)
for (i = 0; i < n; i++){
double l, h;
graph_vector_low_high (graph->vectors [i], &l, &h);
graph_vector_low_high (graph->layout->vectors [i], &l, &h);
if (l < low)
low = l;
if (h > high)
......@@ -124,7 +124,7 @@ graph_compute_stacked_dimensions (Graph *graph)
for (i = 0; i < n; i++){
double v;
v = graph_vector_get_double (graph->vectors [i], x);
v = graph_vector_get_double (graph->layout->vectors [i], x);
if (v < 0)
s_low += v;
......@@ -470,3 +470,15 @@ graph_bind_view (Graph *graph, GraphView *graph_view)
gtk_signal_connect (GTK_OBJECT (graph_view), "destroy",
GTK_SIGNAL_FUNC (graph_view_destroyed), graph);
}
Graph *
graph_new (Layout *layout)
{
Graph *graph;
graph = gtk_type_new (graph_get_type ());
graph->layout = layout;
return graph;
}
[GOADID:embeddable-factory:Graph:Layout]
type=exe
repo_id=IDL:GNOME/EmbeddableFactory:1.0 IDL:GNOME/GenericFactory:1.0
description=GNOME Chart component factory.
location_info=graph
[GOADID:embeddable:Graph:Layout]
type=factory
repo_id=IDL:BonoboObject/text-plain:1.0 IDL:GNOME/Embeddable:1.0
description=GNOME Chart component
location_info=GOADID:embeddable-factory:Graph:Layout
......@@ -8,17 +8,23 @@
BEGIN_GNOME_DECLS
typedef struct _Graph Graph;
typedef struct _GraphView GraphView;
#include "layout.h"
#define GRAPH_TYPE (graph_get_type ())
#define GRAPH(o) (GTK_CHECK_CAST ((o), GRAPH_TYPE, Graph))
#define GRAPH_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GRAPH_TYPE, GraphClass))
#define IS_GRAPH(o) (GTK_CHECK_TYPE ((o), GRAPH_TYPE))
#define IS_GRAPH_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GRAPH_TYPE))
typedef struct _GraphView GraphView;
typedef struct {
struct _Graph {
GnomeObject base;
Layout *layout;
GNOME_Graph_ChartType chart_type;
GNOME_Graph_ScaleType scale_type;
GNOME_Graph_PlotMode plot_mode;
......@@ -43,7 +49,7 @@ typedef struct {
double real_low, real_high;
int divisions;
} Graph;
};
typedef struct {
GnomeObjectClass parent_class;
......
......@@ -8,6 +8,7 @@
* (C) 1999 International GNOME Support
*/
#include <config.h>
#include "Graph.h"
#include "layout-view.h"
#include "graph-view.h"
......
......@@ -9,6 +9,7 @@
*/
#include <config.h>
#include <bonobo/gnome-bonobo.h>
#include "Graph.h"
#include "layout.h"
#include "layout-view.h"
......@@ -61,7 +62,7 @@ impl_reset_series (PortableServer_Servant servant, CORBA_Environment *ev)
for (i = 0; i < n; i++)
graph_vector_destroy (layout->vectors [i]);
g_free (graph->vectors);
g_free (layout->vectors);
layout->vectors = NULL;
layout->n_series = 0;
}
......@@ -155,7 +156,7 @@ layout_new (void)
gnome_embeddable_construct (GNOME_EMBEDDABLE (layout),
(GNOME_Embeddable) corba_layout,
layout_view_factory, NULL);
layout->graph = graph_new ();
layout->graph = graph_new (layout);
return layout;
}
......
/*
* graph/main.c: Main graphics component file
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
*
* (C) 1999 International GNOME Support (http://www.gnome-support.com)
*/
#include <config.h>
#include <bonobo/gnome-bonobo.h>
#include "Graph.h"
#include "layout.h"
CORBA_Environment ev;
CORBA_ORB orb;
static GnomeEmbeddableFactory *factory;
static int active_layouts;
static void
init_server_factory (int argc, char **argv)
{
gnome_CORBA_init_with_popt_table (
"graph", VERSION,
&argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
orb = gnome_CORBA_ORB ();
if (bonobo_init (orb, NULL, NULL) == FALSE)
g_error (_("I could not initialize Bonobo"));
}
static void
layout_destroyed (GtkObject *layout_object)
{
active_layouts--;
if (active_layouts != 0)
return;
gnome_object_unref (GNOME_OBJECT (factory));
gtk_main_quit ();
}
static GnomeObject *
layout_factory (GnomeEmbeddableFactory *this, void *data)
{
Layout *layout;
layout = layout_new ();
if (layout == NULL)
return NULL;
active_layouts++;
gtk_signal_connect (
GTK_OBJECT (layout), "destroy",
layout_destroyed, NULL);
return GNOME_OBJECT (layout);
}
static void
layout_factory_init (void)
{
factory = gnome_embeddable_factory_new (
"embeddable-factory:Graph:Layout", layout_factory, NULL);
if (factory == NULL)
g_error ("It was not possible to register a new layout factory");
}
int
main (int argc, char **argv)
{
CORBA_exception_init (&ev);
init_server_factory (argc, argv);
layout_factory_init ();
bonobo_activate ();
gtk_main ();
return 0;
}
......@@ -157,10 +157,10 @@ vector_corba_object_create (GnomeObject *object)
}
Vector *
vector_new (VectorGetNumFn get, VectorGetValFn,
vector_new (VectorGetNumFn get_numbers, VectorGetValFn get_values,
VectorSetFn set, VectorLenFn len,
GNOME_Gnumeric_VectorNotify notify,
void *data);
void *data)
{
Vector *vector;
GNOME_Gnumeric_Vector corba_vector;
......@@ -181,7 +181,6 @@ vector_new (VectorGetNumFn get, VectorGetValFn,
gnome_object_construct (GNOME_OBJECT (vector), corba_vector);
vector->type = type;
vector->get_numbers = get_numbers;
vector->get_values = get_values;
vector->set = set;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment