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

From Ivan Wong : http://bugzilla.gnome.org/show_bug.cgi?id=159860 Use

2004-12-17  Jody Goldberg <jody@gnome.org>

	From Ivan Wong :
	http://bugzilla.gnome.org/show_bug.cgi?id=159860
	* utils/go-file.c (go_url_show) : Use ShellExecute on win32

2004-11-13  Jody Goldberg <jody@gnome.org>

	* ms-excel-read.c (ms_sheet_realize_obj) : We have a clear separation
	  between create and realize now, we should use it.  This routine sets
	  the content.
	(ms_sheet_create_obj) : this one creates objects for use later.
	  I am not entire happy with this split.  It no longer feels
	  necessary but it is much too close to release to contemplate
	  cleaning it up.


2004-11-14  Jody Goldberg <jody@gnome.org>

	* src/sheet-object-image.c (sheet_object_image_set_image) : renamed
	  from sheet_object_image_new to make the life cycle simpler for
	  importers.
	(soi_get_pixbuf) : No data == no pixbuf
	* src/wbcg-actions.c (cb_insert_image) : adjust to the name and
	  semantic change of sheet_object_image_set_image.
parent 7b2166d0
......@@ -12,10 +12,9 @@ Release Critical
: tie the custom ui into action sensitivity pools
: kasal's popt patch
: support array evaluation for =LARGE and friends
http://bugzilla.gnome.org/show_bug.cgi?id=157997
: image import from xl95
http://bugzilla.gnome.org/show_bug.cgi?id=159581
: undo has dep leaks
: Ivan's win32 build patch
Worries
-------
......
2004-11-14 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.c (sheet_object_image_set_image) : renamed
from sheet_object_image_new to make the life cycle simpler for
importers.
(soi_get_pixbuf) : No data == no pixbuf
* src/wbcg-actions.c (cb_insert_image) : adjust to the name and
semantic change of sheet_object_image_set_image.
2004-12-17 Morten Welinder <terra@gnome.org>
* src/print-cell.c (print_cell_NEW): Fix origin correction.
......
Gnumeric 1.4.2
<<<<<<< NEWS
Caolan McNamara:
* Improve python config test for ia64 [#161547]
* Handle invalid DIMENSIONS records in xls [#161534]
=======
Emmanuel Pacaud:
* fix legend update on pie label change.
* don't disable theming for xy plot with line or marker only.
>>>>>>> 1.1703
J.H.M. Dassen (Ray):
* XLS import for paper sizes for which gnome-print doesn't have a
name.
Jody:
* Install the man pages
* Backport some framework for RTL
* image import from xl95 [#157997]
Morten:
* Improve accuracy of pgamma and thus pchisq, ppois, qgamma,
qchisq, qpois, and more for extreme arguments.
......
2004-11-14 Jody Goldberg <jody@gnome.org>
* src/sheet-object-image.c (sheet_object_image_set_image) : renamed
from sheet_object_image_new to make the life cycle simpler for
importers.
(soi_get_pixbuf) : No data == no pixbuf
* src/wbcg-actions.c (cb_insert_image) : adjust to the name and
semantic change of sheet_object_image_set_image.
2004-12-17 Morten Welinder <terra@gnome.org>
* src/print-cell.c (print_cell_NEW): Fix origin correction.
......
2004-11-13 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (ms_sheet_realize_obj) : We have a clear separation
between create and realize now, we should use it. This routine sets
the content.
(ms_sheet_create_obj) : this one creates objects for use later.
I am not entire happy with this split. It no longer feels
necessary but it is much too close to release to contemplate
cleaning it up.
2004-12-17 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=161534
......
......@@ -245,44 +245,6 @@ ms_sheet_map_color (ExcelReadSheet const *esheet, MSObj const *obj, MSObjAttrID
return RGBA_TO_UINT (r,g,b,0xff);
}
static SheetObject *
ms_sheet_create_image (MSObj *obj, MSEscherBlip *blip)
{
SheetObject *so;
MSObjAttr *crop_left_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_LEFT);
MSObjAttr *crop_top_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_TOP);
MSObjAttr *crop_right_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_RIGHT);
MSObjAttr *crop_bottom_attr = ms_obj_attr_bag_lookup
(obj->attrs, MS_OBJ_ATTR_BLIP_CROP_BOTTOM);
double crop_left_val = 0.0;
double crop_top_val = 0.0;
double crop_right_val = 0.0;
double crop_bottom_val = 0.0;
so = sheet_object_image_new (blip->type, blip->data, blip->data_len,
!blip->needs_free);
if (!so)
return NULL;
if (crop_left_attr)
crop_left_val = (double) crop_left_attr->v.v_uint / 65536.;
if (crop_top_attr)
crop_top_val = (double) crop_top_attr->v.v_uint / 65536.;
if (crop_right_attr)
crop_right_val = (double) crop_right_attr->v.v_uint / 65536.;
if (crop_bottom_attr)
crop_bottom_val = (double) crop_bottom_attr->v.v_uint / 65536.;
sheet_object_image_set_crop (SHEET_OBJECT_IMAGE (so),
crop_left_val, crop_top_val,
crop_right_val, crop_bottom_val);
return so;
}
/**
* ms_sheet_obj_anchor_to_pos:
* @points Array which receives anchor coordinates in points
......@@ -465,25 +427,37 @@ ms_sheet_realize_obj (MSContainer *container, MSObj *obj)
break;
case 0x08: { /* Picture */
MSObjAttr *blip_id = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_ID);
double crop_left = 0.0;
double crop_top = 0.0;
double crop_right = 0.0;
double crop_bottom = 0.0;
if (blip_id != NULL) {
if ((attr = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_ID)) != NULL) {
MSEscherBlip *blip = ms_container_get_blip (container,
blip_id->v.v_uint - 1);
attr->v.v_uint - 1);
if (blip != NULL) {
so = ms_sheet_create_image (obj, blip);
sheet_object_image_set_image (SHEET_OBJECT_IMAGE (so),
blip->type, blip->data, blip->data_len,
!blip->needs_free);
blip->needs_free = FALSE; /* image took over managing data */
}
}
/* replace blips we don't know how to handle with rectangles */
if (so == NULL)
so = g_object_new (GNM_SO_FILLED_TYPE, NULL); /* placeholder */
#warning Free the objects. I have a patch for this once 1.4.0 is out
if (so != obj->gnum_obj)
g_object_unref (so);
if ((attr = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_CROP_LEFT)) != NULL)
crop_left = (double) attr->v.v_uint / 65536.;
if ((attr = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_CROP_RIGHT)) != NULL)
crop_right = (double) attr->v.v_uint / 65536.;
if ((attr = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_CROP_TOP)) != NULL)
crop_top = (double) attr->v.v_uint / 65536.;
if ((attr = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_CROP_BOTTOM)) != NULL)
crop_bottom = (double) attr->v.v_uint / 65536.;
sheet_object_image_set_crop (SHEET_OBJECT_IMAGE (so),
crop_left, crop_top, crop_right, crop_bottom);
break;
}
......@@ -571,24 +545,8 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
/* Button */
case 0x07: so = g_object_new (sheet_widget_button_get_type (), NULL);
break;
case 0x08: { /* Picture */
MSObjAttr *blip_id = ms_obj_attr_bag_lookup (obj->attrs,
MS_OBJ_ATTR_BLIP_ID);
if (blip_id != NULL) {
MSEscherBlip *blip = ms_container_get_blip (container,
blip_id->v.v_uint - 1);
if (blip != NULL) {
so = ms_sheet_create_image (obj, blip);
blip->needs_free = FALSE; /* image took over managing data */
}
}
/* replace blips we don't know how to handle with rectangles */
if (so == NULL)
so = g_object_new (GNM_SO_FILLED_TYPE, NULL); /* placeholder */
case 0x08: so = g_object_new (SHEET_OBJECT_IMAGE_TYPE, NULL); /* Picture */
break;
}
case 0x09: so = g_object_new (GNM_SO_POLYGON_TYPE, NULL);
break;
case 0x0B: so = g_object_new (sheet_widget_checkbox_get_type (), NULL);
......
2004-12-17 Jody Goldberg <jody@gnome.org>
From Ivan Wong :
http://bugzilla.gnome.org/show_bug.cgi?id=159860
* utils/go-file.c (go_url_show) : Use ShellExecute on win32
2004-12-17 Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>
* graph/plot-xy/gog-xy.c (gog_xy_series_init_style): don't disable
......
......@@ -177,9 +177,8 @@ go_dirname_from_uri (const char *uri, gboolean brief)
g_free (raw_uri);
#else
char *uri_dirname = g_path_get_dirname (uri);
char *dir = uri_dirname ? go_filename_from_uri (uri_dirname) : NULL;
dirname = uri_dirname ? go_filename_from_uri (uri_dirname) : NULL;
dirname = dirname ? g_strconcat ("file://", dirname, NULL) : NULL;
g_free (dir);
g_free (uri_dirname);
#endif
......@@ -404,6 +403,11 @@ check_program (char const *prog)
GError *
go_url_show (gchar const *url)
{
#ifdef G_OS_WIN32
ShellExecute (NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
return NULL;
#else
GError *err = NULL;
#ifdef WITH_GNOME
gnome_url_show (url, &err);
......@@ -415,49 +419,6 @@ go_url_show (gchar const *url)
/* 1) Check BROWSER env var */
browser = check_program (getenv ("BROWSER"));
#ifdef G_OS_WIN32
{
char *ptr, *longpath;
HKEY hKey;
unsigned long lType;
DWORD dwSize;
/* 2) Check registry */
if (browser == NULL &&
RegOpenKeyEx (HKEY_CLASSES_ROOT, "http\\shell\\open\\command", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
if(RegQueryValueEx (hKey, NULL, NULL, &lType, NULL, &dwSize) == ERROR_SUCCESS) {
unsigned char *buf = g_new (unsigned char, dwSize + 1);
RegQueryValueEx (hKey, NULL, NULL, &lType, buf, &dwSize);
browser = check_program (buf);
g_free (buf);
}
RegCloseKey(hKey);
}
/* some win32 specific url cleanup */
/* If this is a file:// URL, strip off file:// and make it backslashed */
if (g_ascii_strncasecmp (url, "file://", 7) == 0) {
url += 7;
/* View as WebPage likes to throw in an extra /\ just for fun,
* strip it off */
if (strncmp (url, "/\\", 2) == 0)
url += 2;
longpath = g_strdup (url);
/* s/forward-slash/back-slash/ */
for (ptr = longpath ; *ptr ; ptr++)
if (*ptr == '/')
*ptr = '\\';
clean_url = g_new (char, MAX_PATH);
/* Convert to 8.3 in case of spaces in path */
GetShortPathName (longpath, clean_url, MAX_PATH);
g_free (longpath);
}
}
#endif
if (browser == NULL) {
static char const * const browsers[] = {
"sensible-browser", /* debian */
......@@ -516,4 +477,5 @@ go_url_show (gchar const *url)
g_free (clean_url);
return err;
#endif
#endif
}
......@@ -122,26 +122,29 @@ enum {
};
/**
* sheet_object_image_new :
* sheet_object_image_set_image :
* @so : #SheetObjectImage
* @type :
* @data :
* @data_len
* @copy_data :
*/
SheetObject *
sheet_object_image_new (char const *type,
*
* Assign raw data and type to @so assuming that it has not been initialized
* yet.
**/
void
sheet_object_image_set_image (SheetObjectImage *soi,
char const *type,
guint8 *data,
guint32 data_len,
unsigned data_len,
gboolean copy_data)
{
SheetObjectImage *soi;
g_return_if_fail (IS_SHEET_OBJECT_IMAGE (soi));
g_return_if_fail (soi->bytes.data == NULL && soi->bytes.len == 0);
soi = g_object_new (SHEET_OBJECT_IMAGE_TYPE, NULL);
soi->type = g_strdup (type);
soi->bytes.len = data_len;
soi->bytes.data = copy_data ? g_memdup (data, data_len) : data;
return SHEET_OBJECT (soi);
}
void
......@@ -209,7 +212,7 @@ soi_info_cb (GdkPixbufLoader *loader,
* 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 pixbug for different scale
* only wmf/emf will require regenerating the pixbuf for different scale
* factors. And even then we should cache them.
*/
static GdkPixbuf *
......@@ -226,6 +229,8 @@ soi_get_pixbuf (SheetObjectImage *soi, double scale)
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);
......
......@@ -10,9 +10,10 @@
typedef struct _SheetObjectImage SheetObjectImage;
GType sheet_object_image_get_type (void);
SheetObject *sheet_object_image_new (char const *type,
void sheet_object_image_set_image (SheetObjectImage *soi,
char const *type,
guint8 *data,
guint32 data_len,
unsigned data_len,
gboolean copy_data);
void sheet_object_image_set_crop (SheetObjectImage *soi,
double crop_left, double crop_top,
......
......@@ -294,6 +294,15 @@ sheet_object_get_sheet (SheetObject const *so)
return so->sheet;
}
static int
cb_create_views (SheetObject *so)
{
g_object_set_data (G_OBJECT (so), "create_view_handler", NULL);
SHEET_FOREACH_CONTROL (so->sheet, view, control,
sc_object_create_view (control, so););
sheet_object_update_bounds (so, NULL);
return FALSE;
}
/**
* sheet_object_set_sheet :
......@@ -321,13 +330,14 @@ sheet_object_set_sheet (SheetObject *so, Sheet *sheet)
g_object_ref (G_OBJECT (so));
sheet->sheet_objects = g_list_prepend (sheet->sheet_objects, so);
SHEET_FOREACH_CONTROL (so->sheet, view, control,
sc_object_create_view (control, so););
sheet_object_update_bounds (so, NULL);
/* FIXME : add a flag to sheet to have sheet_update do this */
sheet_objects_max_extent (sheet);
if (NULL == g_object_get_data (G_OBJECT (so), "create_view_handler")) {
guint id = g_idle_add ((GSourceFunc) cb_create_views, so);
g_object_set_data (G_OBJECT (so), "create_view_handler", GUINT_TO_POINTER (id));
}
return FALSE;
}
......@@ -344,6 +354,7 @@ gboolean
sheet_object_clear_sheet (SheetObject *so)
{
GList *ptr;
gpointer view_handler;
g_return_val_if_fail (IS_SHEET_OBJECT (so), TRUE);
g_return_val_if_fail (IS_SHEET (so->sheet), TRUE);
......@@ -351,6 +362,13 @@ sheet_object_clear_sheet (SheetObject *so)
ptr = g_list_find (so->sheet->sheet_objects, so);
g_return_val_if_fail (ptr != NULL, TRUE);
/* clear any pending attempts to create views */
view_handler = g_object_get_data (G_OBJECT (so), "create_view_handler");
if (NULL != view_handler) {
g_source_remove (GPOINTER_TO_UINT (view_handler));
g_object_set_data (G_OBJECT (so), "create_view_handler", NULL);
}
/* The views remove themselves from the list */
while (so->realized_list != NULL)
sheet_object_view_destroy (so->realized_list->data);
......
......@@ -914,8 +914,9 @@ static GNM_ACTION_DEF (cb_insert_image)
if (input != NULL) {
unsigned len = gsf_input_size (input);
guint8 const *data = gsf_input_read (input, len, NULL);
scg_mode_create_object (wbcg_cur_scg (wbcg),
sheet_object_image_new ("", (guint8 *)data, len, TRUE));
SheetObjectImage *soi = g_object_new (SHEET_OBJECT_IMAGE_TYPE, NULL);
sheet_object_image_set_image (soi, "", (guint8 *)data, len, TRUE);
scg_mode_create_object (wbcg_cur_scg (wbcg), SHEET_OBJECT (soi));
g_object_unref (input);
} else
gnm_cmd_context_error (GNM_CMD_CONTEXT (wbcg), err);
......
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