Commit 3d2f48a9 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

always pass something to optional args with supplied values, even if the

2003-09-02  Jody Goldberg <jody@gnome.org>

	* src/func.c (function_call_with_list) : always pass something to
	  optional args with supplied values, even if the supplied value is
	  empty.

2003-09-01  Jody Goldberg <jody@gnome.org>

	* graph/gog-renderer-pixbuf.c (make_layout) : kludge a patch for font
	  scaling.

2003-08-30  Jon K Hellan  <hellan@acm.org>

	* src/sheet-object-graph.c (cb_save_as): New. Save graph as image.
	(sheet_object_graph_populate_menu): New. Add 'Save as image' menu
	item.
	(sheet_object_graph_class_init): Use
	sheet_object_graph_populate_menu.
parent 52183276
......@@ -206,8 +206,10 @@ Pending Patches
1.25.4) solid and empty polygons (DONE)
1.25.5) image filled polygons (DONE)
1.25.6) gradient filled polygons (DONE)
1.25.7) measure text
1.25.7) measure text (DONE)
1.25.8) draw text (DONE)
1.25.9) why doesn't text appear in preview
1.25.10) why is font selection bogus
1.26) Move 'use_one_style' from pie -> plot with 1 series (DONE)
1.27) Add a flag to gobject to go with its role indicating (DONE)
......@@ -288,7 +290,14 @@ Pending Patches
14.4) do we want to persist recently used ?
http://bugzilla.gnome.org/show_bug.cgi?id=69799
20) Change =IF back to a nodes function to handle the majority case
20) sheet-object-image
20.1) Don't make files for things we do not understand. (DONE)
20.2) Make sure we can reexport things we do not
understand
20.3) Show a placeholder image for those (DONE)
20.4) Make sure we can export any of it at all
21) AutoFilter
21.1) clip size for long lists (DONE)
21.2) fix mouse events for scrolled combos (DONE)
......@@ -373,13 +382,6 @@ Pending Patches
the use of gconf.
29.5) update the preference structure on local changes
30) sheet-object-image
30.1) Don't make files for things we do not understand. (DONE)
30.2) Make sure we can reexport things we do not
understand
30.3) Show a placeholder image for those (DONE)
30.4) Make sure we can export any of it at all
1.3 Targets
-----------
- insert cut
......
2003-09-02 Jody Goldberg <jody@gnome.org>
* src/func.c (function_call_with_list) : always pass something to
optional args with supplied values, even if the supplied value is
empty.
2003-09-01 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_graph_dim_editor_update) : If the
......@@ -8,6 +14,14 @@
configure.in: Added "az" in ALL_LINGUAS.
2003-08-30 Jon K Hellan <hellan@acm.org>
* src/sheet-object-graph.c (cb_save_as): New. Save graph as image.
(sheet_object_graph_populate_menu): New. Add 'Save as image' menu
item.
(sheet_object_graph_class_init): Use
sheet_object_graph_populate_menu.
2003-08-27 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-util.c (gnm_pixbuf_intelligent_scale): use height and
......
......@@ -18,6 +18,10 @@ Jody:
* Begin font support for chart attributes
* Fix gradient's in pie/ring slices
* http://bugzilla.gnome.org/show_bug.cgi?id=121045
* Adjust the semantics of empty cells passed to optional arguments
Jon Kåre:
* Add 'Save As' entry for graph objects. Support png for now.
Morten:
* Support End+Home key sequence.
......
2003-09-02 Jody Goldberg <jody@gnome.org>
* src/func.c (function_call_with_list) : always pass something to
optional args with supplied values, even if the supplied value is
empty.
2003-09-01 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_graph_dim_editor_update) : If the
......@@ -8,6 +14,14 @@
configure.in: Added "az" in ALL_LINGUAS.
2003-08-30 Jon K Hellan <hellan@acm.org>
* src/sheet-object-graph.c (cb_save_as): New. Save graph as image.
(sheet_object_graph_populate_menu): New. Add 'Save as image' menu
item.
(sheet_object_graph_class_init): Use
sheet_object_graph_populate_menu.
2003-08-27 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-util.c (gnm_pixbuf_intelligent_scale): use height and
......
2003-09-02 Jody Goldberg <jody@gnome.org>
* src/func.c (function_call_with_list) : always pass something to
optional args with supplied values, even if the supplied value is
empty.
2003-09-01 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_graph_dim_editor_update) : If the
......@@ -8,6 +14,14 @@
configure.in: Added "az" in ALL_LINGUAS.
2003-08-30 Jon K Hellan <hellan@acm.org>
* src/sheet-object-graph.c (cb_save_as): New. Save graph as image.
(sheet_object_graph_populate_menu): New. Add 'Save as image' menu
item.
(sheet_object_graph_class_init): Use
sheet_object_graph_populate_menu.
2003-08-27 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/gui-util.c (gnm_pixbuf_intelligent_scale): use height and
......
2003-09-01 Jody Goldberg <jody@gnome.org>
* graph/gog-renderer-pixbuf.c (make_layout) : kludge a patch for font
scaling.
2003-09-01 Jody Goldberg <jody@gnome.org>
* graph/plugins/plot_xy/gog-xy.c : An initial skeleton, because I
......
......@@ -155,7 +155,7 @@ gog_axis_update (GogObject *obj)
GSList *ptr;
GogAxis *axis = GOG_AXIS (obj);
g_warning ("axis::update");
gog_debug (0, g_warning ("axis::update"););
for (ptr = axis->contributors ; ptr != NULL ; ptr = ptr->next) {
}
......
......@@ -146,7 +146,6 @@ gog_label_get_elem (GogDataset const *set, int dim_i)
static void
gog_label_dim_changed (GogDataset *set, int dim_i)
{
g_warning ("gog_label_dim_changed %p (%d)", set, dim_i);
gog_object_emit_changed (GOG_OBJECT (set), TRUE);
}
......
......@@ -224,7 +224,7 @@ make_layout (GogRendererPixbuf *prend, char const *text)
layout = pango_layout_new (prend->pango_context);
gog_debug (-1, {
gog_debug (0, {
char *msg = pango_font_description_to_string (
prend->base.cur_style->font.font->desc);
g_warning (msg);
......@@ -232,18 +232,17 @@ make_layout (GogRendererPixbuf *prend, char const *text)
});
pango_layout_set_text (layout, text, -1);
attrs = pango_attr_list_new ();
attr = pango_attr_font_desc_new (
pango_layout_set_font_description (layout,
prend->base.cur_style->font.font->desc);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
attr = pango_attr_scale_new (prend->base.zoom);
attr = pango_attr_scale_new (prend->base.zoom *
#warning COMPLETE CRAP. This should not be necessary. but scale seems to override size, rather than modify it
pango_font_description_get_size (prend->base.cur_style->font.font->desc) /
(PANGO_SCALE * 10)); /* assume base size == 10 */
attr->start_index = 0;
attr->end_index = -1;
attrs = pango_attr_list_new ();
pango_attr_list_insert (attrs, attr);
pango_layout_set_attributes (layout, attrs);
......
......@@ -282,7 +282,9 @@ cb_font_removed (GogRenderer *rend, GOFont const *font)
g_return_if_fail (klass != NULL);
g_warning ("notify a '%s' that %p is invalid", G_OBJECT_TYPE_NAME (rend), font);
gog_debug (0, g_warning ("notify a '%s' that %p is invalid",
G_OBJECT_TYPE_NAME (rend), font););
if (klass->font_removed)
(klass->font_removed) (rend, font);
}
......
......@@ -863,7 +863,7 @@ gog_style_is_different_size (GogStyle const *a, GogStyle const *b)
void
gog_style_set_font (GogStyle *style, PangoFontDescription *desc)
{
GOFont const *font = go_font_new_by_desc (desc);
GOFont const *font = go_font_new_by_desc (desc);
if (font != NULL) {
go_font_unref (style->font.font);
style->font.font = font;
......
......@@ -375,6 +375,12 @@ gog_themes_init (void)
gog_theme_add_element (theme, style,
map_area_series_solid_default, "GogSeries", NULL);
/* labels */
style = gog_style_new ();
style->outline.width = -1; /* none */
style->fill.type = GOG_FILL_STYLE_NONE;
gog_theme_add_element (theme, style, NULL, "GogLabel", NULL);
/* Guppi */
theme = gog_theme_new (_("Guppi"));
gog_theme_register (theme, FALSE);
......@@ -418,6 +424,12 @@ gog_themes_init (void)
/* FIXME : not really true, will want to split area from line */
gog_theme_add_element (theme, style,
map_area_series_solid_guppi, "GogSeries", NULL);
/* labels */
style = gog_style_new ();
style->outline.width = -1; /* none */
style->fill.type = GOG_FILL_STYLE_NONE;
gog_theme_add_element (theme, style, NULL, "GogLabel", NULL);
}
void
......
......@@ -770,7 +770,7 @@ function_call_with_list (FunctionEvalInfo *ei, GnmExprList *l,
GnmExprEvalFlags flags)
{
GnmFunc const *fn_def;
int argc, i, optional, iter_count, iter_width = 0, iter_height = 0;
int argc, i, iter_count, iter_width = 0, iter_height = 0;
char arg_type;
Value **args, *tmp = NULL;
GnmExpr *expr;
......@@ -795,16 +795,14 @@ function_call_with_list (FunctionEvalInfo *ei, GnmExprList *l,
_("Invalid number of arguments"));
}
optional = 0;
args = g_alloca (sizeof (Value *) * fn_def->fn.args.max_args);
iter_count = (flags & GNM_EXPR_EVAL_PERMIT_NON_SCALAR) ? 0 : -1;
for (i = 0; l; l = l->next, ++i) {
arg_type = fn_def->fn.args.arg_types[i];
expr = l->data;
if (i >= fn_def->fn.args.min_args)
optional = GNM_EXPR_EVAL_PERMIT_EMPTY;
/* expr is always non-null, missing args are encoded as
* const = empty */
expr = l->data;
if (arg_type == 'A' || arg_type == 'r') {
if (expr->any.oper == GNM_EXPR_OP_CELLREF) {
......@@ -815,7 +813,7 @@ function_call_with_list (FunctionEvalInfo *ei, GnmExprList *l,
#warning do we need to force an eval here ?
} else {
tmp = args[i] = gnm_expr_eval (expr, ei->pos,
optional | GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
if (tmp->type == VALUE_CELLRANGE) {
cellref_make_abs (&tmp->v_range.cell.a,
&tmp->v_range.cell.a,
......@@ -832,7 +830,7 @@ function_call_with_list (FunctionEvalInfo *ei, GnmExprList *l,
}
/* force scalars whenever we are certain */
tmp = args[i] = gnm_expr_eval (expr, ei->pos, optional |
tmp = args[i] = gnm_expr_eval (expr, ei->pos,
((iter_count >= 0 || arg_type == '?')
? GNM_EXPR_EVAL_PERMIT_NON_SCALAR
: GNM_EXPR_EVAL_SCALAR_NON_EMPTY));
......@@ -917,7 +915,7 @@ function_call_with_list (FunctionEvalInfo *ei, GnmExprList *l,
break;
}
}
while (i < fn_def->fn.args.max_args)
args [i++] = NULL;
......
......@@ -50,6 +50,7 @@
#include <libfoocanvas/foo-canvas-polygon.h>
#include <libfoocanvas/foo-canvas-text.h>
#include <math.h>
#include <string.h>
#define SHEET_OBJECT_CONFIG_KEY "sheet-object-graph-key"
......@@ -125,6 +126,83 @@ sheet_object_graph_new_view (SheetObject *so, SheetControl *sc, gpointer key)
return G_OBJECT (item);
}
/*
* The following are useful formats to save in:
* png
* svg
* eps
*
* TODO: Add svg renderer and (possibly) eps renderer. We may also
* use a new instance of pixbufrenderer to save as png. This would
* allow the user to specify size of the saved image, if that's
* wanted.
*/
static void
cb_save_as (GtkWidget *widget, GObject *obj_view)
{
SheetObjectGraph *sog;
GdkPixbuf *pixbuf;
SheetControl *sc;
WorkbookControlGUI *wbcg;
GtkFileSelection *fsel;
sog = SHEET_OBJECT_GRAPH (sheet_object_view_obj (obj_view));
g_return_if_fail (sog != NULL);
g_return_if_fail (IS_GOG_RENDERER_PIXBUF (sog->renderer));
pixbuf = gog_renderer_pixbuf_get (GOG_RENDERER_PIXBUF (sog->renderer));
g_return_if_fail (pixbuf != NULL);
sc = sheet_object_view_control (obj_view);
wbcg = scg_get_wbcg (SHEET_CONTROL_GUI (sc));
fsel = GTK_FILE_SELECTION (gtk_file_selection_new
(_("Save graph as image")));
/* Show file selector */
if (gnumeric_dialog_file_selection (wbcg, fsel)) {
const gchar *fname = gtk_file_selection_get_filename (fsel);
const gchar *base = g_path_get_basename (fname);
const gchar *extension = strrchr (base, '.');
gchar *fullname;
GError *err = NULL;
gboolean ret;
if (extension == NULL) {
fullname = g_strdup_printf ("%s.%s", fname, "png");
} else {
if (strcmp (extension, ".png") != 0) {
gnumeric_notice (wbcg, GTK_MESSAGE_ERROR,
_("Sorry, gnumeric can only save graphs as png images"));
return;
}
fullname = g_strdup (fname);
}
ret = gdk_pixbuf_save (pixbuf, fullname, "png", &err, NULL);
if (!ret)
cmd_context_error (COMMAND_CONTEXT (wbcg), err);
g_free (fullname);
}
}
static void
sheet_object_graph_populate_menu (SheetObject *so,
GObject *obj_view,
GtkMenu *menu)
{
GtkWidget *item, *image;
item = gtk_image_menu_item_new_with_mnemonic (_("_Save as image"));
image = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS,
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (cb_save_as), obj_view);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
SHEET_OBJECT_CLASS (parent_klass)->populate_menu (so, obj_view, menu);
}
static void
sheet_object_graph_update_bounds (SheetObject *so, GObject *view_obj)
{
......@@ -294,6 +372,7 @@ sheet_object_graph_class_init (GObjectClass *klass)
/* SheetObject class method overrides */
so_class->new_view = sheet_object_graph_new_view;
so_class->populate_menu = sheet_object_graph_populate_menu;
so_class->update_view_bounds = sheet_object_graph_update_bounds;
so_class->read_xml = sheet_object_graph_read_xml;
so_class->write_xml = sheet_object_graph_write_xml;
......
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