[gnumeric] Print sheet widget objects. [#144787]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Print sheet widget objects. [#144787]
- Date: Fri, 25 Dec 2009 00:41:49 +0000 (UTC)
commit 5db21d1e679294c5a7a5c55a229ae6d0d85be07f
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Thu Dec 24 17:40:33 2009 -0700
Print sheet widget objects. [#144787]
2009-12-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-object-widget.c (sheet_widget_ ## n1 ## _class_init):
install sheet_widget_draw_cairo
(sheet_widget_draw_cairo): new
ChangeLog | 6 +++++
NEWS | 1 +
src/sheet-object-widget.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 52 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b3837b4..3fe512a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-24 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/sheet-object-widget.c (sheet_widget_ ## n1 ## _class_init):
+ install sheet_widget_draw_cairo
+ (sheet_widget_draw_cairo): new
+
2009-12-24 Jean Brefort <jean brefort normalesup org>
* src/rangefunc.h: add gnm_range_increasing (to fix a double/gnm_float
diff --git a/NEWS b/NEWS
index 8e6a353..17388a7 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Andreas:
* Load graph series labels and categories from ODF files. [#379220]
* Write series labels to ODF files.
* Fix tab behaviour. [#388344]
+ * Print sheet widget objects. [#144787]
Jean
* Fix import export of line type in scatter plots. [#605043]
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index a647e16..972c41b 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -70,6 +70,10 @@ attr_eq (const xmlChar *a, const char *s)
/****************************************************************************/
static void
+sheet_widget_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height);
+
+static void
cb_so_get_ref (GnmDependent *dep, SheetObject *so, gpointer user)
{
GnmDependent **pdep = user;
@@ -193,6 +197,7 @@ sheet_widget_ ## n1 ## _class_init (GObjectClass *object_class) \
so_class->copy = fn_copy; \
so_class->write_xml_sax = fn_write_sax; \
so_class->prep_sax_parser = fn_prep_sax_parser; \
+ so_class->draw_cairo = &sheet_widget_draw_cairo; \
sow_class->create_widget = &sheet_widget_ ## n1 ## _create_widget; \
{ class_init_code; } \
} \
@@ -444,7 +449,6 @@ cb_frame_config_cancel_clicked (GtkWidget *button, FrameConfigState *state)
gtk_widget_destroy (state->dialog);
}
-
static void
cb_frame_label_changed (GtkWidget *entry, FrameConfigState *state)
{
@@ -3258,6 +3262,46 @@ GSF_CLASS (SheetWidgetCombo, sheet_widget_combo,
&sheet_widget_combo_class_init, NULL,
SHEET_WIDGET_LIST_BASE_TYPE)
+
+/**************************************************************************/
+
+static void
+sheet_widget_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ SheetObjectWidget *sow = SHEET_OBJECT_WIDGET (so);
+
+ if ((sow->so.realized_list->data != NULL)) {
+ SheetObjectView *view = sow->so.realized_list->data;
+ GocWidget *item = get_goc_widget (view);
+ GtkWidget *w = GTK_WIDGET (item->widget);
+ GdkPixmap *ss = gtk_widget_get_snapshot (w, NULL);
+ double hscale, vscale;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (w, &allocation);
+ hscale = width / (allocation.width - 1.);
+ vscale = height / (allocation.height - 1.);
+
+ cairo_save (cr);
+ cairo_scale (cr, hscale, vscale);
+ gdk_cairo_set_source_pixmap (cr, ss, -0.5, -0.5);
+ /* We probably need to scale the drawing slightly! */
+ cairo_new_path (cr);
+ cairo_move_to (cr, 0., 0.);
+ cairo_line_to (cr, width/hscale, 0.);
+ cairo_line_to (cr, width/hscale, height/vscale);
+ cairo_line_to (cr, 0., height/vscale);
+ cairo_line_to (cr, 0., 0.);
+ cairo_close_path (cr);
+ cairo_fill (cr);
+ cairo_restore (cr);
+ g_object_unref(G_OBJECT (ss));
+ }
+}
+
+
+
/**************************************************************************/
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]