Commit 7f8319da authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

- Strike through - initial format dialog support for underline and

- Strike through
- initial format dialog support for underline and strikethrough.
- Printing of underlines and strikethroughs.

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

	* src/dialogs/dialog-cell-format.c : Enable the underline and
	  strikethrough elements. TODO : redo the preview for the font
	  tab to support underlining and friends.

	* src/dialogs/cell-format.glade : Rename the underline combo and
	  strikethrough button.

	* src/xml-io.c (xml_write_style) : Add strikethrough.
	(xml_read_style) : Ditto.

	* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
	  the underline button for single underlines.

	* src/sheet-view.[ch] : rename select_all -> select_all_btn.
	  remove unused element.

	* src/sheet-object.h : Remove silly self inclusion.

	* src/print-cell.c : Support underlining and strikethrough.
	  Move even closer into sync with drawing code.

	* src/mstyle.c : Add strikethrough and cleanup includes.

	* src/main.h : Add include for popt.h.

	* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
	  RIGHT.
	(item_grid_draw_cell) : Delete, and merge with draw_cell.

	* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
	  cursor_move.
	* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
	(gnumeric_sheet_key_mode_sheet) : Ditto.
	* src/workbook.c (workbook_parse_and_jump) : Ditto.

	* src/cell-draw.c : Clean includes, add support for strikethrough.
parent e2df9a9e
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-cell-format.c : Enable the underline and
strikethrough elements. TODO : redo the preview for the font
tab to support underlining and friends.
* src/dialogs/cell-format.glade : Rename the underline combo and
strikethrough button.
* src/xml-io.c (xml_write_style) : Add strikethrough.
(xml_read_style) : Ditto.
* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
the underline button for single underlines.
* src/sheet-view.[ch] : rename select_all -> select_all_btn.
remove unused element.
* src/sheet-object.h : Remove silly self inclusion.
* src/print-cell.c : Support underlining and strikethrough.
Move even closer into sync with drawing code.
* src/mstyle.c : Add strikethrough and cleanup includes.
* src/main.h : Add include for popt.h.
* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
RIGHT.
(item_grid_draw_cell) : Delete, and merge with draw_cell.
* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
cursor_move.
* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
(gnumeric_sheet_key_mode_sheet) : Ditto.
* src/workbook.c (workbook_parse_and_jump) : Ditto.
* src/cell-draw.c : Clean includes, add support for strikethrough.
2000-03-04 Morten Welinder <terra@diku.dk>
* src/sheet.c (r1c1_get_item): Fix signed/unsigned char confusion.
......
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-cell-format.c : Enable the underline and
strikethrough elements. TODO : redo the preview for the font
tab to support underlining and friends.
* src/dialogs/cell-format.glade : Rename the underline combo and
strikethrough button.
* src/xml-io.c (xml_write_style) : Add strikethrough.
(xml_read_style) : Ditto.
* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
the underline button for single underlines.
* src/sheet-view.[ch] : rename select_all -> select_all_btn.
remove unused element.
* src/sheet-object.h : Remove silly self inclusion.
* src/print-cell.c : Support underlining and strikethrough.
Move even closer into sync with drawing code.
* src/mstyle.c : Add strikethrough and cleanup includes.
* src/main.h : Add include for popt.h.
* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
RIGHT.
(item_grid_draw_cell) : Delete, and merge with draw_cell.
* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
cursor_move.
* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
(gnumeric_sheet_key_mode_sheet) : Ditto.
* src/workbook.c (workbook_parse_and_jump) : Ditto.
* src/cell-draw.c : Clean includes, add support for strikethrough.
2000-03-04 Morten Welinder <terra@diku.dk>
* src/sheet.c (r1c1_get_item): Fix signed/unsigned char confusion.
......
......@@ -25,8 +25,8 @@ Jukka:
and RandBernoulli() functions.
Jody:
* Redraw improvements (cursor, selection, spanning, speed)
* Border improvements (combo, printing, partial double line).
* Redraw improvements (cursor, selection, spanning, speed, underlining)
* Border improvements (combo, ugly printing, partial double line).
* More work on undo.
* Parse interbook references.
* Mostly correct sizing of MS Excel cols/rows and objects.
......
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-cell-format.c : Enable the underline and
strikethrough elements. TODO : redo the preview for the font
tab to support underlining and friends.
* src/dialogs/cell-format.glade : Rename the underline combo and
strikethrough button.
* src/xml-io.c (xml_write_style) : Add strikethrough.
(xml_read_style) : Ditto.
* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
the underline button for single underlines.
* src/sheet-view.[ch] : rename select_all -> select_all_btn.
remove unused element.
* src/sheet-object.h : Remove silly self inclusion.
* src/print-cell.c : Support underlining and strikethrough.
Move even closer into sync with drawing code.
* src/mstyle.c : Add strikethrough and cleanup includes.
* src/main.h : Add include for popt.h.
* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
RIGHT.
(item_grid_draw_cell) : Delete, and merge with draw_cell.
* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
cursor_move.
* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
(gnumeric_sheet_key_mode_sheet) : Ditto.
* src/workbook.c (workbook_parse_and_jump) : Ditto.
* src/cell-draw.c : Clean includes, add support for strikethrough.
2000-03-04 Morten Welinder <terra@diku.dk>
* src/sheet.c (r1c1_get_item): Fix signed/unsigned char confusion.
......
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-cell-format.c : Enable the underline and
strikethrough elements. TODO : redo the preview for the font
tab to support underlining and friends.
* src/dialogs/cell-format.glade : Rename the underline combo and
strikethrough button.
* src/xml-io.c (xml_write_style) : Add strikethrough.
(xml_read_style) : Ditto.
* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
the underline button for single underlines.
* src/sheet-view.[ch] : rename select_all -> select_all_btn.
remove unused element.
* src/sheet-object.h : Remove silly self inclusion.
* src/print-cell.c : Support underlining and strikethrough.
Move even closer into sync with drawing code.
* src/mstyle.c : Add strikethrough and cleanup includes.
* src/main.h : Add include for popt.h.
* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
RIGHT.
(item_grid_draw_cell) : Delete, and merge with draw_cell.
* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
cursor_move.
* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
(gnumeric_sheet_key_mode_sheet) : Ditto.
* src/workbook.c (workbook_parse_and_jump) : Ditto.
* src/cell-draw.c : Clean includes, add support for strikethrough.
2000-03-04 Morten Welinder <terra@diku.dk>
* src/sheet.c (r1c1_get_item): Fix signed/unsigned char confusion.
......
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-cell-format.c : Enable the underline and
strikethrough elements. TODO : redo the preview for the font
tab to support underlining and friends.
* src/dialogs/cell-format.glade : Rename the underline combo and
strikethrough button.
* src/xml-io.c (xml_write_style) : Add strikethrough.
(xml_read_style) : Ditto.
* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
the underline button for single underlines.
* src/sheet-view.[ch] : rename select_all -> select_all_btn.
remove unused element.
* src/sheet-object.h : Remove silly self inclusion.
* src/print-cell.c : Support underlining and strikethrough.
Move even closer into sync with drawing code.
* src/mstyle.c : Add strikethrough and cleanup includes.
* src/main.h : Add include for popt.h.
* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
RIGHT.
(item_grid_draw_cell) : Delete, and merge with draw_cell.
* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
cursor_move.
* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
(gnumeric_sheet_key_mode_sheet) : Ditto.
* src/workbook.c (workbook_parse_and_jump) : Ditto.
* src/cell-draw.c : Clean includes, add support for strikethrough.
2000-03-04 Morten Welinder <terra@diku.dk>
* src/sheet.c (r1c1_get_item): Fix signed/unsigned char confusion.
......
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-cell-format.c : Enable the underline and
strikethrough elements. TODO : redo the preview for the font
tab to support underlining and friends.
* src/dialogs/cell-format.glade : Rename the underline combo and
strikethrough button.
* src/xml-io.c (xml_write_style) : Add strikethrough.
(xml_read_style) : Ditto.
* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
the underline button for single underlines.
* src/sheet-view.[ch] : rename select_all -> select_all_btn.
remove unused element.
* src/sheet-object.h : Remove silly self inclusion.
* src/print-cell.c : Support underlining and strikethrough.
Move even closer into sync with drawing code.
* src/mstyle.c : Add strikethrough and cleanup includes.
* src/main.h : Add include for popt.h.
* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
RIGHT.
(item_grid_draw_cell) : Delete, and merge with draw_cell.
* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
cursor_move.
* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
(gnumeric_sheet_key_mode_sheet) : Ditto.
* src/workbook.c (workbook_parse_and_jump) : Ditto.
* src/cell-draw.c : Clean includes, add support for strikethrough.
2000-03-04 Morten Welinder <terra@diku.dk>
* src/sheet.c (r1c1_get_item): Fix signed/unsigned char confusion.
......
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* src/dialogs/dialog-cell-format.c : Enable the underline and
strikethrough elements. TODO : redo the preview for the font
tab to support underlining and friends.
* src/dialogs/cell-format.glade : Rename the underline combo and
strikethrough button.
* src/xml-io.c (xml_write_style) : Add strikethrough.
(xml_read_style) : Ditto.
* src/workbook-format-toolbar.c (workbook_feedback_set) : Only show
the underline button for single underlines.
* src/sheet-view.[ch] : rename select_all -> select_all_btn.
remove unused element.
* src/sheet-object.h : Remove silly self inclusion.
* src/print-cell.c : Support underlining and strikethrough.
Move even closer into sync with drawing code.
* src/mstyle.c : Add strikethrough and cleanup includes.
* src/main.h : Add include for popt.h.
* src/item-grid.c (item_grid_draw_border) : No more need for BOTTOM or
RIGHT.
(item_grid_draw_cell) : Delete, and merge with draw_cell.
* src/commands.c (cmd_set_text_undo) : Use cursor_set rather than
cursor_move.
* src/corba-sheet.c (Sheet_cursor_move) : Ditto.
(gnumeric_sheet_key_mode_sheet) : Ditto.
* src/workbook.c (workbook_parse_and_jump) : Ditto.
* src/cell-draw.c : Clean includes, add support for strikethrough.
2000-03-04 Morten Welinder <terra@diku.dk>
* src/sheet.c (r1c1_get_item): Fix signed/unsigned char confusion.
......
2000-03-05 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_get_style_from_xf) : enable strikethrough.
2000-03-01 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (biff_font_data_new) : Fix old typo.
......
......@@ -1096,6 +1096,7 @@ ms_excel_get_style_from_xf (ExcelSheet *sheet, guint16 xfidx)
mstyle_set_font_size (mstyle, fd->height / 20.0);
mstyle_set_font_bold (mstyle, fd->boldness >= 0x2bc);
mstyle_set_font_italic (mstyle, fd->italic);
mstyle_set_font_strike (mstyle, fd->struck_out);
switch (fd->underline) {
case eBiffFUSingle :
case eBiffFUSingleAcc :
......
2000-03-04 Jody Goldberg <jgoldberg@home.com>
* Makefile.am : disable ps.[ch], epsf.[ch].
These are now somewhat behind the times and have been superceded
by gnome-print.
boot.c : Disable epsf.
2000-02-26 Almer. S. Tigelaar. <almer1@dds.nl>
* html.c
......
......@@ -13,7 +13,8 @@ plugindir = $(libdir)/gnumeric/plugins/$(VERSION)
plugin_LTLIBRARIES = libgnum_html.la
libgnum_html_la_SOURCES = boot.h boot.c html.h html.c latex.h latex.c \
roff.h roff.c font.h font.c epsf.h epsf.c ps.h ps.c
roff.h roff.c font.h font.c
#epsf.h epsf.c ps.h ps.c
INCLUDES = \
-I$(GNUMERIC_SRC_DIR) \
......
......@@ -26,7 +26,14 @@
#include "latex.h"
#include "roff.h"
#include "file.h"
#ifdef SUPPORT_OLD_EPSF
/* This is disabled and will probably be removed. Printing support can produce
* postscript and handles things like spanning cells much better. There is no
* reason to fix the breakage here.
*/
#include "epsf.h"
#endif
/*
* We can unload
......@@ -51,7 +58,9 @@ html_cleanup_plugin (PluginData *pd)
file_format_unregister_save (html_write_wb_roff_dvi);
file_format_unregister_save (html_write_wb_roff_pdf);
file_format_unregister_save (html_write_wb_roff);
#ifdef SUPPORT_OLD_EPSF
file_format_unregister_save (epsf_write_wb);
#endif
file_format_unregister_open (NULL,html_read);
}
......@@ -91,8 +100,10 @@ html_init (void)
desc = _("PDF file format (via groff/gs)");
file_format_register_save (".pdf", desc, html_write_wb_roff_pdf);
#ifdef SUPPORT_OLD_EPSF
desc = _("EPS file format (*.eps)");
file_format_register_save (".eps", desc, epsf_write_wb);
#endif
}
#define HTML_TITLE _("HTML (simple html import/export plugin)")
......
......@@ -28,15 +28,15 @@
#include "ps.h"
#include "font.h"
#include "command-context.h"
#include "gnumeric-util.h"
#include "sheet-object.h"
#include "sheet-object-graphic.h"
/* ACK! this is broken. */
#define CELL_DIM(cell,p) (cell->p->size_pts + cell->p->margin_a + cell->p->margin_b)
#define CELL_WIDTH(cell) CELL_DIM(cell,col)
#define CELL_HEIGHT(cell) CELL_DIM(cell,row)
#define COL_DIM(col) (col->size_pts + col->margin_a + col->margin_b)
#define ROW_HEIGHT(col) COL_DIM(col)
#define COL_WIDTH(col) COL_DIM(col)
/*
* write a cell
*/
......@@ -151,12 +151,12 @@ epsf_write_wb (CommandContext *context, Workbook *wb, const char *filename)
bh = 0;
for (row = 0; row <= sheet->rows.max_used; row++) {
row_info = sheet_row_get_info (sheet, row);
bh += ROW_HEIGHT(row_info);
bh += row_info->size_pts;
}
bw = 0;
for (col = 0; col <= sheet->cols.max_used; col++) {
col_info = sheet_col_get_info (sheet, col);
bw += COL_WIDTH(col_info);
bw += col_info->size_pts;
}
ps_init_eps (fp, bx, by, bx + bw, by + bh);
......@@ -164,12 +164,12 @@ epsf_write_wb (CommandContext *context, Workbook *wb, const char *filename)
y_pos = bh;
for (row = 0; row <= sheet->rows.max_used; row++) {
row_info = sheet_row_get_info (sheet, row);
y_pos -= ROW_HEIGHT(row_info);
y_pos -= row_info->size_pts;
for (col = 0; col <= sheet->cols.max_used; col++) {
cell = sheet_cell_get (sheet, col, row);
col_info = sheet_col_get_info (sheet, col);
epsf_write_cell (fp, cell, x_pos, y_pos);
x_pos += COL_WIDTH(col_info);
x_pos += col_info->size_pts;
}
x_pos = 0;
}
......
......@@ -22,10 +22,7 @@
#ifndef GNUMERIC_PLUGIN_EPSF_H
#define GNUMERIC_PLUGIN_EPSF_H
#include "../../src/gnumeric.h"
#include "../../src/gnumeric-util.h"
#include "../../src/sheet-object.h"
#include "../../src/sheet-object-graphic.h"
#include "gnumeric.h"
int epsf_write_wb (CommandContext *context, Workbook *wb,
const char *filename);
......
......@@ -22,8 +22,8 @@
#ifndef GNUMERIC_PLUGIN_HTML_H
#define GNUMERIC_PLUGIN_HTML_H
#include "../../src/gnumeric.h"
#include "../../src/gnumeric-util.h"
#include "gnumeric.h"
#include "gnumeric-util.h"
int html_write_wb_html32 (CommandContext *context, Workbook *wb,
const char *filename);
......
......@@ -400,16 +400,16 @@ style_border_print (MStyleBorder const * const border, MStyleElementType const t
int const i = t-MSTYLE_BORDER_TOP;
int const * const o = (int *)&(offsets[i]);
int x = x1+o[0], y = y1+o[1];
double 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];
y -= extension_begin[i][0][1];
}
gnome_print_moveto (context, x1, y1);
gnome_print_lineto (context, x2, y2);
gnome_print_moveto (context, x, y);
gnome_print_lineto (context, x2+o[2], y2-o[3]);
gnome_print_stroke (context);
x1 += o[4]; y1 -= o[5]; x2 += o[6]; y2 -= o[7];
......
......@@ -5,51 +5,40 @@
* Miguel de Icaza 1998, 1999 (miguel@kernel.org)
*/
#include <config.h>
#include <gnome.h>
#include <locale.h>
#include "gnumeric.h"
#include "gnumeric-sheet.h"
#include "eval.h"
#include "format.h"
#include "color.h"
#include "utils.h"
#include "cell.h"
#include "cellspan.h"
#include <gdk/gdk.h>
#include "cell-draw.h"
#include "style.h"
#include "cell.h"
#include "sheet-view.h" /* FIXME : Only for sheet_view_get_style_font */
#include "utils.h" /* FIXME : Only for cell_name */
static inline void
draw_text (GdkDrawable *drawable, GdkFont *font, StyleUnderlineType const uline,
GdkGC *gc, int x1, int text_base, char const * text, int n, int len_pixels)
draw_text (GdkDrawable *drawable, GdkFont *font, GdkGC *gc,
int x1, int text_base, char const * text, int n, int len_pixels,
int const * const line_offset, int num_lines)
{
gdk_draw_text (drawable, font, gc, x1, text_base, text, n);
/* FIXME how to handle small fonts ?
* the text_base should be at least 2 pixels above the bottom */
switch (uline) {
case UNDERLINE_SINGLE :
gdk_draw_line (drawable, gc, x1, text_base+1, x1+len_pixels, text_base+1);
break;
case UNDERLINE_DOUBLE :
gdk_draw_line (drawable, gc, x1, text_base, x1+len_pixels, text_base);
gdk_draw_line (drawable, gc, x1, text_base+2, x1+len_pixels, text_base+2);
default :
break;
while (--num_lines >= 0) {
int y = text_base + line_offset[num_lines];
gdk_draw_line (drawable, gc, x1, y, x1+len_pixels, y);
}
}
static void
draw_overflow (GdkDrawable *drawable, GdkGC *gc,
GdkFont *font, StyleUnderlineType const uline,
int x1, int text_base, int width)
draw_overflow (GdkDrawable *drawable, GdkGC *gc, GdkFont *font,
int x1, int text_base, int width,
int const * const line_offset, int num_lines)
{
int const len = gdk_string_width (font, "#");
int count = (len != 0) ? (width / len) : 0;
/* Center */
for (x1 += (width - count*len) / 2; --count >= 0 ; x1 += len )
draw_text (drawable, font, uline, gc, x1, text_base, "#", 1, len);
draw_text (drawable, font, gc, x1, text_base, "#", 1, len,
line_offset, num_lines);
}
/*
......@@ -141,16 +130,13 @@ cell_split_text (GdkFont *font, char const *text, int const width)
* of the gridlines (marked a).
*/
void
cell_draw (Cell *cell, MStyle *mstyle,
SheetView *sheet_view, GdkGC *gc, GdkDrawable *drawable,
int x1, int y1)
cell_draw (Cell *cell, MStyle *mstyle, CellSpanInfo const * const spaninfo,
GdkGC *gc, GdkDrawable *drawable, int x1, int y1)
{
StyleUnderlineType const uline = mstyle_get_font_uline (mstyle);
StyleFont *style_font = sheet_view_get_style_font (cell->sheet, mstyle);
GdkFont *font = style_font_gdk_font (style_font);
GdkRectangle rect;
GnumericSheet *gsheet;
GnomeCanvas *canvas;
int num_lines = 0, line_offset[3]; /* There are up to 3 lines, double underlined strikethroughs */
int start_col, end_col;
int width, height;
......@@ -159,15 +145,19 @@ 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_if_fail (GNUMERIC_IS_SHEET (gsheet));
g_return_if_fail (cell);
g_return_if_fail (cell->text);
canvas = GNOME_CANVAS (gsheet);
/*
* If it is being edited pretend it is empty to avoid problems with the
* a long cells contents extending past the edge of the edit box.
* Don't print zeros if they should be ignored.
*/
if (cell == cell->sheet->editing_cell ||
(!cell->sheet->display_zero && cell_is_zero (cell)))
return;
if (cell->text->str == NULL) {
g_warning ("Serious cell error at '%s'\n",
cell_name (cell->col->pos, cell->row->pos));
......@@ -176,7 +166,6 @@ cell_draw (Cell *cell, MStyle *mstyle,
} else
text = cell->text->str;
spaninfo = row_span_get (cell->row, cell->col->pos);
if (spaninfo != NULL) {
start_col = spaninfo->left;
end_col = spaninfo->right;
......@@ -266,20 +255,33 @@ cell_draw (Cell *cell, MStyle *mstyle,
else
gdk_gc_set_foreground (gc, &mstyle_get_color (mstyle, MSTYLE_COLOR_FORE)->color);
/* Handle underlining and strikethrough */
switch (mstyle_get_font_uline (mstyle)) {
case UNDERLINE_SINGLE : num_lines = 1;
line_offset[0] = 1;
break;
case UNDERLINE_DOUBLE : num_lines = 2;
line_offset[0] = 0;
line_offset[1] = 2;
default :
break;
};
if (mstyle_get_font_strike (mstyle))
line_offset[num_lines++] = font->ascent/-2;