Commit bb5371b7 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Improve the handling of backgrounds and selection in the presence of


Improve the handling of backgrounds and selection
in the presence of spanning columns.

Improve borders.  Somewhat more correct handling of double lined borders.
Still mostly wrong, but its a start.

2000-02-28  Jody Goldberg <jgoldberg@home.com>

	* src/expr.h : Move FunctionDefinition to
	* src/gnumeric.h : here.

	* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
	(col_compare) : Ditto.
	(row_init_span) : Delete.
	(free_hash_value) : Renamed from free_hash_key.
	(cell_register_span) : Register all cells in a span, malloc a
	  CellSpanInfo to store a descriptor about the first and last cols.
	(assemble_unregister_span_list) : Delete.
	(span_remove) : New function for use by g_hash_table_foreach_remove.
	(cell_unregister_span) : Use g_hash_table_foreach_remove.
	(row_cell_get_displayed_at) : Adjust to new descriptor.
	(row_span_get) : New function.

	* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.

	* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
	  Use new CellSpanInfo to avoid recomputing spans every time.
	(cell_is_blank) : Remove hack about treating empty strings as empty.

	* src/cellspan.h : New file.  Move span decls here.

	* src/item-grid.c (item_grid_draw) : Rework to correctly handle
	  backgrounds and borders for spanning columns.

2000-02-27  Jody Goldberg <jgoldberg@home.com>

	* src/cell.c (cell_is_blank) : Update.

	* src/border.c (style_border_draw) : Make somewhat more correct.
	  Still broken for non-top-left corners.

	* src/item-grid.c (item_grid_draw_border) : Ditto.
	(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
	  handle spans more cleanly.
	(item_grid_draw_cell) : handle conditionals for displaying contents here.
	  Remove all handling of backgrounds.
parent 2564cc1e
......@@ -4,14 +4,8 @@ and longer term bugs.
Release Critical
----------------
- Selection highlighting of spanning columns draws columns outside the selection
range as if they were selected.
Entering '1e99' in a cell with format 'General' is broken.
Long term breakage
------------------
- border style double_line does not respect the background colour of the cell
being painted.
- border style double_line does handle all of the different intersection cases.
- Borders above below cells spanning cols are lost.
2000-02-28 Jody Goldberg <jgoldberg@home.com>
* src/expr.h : Move FunctionDefinition to
* src/gnumeric.h : here.
* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
(col_compare) : Ditto.
(row_init_span) : Delete.
(free_hash_value) : Renamed from free_hash_key.
(cell_register_span) : Register all cells in a span, malloc a
CellSpanInfo to store a descriptor about the first and last cols.
(assemble_unregister_span_list) : Delete.
(span_remove) : New function for use by g_hash_table_foreach_remove.
(cell_unregister_span) : Use g_hash_table_foreach_remove.
(row_cell_get_displayed_at) : Adjust to new descriptor.
(row_span_get) : New function.
* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.
* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
Use new CellSpanInfo to avoid recomputing spans every time.
(cell_is_blank) : Remove hack about treating empty strings as empty.
* src/cellspan.h : New file. Move span decls here.
* src/item-grid.c (item_grid_draw) : Rework to correctly handle
backgrounds and borders for spanning columns.
2000-02-27 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_is_blank) : Update.
* src/border.c (style_border_draw) : Make somewhat more correct.
Still broken for non-top-left corners.
* src/item-grid.c (item_grid_draw_border) : Ditto.
(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
handle spans more cleanly.
(item_grid_draw_cell) : handle conditionals for displaying contents here.
Remove all handling of backgrounds.
2000-02-28 Michael Meeks <michael@helixcode.com>
* src/xml-io.c (xml_sheet_read, xml_sheet_write): kill for now.
......@@ -48,6 +89,14 @@
* doc/python-gnumeric.txt: New file. Documents the Python plugin.
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (CurrencySymbol) : Add symbols and names to
translation list.
* src/workbook.c (insert_object_cmd) : Bug 6499.
Move Define name to the insert menu to avoid conflict.
2000-02-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/xml-io.c (xml_read_solver): New. (xml_write_solver): New.
......
2000-02-28 Jody Goldberg <jgoldberg@home.com>
* src/expr.h : Move FunctionDefinition to
* src/gnumeric.h : here.
* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
(col_compare) : Ditto.
(row_init_span) : Delete.
(free_hash_value) : Renamed from free_hash_key.
(cell_register_span) : Register all cells in a span, malloc a
CellSpanInfo to store a descriptor about the first and last cols.
(assemble_unregister_span_list) : Delete.
(span_remove) : New function for use by g_hash_table_foreach_remove.
(cell_unregister_span) : Use g_hash_table_foreach_remove.
(row_cell_get_displayed_at) : Adjust to new descriptor.
(row_span_get) : New function.
* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.
* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
Use new CellSpanInfo to avoid recomputing spans every time.
(cell_is_blank) : Remove hack about treating empty strings as empty.
* src/cellspan.h : New file. Move span decls here.
* src/item-grid.c (item_grid_draw) : Rework to correctly handle
backgrounds and borders for spanning columns.
2000-02-27 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_is_blank) : Update.
* src/border.c (style_border_draw) : Make somewhat more correct.
Still broken for non-top-left corners.
* src/item-grid.c (item_grid_draw_border) : Ditto.
(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
handle spans more cleanly.
(item_grid_draw_cell) : handle conditionals for displaying contents here.
Remove all handling of backgrounds.
2000-02-28 Michael Meeks <michael@helixcode.com>
* src/xml-io.c (xml_sheet_read, xml_sheet_write): kill for now.
......@@ -48,6 +89,14 @@
* doc/python-gnumeric.txt: New file. Documents the Python plugin.
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (CurrencySymbol) : Add symbols and names to
translation list.
* src/workbook.c (insert_object_cmd) : Bug 6499.
Move Define name to the insert menu to avoid conflict.
2000-02-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/xml-io.c (xml_read_solver): New. (xml_write_solver): New.
......
......@@ -29,6 +29,7 @@ Jody:
* More work on undo.
* Parse interbook references.
* Mostly correct sizing of MS Excel cols/rows and objects.
* Border combo.
Jon:
* Cursor fixes and speedups.
......@@ -41,6 +42,7 @@ Michael:
Dom Lachowicz :
* libgladify the plugin manager.
* Improve color combo.
Mike Kestner:
* Add file menu file history.
......@@ -51,6 +53,7 @@ Almer :
- Pops-up when pasting from external applications.
- Preview is drawn faster and is interactive.
- More separators to choose from when doing a CSV import
--------------------------------------------------------------------------
Gnumeric 0.48
......
2000-02-28 Jody Goldberg <jgoldberg@home.com>
* src/expr.h : Move FunctionDefinition to
* src/gnumeric.h : here.
* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
(col_compare) : Ditto.
(row_init_span) : Delete.
(free_hash_value) : Renamed from free_hash_key.
(cell_register_span) : Register all cells in a span, malloc a
CellSpanInfo to store a descriptor about the first and last cols.
(assemble_unregister_span_list) : Delete.
(span_remove) : New function for use by g_hash_table_foreach_remove.
(cell_unregister_span) : Use g_hash_table_foreach_remove.
(row_cell_get_displayed_at) : Adjust to new descriptor.
(row_span_get) : New function.
* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.
* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
Use new CellSpanInfo to avoid recomputing spans every time.
(cell_is_blank) : Remove hack about treating empty strings as empty.
* src/cellspan.h : New file. Move span decls here.
* src/item-grid.c (item_grid_draw) : Rework to correctly handle
backgrounds and borders for spanning columns.
2000-02-27 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_is_blank) : Update.
* src/border.c (style_border_draw) : Make somewhat more correct.
Still broken for non-top-left corners.
* src/item-grid.c (item_grid_draw_border) : Ditto.
(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
handle spans more cleanly.
(item_grid_draw_cell) : handle conditionals for displaying contents here.
Remove all handling of backgrounds.
2000-02-28 Michael Meeks <michael@helixcode.com>
* src/xml-io.c (xml_sheet_read, xml_sheet_write): kill for now.
......@@ -48,6 +89,14 @@
* doc/python-gnumeric.txt: New file. Documents the Python plugin.
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (CurrencySymbol) : Add symbols and names to
translation list.
* src/workbook.c (insert_object_cmd) : Bug 6499.
Move Define name to the insert menu to avoid conflict.
2000-02-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/xml-io.c (xml_read_solver): New. (xml_write_solver): New.
......
2000-02-28 Jody Goldberg <jgoldberg@home.com>
* src/expr.h : Move FunctionDefinition to
* src/gnumeric.h : here.
* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
(col_compare) : Ditto.
(row_init_span) : Delete.
(free_hash_value) : Renamed from free_hash_key.
(cell_register_span) : Register all cells in a span, malloc a
CellSpanInfo to store a descriptor about the first and last cols.
(assemble_unregister_span_list) : Delete.
(span_remove) : New function for use by g_hash_table_foreach_remove.
(cell_unregister_span) : Use g_hash_table_foreach_remove.
(row_cell_get_displayed_at) : Adjust to new descriptor.
(row_span_get) : New function.
* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.
* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
Use new CellSpanInfo to avoid recomputing spans every time.
(cell_is_blank) : Remove hack about treating empty strings as empty.
* src/cellspan.h : New file. Move span decls here.
* src/item-grid.c (item_grid_draw) : Rework to correctly handle
backgrounds and borders for spanning columns.
2000-02-27 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_is_blank) : Update.
* src/border.c (style_border_draw) : Make somewhat more correct.
Still broken for non-top-left corners.
* src/item-grid.c (item_grid_draw_border) : Ditto.
(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
handle spans more cleanly.
(item_grid_draw_cell) : handle conditionals for displaying contents here.
Remove all handling of backgrounds.
2000-02-28 Michael Meeks <michael@helixcode.com>
* src/xml-io.c (xml_sheet_read, xml_sheet_write): kill for now.
......@@ -48,6 +89,14 @@
* doc/python-gnumeric.txt: New file. Documents the Python plugin.
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (CurrencySymbol) : Add symbols and names to
translation list.
* src/workbook.c (insert_object_cmd) : Bug 6499.
Move Define name to the insert menu to avoid conflict.
2000-02-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/xml-io.c (xml_read_solver): New. (xml_write_solver): New.
......
2000-02-28 Jody Goldberg <jgoldberg@home.com>
* src/expr.h : Move FunctionDefinition to
* src/gnumeric.h : here.
* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
(col_compare) : Ditto.
(row_init_span) : Delete.
(free_hash_value) : Renamed from free_hash_key.
(cell_register_span) : Register all cells in a span, malloc a
CellSpanInfo to store a descriptor about the first and last cols.
(assemble_unregister_span_list) : Delete.
(span_remove) : New function for use by g_hash_table_foreach_remove.
(cell_unregister_span) : Use g_hash_table_foreach_remove.
(row_cell_get_displayed_at) : Adjust to new descriptor.
(row_span_get) : New function.
* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.
* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
Use new CellSpanInfo to avoid recomputing spans every time.
(cell_is_blank) : Remove hack about treating empty strings as empty.
* src/cellspan.h : New file. Move span decls here.
* src/item-grid.c (item_grid_draw) : Rework to correctly handle
backgrounds and borders for spanning columns.
2000-02-27 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_is_blank) : Update.
* src/border.c (style_border_draw) : Make somewhat more correct.
Still broken for non-top-left corners.
* src/item-grid.c (item_grid_draw_border) : Ditto.
(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
handle spans more cleanly.
(item_grid_draw_cell) : handle conditionals for displaying contents here.
Remove all handling of backgrounds.
2000-02-28 Michael Meeks <michael@helixcode.com>
* src/xml-io.c (xml_sheet_read, xml_sheet_write): kill for now.
......@@ -48,6 +89,14 @@
* doc/python-gnumeric.txt: New file. Documents the Python plugin.
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (CurrencySymbol) : Add symbols and names to
translation list.
* src/workbook.c (insert_object_cmd) : Bug 6499.
Move Define name to the insert menu to avoid conflict.
2000-02-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/xml-io.c (xml_read_solver): New. (xml_write_solver): New.
......
2000-02-28 Jody Goldberg <jgoldberg@home.com>
* src/expr.h : Move FunctionDefinition to
* src/gnumeric.h : here.
* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
(col_compare) : Ditto.
(row_init_span) : Delete.
(free_hash_value) : Renamed from free_hash_key.
(cell_register_span) : Register all cells in a span, malloc a
CellSpanInfo to store a descriptor about the first and last cols.
(assemble_unregister_span_list) : Delete.
(span_remove) : New function for use by g_hash_table_foreach_remove.
(cell_unregister_span) : Use g_hash_table_foreach_remove.
(row_cell_get_displayed_at) : Adjust to new descriptor.
(row_span_get) : New function.
* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.
* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
Use new CellSpanInfo to avoid recomputing spans every time.
(cell_is_blank) : Remove hack about treating empty strings as empty.
* src/cellspan.h : New file. Move span decls here.
* src/item-grid.c (item_grid_draw) : Rework to correctly handle
backgrounds and borders for spanning columns.
2000-02-27 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_is_blank) : Update.
* src/border.c (style_border_draw) : Make somewhat more correct.
Still broken for non-top-left corners.
* src/item-grid.c (item_grid_draw_border) : Ditto.
(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
handle spans more cleanly.
(item_grid_draw_cell) : handle conditionals for displaying contents here.
Remove all handling of backgrounds.
2000-02-28 Michael Meeks <michael@helixcode.com>
* src/xml-io.c (xml_sheet_read, xml_sheet_write): kill for now.
......@@ -48,6 +89,14 @@
* doc/python-gnumeric.txt: New file. Documents the Python plugin.
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (CurrencySymbol) : Add symbols and names to
translation list.
* src/workbook.c (insert_object_cmd) : Bug 6499.
Move Define name to the insert menu to avoid conflict.
2000-02-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/xml-io.c (xml_read_solver): New. (xml_write_solver): New.
......
2000-02-28 Jody Goldberg <jgoldberg@home.com>
* src/expr.h : Move FunctionDefinition to
* src/gnumeric.h : here.
* src/cellspan.c (col_hash) : Use GPOINTER_TO_INT.
(col_compare) : Ditto.
(row_init_span) : Delete.
(free_hash_value) : Renamed from free_hash_key.
(cell_register_span) : Register all cells in a span, malloc a
CellSpanInfo to store a descriptor about the first and last cols.
(assemble_unregister_span_list) : Delete.
(span_remove) : New function for use by g_hash_table_foreach_remove.
(cell_unregister_span) : Use g_hash_table_foreach_remove.
(row_cell_get_displayed_at) : Adjust to new descriptor.
(row_span_get) : New function.
* src/cell.c (cell_calculate_span) : Renamed from cell_get_span.
* src/cell-draw.c (cell_draw) : Do not draw backgrounds here.
Use new CellSpanInfo to avoid recomputing spans every time.
(cell_is_blank) : Remove hack about treating empty strings as empty.
* src/cellspan.h : New file. Move span decls here.
* src/item-grid.c (item_grid_draw) : Rework to correctly handle
backgrounds and borders for spanning columns.
2000-02-27 Jody Goldberg <jgoldberg@home.com>
* src/cell.c (cell_is_blank) : Update.
* src/border.c (style_border_draw) : Make somewhat more correct.
Still broken for non-top-left corners.
* src/item-grid.c (item_grid_draw_border) : Ditto.
(item_grid_draw_background) : Rename from item_grid_paint_empty_cell
handle spans more cleanly.
(item_grid_draw_cell) : handle conditionals for displaying contents here.
Remove all handling of backgrounds.
2000-02-28 Michael Meeks <michael@helixcode.com>
* src/xml-io.c (xml_sheet_read, xml_sheet_write): kill for now.
......@@ -48,6 +89,14 @@
* doc/python-gnumeric.txt: New file. Documents the Python plugin.
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* src/formats.c (CurrencySymbol) : Add symbols and names to
translation list.
* src/workbook.c (insert_object_cmd) : Bug 6499.
Move Define name to the insert menu to avoid conflict.
2000-02-26 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/xml-io.c (xml_read_solver): New. (xml_write_solver): New.
......
......@@ -3,16 +3,10 @@
Gnumeric Spread Sheet task list
* Workbook
Have a new "manager" file that will take over the details of open
workbooks and active servers, instead of the current approach we
use to have this management in the workbook.c file
JEG : Maybe move this to application.[ch] ??
The bold and italic buttons need to be updated after a load to
reflect the cell with the cursor.
* Component
Make sheet_selection_changed_hook execute a list of hooks
......@@ -70,7 +64,6 @@ Gnumeric Spread Sheet task list
* Create a simplistic dialog (to map to font-bold yes/no).
* Cell dimension computation is broken on font change for multi-lines.
- Alignment 'Center' is broken when used with spanning cells.
* Number formatting
......@@ -107,24 +100,11 @@ Gnumeric Spread Sheet task list
** Column sizes
Columns should be smaller by default, and have an
"auto-grow-up-to-this-point" feature. Beyond that size, it would
truncate as it does now.
Columns should have an "auto-grow-up-to-this-point" feature. Beyond that
size, it would truncate as it does now.
** Parser
* Support parsing of interbook references
** Display
Provide a CanvasAA version of Gnumeric.
Nice side effect is that the selection would just be a transparent
color layered on top of whatever is selected. So we can do the
Excel2000 trick of using a light blue to show the selection, rather
than black.
This has the effect of letting users "see" the color they are
filling/coloring things with when the selection is turned on
* Improve error reporting.
** Cell data entry:
double click on cell allows editing as in main editing box.
......@@ -138,10 +118,6 @@ Gnumeric Spread Sheet task list
be possible to display "Sales". We can use this with Michael's
name support.
Instead this should be done with split-pane support in tandem with
disabling the standard caption rendering. This would give a far more
flexible approach : Michael.
** Captions (ItemBar)
It should be possible to set the dimensions of the cols, rows to
......
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* dif.c (dif_read_workbook) : Bug 5716.
2000-01-31 Jon K Hellan <hellan@acm.org>
* dif.c (dif_write_workbook): Improve reporting.
......
......@@ -262,8 +262,8 @@ dif_read_workbook (CommandContext *context,
}
len = sbuf.st_size;
if (MAP_FAILED != (data = (char const *) (mmap(0, len, PROT_READ,
MAP_PRIVATE, fd, 0)))) {
if ((caddr_t)MAP_FAILED != (data = (caddr_t) (mmap(0, len, PROT_READ,
MAP_PRIVATE, fd, 0)))) {
FileSource_t src;
char * name = g_strdup_printf (_("Imported %s"), g_basename (filename));
......
2000-02-26 Jody Goldberg <jgoldberg@home.com>
* csv-io.c (csv_read_workbook) : Bug 5716.
2000-01-31 Jon K Hellan <hellan@acm.org>
* csv-io.c (csv_write_workbook): Improve reporting.
......
......@@ -171,8 +171,8 @@ csv_read_workbook (CommandContext *context, Workbook *book,
}
len = sbuf.st_size;
if (MAP_FAILED != (data = (char const *) (mmap(0, len, PROT_READ,
MAP_PRIVATE, fd, 0)))) {
if ((caddr_t)MAP_FAILED != (data = (caddr_t) (mmap(0, len, PROT_READ,
MAP_PRIVATE, fd, 0)))) {
FileSource_t src;
char *name = g_strdup_printf (_("Imported %s"), g_basename (filename));
......
......@@ -61,6 +61,7 @@ GNUMERIC_BASE_SOURCES = \
cell-draw.c \
cell-draw.h \
cellspan.c \
cellspan.h \
clipboard.c \
clipboard.h \
collect.h \
......
......@@ -61,7 +61,7 @@ struct {
/* 0x3 : STYLE_BORDER_DASHED */ { 0, 0, &dashed_line },
/* 0x4 : STYLE_BORDER_DOTTED */ { 0, 0, &dotted_line },
/* 0x5 : STYLE_BORDER_THICK */ { 3, 0, NULL },
/* 0x6 : STYLE_BORDER_DOUBLE */ { 3, 0, NULL },/* How to clear middle line ?? */
/* 0x6 : STYLE_BORDER_DOUBLE */ { 0, 0, NULL },
/* 0x7 : STYLE_BORDER_HAIR */ { 0, 0, &hair_line },
/* 0x8 : STYLE_BORDER_MEDIUM_DASH */ { 2, 9, &med_dashed_line },
/* 0x9 : STYLE_BORDER_DASH_DOT */ { 0, 0, &dash_dot_line },
......@@ -250,22 +250,58 @@ style_border_unref (MStyleBorder *border)
}
void
style_border_draw (GdkDrawable * drawable, const MStyleBorder* border,
int x1, int y1, int x2, int y2)
style_border_draw (MStyleBorder const * const border, MStyleElementType const t,
GdkDrawable * const drawable,
int x1, int y1, int x2, int y2,
MStyleBorder const * const extend_begin,
MStyleBorder const * const extend_end)
{
if (border != NULL && border->line_type != STYLE_BORDER_NONE) {
GdkGC *gc = style_border_get_gc ((MStyleBorder *)border,
drawable);
/* Cast away const */
GdkGC *gc = style_border_get_gc ((MStyleBorder *)border, drawable);
gdk_draw_line (drawable, gc, x1, y1, x2, y2);
/* This is WRONG. FIXME FIXME FIXME
* when we are finished converting to drawing only top & left
* then rework the state table.
*/
if (border->line_type == STYLE_BORDER_DOUBLE) {
static GdkGC *middle_gc = NULL;
if (middle_gc == NULL) {
middle_gc = gdk_gc_new (drawable);
gdk_gc_set_foreground (middle_gc, &gs_white);
static int const offsets[][2][4] = {
{ { 0,-1,0,-1}, { 0,1,0,1} }, /* TOP */
{ { 0,-1,0,-1}, { 0,1,0,1} }, /* BOTTOM */
{ { -1,0,-1,0}, { 1,0,1,0} }, /* LEFT */
{ { -1,0,-1,0}, { 1,0,1,0} }, /* RIGHT */
{ { 0,1,-1,0}, { 1,0,0,-1} }, /* DIAGONAL */
{ { 0,-1,-1,0 },{ 1,0,0,1} }, /* REV_DIAGONAL */
};
static int const extension_begin[][2][2] = {
{ { -1, 0 }, { 1, 0 } }, /* TOP */
{ { 1, 0 }, { -1, 0 } }, /* BOTTOM */
{ { 0, -1 }, { 0, 1} }, /* LEFT */
{ { 0, 1 }, { 0, -1} }, /* RIGHT */
{ { 1, 1}, { 1, 1 } }, /* DIAGONAL */
{ { -1, -1}, { -1, -1} }, /* REV_DIAGONAL */
};
int const i = t-MSTYLE_BORDER_TOP;
int const * const o = (int *)&(offsets[i]);
int x = x1+o[0], y = y1+o[1];
if (extend_begin != NULL &&
extend_begin->line_type != STYLE_BORDER_NONE) {
x += extension_begin[i][0][0];
y += extension_begin[i][0][1];
}
gdk_draw_line (drawable, gc, x, y, x2+o[2], y2+o[3]);
x1 += o[4]; y1 += o[5]; x2 += o[6]; y2 += o[7];
if (extend_begin != NULL &&
extend_begin->line_type != STYLE_BORDER_NONE) {
x1 += extension_begin[i][1][0];
y1 += extension_begin[i][1][1];
}
gdk_draw_line (drawable, middle_gc, x1, y1, x2, y2);
}
gdk_draw_line (drawable, gc, x1, y1, x2, y2);
}
}
......
......@@ -55,7 +55,10 @@ gint style_border_get_width (StyleBorderType const line_type);
void style_border_set_gc_dash (GdkGC *gc, StyleBorderType const line_type);
GdkGC *style_border_get_gc (MStyleBorder *border, GdkWindow *window);
void style_border_draw (GdkDrawable * drawable, const MStyleBorder *border,
int x1, int y1, int x2, int y2);
void style_border_draw (MStyleBorder const * const st, MStyleElementType const t,
GdkDrawable * const drawable,
int const x1, int const y1, int const x2, int const y2,
MStyleBorder const * const extend_begin,
MStyleBorder const * const extend_end);
#endif /* GNUMERIC_BORDER_H */
......@@ -13,8 +13,8 @@
#include "format.h"
#include "color.h"
#include "utils.h"
#include "pattern.h"
#include "cell.h"
#include "cellspan.h"
#include "cell-draw.h"
static void
......@@ -122,7 +122,7 @@ cell_split_text (GdkFont *font, char const *text, int const width)
int
cell_draw (Cell *cell, MStyle *mstyle,
SheetView *sheet_view, GdkGC *gc, GdkDrawable *drawable,
int x1, int y1, gboolean const is_selected)
int x1, int y1)
{
StyleFont *style_font = sheet_view_get_style_font (cell->sheet, mstyle);
GdkFont *font = style_font_gdk_font (style_font);
......@@ -137,6 +137,7 @@ cell_draw (Cell *cell, MStyle *mstyle,
int halign;
gboolean is_single_line;
char const *text;
CellSpanInfo const * spaninfo;
gsheet = GNUMERIC_SHEET (sheet_view->sheet_view);
g_return_val_if_fail (GNUMERIC_IS_SHEET (gsheet), 1);
......@@ -152,7 +153,12 @@ cell_draw (Cell *cell, MStyle *mstyle,
} else
text = cell->text->str;
cell_get_span (cell, &start_col, &end_col);
spaninfo = row_span_get (cell->row, cell->col->pos);
if (spaninfo != NULL) {
start_col = spaninfo->left;
end_col = spaninfo->right;
} else
start_col = end_col = cell->col->pos;
/* Get the sizes exclusive of margins and grids */
width = COL_INTERNAL_WIDTH (cell->col);
......@@ -160,33 +166,6 @@ cell_draw (Cell *cell, MStyle *mstyle,
font_height = style_font_get_height (style_font);
/* This rectangle has the whole area used by this cell
* including the surrounding grid lines */
rect.x = x1;
rect.y = y1;
rect.width = cell->col->size_pixels + 1;
rect.height = cell->row->size_pixels + 1;
/*
* x1, y1 are relative to this cell origin, but the cell might be using
* columns to the left (if it is set to right justify or center justify)
* compute the pixel difference
*/
if (start_col != cell->col->pos) {
int const offset =
sheet_col_get_distance_pixels (cell->sheet,
start_col, cell->col->pos);
rect.x -= offset;
rect.width += offset;
}
if (end_col != cell->col->pos) {
int const offset =
sheet_col_get_distance_pixels (cell->sheet,
cell->col->pos+1, end_col+1);
rect.width += offset;
}
gdk_gc_set_clip_rectangle (gc, &rect);
switch (mstyle_get_align_v (mstyle)) {
default:
g_warning ("Unhandled cell vertical alignment\n");
......@@ -222,15 +201,40 @@ cell_draw (Cell *cell, MStyle *mstyle,
mstyle_get_align_v (mstyle) != VALIGN_JUSTIFY &&
!mstyle_get_fit_in_cell (mstyle));
/* Draw the background if there is one */
if (gnumeric_background_set_gc (mstyle, gc, canvas, is_selected))
gdk_draw_rectangle (drawable, gc, TRUE,
rect.x, rect.y, rect.width, rect.height);
/* This rectangle has the whole area used by this cell
* including the surrounding grid lines */
rect.x = x1;
rect.y = y1;
rect.width = cell->col->size_pixels + 1;
rect.height = cell->row->size_pixels + 1;
/*
* x1, y1 are relative to this cell origin, but the cell might be using
* columns to the left (if it is set to right justify or center justify)
* compute the pixel difference
*/
if (start_col != cell->col->pos) {
int const offset =
sheet_col_get_distance_pixels (cell->sheet,