Commit 63d85243 authored by Jean Bréfort's avatar Jean Bréfort

More dialogs fixes. [#665062]

parent 28c1d05e
2011-11-28 Jean Brefort <jean.brefort@normalesup.org>
* cell-comment.ui: more GtkTable eradication work.
* cell-format-cond.ui: ditto.
* cell-format.ui: ditto.
* covariance.ui: fixed widgets names. [#665062]
* dialog-analysis-tool-kaplan-meier.c (dialog_kaplan_meier_tool): fixed.
[#665062]
* dialog-cell-format-cond.c (c_fmt_dialog_init_editor_page): ditto.
* dialog-cell-format.c (fmt_dialog_init_align_page): ditto.
* kaplan-meier.ui: fixed groups page. [#665062]
2011-11-27 Morten Welinder <terra@gnome.org>
* Release 1.11.1
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="comment_dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
......@@ -23,6 +22,7 @@
<child>
<object class="GtkButton" id="help_button">
<property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
......@@ -39,6 +39,7 @@
<child>
<object class="GtkButton" id="cancel_button">
<property name="label">gtk-cancel</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
......@@ -55,6 +56,7 @@
<child>
<object class="GtkButton" id="ok_button">
<property name="label">gtk-ok</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
......@@ -77,29 +79,25 @@
</packing>
</child>
<child>
<object class="GtkTable" id="table1">
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkEntry" id="new-author-entry">
<object class="GtkLabel" id="old-author-label">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Old Author:&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_SHRINK | GTK_FILL</property>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
......@@ -111,9 +109,9 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_SHRINK | GTK_FILL</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
......@@ -126,36 +124,40 @@
<property name="single_line_mode">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="old-author-label">
<object class="GtkEntry" id="new-author-entry">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Old Author:&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="single_line_mode">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char"></property>
<property name="invisible_char_set">True</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="wrap-check">
<property name="label" translatable="yes">_Wrap in properties window</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
......
This diff is collapsed.
This diff is collapsed.
......@@ -88,7 +88,7 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="var1-label1">
<object class="GtkLabel" id="var1-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
......@@ -119,7 +119,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="labels_button1">
<object class="GtkCheckButton" id="labels_button">
<property name="label" translatable="yes">_Labels</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
......@@ -138,7 +138,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="grouped_by_col1">
<object class="GtkRadioButton" id="grouped_by_col">
<property name="label" translatable="yes" context="groupby" comments="Group by Columns">_Columns</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
......@@ -158,7 +158,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="grouped_by_row1">
<object class="GtkRadioButton" id="grouped_by_row">
<property name="label" translatable="yes" context="groupby" comments="Group by Rows">_Rows</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
......@@ -168,7 +168,6 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">grouped_by_col</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -178,7 +177,7 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="grouped_by_area1">
<object class="GtkRadioButton" id="grouped_by_area">
<property name="label" translatable="yes">_Areas</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
......@@ -188,7 +187,6 @@
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="group">grouped_by_col</property>
</object>
<packing>
<property name="left_attach">1</property>
......@@ -197,6 +195,21 @@
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="tab">
......
......@@ -67,7 +67,7 @@ typedef struct {
GtkWidget *remove_group_button;
GtkWidget *std_error_button;
GtkWidget *groups_check;
GtkWidget *groups_table;
GtkWidget *groups_grid;
GnmExprEntry *groups_input;
GtkTreeView *groups_treeview;
GtkListStore *groups_list;
......@@ -666,14 +666,14 @@ dialog_kaplan_meier_tool (WBCGtk *wbcg, Sheet *sheet)
state->groups_check = GTK_WIDGET (go_gtk_builder_get_widget
(state->base.gui,
"groups-check"));
state->groups_table = GTK_WIDGET (go_gtk_builder_get_widget
state->groups_grid = GTK_WIDGET (go_gtk_builder_get_widget
(state->base.gui,
"groups-table"));
"groups-grid"));
state->groups_input = gnm_expr_entry_new (state->base.wbcg, TRUE);
gnm_expr_entry_set_flags (state->groups_input, GNM_EE_FORCE_ABS_REF,
GNM_EE_MASK);
gtk_table_attach (GTK_TABLE (state->groups_table), GTK_WIDGET (state->groups_input),
1, 3, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
gtk_grid_attach (GTK_GRID (state->groups_grid),
GTK_WIDGET (state->groups_input), 1, 1, 2, 1);
dialog_kaplan_meier_tool_setup_treeview (state);
......
......@@ -1117,25 +1117,25 @@ cb_c_format_dialog_range (G_GNUC_UNUSED SheetView *sv, GnmRange const *range, GS
static void
c_fmt_dialog_init_editor_page (CFormatState *state)
{
GtkTable *table;
GtkGrid *grid;
state->editor.add_button = go_gtk_builder_get_widget (state->gui, "add-button");
state->editor.replace_button = go_gtk_builder_get_widget (state->gui, "replace-button");
state->editor.copy_button = go_gtk_builder_get_widget (state->gui, "copy-button");
state->editor.edit_style_button = go_gtk_builder_get_widget (state->gui, "edit-style-button");
state->editor.combo = go_gtk_builder_get_widget (state->gui, "condition-combo");
table = GTK_TABLE (go_gtk_builder_get_widget (state->gui, "condition-table"));
grid = GTK_GRID (go_gtk_builder_get_widget (state->gui, "condition-grid"));
state->editor.expr_x = GTK_WIDGET (gnm_expr_entry_new (state->wbcg, TRUE));
gtk_table_attach (table, state->editor.expr_x, 1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_grid_attach (grid, state->editor.expr_x, 1, 2, 2, 1);
gtk_widget_set_hexpand (state->editor.expr_x, TRUE);
gtk_widget_show(state->editor.expr_x);
gnm_expr_entry_set_flags (GNM_EXPR_ENTRY (state->editor.expr_x),
GNM_EE_CONSTANT_ALLOWED,
GNM_EE_MASK);
state->editor.expr_y = GTK_WIDGET (gnm_expr_entry_new (state->wbcg, TRUE));
gtk_table_attach (table, state->editor.expr_y, 1, 2, 3, 4,
GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_grid_attach (grid, state->editor.expr_y, 1, 3, 2, 1);
gtk_widget_set_hexpand (state->editor.expr_y, TRUE);
gtk_widget_show(state->editor.expr_y);
gnm_expr_entry_set_flags (GNM_EXPR_ENTRY (state->editor.expr_y),
GNM_EE_CONSTANT_ALLOWED,
......
......@@ -687,8 +687,8 @@ fmt_dialog_init_align_page (FormatState *state)
} else
r = 0;
state->align.rotation = (GORotationSel *) go_rotation_sel_new ();
gtk_box_pack_start (GTK_BOX (go_gtk_builder_get_widget (state->gui, "alignment_box")),
GTK_WIDGET (state->align.rotation), TRUE, TRUE, 0);
gtk_grid_attach (GTK_GRID (go_gtk_builder_get_widget (state->gui, "alignment-grid")),
GTK_WIDGET (state->align.rotation), 3, 0, 1, 12);
go_rotation_sel_set_rotation (state->align.rotation, r);
g_signal_connect (G_OBJECT (state->align.rotation), "rotation-changed",
G_CALLBACK (cb_rotation_changed), state);
......
......@@ -314,7 +314,7 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="width">2</property>
<property name="height">3</property>
</packing>
</child>
......@@ -325,11 +325,12 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">start</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
......@@ -342,11 +343,12 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">start</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
......@@ -388,21 +390,6 @@
<property name="border_width">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<object class="GtkCheckButton" id="graph-button">
<property name="label" translatable="yes">Show graph </property>
......@@ -499,6 +486,24 @@
<property name="height">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">2</property>
......
......@@ -10,6 +10,7 @@
#include <glib/gi18n-lib.h>
#include "gnumeric.h"
#include "sheet-object-image.h"
#include "sheet.h"
#include "gnm-pane.h"
#include "wbc-gtk.h"
......@@ -98,6 +99,7 @@ struct _SheetObjectImage {
GOImage *image;
char *type;
char *name;
GByteArray bytes;
gboolean dumped;
......@@ -169,6 +171,7 @@ gnm_soi_finalize (GObject *object)
soi = SHEET_OBJECT_IMAGE (object);
g_free (soi->bytes.data);
g_free (soi->type);
g_free (soi->name);
soi->bytes.data = NULL;
if (soi->image)
g_object_unref (soi->image);
......@@ -176,129 +179,6 @@ gnm_soi_finalize (GObject *object)
G_OBJECT_CLASS (gnm_soi_parent_class)->finalize (object);
}
static GdkPixbuf *
soi_get_cropped_pixbuf (SheetObjectImage *soi, GdkPixbuf *pixbuf)
{
int width = gdk_pixbuf_get_width (pixbuf);
int height = gdk_pixbuf_get_height (pixbuf);
int sub_x = rint (soi->crop_left * width);
int sub_y = rint (soi->crop_top * height);
int sub_width = rint (width *
(1. - soi->crop_left - soi->crop_right));
int sub_height = rint (height *
(1. - soi->crop_top - soi->crop_bottom));
GdkPixbuf *sub = gdk_pixbuf_new_subpixbuf (pixbuf, sub_x, sub_y,
sub_width, sub_height);
if (sub) {
g_object_unref (G_OBJECT (pixbuf));
pixbuf = sub;
}
return pixbuf;
}
static void
soi_info_cb (GdkPixbufLoader *loader,
int width,
int height,
gpointer data)
{
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (data);
GdkPixbufFormat *format = gdk_pixbuf_loader_get_format (loader);
char *name = gdk_pixbuf_format_get_name (format);
g_free (soi->type);
soi->type = name;
}
/**
* be sure to unref the result if it is non-NULL
*
* TODO : this is really overkill for now.
* only wmf/emf will require regenerating the pixbuf for different scale
* factors. And even then we should cache them.
*/
static GdkPixbuf *
soi_get_pixbuf (SheetObjectImage *soi, double scale)
{
GError *err = NULL;
guint8 *data;
guint32 data_len;
GdkPixbufLoader *loader = NULL;
GdkPixbuf *pixbuf = NULL;
gboolean ret;
g_return_val_if_fail (IS_SHEET_OBJECT_IMAGE (soi), NULL);
data = soi->bytes.data;
data_len = soi->bytes.len;
if (data == NULL || data_len == 0)
return pixbuf;
if (soi->type != NULL && !strcmp (soi->type, "wmf"))
loader = gdk_pixbuf_loader_new_with_type (soi->type, &err);
else
loader = gdk_pixbuf_loader_new ();
if (soi->type == NULL || strlen (soi->type) == 0)
g_signal_connect (loader, "size-prepared",
G_CALLBACK (soi_info_cb), soi);
if (loader) {
ret = gdk_pixbuf_loader_write (loader,
soi->bytes.data, soi->bytes.len,
&err);
/* Close in any case. But don't let error during closing
* shadow error from loader_write. */
gdk_pixbuf_loader_close (loader, ret ? &err : NULL);
if (ret)
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
if (pixbuf) {
g_object_ref (G_OBJECT (pixbuf));
d (printf ("pixbuf width=%d, height=%d\n",
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf)));
if (soi->crop_top != 0.0 || soi->crop_bottom != 0.0 ||
soi->crop_left != 0.0 || soi->crop_right != 0.0) {
d (printf ("crop rect top=%g, bottom=%g, "
"left=%g, right=%g\n",
soi->crop_top, soi->crop_bottom,
soi->crop_left, soi->crop_right));
pixbuf = soi_get_cropped_pixbuf (soi, pixbuf);
}
}
g_object_unref (G_OBJECT (loader));
}
if (!pixbuf) {
if (!soi->dumped) {
static int count = 0;
char *filename = g_strdup_printf ("unknown%d.%s",
count++, soi->type);
#if 0
GsfOutput *file = gsf_output_stdio_new (filename, NULL);
if (file) {
gsf_output_write (GSF_OUTPUT (file),
soi->bytes.len,
soi->bytes.data);
gsf_output_close (GSF_OUTPUT (file));
g_object_unref (file);
}
#endif
g_free (filename);
soi->dumped = TRUE;
}
if (err != NULL) {
g_warning ("%s", err->message);
g_error_free (err);
err = NULL;
} else {
g_warning ("Unable to display image");
}
}
return pixbuf;
}
static SheetObjectView *
gnm_soi_new_view (SheetObject *so, SheetObjectViewContainer *container)
{
......@@ -322,7 +202,7 @@ gnm_soi_new_view (SheetObject *so, SheetObjectViewContainer *container)
} else {
GdkPixbuf *pixbuf, *placeholder = NULL;
pixbuf = soi_get_pixbuf (soi, 1.);
pixbuf = go_image_get_pixbuf (soi->image);
if (pixbuf == NULL) {
placeholder = gtk_icon_theme_load_icon (
......@@ -364,7 +244,8 @@ static GOImageFormat const standard_formats[] = {
GO_IMAGE_FORMAT_JPG,
GO_IMAGE_FORMAT_SVG,
GO_IMAGE_FORMAT_EMF,
GO_IMAGE_FORMAT_WMF
GO_IMAGE_FORMAT_WMF,
GO_IMAGE_FORMAT_EPS
};
static GtkTargetList *
......@@ -377,7 +258,7 @@ gnm_soi_get_target_list (SheetObject const *so)
GdkPixbuf *pixbuf = NULL;
if (soi->type == NULL || soi->image == NULL)
pixbuf = soi_get_pixbuf (soi, 1.0);
pixbuf = go_image_get_pixbuf (soi->image);
mime_str = go_image_format_to_mime (soi->type);
if (mime_str) {
mimes = go_strsplit_to_slist (mime_str, ',');
......@@ -407,7 +288,7 @@ gnm_soi_write_image (SheetObject const *so, char const *format, double resolutio
{
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
gboolean res = FALSE;
GdkPixbuf *pixbuf = soi_get_pixbuf (soi, 1.0);
GdkPixbuf *pixbuf = go_image_get_pixbuf (soi->image);
if (!soi->type || strcmp (format, soi->type) == 0)
res = gsf_output_write (output,
......@@ -440,10 +321,10 @@ soi_cb_save_as (SheetObject *so, SheetControl *sc)
g_return_if_fail (soi != NULL);
sel_fmt = go_image_get_format_from_name (soi->type);
if ((pixbuf = soi_get_pixbuf (soi, 1.0)) != NULL)
if ((pixbuf = go_image_get_pixbuf (soi->image)) != NULL)
l = go_image_get_formats_with_pixbuf_saver ();
/* Move original format first in menu */
if (sel_fmt) {
if (sel_fmt != GO_IMAGE_FORMAT_UNKNOWN) {
l = g_slist_remove (l, GUINT_TO_POINTER (sel_fmt));
l = g_slist_prepend (l, GUINT_TO_POINTER (sel_fmt));
}
......@@ -486,13 +367,17 @@ content_start (GsfXMLIn *xin, xmlChar const **attrs)
{
SheetObject *so = gnm_xml_in_cur_obj (xin);
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
char const *image_type = NULL;
char const *image_type = NULL, *image_name = NULL;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (attr_eq (attrs[0], "image-type"))
image_type = CXML2C (attrs[1]);
else if (attr_eq (attrs[0], "name"))
image_name = CXML2C (attrs[1]);
soi->type = g_strdup (image_type);
if (image_name)
soi->name = g_strdup (image_name);
}
static void
content_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
......@@ -500,10 +385,12 @@ content_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
SheetObject *so = gnm_xml_in_cur_obj (xin);
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
soi->bytes.len = gsf_base64_decode_simple (
xin->content->str, xin->content->len);
soi->bytes.data = g_memdup (xin->content->str, soi->bytes.len);
soi->image = go_image_new_from_data (soi->type, xin->content->str, soi->bytes.len, NULL, NULL);
if (soi->name == NULL) {
soi->bytes.len = gsf_base64_decode_simple (
xin->content->str, xin->content->len);
soi->bytes.data = g_memdup (xin->content->str, soi->bytes.len);
soi->image = go_image_new_from_data (soi->type, xin->content->str, soi->bytes.len, NULL, NULL);
}
}
static void
......@@ -545,8 +432,13 @@ gnm_soi_write_xml_sax (SheetObject const *so, GsfXMLOut *output,
gsf_xml_out_start_element (output, "Content");
if (soi->type != NULL)
gsf_xml_out_add_cstr (output, "image-type", soi->type);
gsf_xml_out_add_uint (output, "size-bytes", soi->bytes.len);
gsf_xml_out_add_base64 (output, NULL, soi->bytes.data, soi->bytes.len);
if (soi->image && go_image_get_name (soi->image)) {
gsf_xml_out_add_cstr (output, "name", go_image_get_name (soi->image));
go_doc_save_image (GO_DOC (sheet_object_get_sheet (so)->workbook), go_image_get_name (soi->image));
} else {
gsf_xml_out_add_uint (output, "size-bytes", soi->bytes.len);
gsf_xml_out_add_base64 (output, NULL, soi->bytes.data, soi->bytes.len);
}
gsf_xml_out_end_element (output);
}
......@@ -589,7 +481,7 @@ gnm_soi_draw_cairo (SheetObject const *so, cairo_t *cr,
go_image_draw (soi->image, cr);
cairo_restore (cr);
} else {
pixbuf = soi_get_pixbuf (soi, 1.);
pixbuf = go_image_get_pixbuf (soi->image);
if (!pixbuf || width == 0. || height == 0.)
return;
cairo_save (cr);
......@@ -617,7 +509,7 @@ gnm_soi_default_size (SheetObject const *so, double *w, double *h)
*w = go_image_get_width (soi->image);
*h = go_image_get_height (soi->image);
} else {
GdkPixbuf *buf = soi_get_pixbuf (soi, 1.);
GdkPixbuf *buf = go_image_get_pixbuf (soi->image);
if (!buf) {
*w = *h = 5;
......@@ -639,6 +531,26 @@ gnm_soi_default_size (SheetObject const *so, double *w, double *h)
}
}
static gboolean
gnm_soi_assign_to_sheet (SheetObject *so, Sheet *sheet)
{
SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
if (soi->image && !go_image_get_name (soi->image)) {
GODoc *doc = GO_DOC (sheet->workbook);
GOImage *image = go_doc_add_image (doc, NULL, soi->image);
if (soi->image != image) {
g_object_unref (soi->image);
soi->image = image;
}
} else if (soi->name) {
GODoc *doc = GO_DOC (sheet->workbook);
GType type = go_image_type_for_format (soi->type);
soi->image = g_object_ref (go_doc_image_fetch (doc, soi->name, type));
}
return FALSE;
}
static void
gnm_soi_get_property (GObject *object,
guint property_id,
......@@ -656,7 +568,7 @@ gnm_soi_get_property (GObject *object,
g_value_set_pointer (value, &soi->bytes);
break;
case PROP_PIXBUF:
pixbuf = soi_get_pixbuf (soi, 1.0);
pixbuf = go_image_get_pixbuf (soi->image);
g_value_set_object (value, pixbuf);
break;
default:
......@@ -686,6 +598,7 @@ gnm_soi_class_init (GObjectClass *object_class)
so_class->draw_cairo = gnm_soi_draw_cairo;
so_class->user_config = NULL;
so_class->default_size = gnm_soi_default_size;
so_class->assign_to_sheet = gnm_soi_assign_to_sheet;
so_class->rubber_band_directly = TRUE;
/* The property strings don't need translation */
......
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