Commit 85ff8354 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

go one past the last visible in case the last visible == the last full.

2001-07-06  Jody Goldberg <jgoldberg@home.com>

	* src/item-cursor.c (item_cursor_update) : go one past the last
	  visible in case the last visible == the last full.

	* src/item-bar.c (item_bar_end_resize) : fix typo.

	* src/sheet.c (sheet_update_only_grid) : force a resize after col/row
	  resizes with frozen panes.
parent ca4646db
2001-07-06 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_update) : go one past the last
visible in case the last visible == the last full.
* src/item-bar.c (item_bar_end_resize) : fix typo.
* src/sheet.c (sheet_update_only_grid) : force a resize after col/row
resizes with frozen panes.
2001-07-07 Almer S. Tigelaar <almer@gnome.org>
* src/preview-grid.[ch] (marshal_POINTER__INT_INT): New, custom marshaller.
......
2001-07-06 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_update) : go one past the last
visible in case the last visible == the last full.
* src/item-bar.c (item_bar_end_resize) : fix typo.
* src/sheet.c (sheet_update_only_grid) : force a resize after col/row
resizes with frozen panes.
2001-07-07 Almer S. Tigelaar <almer@gnome.org>
* src/preview-grid.[ch] (marshal_POINTER__INT_INT): New, custom marshaller.
......
2001-07-06 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_update) : go one past the last
visible in case the last visible == the last full.
* src/item-bar.c (item_bar_end_resize) : fix typo.
* src/sheet.c (sheet_update_only_grid) : force a resize after col/row
resizes with frozen panes.
2001-07-07 Almer S. Tigelaar <almer@gnome.org>
* src/preview-grid.[ch] (marshal_POINTER__INT_INT): New, custom marshaller.
......
2001-07-06 Jody Goldberg <jgoldberg@home.com>
* src/item-cursor.c (item_cursor_update) : go one past the last
visible in case the last visible == the last full.
* src/item-bar.c (item_bar_end_resize) : fix typo.
* src/sheet.c (sheet_update_only_grid) : force a resize after col/row
resizes with frozen panes.
2001-07-07 Almer S. Tigelaar <almer@gnome.org>
* src/preview-grid.[ch] (marshal_POINTER__INT_INT): New, custom marshaller.
......
......@@ -32,6 +32,7 @@
# include "sheet-object-container.h"
#endif
#include <gal/widgets/e-cursors.h>
#include <gal/util/e-util.h>
static GnomeCanvasClass *gsheet_parent_class;
......@@ -630,7 +631,8 @@ gnumeric_sheet_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
(*GTK_WIDGET_CLASS (gsheet_parent_class)->size_allocate)(widget, allocation);
gsheet_compute_visible_region (GNUMERIC_SHEET (widget), FALSE);
/* Be extra careful, panes require a full recompute */
gsheet_compute_visible_region (GNUMERIC_SHEET (widget), TRUE);
}
typedef struct {
......@@ -670,33 +672,18 @@ gnumeric_sheet_init (GnumericSheet *gsheet)
gsheet->ic = NULL;
gsheet->ic_attr = NULL;
gsheet->col.first = gsheet->col.last_full = gsheet->col.last_visible = 0;
gsheet->row.first = gsheet->row.last_full = gsheet->row.last_visible = 0;
gsheet->col_offset.first = gsheet->col_offset.last_full = gsheet->col_offset.last_visible = 0;
gsheet->row_offset.first = gsheet->row_offset.last_full = gsheet->row_offset.last_visible = 0;
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_DEFAULT);
}
GtkType
gnumeric_sheet_get_type (void)
{
static GtkType gnumeric_sheet_type = 0;
if (!gnumeric_sheet_type) {
GtkTypeInfo gnumeric_sheet_info = {
"GnumericSheet",
sizeof (GnumericSheet),
sizeof (GnumericSheetClass),
(GtkClassInitFunc) gnumeric_sheet_class_init,
(GtkObjectInitFunc) gnumeric_sheet_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
};
gnumeric_sheet_type = gtk_type_unique (gnome_canvas_get_type (), &gnumeric_sheet_info);
}
return gnumeric_sheet_type;
}
E_MAKE_TYPE (gnumeric_sheet, "GnumericSheet", GnumericSheet,
gnumeric_sheet_class_init, gnumeric_sheet_init,
GNOME_TYPE_CANVAS);
GnumericSheet *
gnumeric_sheet_new (SheetControlGUI *scg, GnumericPane *pane)
......@@ -718,10 +705,6 @@ gnumeric_sheet_new (SheetControlGUI *scg, GnumericPane *pane)
gsheet->scg = scg;
gsheet->pane = pane;
gsheet->row.first = gsheet->row.last_full = gsheet->row.last_visible = 0;
gsheet->col.first = gsheet->col.last_full = gsheet->col.last_visible = 0;
gsheet->row_offset.first = gsheet->row_offset.last_full = gsheet->row_offset.last_visible = 0;
gsheet->col_offset.first = gsheet->col_offset.last_full = gsheet->col_offset.last_visible = 0;
/* FIXME: figure out some real size for the canvas scrolling region */
gnome_canvas_set_scroll_region (GNOME_CANVAS (gsheet), 0, 0,
......@@ -970,15 +953,25 @@ gsheet_compute_visible_region (GnumericSheet *gsheet,
if (full_recompute) {
gsheet->col_offset.first = scg_colrow_distance_get (scg,
TRUE, 0, gsheet->col.first);
if (NULL != scg->pane->col.canvas)
gnome_canvas_scroll_to (scg->pane->col.canvas,
if (NULL != gsheet->pane->col.canvas)
gnome_canvas_scroll_to (gsheet->pane->col.canvas,
gsheet->col_offset.first, 0);
gsheet->row_offset.first = scg_colrow_distance_get (scg,
FALSE, 0, gsheet->row.first);
if (NULL != scg->pane->row.canvas)
gnome_canvas_scroll_to (scg->pane->row.canvas,
if (NULL != gsheet->pane->row.canvas) {
if (gsheet->pane->index == 2) {
printf ("to1[2] 0x%p = %d, %d\n", gsheet->pane->row.canvas,
0, gsheet->row_offset.first);
}
gnome_canvas_scroll_to (gsheet->pane->row.canvas,
0, gsheet->row_offset.first);
if (gsheet->pane->index == 2) {
int left, top;
gnome_canvas_get_scroll_offsets (gsheet->pane->row.canvas, &left, &top);
printf ("o3 0x%p = %d, %d\n", gsheet->pane->row.canvas, left, top);
}
}
gnome_canvas_scroll_to (GNOME_CANVAS (gsheet),
gsheet->col_offset.first,
......
......@@ -32,6 +32,7 @@
# include "sheet-object-container.h"
#endif
#include <gal/widgets/e-cursors.h>
#include <gal/util/e-util.h>
static GnomeCanvasClass *gsheet_parent_class;
......@@ -630,7 +631,8 @@ gnumeric_sheet_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
(*GTK_WIDGET_CLASS (gsheet_parent_class)->size_allocate)(widget, allocation);
gsheet_compute_visible_region (GNUMERIC_SHEET (widget), FALSE);
/* Be extra careful, panes require a full recompute */
gsheet_compute_visible_region (GNUMERIC_SHEET (widget), TRUE);
}
typedef struct {
......@@ -670,33 +672,18 @@ gnumeric_sheet_init (GnumericSheet *gsheet)
gsheet->ic = NULL;
gsheet->ic_attr = NULL;
gsheet->col.first = gsheet->col.last_full = gsheet->col.last_visible = 0;
gsheet->row.first = gsheet->row.last_full = gsheet->row.last_visible = 0;
gsheet->col_offset.first = gsheet->col_offset.last_full = gsheet->col_offset.last_visible = 0;
gsheet->row_offset.first = gsheet->row_offset.last_full = gsheet->row_offset.last_visible = 0;
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_DEFAULT);
}
GtkType
gnumeric_sheet_get_type (void)
{
static GtkType gnumeric_sheet_type = 0;
if (!gnumeric_sheet_type) {
GtkTypeInfo gnumeric_sheet_info = {
"GnumericSheet",
sizeof (GnumericSheet),
sizeof (GnumericSheetClass),
(GtkClassInitFunc) gnumeric_sheet_class_init,
(GtkObjectInitFunc) gnumeric_sheet_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
};
gnumeric_sheet_type = gtk_type_unique (gnome_canvas_get_type (), &gnumeric_sheet_info);
}
return gnumeric_sheet_type;
}
E_MAKE_TYPE (gnumeric_sheet, "GnumericSheet", GnumericSheet,
gnumeric_sheet_class_init, gnumeric_sheet_init,
GNOME_TYPE_CANVAS);
GnumericSheet *
gnumeric_sheet_new (SheetControlGUI *scg, GnumericPane *pane)
......@@ -718,10 +705,6 @@ gnumeric_sheet_new (SheetControlGUI *scg, GnumericPane *pane)
gsheet->scg = scg;
gsheet->pane = pane;
gsheet->row.first = gsheet->row.last_full = gsheet->row.last_visible = 0;
gsheet->col.first = gsheet->col.last_full = gsheet->col.last_visible = 0;
gsheet->row_offset.first = gsheet->row_offset.last_full = gsheet->row_offset.last_visible = 0;
gsheet->col_offset.first = gsheet->col_offset.last_full = gsheet->col_offset.last_visible = 0;
/* FIXME: figure out some real size for the canvas scrolling region */
gnome_canvas_set_scroll_region (GNOME_CANVAS (gsheet), 0, 0,
......@@ -970,15 +953,25 @@ gsheet_compute_visible_region (GnumericSheet *gsheet,
if (full_recompute) {
gsheet->col_offset.first = scg_colrow_distance_get (scg,
TRUE, 0, gsheet->col.first);
if (NULL != scg->pane->col.canvas)
gnome_canvas_scroll_to (scg->pane->col.canvas,
if (NULL != gsheet->pane->col.canvas)
gnome_canvas_scroll_to (gsheet->pane->col.canvas,
gsheet->col_offset.first, 0);
gsheet->row_offset.first = scg_colrow_distance_get (scg,
FALSE, 0, gsheet->row.first);
if (NULL != scg->pane->row.canvas)
gnome_canvas_scroll_to (scg->pane->row.canvas,
if (NULL != gsheet->pane->row.canvas) {
if (gsheet->pane->index == 2) {
printf ("to1[2] 0x%p = %d, %d\n", gsheet->pane->row.canvas,
0, gsheet->row_offset.first);
}
gnome_canvas_scroll_to (gsheet->pane->row.canvas,
0, gsheet->row_offset.first);
if (gsheet->pane->index == 2) {
int left, top;
gnome_canvas_get_scroll_offsets (gsheet->pane->row.canvas, &left, &top);
printf ("o3 0x%p = %d, %d\n", gsheet->pane->row.canvas, left, top);
}
}
gnome_canvas_scroll_to (GNOME_CANVAS (gsheet),
gsheet->col_offset.first,
......
......@@ -398,6 +398,12 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
int total = 1 + gsheet->row_offset.first - y;
int row = gsheet->row.first;
if (gsheet->pane->index == 2) {
int left, top;
gnome_canvas_get_scroll_offsets (canvas, &left, &top);
printf ("offset 0x%p = %d, %d\n", canvas, left, top);
}
rect.x = ib->indent - x;
rect.width = ib->cell_width;
......@@ -600,9 +606,8 @@ set_cursor (ItemBar *ib, int x, int y)
}
static void
item_bar_start_resize (ItemBar *ib)
resize_bar_init (ItemBar *ib, GnumericSheet const * const gsheet)
{
GnumericSheet const * const gsheet = ib->gsheet;
SheetControlGUI const * const scg = gsheet->scg;
Sheet const * const sheet = ((SheetControl *) scg)->sheet;
double const zoom = sheet->last_zoom_factor_used; /* * res / 72.; */
......@@ -610,12 +615,12 @@ item_bar_start_resize (ItemBar *ib)
GnomeCanvasGroup * const group = GNOME_CANVAS_GROUP (canvas->root);
GnomeCanvasPoints * const points =
ib->resize_points = gnome_canvas_points_new (2);
GnomeCanvasItem * item =
gnome_canvas_item_new ( group,
gnome_canvas_line_get_type (),
"fill_color", "black",
"width_pixels", 1,
NULL);
GnomeCanvasItem * item;
item = gnome_canvas_item_new (group, gnome_canvas_line_get_type (),
"fill_color", "black",
"width_pixels", 1,
NULL);
ib->resize_guide = GTK_OBJECT (item);
/* NOTE : Set the position of the stationary line here.
......@@ -641,15 +646,24 @@ item_bar_start_resize (ItemBar *ib)
points->coords [3] = y;
}
item = gnome_canvas_item_new ( group,
gnome_canvas_line_get_type (),
"points", points,
"fill_color", "black",
"width_pixels", 1,
NULL);
item = gnome_canvas_item_new (group, gnome_canvas_line_get_type (),
"points", points,
"fill_color", "black",
"width_pixels", 1,
NULL);
ib->resize_start = GTK_OBJECT (item);
}
static void
item_bar_start_resize (ItemBar *ib)
{
resize_bar_init (ib, ib->gsheet);
#if 0
if (sheet_is_frozen (((SheetControl *) ib->gsheet->scg)->sheet))
resize_bar_init (ib, ib->gsheet);
#endif
}
static void
colrow_tip_setlabel (ItemBar *ib, gboolean const is_cols, int size_pixels)
{
......@@ -679,7 +693,7 @@ item_bar_end_resize (ItemBar *ib, int new_size)
gnome_canvas_points_free (ib->resize_points);
ib->resize_points = NULL;
}
if (ib->resize_guide) {
if (ib->resize_start) {
gtk_object_destroy (ib->resize_start);
ib->resize_start = NULL;
}
......@@ -1054,4 +1068,5 @@ item_bar_class_init (ItemBarClass *item_bar_class)
}
E_MAKE_TYPE (item_bar, "ItemBar", ItemBar,
item_bar_class_init, item_bar_init, GNOME_TYPE_CANVAS_ITEM);
item_bar_class_init, item_bar_init,
GNOME_TYPE_CANVAS_ITEM);
......@@ -25,15 +25,12 @@
#include "ranges.h"
#include "parse-util.h"
#include <gal/widgets/e-cursors.h>
#include <gal/util/e-util.h>
#define ITEM_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_cursor_get_type (), ItemCursorClass))
#define AUTO_HANDLE_SPACE 4
#define CLIP_SAFETY_MARGIN (AUTO_HANDLE_SPACE + 5)
#define IS_LITTLE_SQUARE(item,x,y) \
(((x) > (item)->canvas_item.x2 - 6) && \
((item->auto_fill_handle_at_top && ((y) < (item)->canvas_item.y1 + 6)) || \
((y) > (item)->canvas_item.y2 - 6)))
struct _ItemCursor {
GnomeCanvasItem canvas_item;
......@@ -64,13 +61,13 @@ struct _ItemCursor {
/* Cached values of the last bounding box information used */
int cached_x, cached_y, cached_w, cached_h;
int visible:1;
int use_color:1;
/* Location of auto fill handle */
int auto_fill_handle_at_top:1;
int drag_button;
gboolean visible:1;
gboolean use_color:1;
gboolean auto_fill_handle_at_top:1;
gboolean auto_fill_handle_at_left:1;
GdkPixmap *stipple;
GdkColor color;
};
......@@ -204,9 +201,9 @@ item_cursor_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, in
/* Clip the bounds of the cursor to the visible region of cells */
int const left = MAX (gsheet->col.first-1, item_cursor->pos.start.col);
int const right = MIN (gsheet->col.last_visible, item_cursor->pos.end.col);
int const right = MIN (gsheet->col.last_visible+1, item_cursor->pos.end.col);
int const top = MAX (gsheet->row.first-1, item_cursor->pos.start.row);
int const bottom = MIN (gsheet->row.last_visible, item_cursor->pos.end.row);
int const bottom = MIN (gsheet->row.last_visible+1, item_cursor->pos.end.row);
/* Erase the old cursor */
item_cursor_request_redraw (item_cursor);
......@@ -307,9 +304,6 @@ item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, in
draw_external = 1;
{
GnumericSheet const *gsheet = GNUMERIC_SHEET (item->canvas);
SheetControlGUI const *scg = gsheet->scg;
/* FIXME : too simplistic. do better checking for
* frozen panes */
if (item_cursor->pos.end.row <= gsheet->row.last_full)
draw_handle = 1;
else if (item_cursor->pos.start.row < gsheet->row.first)
......@@ -566,12 +560,30 @@ item_cursor_setup_auto_fill (ItemCursor *item_cursor, ItemCursor const *parent,
item_cursor->base.row = parent->pos.start.row;
}
static inline gboolean
item_cursor_in_drag_handle (ItemCursor *ic, int x, int y)
{
int const y_test = ic->auto_fill_handle_at_top
? ic->canvas_item.y1
: ic->canvas_item.y2;
if ((y_test-AUTO_HANDLE_SPACE) <= y &&
y <= (y_test+AUTO_HANDLE_SPACE)) {
int const x_test = ic->auto_fill_handle_at_left
? ic->canvas_item.x1
: ic->canvas_item.x2;
return (x_test-AUTO_HANDLE_SPACE) <= x &&
x <= (x_test+AUTO_HANDLE_SPACE);
}
return FALSE;
}
static void
item_cursor_set_cursor (GnomeCanvas *canvas, ItemCursor *ic, int x, int y)
{
int cursor;
if (IS_LITTLE_SQUARE (ic, x, y))
if (item_cursor_in_drag_handle (ic, x, y))
cursor = E_CURSOR_THIN_CROSS;
else
cursor = E_CURSOR_ARROW;
......@@ -611,7 +623,7 @@ item_cursor_selection_event (GnomeCanvasItem *item, GdkEvent *event)
* determine which part of the cursor was clicked:
* the border or the handlebox
*/
if (IS_LITTLE_SQUARE (ic, x, y))
if (item_cursor_in_drag_handle (ic, x, y))
style = ITEM_CURSOR_AUTOFILL;
else
style = ITEM_CURSOR_DRAG;
......@@ -1295,39 +1307,6 @@ item_cursor_event (GnomeCanvasItem *item, GdkEvent *event)
}
}
/*
* Instance initialization
*/
static void
item_cursor_init (ItemCursor *item_cursor)
{
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_cursor);
item->x1 = 0;
item->y1 = 0;
item->x2 = 1;
item->y2 = 1;
item_cursor->pos.start.col = 0;
item_cursor->pos.end.col = 0;
item_cursor->pos.start.row = 0;
item_cursor->pos.end.row = 0;
item_cursor->col_delta = 0;
item_cursor->row_delta = 0;
item_cursor->tip = NULL;
item_cursor->style = ITEM_CURSOR_SELECTION;
item_cursor->gc = NULL;
item_cursor->state = 0;
item_cursor->animation_timer = -1;
item_cursor->visible = TRUE;
item_cursor->auto_fill_handle_at_top = FALSE;
item_cursor->drag_button = -1;
}
static void
item_cursor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
......@@ -1349,9 +1328,7 @@ item_cursor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
case ARG_COLOR: {
GdkColor color;
char *color_name;
color_name = GTK_VALUE_STRING (*arg);
char *color_name = GTK_VALUE_STRING (*arg);
if (gnome_canvas_get_color (item->canvas, color_name, &color)){
item_cursor->color = color;
item_cursor->use_color = 1;
......@@ -1400,25 +1377,37 @@ item_cursor_class_init (ItemCursorClass *item_cursor_class)
item_class->event = item_cursor_event;
}
GtkType
item_cursor_get_type (void)
static void
item_cursor_init (ItemCursor *item_cursor)
{
static GtkType item_cursor_type = 0;
if (!item_cursor_type) {
GtkTypeInfo item_cursor_info = {
"ItemCursor",
sizeof (ItemCursor),
sizeof (ItemCursorClass),
(GtkClassInitFunc) item_cursor_class_init,
(GtkObjectInitFunc) item_cursor_init,
NULL, /* reserved_1 */
NULL, /* reserved_2 */
(GtkClassInitFunc) NULL
};
GnomeCanvasItem *item = GNOME_CANVAS_ITEM (item_cursor);
item_cursor_type = gtk_type_unique (gnome_canvas_item_get_type (), &item_cursor_info);
}
item->x1 = 0;
item->y1 = 0;
item->x2 = 1;
item->y2 = 1;
item_cursor->pos.start.col = 0;
item_cursor->pos.end.col = 0;
item_cursor->pos.start.row = 0;
item_cursor->pos.end.row = 0;
item_cursor->col_delta = 0;
item_cursor->row_delta = 0;
item_cursor->tip = NULL;
item_cursor->style = ITEM_CURSOR_SELECTION;
item_cursor->gc = NULL;
item_cursor->state = 0;
item_cursor->animation_timer = -1;
return item_cursor_type;
item_cursor->visible = TRUE;
item_cursor->auto_fill_handle_at_top = FALSE;
item_cursor->auto_fill_handle_at_left = FALSE;
item_cursor->drag_button = -1;
}
E_MAKE_TYPE (item_cursor, "ItemCursor", ItemCursor,
item_cursor_class_init, item_cursor_init,
GNOME_TYPE_CANVAS_ITEM);
......@@ -1103,4 +1103,5 @@ item_grid_class_init (ItemGridClass *item_grid_class)
}
E_MAKE_TYPE (item_grid, "ItemGrid", ItemGrid,
item_grid_class_init, item_grid_init, GNOME_TYPE_CANVAS_ITEM);
item_grid_class_init, item_grid_init,
GNOME_TYPE_CANVAS_ITEM);
......@@ -58,10 +58,13 @@ static void scg_unant (SheetControl *sc);
/* FIXME : Audit all of the uses of this */
GnumericSheet *
scg_primary_pane (SheetControlGUI *scg)
scg_pane (SheetControlGUI *scg, int p)
{
g_return_val_if_fail (IS_SHEET_CONTROL_GUI (scg), NULL);
return scg->pane[0].gsheet;
g_return_val_if_fail (p >= 0, NULL);
g_return_val_if_fail (p < 4, NULL);
return scg->pane[p].gsheet;
}
WorkbookControlGUI *
......@@ -206,7 +209,7 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
zoom = sheet->last_zoom_factor_used;
/* Recalibrate the starting offsets */
gsheet = scg_primary_pane (scg);
gsheet = scg_pane (scg, 0);
gsheet->col_offset.first = scg_colrow_distance_get (scg,
TRUE, 0, gsheet->col.first);
gsheet->row_offset.first = scg_colrow_distance_get (scg,
......@@ -224,16 +227,16 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
gnome_canvas_set_scroll_region (scg->pane[0].row.canvas,
0, 0, w / zoom, GNUMERIC_SHEET_FACTOR_Y / zoom);
} else {
CellPos const *tl = &sheet->frozen.top_left;
CellPos const *br = &sheet->frozen.bottom_right;
int const l = scg_colrow_distance_get (scg, TRUE,
0, sheet->frozen.top_left.col);
0, tl->col);
int const r = scg_colrow_distance_get (scg, TRUE,
sheet->frozen.top_left.col,
sheet->frozen.bottom_right.col +1);
tl->col, br->col + 1) + l;
int const t = scg_colrow_distance_get (scg, FALSE,
0, sheet->frozen.top_left.row);
0, tl->row);
int const b = scg_colrow_distance_get (scg, FALSE,
sheet->frozen.top_left.row,
sheet->frozen.bottom_right.row +1);
tl->row, br->row + 1) + t;
int i;
/* pane 0 has already been done */
......@@ -245,6 +248,10 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
scg, FALSE, 0, p->gsheet->row.first);
}
gtk_widget_set_usize (GTK_WIDGET (scg->pane[1].gsheet), r - l, -1);
gtk_widget_set_usize (GTK_WIDGET (scg->pane[2].gsheet), r - l, b - t);
gtk_widget_set_usize (GTK_WIDGET (scg->pane[3].gsheet), -1, b - t);
/* The item_bar_calcs should be equal */
h = item_bar_calc_size (scg->pane[2].col.item);
gtk_widget_set_usize (GTK_WIDGET (scg->pane[2].col.canvas), r - l, h);
......@@ -258,17 +265,12 @@ scg_resize (SheetControl *sc, gboolean force_scroll)
gtk_widget_set_usize (GTK_WIDGET (scg->pane[2].row.canvas), w, b - t);
gnome_canvas_set_scroll_region (scg->pane[2].row.canvas,
0, t / zoom, w / zoom, b / zoom);
printf ("%g, %g -> %g, %g\n",
0., t / zoom, w / zoom, b / zoom);
gnome_canvas_set_scroll_region (scg->pane[0].row.canvas,
0, b / zoom, w / zoom, GNUMERIC_SHEET_FACTOR_Y / zoom);
gtk_widget_set_usize (GTK_WIDGET (scg->pane[1].gsheet), r - l, -1);
gtk_widget_set_usize (GTK_WIDGET (scg->pane[2].gsheet), r - l, b - t);
gtk_widget_set_usize (GTK_WIDGET (scg->pane[3].gsheet), -1, b - t);
}
scg_make_cell_visible (scg,
sheet->edit_pos.col, sheet->edit_pos.row, force_scroll);
scg_update_cursor_pos (sc);
}
......@@ -299,31 +301,51 @@ scg_set_zoom_factor (SheetControl *sc)
}
static void
canvas_bar_realized (GtkWidget *widget, gpointer data)
canvas_bar_realized (GtkWidget *widget, gpointer ignored)
{
gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE);
}
static void
canvas_bar_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
gpointer data)
{
GnumericPane *pane = data;
Sheet *sheet = sc_sheet (SHEET_CONTROL (pane->gsheet->scg));
CellPos const *tl = &sheet->frozen.top_left;
puts ("realized");
gnumeric_sheet_set_top_left (pane->gsheet,
tl->col, tl->row, FALSE);
bar_set_top_row (pane->gsheet, pane->gsheet->row.first);
bar_set_left_col (pane->gsheet, pane->gsheet->col.first);
{
int left, top;
gnome_canvas_get_scroll_offsets (pane->gsheet, &left, &top);
printf ("o2 0x%p = %d, %d\n", pane->row.canvas, left, top);
}
}
static GnomeCanvas *
new_canvas_bar (GnumericSheet *gsheet, gboolean is_col_header, ItemBar **itemp)
{
GtkWidget *canvas = gnome_canvas_new ();
GnomeCanvasGroup *group =
GNOME_CANVAS_GROUP (GNOME_CANVAS (canvas)->root);
GnomeCanvasItem *item =
gnome_canvas_item_new (group,
item_bar_get_type (),
"ItemBar::GnumericSheet", gsheet,
"ItemBar::IsColHeader", is_col_header,
NULL);
new_canvas_bar (GnumericPane *pane, gboolean is_col_header, ItemBar **itemp)
{
GnomeCanvas *canvas = GNOME_CANVAS (gnome_canvas_new ());
GnomeCanvasGroup *group = GNOME_CANVAS_GROUP (canvas->root);
GnomeCanvasItem *item = gnome_canvas_item_new (group,
item_bar_get_type (),
"ItemBar::GnumericSheet", pane->gsheet,
"ItemBar::IsColHeader", is_col_header,
NULL);
item_bar_calc_size (ITEM_BAR (item));
gtk_signal_connect (GTK_OBJECT (canvas), "realize",
(GtkSignalFunc) canvas_bar_realized,
NULL);
canvas_bar_realized, NULL);
if (pane->index == 2)
gtk_signal_connect (GTK_OBJECT (canvas), "size_allocate",
canvas_bar_size_allocate, pane);
*itemp = ITEM_BAR (item);
return GNOME_CANVAS (canvas);
return canvas;
}
/**
......@@ -349,7 +371,7 @@ scg_scrollbar_config (SheetControl const *sc)
SheetControlGUI *scg = SHEET_CONTROL_GUI (sc);
GtkAdjustment *va = GTK_ADJUSTMENT (scg->va);
GtkAdjustment *ha = GTK_ADJUSTMENT (scg->ha);
GnumericSheet *gsheet = scg_primary_pane (scg);
GnumericSheet *gsheet = scg_pane (scg, 0);
Sheet *sheet = sc->sheet;
int const last_col = gsheet->col.last_full;
int const last_row = gsheet->row.last_full;
......@@ -506,7 +528,7 @@ scg_colrow_select (SheetControlGUI *scg, gboolean is_cols,
0, index, SHEET_MAX_COLS-1, index);
} else {
/* FIXME : do we want to take the panes into account too ? */
GnumericSheet *gsheet = scg_primary_pane (scg);
GnumericSheet *gsheet = scg_pane (scg, 0);
if (is_cols)
sheet_selection_add_range (sheet,
......@@ -575,7 +597,7 @@ cb_table_destroy (GtkObject *table, SheetControlGUI *scg)
/* Only pane-0 ever gets focus */
if (NULL != toplevel &&
toplevel->focus_widget == GTK_WIDGET (scg_primary_pane (scg)))
toplevel->focus_widget == GTK_WIDGET (scg_pane (scg, 0)))
gtk_window_set_focus (toplevel, NULL);
}
scg->table = NULL;
......@@ -649,7 +671,7 @@ void
scg_set_left_col (SheetControlGUI *scg, int new_first_col)
{
/* TODO : panes */
gnumeric_sheet_set_left_col (scg_primary_pane (scg), new_first_col);
gnumeric_sheet_set_left_col (scg_pane (scg, 0), new_first_col);
}