Commit 0e738d0a authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

don't draw the diagonals here. (style_border_draw_diag) : split the diag


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

	* src/style-border.c (style_borders_row_draw) : don't draw the
	  diagonals here.
	(style_border_draw_diag) : split the diag drawing code into here.

	* src/item-grid.c (item_grid_draw_merged_range) : call
	  style_border_draw_diag here.
	(item_grid_draw_background) : and here.

	* src/workbook-format-toolbar.c (cb_merge_cells) : fragment the
	  selection just in case.
	(cb_unmerge_cells) : ditto.  Thanks Juan Pablo.

	* src/commands.c (cmd_unmerge_cells) : remove ugly hack cast.
	(cmd_merge_cells) : ditto.  DO NOT DO THAT !
parent df48a66b
2001-05-06 Jody Goldberg <jgoldberg@home.com>
* src/style-border.c (style_borders_row_draw) : don't draw the
diagonals here.
(style_border_draw_diag) : split the diag drawing code into here.
* src/item-grid.c (item_grid_draw_merged_range) : call
style_border_draw_diag here.
(item_grid_draw_background) : and here.
* src/workbook-format-toolbar.c (cb_merge_cells) : fragment the
selection just in case.
(cb_unmerge_cells) : ditto. Thanks Juan Pablo.
......
2001-05-06 Jody Goldberg <jgoldberg@home.com>
* src/style-border.c (style_borders_row_draw) : don't draw the
diagonals here.
(style_border_draw_diag) : split the diag drawing code into here.
* src/item-grid.c (item_grid_draw_merged_range) : call
style_border_draw_diag here.
(item_grid_draw_background) : and here.
* src/workbook-format-toolbar.c (cb_merge_cells) : fragment the
selection just in case.
(cb_unmerge_cells) : ditto. Thanks Juan Pablo.
......
2001-05-06 Jody Goldberg <jgoldberg@home.com>
* src/style-border.c (style_borders_row_draw) : don't draw the
diagonals here.
(style_border_draw_diag) : split the diag drawing code into here.
* src/item-grid.c (item_grid_draw_merged_range) : call
style_border_draw_diag here.
(item_grid_draw_background) : and here.
* src/workbook-format-toolbar.c (cb_merge_cells) : fragment the
selection just in case.
(cb_unmerge_cells) : ditto. Thanks Juan Pablo.
......
2001-05-06 Jody Goldberg <jgoldberg@home.com>
* src/style-border.c (style_borders_row_draw) : don't draw the
diagonals here.
(style_border_draw_diag) : split the diag drawing code into here.
* src/item-grid.c (item_grid_draw_merged_range) : call
style_border_draw_diag here.
(item_grid_draw_background) : and here.
* src/workbook-format-toolbar.c (cb_merge_cells) : fragment the
selection just in case.
(cb_unmerge_cells) : ditto. Thanks Juan Pablo.
......
2001-05-06 Jody Goldberg <jgoldberg@home.com>
* src/style-border.c (style_borders_row_draw) : don't draw the
diagonals here.
(style_border_draw_diag) : split the diag drawing code into here.
* src/item-grid.c (item_grid_draw_merged_range) : call
style_border_draw_diag here.
(item_grid_draw_background) : and here.
* src/workbook-format-toolbar.c (cb_merge_cells) : fragment the
selection just in case.
(cb_unmerge_cells) : ditto. Thanks Juan Pablo.
......
......@@ -224,10 +224,10 @@ update_after_action (Sheet *sheet)
* @ranges : GSList containing Range *'s
*/
static GString *
range_list_to_string (GSList *ranges)
range_list_to_string (GSList const *ranges)
{
GString *names;
GSList *l;
GSList const *l;
g_return_val_if_fail (ranges != NULL, NULL);
......
......@@ -159,7 +159,7 @@ item_grid_draw_merged_range (GdkDrawable *drawable, ItemGrid *ig,
Cell const *cell = sheet_cell_get (sheet, range->start.col, range->start.row);
/* load style from corner which may not be visible */
MStyle const *mstyle = sheet_style_get (sheet, range->start.col, range->start.row);
MStyle const *style = sheet_style_get (sheet, range->start.col, range->start.row);
gboolean const is_selected = (sheet->edit_pos.col != range->start.col ||
sheet->edit_pos.row != range->start.row) &&
sheet_is_full_range_selected (sheet, range);
......@@ -181,36 +181,37 @@ item_grid_draw_merged_range (GdkDrawable *drawable, ItemGrid *ig,
b += scg_colrow_distance_get (ig->scg, FALSE, view->start.row, last+1);
/* Check for background THEN selection */
if (gnumeric_background_set_gc (mstyle, gc,
if (gnumeric_background_set_gc (style, gc,
ig->canvas_item.canvas,
is_selected) ||
is_selected)
/* Remember X excludes the far pixels */
gdk_draw_rectangle (drawable, gc, TRUE, l, t, r-l+1, b-t+1);
if (range->start.col < view->start.col)
l -= scg_colrow_distance_get (ig->scg, TRUE,
range->start.col, view->start.col);
if (view->end.col < range->end.col)
r += scg_colrow_distance_get (ig->scg, TRUE,
view->end.col+1, range->end.col+1);
if (range->start.row < view->start.row)
t -= scg_colrow_distance_get (ig->scg, FALSE,
range->start.row, view->start.row);
if (view->end.row < range->end.row)
b += scg_colrow_distance_get (ig->scg, FALSE,
view->end.row+1, range->end.row+1);
if (cell != NULL) {
ColRowInfo const * const ri = cell->row_info;
ColRowInfo const * const ci = cell->col_info;
if (range->start.col < view->start.col)
l -= scg_colrow_distance_get (ig->scg, TRUE,
range->start.col, view->start.col);
if (view->end.col < range->end.col)
r += scg_colrow_distance_get (ig->scg, TRUE,
view->end.col+1, range->end.col+1);
if (range->start.row < view->start.row)
t -= scg_colrow_distance_get (ig->scg, FALSE,
range->start.row, view->start.row);
if (view->end.row < range->end.row)
b += scg_colrow_distance_get (ig->scg, FALSE,
view->end.row+1, range->end.row+1);
/* FIXME : get the margins from the far col/row too */
cell_draw (cell, mstyle, ig->gc.cell, drawable,
cell_draw (cell, style, ig->gc.cell, drawable,
l, t,
r - l - (ci->margin_b + ci->margin_a + 1),
b - t - (ri->margin_b + ri->margin_a + 1), -1);
}
style_border_draw_diag (style, drawable, l, t, r, b);
}
static void
......@@ -233,6 +234,8 @@ item_grid_draw_background (GdkDrawable *drawable, ItemGrid *ig,
if (has_back || is_selected)
/* Fill the entire cell (API excludes far pixel) */
gdk_draw_rectangle (drawable, gc, TRUE, x, y, w+1, h+1);
style_border_draw_diag (style, drawable, x, y, x+w, y+h);
}
static gint
......
......@@ -594,7 +594,6 @@ style_borders_row_draw (StyleBorder const * const * prev_vert,
int o[2][2];
int col, next_x = x;
GdkGC *gc;
StyleBorder const *diag;
for (col = sr->start_col; col <= sr->end_col ; col++, x = next_x) {
......@@ -631,30 +630,6 @@ style_borders_row_draw (StyleBorder const * const * prev_vert,
gdk_draw_line (drawable, gc, x1, y1 + o[0][0],
x1, y2 + o[0][1] + 1);
}
/* FIXME : I am tired. Do proper margins for these later */
diag = mstyle_get_border (sr->styles [col], MSTYLE_BORDER_REV_DIAGONAL);
if (diag != NULL && diag->line_type != STYLE_BORDER_NONE) {
int a = 0;
gc = style_border_get_gc (diag, drawable);
if (diag->line_type == STYLE_BORDER_DOUBLE) {
gdk_draw_line (drawable, gc, x, y1+2, next_x-2, y2);
a = 2;
}
gdk_draw_line (drawable, gc, x+a, y1, next_x, y2-a);
}
diag = mstyle_get_border (sr->styles [col], MSTYLE_BORDER_DIAGONAL);
if (diag != NULL && diag->line_type != STYLE_BORDER_NONE) {
int a = 0;
gc = style_border_get_gc (diag, drawable);
if (diag->line_type == STYLE_BORDER_DOUBLE) {
gdk_draw_line (drawable, gc, x, y2-2, next_x-2, y1);
a = 2;
}
gdk_draw_line (drawable, gc, x+a, y2, next_x, y1+a);
}
}
if (draw_vertical) {
gc = style_border_get_gc (sr->vertical [col], drawable);
......@@ -672,6 +647,37 @@ style_borders_row_draw (StyleBorder const * const * prev_vert,
}
}
void
style_border_draw_diag (MStyle const *style,
GdkDrawable *drawable,
int x1, int y1, int x2, int y2)
{
StyleBorder const *diag;
GdkGC *gc;
diag = mstyle_get_border (style, MSTYLE_BORDER_REV_DIAGONAL);
if (diag != NULL && diag->line_type != STYLE_BORDER_NONE) {
int a = 0;
gc = style_border_get_gc (diag, drawable);
if (diag->line_type == STYLE_BORDER_DOUBLE) {
gdk_draw_line (drawable, gc, x1, y1+2, x2-2, y2);
a = 2;
}
gdk_draw_line (drawable, gc, x1+a, y1, x2, y2-a);
}
diag = mstyle_get_border (style, MSTYLE_BORDER_DIAGONAL);
if (diag != NULL && diag->line_type != STYLE_BORDER_NONE) {
int a = 0;
gc = style_border_get_gc (diag, drawable);
if (diag->line_type == STYLE_BORDER_DOUBLE) {
gdk_draw_line (drawable, gc, x1, y2-2, x2-2, y1);
a = 2;
}
gdk_draw_line (drawable, gc, x1+a, y2, x2, y1+a);
}
}
static inline void
print_hline (GnomePrintContext *context,
float x1, float x2, float y, int width)
......
......@@ -79,10 +79,17 @@ void style_borders_row_draw (StyleBorder const * const * prev_vert,
GdkDrawable *drawable,
int x, int y1, int y2,
int *colwidths, gboolean draw_vertical);
void style_border_draw_diag (MStyle const *style,
GdkDrawable *drawable,
int x1, int y1, int x2, int y2);
void style_borders_row_print (StyleBorder const * const * prev_vert,
StyleRow const *sr,
GnomePrintContext *context,
float x, float y1, float y2,
Sheet const *sheet, gboolean draw_vertical);
void style_border_print_diag (MStyle const *style,
GnomePrintContext *context,
float x1, float y1, float x2, float y2);
#endif /* GNUMERIC_STYLE_BORDER_H */
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