Commit 19d858dd authored by Arturo Espinosa's avatar Arturo Espinosa

sync trough cvs

parent b5551647
......@@ -14,6 +14,8 @@ gnumeric_SOURCES = \
gnumeric-sheet.h \
gnumeric-sheet.c \
gnumeric.h \
item-grid.c \
item-grid.h \
main.c \
sheet.c \
sheet.h \
......
......@@ -9,15 +9,9 @@ enum {
GNUMERIC_SHEET_LAST_SIGNAL
};
enum {
ITEM_SHEET_LAST_SIGNAL
};
static guint sheet_signals [GNUMERIC_SHEET_LAST_SIGNAL] = { 0 };
static guint item_signals [ITEM_SHEET_LAST_SIGNAL] = { 0 };
static GnomeCanvasClass *sheet_parent_class;
static GtkObjectClass *item_parent_class;
static void
gnumeric_sheet_destroy (GtkObject *object)
......@@ -31,8 +25,8 @@ gnumeric_sheet_destroy (GtkObject *object)
(*GTK_OBJECT_CLASS (sheet_parent_class)->destroy)(object);
}
GtkWidget *
gnumeric_sheet_new (Sheet *sheet)
static GnumericSheet *
gnumeric_sheet_create (Sheet *sheet)
{
GnumericSheet *gsheet;
GnomeCanvas *canvas;
......@@ -49,6 +43,23 @@ gnumeric_sheet_new (Sheet *sheet)
gsheet->top_col = 0;
gsheet->top_row = 0;
return gsheet;
}
GtkWidget *
gnumeric_sheet_new (Sheet *sheet)
{
GnumericSheet *gsheet;
gsheet = gnumeric_sheet_create (sheet);
gnome_canvas_set_size (GNOME_CANVAS (gsheet), 300, 100);
gsheet->item_grid = ITEM_GRID (gnome_canvas_item_new (
GNOME_CANVAS (gsheet),
GNOME_CANVAS_GROUP (GNOME_CANVAS(gsheet)->root),
item_grid_get_type (),
"ItemGrid::default_grid_color", "gray",
NULL));
return GTK_WIDGET (gsheet);
}
......@@ -69,6 +80,15 @@ gnumeric_sheet_class_init (GnumericSheetClass *class)
object_class->destroy = gnumeric_sheet_destroy;
}
static void
gnumeric_sheet_init (GnumericSheet *gsheet)
{
GnomeCanvas *canvas = GNOME_CANVAS (gsheet);
printf ("idel_id=%d\n", canvas->idle_id);
printf ("pixs=%g\n", canvas->pixels_per_unit);
}
GtkType
gnumeric_sheet_get_type (void)
{
......@@ -80,7 +100,7 @@ gnumeric_sheet_get_type (void)
sizeof (GnumericSheet),
sizeof (GnumericSheetClass),
(GtkClassInitFunc) gnumeric_sheet_class_init,
(GtkObjectInitFunc) NULL,
(GtkObjectInitFunc) gnumeric_sheet_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
......
#ifndef GNUMERIC_SHEET_H
#define GNUMERIC_SHEET_H
#include "item-grid.h"
#define GNUMERIC_TYPE_SHEET (gnumeric_sheet_get_type ())
#define GNUMERIC_SHEET(obj) (GTK_CHECK_CAST((obj), GNUMERIC_TYPE_SHEET, GnumericSheet))
#define GNUMERIC_SHEET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), GNUMERIC_TYPE_SHEET))
......@@ -13,8 +15,7 @@ typedef struct {
ColType top_col;
RowType top_row;
/* Font used for the labels in the columns and rows */
GdkFont *label_font;
ItemGrid *item_grid;
} GnumericSheet;
GtkType gnumeric_sheet_get_type (void);
......
......@@ -9,15 +9,9 @@ enum {
GNUMERIC_SHEET_LAST_SIGNAL
};
enum {
ITEM_SHEET_LAST_SIGNAL
};
static guint sheet_signals [GNUMERIC_SHEET_LAST_SIGNAL] = { 0 };
static guint item_signals [ITEM_SHEET_LAST_SIGNAL] = { 0 };
static GnomeCanvasClass *sheet_parent_class;
static GtkObjectClass *item_parent_class;
static void
gnumeric_sheet_destroy (GtkObject *object)
......@@ -31,8 +25,8 @@ gnumeric_sheet_destroy (GtkObject *object)
(*GTK_OBJECT_CLASS (sheet_parent_class)->destroy)(object);
}
GtkWidget *
gnumeric_sheet_new (Sheet *sheet)
static GnumericSheet *
gnumeric_sheet_create (Sheet *sheet)
{
GnumericSheet *gsheet;
GnomeCanvas *canvas;
......@@ -49,6 +43,23 @@ gnumeric_sheet_new (Sheet *sheet)
gsheet->top_col = 0;
gsheet->top_row = 0;
return gsheet;
}
GtkWidget *
gnumeric_sheet_new (Sheet *sheet)
{
GnumericSheet *gsheet;
gsheet = gnumeric_sheet_create (sheet);
gnome_canvas_set_size (GNOME_CANVAS (gsheet), 300, 100);
gsheet->item_grid = ITEM_GRID (gnome_canvas_item_new (
GNOME_CANVAS (gsheet),
GNOME_CANVAS_GROUP (GNOME_CANVAS(gsheet)->root),
item_grid_get_type (),
"ItemGrid::default_grid_color", "gray",
NULL));
return GTK_WIDGET (gsheet);
}
......@@ -69,6 +80,15 @@ gnumeric_sheet_class_init (GnumericSheetClass *class)
object_class->destroy = gnumeric_sheet_destroy;
}
static void
gnumeric_sheet_init (GnumericSheet *gsheet)
{
GnomeCanvas *canvas = GNOME_CANVAS (gsheet);
printf ("idel_id=%d\n", canvas->idle_id);
printf ("pixs=%g\n", canvas->pixels_per_unit);
}
GtkType
gnumeric_sheet_get_type (void)
{
......@@ -80,7 +100,7 @@ gnumeric_sheet_get_type (void)
sizeof (GnumericSheet),
sizeof (GnumericSheetClass),
(GtkClassInitFunc) gnumeric_sheet_class_init,
(GtkObjectInitFunc) NULL,
(GtkObjectInitFunc) gnumeric_sheet_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
......
#ifndef GNUMERIC_SHEET_H
#define GNUMERIC_SHEET_H
#include "item-grid.h"
#define GNUMERIC_TYPE_SHEET (gnumeric_sheet_get_type ())
#define GNUMERIC_SHEET(obj) (GTK_CHECK_CAST((obj), GNUMERIC_TYPE_SHEET, GnumericSheet))
#define GNUMERIC_SHEET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), GNUMERIC_TYPE_SHEET))
......@@ -13,8 +15,7 @@ typedef struct {
ColType top_col;
RowType top_row;
/* Font used for the labels in the columns and rows */
GdkFont *label_font;
ItemGrid *item_grid;
} GnumericSheet;
GtkType gnumeric_sheet_get_type (void);
......
......@@ -6,12 +6,19 @@
/* The signals we emit */
enum {
ITEM_GRID_TEST,
ITEM_GRID_LAST_SIGNAL
};
static guint item_grid_signals [ITEM_GRID_LAST_SIGNAL] = { 0 };
static GnomeCanvasItem *item_grid_parent_class;
/* The arguments we take */
enum {
ARG_0,
ARG_DEFAULT_GRID_COLOR
};
static void
item_grid_destroy (GtkObject *object)
{
......@@ -23,16 +30,142 @@ item_grid_destroy (GtkObject *object)
(*GTK_OBJECT_CLASS (item_grid_parent_class)->destroy)(object);
}
static void
item_grid_realize (GnomeCanvasItem *item)
{
ItemGrid *item_grid;
item_grid = ITEM_GRID (item);
item_grid->grid_gc = gdk_gc_new (GTK_WIDGET (item->canvas)->window);
}
static void
item_grid_unrealize (GnomeCanvasItem *item)
{
ItemGrid *item_grid = ITEM_GRID (item);
gdk_gc_unref (item_grid->grid_gc);
item_grid->grid_gc = 0;
}
static void
item_grid_reconfigure (GnomeCanvasItem *item)
{
g_warning ("item_grid_reconfigure\n");
}
static void
item_grid_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
int x, int y, int width, int height)
{
ItemGrid *item_grid = ITEM_GRID (item);
printf ("item_grid_draw (%d, %d) for (%d, %d)\n",
x, y, width, height);
gdk_draw_line (drawable,
item_grid->grid_gc,
x, y, x+width, y+height);
}
static double
item_grid_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
GnomeCanvasItem **actual_item)
{
printf ("item_grid_point: %g,%g (%d,%d)\n",
x, y, cx, cy);
*actual_item = NULL;
return 0.0;
}
static void
item_grid_translate (GnomeCanvasItem *item, double dx, double dy)
{
printf ("item_grid_translate %g, %g\n", dx, dy);
}
static gint
item_grid_event (GnomeCanvasItem *item, GdkEvent *event)
{
printf ("Event\n");
return 0;
}
/*
* Instance initialization
*/
static void
item_grid_init (ItemGrid *item_grid)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_grid);
item->x1 = 0;
item->y1 = 0;
/* A big number for now */
item->x2 = 9999999;
item->y2 = 9999999;
item_grid->left_col = 0;
item_grid->top_row = 0;
item_grid->top_offset = 0;
item_grid->left_offset = 0;
#if 0
gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent),
item);
#endif
}
static void
item_grid_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
GnomeCanvasItem *item;
ItemGrid *item_grid;
GdkColor color;
item = GNOME_CANVAS_ITEM (o);
item_grid = ITEM_GRID (o);
switch (arg_id){
case ARG_DEFAULT_GRID_COLOR:
if (gnome_canvas_get_color (item->canvas,
GTK_VALUE_STRING (*arg), &color))
break;
item_grid->default_grid_color = color.pixel;
}
}
/*
* ItemGrid class initialization
*/
static void
item_grid_class_init (ItemGridClass *item_grid_class)
{
GtkObjectClass *object_class;
GnomeCanvasItem *item_class;
GnomeCanvasItemClass *item_class;
item_grid_parent_class = gtk_type_class (gnome_canvas_item_get_type());
object_class = (GtkObjectClass *) item_grid_class;
item_class = (GnomeCanvasItemClass *) item_grid_class;
gtk_object_add_arg_type
gtk_object_add_arg_type ("ItemGrid::default_grid_color",
GTK_TYPE_STRING,
GTK_ARG_WRITABLE,
ARG_DEFAULT_GRID_COLOR);
object_class->set_arg = item_grid_set_arg;
/* GnomeCanvasItem method overrides */
item_class->realize = item_grid_realize;
item_class->unrealize = item_grid_unrealize;
item_class->reconfigure = item_grid_reconfigure;
item_class->draw = item_grid_draw;
item_class->point = item_grid_point;
item_class->translate = item_grid_translate;
item_class->event = item_grid_event;
}
GtkType
......@@ -40,7 +173,7 @@ item_grid_get_type (void)
{
static GtkType item_grid_type = 0;
if (!re_type) {
if (!item_grid_type) {
GtkTypeInfo item_grid_info = {
"ItemGrid",
sizeof (ItemGrid),
......@@ -55,5 +188,5 @@ item_grid_get_type (void)
item_grid_type = gtk_type_unique (gnome_canvas_item_get_type (), &item_grid_info);
}
return re_type;
return item_grid_type;
}
#ifndef ITEM_GRID_H
#define ITEM_GRID_H
#deinfe ITEM_GRID(obj) (GTK_CHECK_CAST((obj), item_grid_get_type (), ItemGrid))
#define ITEM_GRID(obj) (GTK_CHECK_CAST((obj), item_grid_get_type (), ItemGrid))
#define ITEM_GRID_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_grid_get_type ()))
#define IS_ITEM_GRID(o) (GTK_CHECK_TYPE((o), item_grid_get_type ()))
......@@ -18,7 +18,8 @@ typedef struct {
long top_offset;
long left_offset;
GdkGC *default_grid_color;
GdkGC *grid_gc;
gulong default_grid_color;
} ItemGrid;
......
......@@ -36,7 +36,7 @@ workbook_new (void)
gnome_app_set_contents (GNOME_APP (wb->toplevel), wb->notebook);
gnome_app_create_menus (GNOME_APP (wb->toplevel), workbook_menu);
gtk_widget_show (wb->notebook);
gtk_widget_show_all (wb->notebook);
return wb;
}
......
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