Commit 925863b2 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Borders now work. We still don't handle the intersection cases properly.

And the top and left of merged cells will look odd.

2001-01-16  Jody Goldberg <jgoldberg@home.com>

	* src/sheet-style.c (sheet_style_get_uniform) : don't leak border ref.

	* src/workbook.c (workbook_sheet_delete) : disable the undo/redo
	  combos when we clear the undo stack.

2001-01-14  Jody Goldberg <jgoldberg@home.com>

	* src/sheet-style.c (style_row) : don't apply none to a cleared
	  border.

	* src/sheet-style.h (StyleRow) : const.

	* src/mstyle.c (mstyle_get_color) : const.

	* src/pattern.c (gnumeric_background_set_gc) : remove duplicate
	  test, const.

2001-01-13  Jody Goldberg <jgoldberg@home.com>

	* src/item-grid.c (item_grid_draw) : rewrite.

	* src/sheet-control-gui.c (sheet_view_redraw_cell_region) : make the
	  borders wider.

	* src/commands.c (cmd_format) : if there are no borders there is no
	  need to save the surroundings.

	* src/selection.c (selection_contains_colrow) : const

	* src/sheet-style.c (get_style_row) : Fix stupidity.
	(style_row) : ditto.

2001-01-12  Jody Goldberg <jgoldberg@home.com>

	* src/cell-draw.c (cell_draw) : const.

	* src/pattern.c (gnumeric_background_set_gc) : const.
	(gnumeric_background_set_pc) : const.

	* src/sheet-control-gui.c (sheet_view_selection_ant) : No more 'grid'
	  argument.

	* src/item-grid.c : privatize the structure in preparation for panes.

	* src/item-edit.c (entry_create_feedback_range) : no more grid
	  argument.  Use scg instead.
	(item_edit_set_arg) : ditto.

	* src/item-cursor.c (item_cursor_set_arg) : delete the GRID argument
	  it was useless.

	* src/gnumeric-sheet.c (start_cell_selection_at) : Avoid casting the
	  result of a function call.  Remove setting 'Grid' deleted argument.
	(gnumeric_sheet_new) : No more Grid argument.

	* src/preview-grid.c (preview_grid_draw_border) : moved here from
	  item-grid.
parent 4fd05d73
......@@ -6,7 +6,7 @@ Release Critical
----------------
- Styles
- uniform
- uniform_get
- test persistance
- more tuning
......@@ -19,36 +19,10 @@ Release Critical
- Fix Borders
- border style double_line does not handle all of the different
intersection cases.
- We are back to drawing just top and left
- > 1. Rename Sheet1 to Sheet1a.
> 2. Duplicate Sheet1a.
> 3. Remove Sheet1a.
> 4. Undo renaming.
> ** CRITICAL **: file commands.c: line 226 (command_undo): assertion `wb->undo_commands != NULL' failed.
- > 1. Select B2:D3.
> 2. Merge cells.
> 3. Right-click and select "Format".
> 4. Click the alignment tab.
> 5. Select center in both directions.
> 6. Click ok.
> 7. Exit.
> ** CRITICAL **: file style-border.c: line 332 (style_border_unref): assertion `border != style_border_none ()' failed.
> ** CRITICAL **: file style-border.c: line 322 (style_border_unref): assertion `border->ref_count > 0' failed.
> ** CRITICAL **: file style-border.c: line 322 (style_border_unref): assertion `border->ref_count > 0' failed.
> ** CRITICAL **: file style-border.c: line 322 (style_border_unref): assertion `border->ref_count > 0' failed.
Long term breakage
------------------
- > MLK: 44 bytes leaked at 0xd6d960
> g_hash_table_new [ghash.c:89]
> sheet_style_get_uniform [sheet-style.c:1247]
> fmt_dialog_selection_type [dialog-cell-format.c:2258]
> selection_foreach_range [selection.c:1148]
> dialog_cell_format [dialog-cell-format.c:2296]
- Entering "=1e11111" yields "Syntax Error", not "overflow".
In general parsing needs better error messages.
......
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (sheet_style_get_uniform) : don't leak border ref.
* src/workbook.c (workbook_sheet_delete) : disable the undo/redo
combos when we clear the undo stack.
2001-01-14 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (style_row) : don't apply none to a cleared
border.
* src/sheet-style.h (StyleRow) : const.
* src/mstyle.c (mstyle_get_color) : const.
* src/pattern.c (gnumeric_background_set_gc) : remove duplicate
test, const.
2001-01-13 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : rewrite.
* src/sheet-control-gui.c (sheet_view_redraw_cell_region) : make the
borders wider.
* src/commands.c (cmd_format) : if there are no borders there is no
need to save the surroundings.
* src/selection.c (selection_contains_colrow) : const
* src/sheet-style.c (get_style_row) : Fix stupidity.
(style_row) : ditto.
2001-01-12 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : const.
* src/pattern.c (gnumeric_background_set_gc) : const.
(gnumeric_background_set_pc) : const.
* src/sheet-control-gui.c (sheet_view_selection_ant) : No more 'grid'
argument.
* src/item-grid.c : privatize the structure in preparation for panes.
* src/item-edit.c (entry_create_feedback_range) : no more grid
argument. Use scg instead.
(item_edit_set_arg) : ditto.
* src/item-cursor.c (item_cursor_set_arg) : delete the GRID argument
it was useless.
* src/gnumeric-sheet.c (start_cell_selection_at) : Avoid casting the
result of a function call. Remove setting 'Grid' deleted argument.
(gnumeric_sheet_new) : No more Grid argument.
* src/preview-grid.c (preview_grid_draw_border) : moved here from
item-grid.
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* configure.in : Switch to AM_GNOME_GETTEXT and remove the
......
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (sheet_style_get_uniform) : don't leak border ref.
* src/workbook.c (workbook_sheet_delete) : disable the undo/redo
combos when we clear the undo stack.
2001-01-14 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (style_row) : don't apply none to a cleared
border.
* src/sheet-style.h (StyleRow) : const.
* src/mstyle.c (mstyle_get_color) : const.
* src/pattern.c (gnumeric_background_set_gc) : remove duplicate
test, const.
2001-01-13 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : rewrite.
* src/sheet-control-gui.c (sheet_view_redraw_cell_region) : make the
borders wider.
* src/commands.c (cmd_format) : if there are no borders there is no
need to save the surroundings.
* src/selection.c (selection_contains_colrow) : const
* src/sheet-style.c (get_style_row) : Fix stupidity.
(style_row) : ditto.
2001-01-12 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : const.
* src/pattern.c (gnumeric_background_set_gc) : const.
(gnumeric_background_set_pc) : const.
* src/sheet-control-gui.c (sheet_view_selection_ant) : No more 'grid'
argument.
* src/item-grid.c : privatize the structure in preparation for panes.
* src/item-edit.c (entry_create_feedback_range) : no more grid
argument. Use scg instead.
(item_edit_set_arg) : ditto.
* src/item-cursor.c (item_cursor_set_arg) : delete the GRID argument
it was useless.
* src/gnumeric-sheet.c (start_cell_selection_at) : Avoid casting the
result of a function call. Remove setting 'Grid' deleted argument.
(gnumeric_sheet_new) : No more Grid argument.
* src/preview-grid.c (preview_grid_draw_border) : moved here from
item-grid.
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* configure.in : Switch to AM_GNOME_GETTEXT and remove the
......
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (sheet_style_get_uniform) : don't leak border ref.
* src/workbook.c (workbook_sheet_delete) : disable the undo/redo
combos when we clear the undo stack.
2001-01-14 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (style_row) : don't apply none to a cleared
border.
* src/sheet-style.h (StyleRow) : const.
* src/mstyle.c (mstyle_get_color) : const.
* src/pattern.c (gnumeric_background_set_gc) : remove duplicate
test, const.
2001-01-13 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : rewrite.
* src/sheet-control-gui.c (sheet_view_redraw_cell_region) : make the
borders wider.
* src/commands.c (cmd_format) : if there are no borders there is no
need to save the surroundings.
* src/selection.c (selection_contains_colrow) : const
* src/sheet-style.c (get_style_row) : Fix stupidity.
(style_row) : ditto.
2001-01-12 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : const.
* src/pattern.c (gnumeric_background_set_gc) : const.
(gnumeric_background_set_pc) : const.
* src/sheet-control-gui.c (sheet_view_selection_ant) : No more 'grid'
argument.
* src/item-grid.c : privatize the structure in preparation for panes.
* src/item-edit.c (entry_create_feedback_range) : no more grid
argument. Use scg instead.
(item_edit_set_arg) : ditto.
* src/item-cursor.c (item_cursor_set_arg) : delete the GRID argument
it was useless.
* src/gnumeric-sheet.c (start_cell_selection_at) : Avoid casting the
result of a function call. Remove setting 'Grid' deleted argument.
(gnumeric_sheet_new) : No more Grid argument.
* src/preview-grid.c (preview_grid_draw_border) : moved here from
item-grid.
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* configure.in : Switch to AM_GNOME_GETTEXT and remove the
......
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (sheet_style_get_uniform) : don't leak border ref.
* src/workbook.c (workbook_sheet_delete) : disable the undo/redo
combos when we clear the undo stack.
2001-01-14 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (style_row) : don't apply none to a cleared
border.
* src/sheet-style.h (StyleRow) : const.
* src/mstyle.c (mstyle_get_color) : const.
* src/pattern.c (gnumeric_background_set_gc) : remove duplicate
test, const.
2001-01-13 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : rewrite.
* src/sheet-control-gui.c (sheet_view_redraw_cell_region) : make the
borders wider.
* src/commands.c (cmd_format) : if there are no borders there is no
need to save the surroundings.
* src/selection.c (selection_contains_colrow) : const
* src/sheet-style.c (get_style_row) : Fix stupidity.
(style_row) : ditto.
2001-01-12 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : const.
* src/pattern.c (gnumeric_background_set_gc) : const.
(gnumeric_background_set_pc) : const.
* src/sheet-control-gui.c (sheet_view_selection_ant) : No more 'grid'
argument.
* src/item-grid.c : privatize the structure in preparation for panes.
* src/item-edit.c (entry_create_feedback_range) : no more grid
argument. Use scg instead.
(item_edit_set_arg) : ditto.
* src/item-cursor.c (item_cursor_set_arg) : delete the GRID argument
it was useless.
* src/gnumeric-sheet.c (start_cell_selection_at) : Avoid casting the
result of a function call. Remove setting 'Grid' deleted argument.
(gnumeric_sheet_new) : No more Grid argument.
* src/preview-grid.c (preview_grid_draw_border) : moved here from
item-grid.
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* configure.in : Switch to AM_GNOME_GETTEXT and remove the
......
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (sheet_style_get_uniform) : don't leak border ref.
* src/workbook.c (workbook_sheet_delete) : disable the undo/redo
combos when we clear the undo stack.
2001-01-14 Jody Goldberg <jgoldberg@home.com>
* src/sheet-style.c (style_row) : don't apply none to a cleared
border.
* src/sheet-style.h (StyleRow) : const.
* src/mstyle.c (mstyle_get_color) : const.
* src/pattern.c (gnumeric_background_set_gc) : remove duplicate
test, const.
2001-01-13 Jody Goldberg <jgoldberg@home.com>
* src/item-grid.c (item_grid_draw) : rewrite.
* src/sheet-control-gui.c (sheet_view_redraw_cell_region) : make the
borders wider.
* src/commands.c (cmd_format) : if there are no borders there is no
need to save the surroundings.
* src/selection.c (selection_contains_colrow) : const
* src/sheet-style.c (get_style_row) : Fix stupidity.
(style_row) : ditto.
2001-01-12 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : const.
* src/pattern.c (gnumeric_background_set_gc) : const.
(gnumeric_background_set_pc) : const.
* src/sheet-control-gui.c (sheet_view_selection_ant) : No more 'grid'
argument.
* src/item-grid.c : privatize the structure in preparation for panes.
* src/item-edit.c (entry_create_feedback_range) : no more grid
argument. Use scg instead.
(item_edit_set_arg) : ditto.
* src/item-cursor.c (item_cursor_set_arg) : delete the GRID argument
it was useless.
* src/gnumeric-sheet.c (start_cell_selection_at) : Avoid casting the
result of a function call. Remove setting 'Grid' deleted argument.
(gnumeric_sheet_new) : No more Grid argument.
* src/preview-grid.c (preview_grid_draw_border) : moved here from
item-grid.
2001-01-16 Jody Goldberg <jgoldberg@home.com>
* configure.in : Switch to AM_GNOME_GETTEXT and remove the
......
......@@ -140,7 +140,7 @@ cell_split_text (GdkFont *font, char const *text, int const width)
* of the gridlines (marked a).
*/
void
cell_draw (Cell const *cell, MStyle *mstyle,
cell_draw (Cell const *cell, MStyle const *mstyle,
GdkGC *gc, GdkDrawable *drawable, int x1, int y1, int width, int height)
{
StyleFont *style_font;
......
......@@ -4,7 +4,7 @@
#include <glib.h>
#include "gnumeric.h"
void cell_draw (Cell const *cell, MStyle *mstyle,
void cell_draw (Cell const *cell, MStyle const *mstyle,
GdkGC *gc, GdkDrawable *drawable, int x, int y, int height, int width);
#endif /* GNUMERIC_CELL_DRAW_H */
......@@ -1270,10 +1270,12 @@ cmd_format (WorkbookControl *wbc, Sheet *sheet,
Range range = *((Range const *)l->data);
/* Store the containing range to handle borders */
if (range.start.col > 0) range.start.col--;
if (range.start.row > 0) range.start.row--;
if (range.end.col < SHEET_MAX_COLS-1) range.end.col++;
if (range.end.row < SHEET_MAX_ROWS-1) range.end.row++;
if (borders != NULL) {
if (range.start.col > 0) range.start.col--;
if (range.start.row > 0) range.start.row--;
if (range.end.col < SHEET_MAX_COLS-1) range.end.col++;
if (range.end.row < SHEET_MAX_ROWS-1) range.end.row++;
}
os = g_new (CmdFormatOldStyle, 1);
......
......@@ -253,6 +253,7 @@ static void
start_cell_selection_at (GnumericSheet *gsheet, int col, int row)
{
GnomeCanvas *canvas = GNOME_CANVAS (gsheet);
GnomeCanvasItem *tmp;
GnomeCanvasGroup *group = GNOME_CANVAS_GROUP (canvas->root);
Sheet *sheet = gsheet->scg->sheet;
WorkbookControlGUI *wbcg = gsheet->scg->wbcg;
......@@ -266,13 +267,12 @@ start_cell_selection_at (GnumericSheet *gsheet, int col, int row)
item_cursor_set_visibility (gsheet->item_cursor, FALSE);
gsheet->selecting_cell = TRUE;
gsheet->sel_cursor = ITEM_CURSOR (gnome_canvas_item_new (
group,
tmp = gnome_canvas_item_new (group,
item_cursor_get_type (),
"SheetControlGUI", gsheet->scg,
"Grid", gsheet->item_grid,
"Style", ITEM_CURSOR_ANTED, NULL));
item_cursor_set_bounds (ITEM_CURSOR (gsheet->sel_cursor), col, row, col, row);
"Style", ITEM_CURSOR_ANTED, NULL);
gsheet->sel_cursor = ITEM_CURSOR (tmp);
item_cursor_set_bounds (gsheet->sel_cursor, col, row, col, row);
/* If we are selecting a range on a different sheet this may be NULL */
if (gsheet->item_editor)
......@@ -334,7 +334,7 @@ gnumeric_sheet_create_editing_cursor (GnumericSheet *gsheet)
item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (canvas->root),
item_edit_get_type (),
"ItemEdit::Grid", gsheet->item_grid,
"ItemEdit::SheetControlGUI", gsheet->scg,
NULL);
gsheet->item_editor = ITEM_EDIT (item);
......@@ -860,7 +860,6 @@ gnumeric_sheet_new (SheetControlGUI *scg)
item = gnome_canvas_item_new (gsheet_group,
item_cursor_get_type (),
"ItemCursor::SheetControlGUI", scg,
"ItemCursor::Grid", gsheet->item_grid,
NULL);
gsheet->item_cursor = ITEM_CURSOR (item);
item_cursor_set_bounds (gsheet->item_cursor, 0, 0, 0, 0); /* A1 */
......
......@@ -253,6 +253,7 @@ static void
start_cell_selection_at (GnumericSheet *gsheet, int col, int row)
{
GnomeCanvas *canvas = GNOME_CANVAS (gsheet);
GnomeCanvasItem *tmp;
GnomeCanvasGroup *group = GNOME_CANVAS_GROUP (canvas->root);
Sheet *sheet = gsheet->scg->sheet;
WorkbookControlGUI *wbcg = gsheet->scg->wbcg;
......@@ -266,13 +267,12 @@ start_cell_selection_at (GnumericSheet *gsheet, int col, int row)
item_cursor_set_visibility (gsheet->item_cursor, FALSE);
gsheet->selecting_cell = TRUE;
gsheet->sel_cursor = ITEM_CURSOR (gnome_canvas_item_new (
group,
tmp = gnome_canvas_item_new (group,
item_cursor_get_type (),
"SheetControlGUI", gsheet->scg,
"Grid", gsheet->item_grid,
"Style", ITEM_CURSOR_ANTED, NULL));
item_cursor_set_bounds (ITEM_CURSOR (gsheet->sel_cursor), col, row, col, row);
"Style", ITEM_CURSOR_ANTED, NULL);
gsheet->sel_cursor = ITEM_CURSOR (tmp);
item_cursor_set_bounds (gsheet->sel_cursor, col, row, col, row);
/* If we are selecting a range on a different sheet this may be NULL */
if (gsheet->item_editor)
......@@ -334,7 +334,7 @@ gnumeric_sheet_create_editing_cursor (GnumericSheet *gsheet)
item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (canvas->root),
item_edit_get_type (),
"ItemEdit::Grid", gsheet->item_grid,
"ItemEdit::SheetControlGUI", gsheet->scg,
NULL);
gsheet->item_editor = ITEM_EDIT (item);
......@@ -860,7 +860,6 @@ gnumeric_sheet_new (SheetControlGUI *scg)
item = gnome_canvas_item_new (gsheet_group,
item_cursor_get_type (),
"ItemCursor::SheetControlGUI", scg,
"ItemCursor::Grid", gsheet->item_grid,
NULL);
gsheet->item_cursor = ITEM_CURSOR (item);
item_cursor_set_bounds (gsheet->item_cursor, 0, 0, 0, 0); /* A1 */
......
......@@ -19,10 +19,7 @@
#include "workbook-cmd-format.h"
#include "application.h"
#include "style.h"
/* The signal signatures */
typedef void (*ItemBarSignal1) (GtkObject *, gint arg1, gpointer data);
typedef void (*ItemBarSignal2) (GtkObject *, gint arg1, gint arg2, gpointer data);
#include "gnumeric-type-util.h"
#if 0
#ifndef __GNUC__
......@@ -264,10 +261,16 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
if (element >= SHEET_MAX_ROWS)
return;
/* DO NOT enable resizing all until we get rid of
* resize_start_pos. It will be wrong if things ahead of it move
*/
cri = sheet_row_get_info (sheet, element);
pixels = (item_bar->resize_pos != element)
? cri->size_pixels
: item_bar->resize_width;
if (item_bar->resize_pos != -1 &&
((item_bar->resize_pos == element)))
/* || selection_contains_colrow (sheet, element, FALSE))) */
pixels = item_bar->resize_width;
else
pixels = cri->size_pixels;
if (cri->visible) {
total += pixels;
......@@ -304,10 +307,16 @@ item_bar_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int w
if (element >= SHEET_MAX_COLS)
return;
/* DO NOT enable resizing all until we get rid of
* resize_start_pos. It will be wrong if things ahead of it move
*/
cri = sheet_col_get_info (sheet, element);
pixels = (item_bar->resize_pos != element)
? cri->size_pixels
: item_bar->resize_width;
if (item_bar->resize_pos != -1 &&
((item_bar->resize_pos == element)))
/* || selection_contains_colrow (sheet, element, TRUE))) */
pixels = item_bar->resize_width;
else
pixels = cri->size_pixels;
if (cri->visible) {
total += pixels;
......@@ -781,6 +790,14 @@ item_bar_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
item_bar_update (item, NULL, NULL, 0);
}
typedef struct {
GnomeCanvasItemClass parent_class;
/* Signals emited */
void (* selection_changed) (ItemBar *, int column, int modifiers);
void (* size_changed) (ItemBar *, int column, int new_width);
} ItemBarClass;
/*
* ItemBar class initialization
*/
......@@ -818,25 +835,6 @@ item_bar_class_init (ItemBarClass *item_bar_class)
item_class->event = item_bar_event;
}
GtkType
item_bar_get_type (void)
{
static GtkType item_bar_type = 0;
if (!item_bar_type) {
GtkTypeInfo item_bar_info = {
"ItemBar",
sizeof (ItemBar),
sizeof (ItemBarClass),
(GtkClassInitFunc) item_bar_class_init,
(GtkObjectInitFunc) item_bar_init,
NULL, /* reserved_1 */
NULL, /* reserved_2 */
(GtkClassInitFunc) NULL
};
item_bar_type = gtk_type_unique (gnome_canvas_item_get_type (), &item_bar_info);
}
return item_bar_type;
}
GNUMERIC_MAKE_TYPE (item_bar, "ItemBar", ItemBar,
item_bar_class_init, item_bar_init,
gnome_canvas_item_get_type ())
......@@ -4,7 +4,6 @@
#include "gui-gnumeric.h"
#define ITEM_BAR(obj) (GTK_CHECK_CAST((obj), item_bar_get_type (), ItemBar))
#define ITEM_BAR_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), item_bar_get_type (), ItemBarType))
#define IS_ITEM_BAR(o) (GTK_CHECK_TYPE((o), item_bar_get_type ()))
struct _ItemBar {
......@@ -38,12 +37,4 @@ struct _ItemBar {
GtkType item_bar_get_type (void);
void item_bar_fonts_init (ItemBar *item_bar);
typedef struct {
GnomeCanvasItemClass parent_class;
/* Signals emited */
void (* selection_changed) (ItemBar *, int column, int modifiers);
void (* size_changed) (ItemBar *, int column, int new_width);
} ItemBarClass;
#endif /* GNUMERIC_ITEM_BAR_H */
......@@ -50,7 +50,6 @@ static GnomeCanvasItem *item_cursor_parent_class;
enum {
ARG_0,
ARG_SHEET_CONTROL_GUI, /* The SheetControlGUI * argument */
ARG_ITEM_GRID, /* The ItemGrid * argument */
ARG_STYLE, /* The style type */
ARG_BUTTON, /* The button used to drag this cursor around */
ARG_COLOR, /* The optional color */
......@@ -616,7 +615,6 @@ item_cursor_selection_event (GnomeCanvasItem *item, GdkEvent *event)
GNOME_CANVAS_GROUP (canvas->root),
item_cursor_get_type (),
"ItemCursor::SheetControlGUI", ic->scg,
"ItemCursor::Grid", ic->item_grid,
"ItemCursor::Style", style,
"ItemCursor::Button", ic->drag_button,
NULL);
......@@ -1308,9 +1306,6 @@ item_cursor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_SHEET_CONTROL_GUI:
item_cursor->scg = GTK_VALUE_POINTER (*arg);
break;
case ARG_ITEM_GRID:
item_cursor->item_grid = GTK_VALUE_POINTER (*arg);
break;
case ARG_STYLE:
item_cursor->style = GTK_VALUE_INT (*arg);
break;
......@@ -1346,8 +1341,6 @@ item_cursor_class_init (ItemCursorClass *item_cursor_class)
gtk_object_add_arg_type ("ItemCursor::SheetControlGUI", GTK_TYPE_POINTER,
GTK_ARG_WRITABLE, ARG_SHEET_CONTROL_GUI);
gtk_object_add_arg_type ("ItemCursor::Grid", GTK_TYPE_POINTER,
GTK_ARG_WRITABLE, ARG_ITEM_GRID);
gtk_object_add_arg_type ("ItemCursor::Style", GTK_TYPE_INT,
GTK_ARG_WRITABLE, ARG_STYLE);
gtk_object_add_arg_type ("ItemCursor::Button", GTK_TYPE_INT,
......
......@@ -20,7 +20,6 @@ struct _ItemCursor {
GnomeCanvasItem canvas_item;
SheetControlGUI *scg;
ItemGrid *item_grid; /* A copy of our "parent" grid */
Range pos;
CellPos base_corner; /* Corner remains static when rubber banding */
......
......@@ -40,7 +40,7 @@ static GnomeCanvasItem *item_edit_parent_class;
/* The arguments we take */
enum {
ARG_0,
ARG_ITEM_GRID, /* The ItemGrid * argument */
ARG_SHEET_CONTROL_GUI, /* The SheetControlGUI * argument */
};
static void
......@@ -121,7 +121,6 @@ entry_create_feedback_range (ItemEdit *item_edit, Range *range)
GNOME_CANVAS_GROUP (item->canvas->root),
item_cursor_get_type (),
"SheetControlGUI", item_edit->scg,
"Grid", item_edit->item_grid,
"Style", ITEM_CURSOR_BLOCK,
"Color", "red",
NULL);
......@@ -504,12 +503,11 @@ item_edit_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
Sheet *sheet;
GtkEntry *entry;
/* We can only set the item_grid once */
g_return_if_fail (arg_id == ARG_ITEM_GRID);
g_return_if_fail (item_edit->item_grid == NULL);
/* We can only set the sheet-control-gui once */
g_return_if_fail (arg_id == ARG_SHEET_CONTROL_GUI);
g_return_if_fail (item_edit->scg == NULL);
item_edit->item_grid = GTK_VALUE_POINTER (*arg);
item_edit->scg = item_edit->item_grid->scg;
item_edit->scg = GTK_VALUE_POINTER (*arg);
sheet = item_edit->scg->sheet;
item_edit->entry = GTK_ENTRY (workbook_get_entry (item_edit->scg->wbcg));
item_edit->pos = sheet->edit_pos;
......@@ -572,8 +570,8 @@ item_edit_class_init (ItemEditClass *item_edit_class)
object_class = (GtkObjectClass *) item_edit_class;
item_class = (GnomeCanvasItemClass *) item_edit_class;
gtk_object_add_arg_type ("ItemEdit::Grid", GTK_TYPE_POINTER,
GTK_ARG_WRITABLE, ARG_ITEM_GRID);
gtk_object_add_arg_type ("ItemEdit::SheetControlGUI", GTK_TYPE_POINTER,
GTK_ARG_WRITABLE, ARG_SHEET_CONTROL_GUI);
object_class->set_arg = item_edit_set_arg;
object_class->destroy = item_edit_destroy;
......
......@@ -30,6 +30,7 @@
#include "style-border.h"
#include "style-color.h"
#include "pattern.h"
#include "portability.h"
#include <gal/widgets/e-cursors.h>
#include <math.h>
......@@ -63,6 +64,31 @@ enum {
ARG_0,
ARG_SHEET_CONTROL_GUI,
};
typedef enum {
ITEM_GRID_NO_SELECTION,
ITEM_GRID_SELECTING_CELL_RANGE,
ITEM_GRID_SELECTING_FORMULA_RANGE
} ItemGridSelectionType;
struct _ItemGrid {
GnomeCanvasItem canvas_item;
SheetControlGUI *scg;
ItemGridSelectionType selecting;
GdkGC *grid_gc; /* Draw grid gc */
GdkGC *fill_gc; /* Default background fill gc */
GdkGC *gc; /* Color used for the cell */
GdkGC *empty_gc; /* GC used for drawing empty cells */
GdkColor background;
GdkColor grid_color;
GdkColor default_color;
int visual_is_paletted;
};
static void
item_grid_destroy (GtkObject *object)
......@@ -163,38 +189,6 @@ item_grid_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int
gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
}
/*
* NOTE : preview_grid_draw calls this routine also (preview-grid.c)
*/
void
item_grid_draw_border (GdkDrawable *drawable, MStyle *mstyle,
int x, int y, int w, int h,
gboolean const extended_left)
{
StyleBorder const * const top =
mstyle_get_border (mstyle, MSTYLE_BORDER_TOP);
StyleBorder const * const left = extended_left ? NULL :
mstyle_get_border (mstyle, MSTYLE_BORDER_LEFT);
StyleBorder const * const diag =
mstyle_get_border (mstyle, MSTYLE_BORDER_DIAGONAL);
StyleBorder const * const rev_diag =
mstyle_get_border (mstyle, MSTYLE_BORDER_REV_DIAGONAL);
if (top != NULL && top->line_type != STYLE_BORDER_NONE)
style_border_draw (top, STYLE_BORDER_TOP, drawable,
x, y, x + w, y, left, NULL);
if (left != NULL && left->line_type != STYLE_BORDER_NONE)
style_border_draw (left, STYLE_BORDER_LEFT, drawable,
x, y, x, y + h, top, NULL);