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

Fix - bug 9984, fix embedded bonobo objects a starting size > 0,0 -

Fix
    - bug 9984, fix embedded bonobo objects a starting size > 0,0
    - vertical justification was broken
    - a few warnings.

2000-05-17  Jody Goldberg <jgoldberg@home.com>

	* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
	  ensure that verticaly justified lines do not overlap.
	* src/print-cell.c (print_cell) : Ditto.

	* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
	  avoid warnings.

	* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
	  Ensure that objects do not start with size 0,0.
parent df7d4b5a
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
ensure that verticaly justified lines do not overlap.
* src/print-cell.c (print_cell) : Ditto.
* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
avoid warnings.
* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
Ensure that objects do not start with size 0,0.
* src/workbook.c (workbook_expr_relocate) : Add missing
initialization.
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
ensure that verticaly justified lines do not overlap.
* src/print-cell.c (print_cell) : Ditto.
* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
avoid warnings.
* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
Ensure that objects do not start with size 0,0.
* src/workbook.c (workbook_expr_relocate) : Add missing
initialization.
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
ensure that verticaly justified lines do not overlap.
* src/print-cell.c (print_cell) : Ditto.
* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
avoid warnings.
* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
Ensure that objects do not start with size 0,0.
* src/workbook.c (workbook_expr_relocate) : Add missing
initialization.
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
ensure that verticaly justified lines do not overlap.
* src/print-cell.c (print_cell) : Ditto.
* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
avoid warnings.
* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
Ensure that objects do not start with size 0,0.
* src/workbook.c (workbook_expr_relocate) : Add missing
initialization.
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
ensure that verticaly justified lines do not overlap.
* src/print-cell.c (print_cell) : Ditto.
* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
avoid warnings.
* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
Ensure that objects do not start with size 0,0.
* src/workbook.c (workbook_expr_relocate) : Add missing
initialization.
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
ensure that verticaly justified lines do not overlap.
* src/print-cell.c (print_cell) : Ditto.
* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
avoid warnings.
* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
Ensure that objects do not start with size 0,0.
* src/workbook.c (workbook_expr_relocate) : Add missing
initialization.
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/cell-draw.c (cell_draw) : Cache the vertical alignment, and
ensure that verticaly justified lines do not overlap.
* src/print-cell.c (print_cell) : Ditto.
* src/sheet-object.c (sheet_set_mode_type_full) : Add a prototype to
avoid warnings.
* src/sheet-object.c (create_object) : Ugly workaround for bug 9984.
Ensure that objects do not start with size 0,0.
* src/workbook.c (workbook_expr_relocate) : Add missing
initialization.
......
......@@ -145,7 +145,8 @@ cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo
int width, height;
int text_base;
int font_height;
int halign;
StyleHAlignFlags halign;
StyleVAlignFlags valign;
int num_lines = 0;
int line_offset[3]; /* There are up to 3 lines, double underlined strikethroughs */
gboolean is_single_line;
......@@ -185,8 +186,9 @@ cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo
style_font = sheet_view_get_style_font (sheet, mstyle);
font = style_font_gdk_font (style_font);
font_height = style_font_get_height (style_font);
valign = mstyle_get_align_v (mstyle);
switch (mstyle_get_align_v (mstyle)) {
switch (valign) {
default:
g_warning ("Unhandled cell vertical alignment\n");
......@@ -218,7 +220,7 @@ cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo
halign = value_get_default_halign (cell->value, mstyle);
is_single_line = (halign != HALIGN_JUSTIFY &&
mstyle_get_align_v (mstyle) != VALIGN_JUSTIFY &&
valign != VALIGN_JUSTIFY &&
!mstyle_get_fit_in_cell (mstyle));
/* This rectangle has the whole area used by this cell
......@@ -332,7 +334,7 @@ cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo
int line_count = g_list_length (lines);
int x_offset, y_offset, inter_space;
switch (mstyle_get_align_v (mstyle)) {
switch (valign) {
case VALIGN_TOP:
y_offset = 0;
inter_space = font_height;
......@@ -350,6 +352,10 @@ cell_draw (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo
inter_space = font_height +
(height - (line_count * font_height))
/ (line_count - 1);
/* lines should not overlap */
if (inter_space < font_height)
inter_space = font_height;
break;
}
/* Else, we become a VALIGN_BOTTOM line */
......
......@@ -167,7 +167,8 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
double width, height;
double text_base;
double font_height;
int halign;
StyleHAlignFlags halign;
StyleVAlignFlags valign;
int num_lines = 0;
double line_offset[3]; /* There are up to 3 lines, double underlined strikethroughs */
gboolean is_single_line;
......@@ -196,14 +197,14 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
} else
start_col = end_col = cell->col_info->pos;
/* Get the sizes exclusive of margins and grids */
width = cell->col_info->size_pts - cell->col_info->margin_a - cell->col_info->margin_b - 1;
height = cell->row_info->size_pts - cell->row_info->margin_a - cell->row_info->margin_b - 1;
font_height = style_font->size;
valign = mstyle_get_align_v (mstyle);
switch (mstyle_get_align_v (mstyle)) {
switch (valign) {
default:
g_warning ("Unhandled cell vertical alignment\n");
......@@ -236,8 +237,9 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
text_width = gnome_font_get_width_string (print_font, text);
halign = value_get_default_halign (cell->value, mstyle);
is_single_line = (halign != HALIGN_JUSTIFY &&
mstyle_get_align_v (mstyle) != VALIGN_JUSTIFY &&
valign != VALIGN_JUSTIFY &&
!mstyle_get_fit_in_cell (mstyle));
/* This rectangle has the whole area used by this cell
......@@ -374,7 +376,7 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
}
}
switch (mstyle_get_align_v (mstyle)) {
switch (valign) {
case VALIGN_TOP:
y_offset = 0;
inter_space = font_height;
......@@ -392,6 +394,10 @@ print_cell (Cell const *cell, MStyle *mstyle, CellSpanInfo const * const spaninf
inter_space = font_height +
(cell->row_info->size_pts - (line_count * font_height))
/ (line_count - 1);
/* lines should not overlap */
if (inter_space < font_height)
inter_space = font_height;
break;
}
/* Else, we become a VALIGN_BOTTOM line */
......
......@@ -480,6 +480,11 @@ create_object (Sheet *sheet, gdouble to_x, gdouble to_y)
case SHEET_MODE_CREATE_GRAPHIC:
#ifdef ENABLE_BONOBO
/* Bug 9984 : do not start objects with size 0,0 */
if (x1 == x2)
x2 += 50.;
if (y1 == y2)
y2 += 50.;
g_warning ("Ugly API name follows, fix it");
o = sheet_object_container_new_bonobo (
sheet, x1, y1, x2, y2, sheet->mode_data);
......@@ -494,6 +499,11 @@ create_object (Sheet *sheet, gdouble to_x, gdouble to_y)
case SHEET_MODE_CREATE_COMPONENT:
#ifdef ENABLE_BONOBO
/* Bug 9984 : do not start objects with size 0,0 */
if (x1 == x2)
x2 += 50.;
if (y1 == y2)
y2 += 50.;
o = sheet_object_container_new_from_goadid (
sheet, x1, y1, x2, y1, sheet->mode_data);
g_free (sheet->mode_data);
......
......@@ -119,4 +119,7 @@ SheetObject *sheet_object_create_checkbox(Sheet *sheet,
double x1, double y1,
double x2, double y2);
void sheet_set_mode_type_full (Sheet *sheet, SheetModeType mode,
void *mode_data);
#endif /* GNUMERIC_SHEET_OBJECT_H */
......@@ -12,6 +12,7 @@
#include <gnome.h>
#include "gnumeric.h"
#include "workbook.h"
#include "sheet-object.h"
#include <libgnorba/gnorba.h>
#include <glade/glade.h>
#include "gnumeric-util.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