Commit c4e5b7ac authored by Jean Brefort's avatar Jean Brefort Committed by Jody Goldberg

Start work on image

2003-06-07    Jean Brefort <jean.brefort@ac-dijon.fr>

	* graph/gog-style.c (gog_style_editor) :
	* graph/gog-style.h (struct _GogStyle) :
	* graph/gog-style-prefs.glade :
	* graph/gog-renderer-pixbuf.c (gog_renderer_pixbuf_draw_polygon) : Start work on image

2003-06-08  Jody Goldberg <jody@gnome.org>

	* Makefile.am : do not include the .server or .server.in files in the
	  distribution.
	* src/Makefile.am (ui_DATA) : be absolutely anal about
	  gnumeric-paths.h, generate it early, and do not include it in the
	  distribution.
parent 40cbba85
2003-06-08 Jody Goldberg <jody@gnome.org>
* Makefile.am : do not include the .server or .server.in files in the
distribution.
* src/Makefile.am (ui_DATA) : be absolutely anal about
gnumeric-paths.h, generate it early, and do not include it in the
distribution.
2003-06-07 Jody Goldberg <jody@gnome.org> 2003-06-07 Jody Goldberg <jody@gnome.org>
* configure.in : bump again * configure.in : bump again
......
...@@ -22,7 +22,7 @@ Mime_DATA = gnumeric.keys gnumeric.mime ...@@ -22,7 +22,7 @@ Mime_DATA = gnumeric.keys gnumeric.mime
serverdir = $(libdir)/bonobo/servers/ serverdir = $(libdir)/bonobo/servers/
server_in_files = GNOME_Gnumeric.server.in server_in_files = GNOME_Gnumeric.server.in
server_DATA = GNOME_Gnumeric.server server_DATA = GNOME_Gnumeric.server
GNOME_Gnumeric.server.in : GNOME_Gnumeric.server.in.in GNOME_Gnumeric.server.in : GNOME_Gnumeric.server.in.in Makefile
sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
@INTLTOOL_SERVER_RULE@ @INTLTOOL_SERVER_RULE@
...@@ -45,6 +45,7 @@ gnumeric.keys: gnumeric.keys.in Makefile ...@@ -45,6 +45,7 @@ gnumeric.keys: gnumeric.keys.in Makefile
&& mv gnumeric.keys.tmp gnumeric.keys && mv gnumeric.keys.tmp gnumeric.keys
dist-hook: gnumeric.spec dist-hook: gnumeric.spec
-cd $(distdir) ; rm -f $(server_in_files) $(server_DATA)
mkdir $(distdir)/samples mkdir $(distdir)/samples
cp $(srcdir)/samples/*gnumeric $(distdir)/samples cp $(srcdir)/samples/*gnumeric $(distdir)/samples
cp gnumeric.spec $(distdir) cp gnumeric.spec $(distdir)
Gnumeric 1.1.20
Jean Brefort:
* Support image files in chart areas (background, bar/col or pie)
Jody:
* Fix the generated files.
--------------------------------------------------------------------------
Gnumeric 1.1.18 Gnumeric 1.1.18
Andreas: Andreas:
......
2003-06-08 Jody Goldberg <jody@gnome.org>
* Makefile.am : do not include the .server or .server.in files in the
distribution.
* src/Makefile.am (ui_DATA) : be absolutely anal about
gnumeric-paths.h, generate it early, and do not include it in the
distribution.
2003-06-07 Jody Goldberg <jody@gnome.org> 2003-06-07 Jody Goldberg <jody@gnome.org>
* configure.in : bump again * configure.in : bump again
......
2003-06-08 Jody Goldberg <jody@gnome.org>
* Makefile.am : do not include the .server or .server.in files in the
distribution.
* src/Makefile.am (ui_DATA) : be absolutely anal about
gnumeric-paths.h, generate it early, and do not include it in the
distribution.
2003-06-07 Jody Goldberg <jody@gnome.org> 2003-06-07 Jody Goldberg <jody@gnome.org>
* configure.in : bump again * configure.in : bump again
......
...@@ -358,15 +358,24 @@ gnm-marshalers.c : gnm-marshalers.list $(GLIB_GENMARSHAL) ...@@ -358,15 +358,24 @@ gnm-marshalers.c : gnm-marshalers.list $(GLIB_GENMARSHAL)
cat $@.tmp >>$@ cat $@.tmp >>$@
rm -f $@.tmp rm -f $@.tmp
gnumeric-paths.h: gnumeric-paths.h.in Makefile .PHONY: all-local
sed \ all-local :
# be really really anal about generating the paths
gnumeric-paths.h : $(srcdir)/gnumeric-paths.h.in all-local
@sed \
-e 's!@''gnumeric_prefix''@!$(gnumeric_prefix)!' \ -e 's!@''gnumeric_prefix''@!$(gnumeric_prefix)!' \
-e 's!@''gnumeric_sysconfdir''@!$(gnumeric_sysconfdir)!' \ -e 's!@''gnumeric_sysconfdir''@!$(gnumeric_sysconfdir)!' \
-e 's!@''gnumeric_datadir''@!$(gnumeric_datadir)!' \ -e 's!@''gnumeric_datadir''@!$(gnumeric_datadir)!' \
-e 's!@''gnumeric_libdir''@!$(gnumeric_libdir)!' \ -e 's!@''gnumeric_libdir''@!$(gnumeric_libdir)!' \
-e 's!@''gnumeric_icondir''@!$(gnumeric_icondir)!' \ -e 's!@''gnumeric_icondir''@!$(gnumeric_icondir)!' \
-e 's!@''gnumeric_localedir''@!$(gnumeric_localedir)!' \ -e 's!@''gnumeric_localedir''@!$(gnumeric_localedir)!' \
<$< >$@ < $< > $@.tmp ; \
if cmp -s $@.tmp $@; then rm $@.tmp; else mv $@.tmp $@ ; fi
# do not include the paths in the tarball
dist-hook :
-rm -f $(distdir)/gnumeric-paths.h
# include conditional files to ensure everything gets distributed no matter # include conditional files to ensure everything gets distributed no matter
# what the build # what the build
......
2003-06-07 Jean Brefort <jean.brefort@ac-dijon.fr>
* graph/gog-style.c (gog_style_editor) :
* graph/gog-style.h (struct _GogStyle) :
* graph/gog-style-prefs.glade :
* graph/gog-renderer-pixbuf.c (gog_renderer_pixbuf_draw_polygon) : Start work on image
2003-06-07 Jody Goldberg <jody@gnome.org> 2003-06-07 Jody Goldberg <jody@gnome.org>
* Release 1.1.19 * Release 1.1.19
......
...@@ -133,6 +133,9 @@ gog_renderer_pixbuf_draw_polygon (GogRenderer *renderer, ArtVpath *path, gboolea ...@@ -133,6 +133,9 @@ gog_renderer_pixbuf_draw_polygon (GogRenderer *renderer, ArtVpath *path, gboolea
{ 0., { 0, 0, 0, 0 }}, { 0., { 0, 0, 0, 0 }},
{ 1., { 0, 0, 0, 0 }} { 1., { 0, 0, 0, 0 }}
}; };
GdkPixbuf *image;
GError *err = NULL;
gint i, j, imax, jmax, w, h, x, y;
if (!narrow && style->outline.width >= 0.) if (!narrow && style->outline.width >= 0.)
outline = art_svp_vpath_stroke (path, outline = art_svp_vpath_stroke (path,
...@@ -190,15 +193,12 @@ gog_renderer_pixbuf_draw_polygon (GogRenderer *renderer, ArtVpath *path, gboolea ...@@ -190,15 +193,12 @@ gog_renderer_pixbuf_draw_polygon (GogRenderer *renderer, ArtVpath *path, gboolea
gradient.n_stops = G_N_ELEMENTS (stops); gradient.n_stops = G_N_ELEMENTS (stops);
gradient.stops = stops; gradient.stops = stops;
if (style->fill.u.gradient.type == GOG_GRADIENT_NE_TO_SW) if (style->fill.u.gradient.type == GOG_GRADIENT_NE_TO_SW) {
{
go_color_to_artpix (stops[0].color, go_color_to_artpix (stops[0].color,
style->fill.u.gradient.end); style->fill.u.gradient.end);
go_color_to_artpix (stops[1].color, go_color_to_artpix (stops[1].color,
style->fill.u.gradient.start); style->fill.u.gradient.start);
} } else {
else
{
go_color_to_artpix (stops[0].color, go_color_to_artpix (stops[0].color,
style->fill.u.gradient.start); style->fill.u.gradient.start);
go_color_to_artpix (stops[1].color, go_color_to_artpix (stops[1].color,
...@@ -210,7 +210,47 @@ gog_renderer_pixbuf_draw_polygon (GogRenderer *renderer, ArtVpath *path, gboolea ...@@ -210,7 +210,47 @@ gog_renderer_pixbuf_draw_polygon (GogRenderer *renderer, ArtVpath *path, gboolea
break; break;
case GOG_FILL_STYLE_IMAGE: case GOG_FILL_STYLE_IMAGE:
g_warning ("unimplemented"); if (!style->fill.u.image.image_file)
break;
image = gdk_pixbuf_new_from_file (style->fill.u.image.image_file, &err);
if (err != NULL)
break;
switch (style->fill.u.image.type) {
case GOG_IMAGE_STRETCHED:
gdk_pixbuf_scale(image, prend->buffer,
0, 0, prend->w, prend->h, 0, 0,
(double)prend->w / gdk_pixbuf_get_width (image),
(double)prend->h / gdk_pixbuf_get_height (image),
GDK_INTERP_HYPER);
case GOG_IMAGE_WALLPAPER:
imax = prend->w / (w = gdk_pixbuf_get_width (image));
jmax = prend->h / (h = gdk_pixbuf_get_height (image));
x = 0;
for (i = 0; i < imax; i++) {
y = 0;
for (j = 0; j < jmax; j++) {
gdk_pixbuf_copy_area (image, 0, 0, w, h,
prend->buffer, x, y);
y+= h;
}
gdk_pixbuf_copy_area (image, 0, 0, w,
prend->h % h, prend->buffer, x, y);
x += w;
}
y = 0;
for (j = 0; j < jmax; j++) {
gdk_pixbuf_copy_area (image, 0, 0, prend->w % w, h,
prend->buffer, x, y);
y+= h;
}
gdk_pixbuf_copy_area (image, 0, 0, prend->w % w, prend->h % h,
prend->buffer, x, y);
break;
}
g_object_unref (image);
break;
case GOG_FILL_STYLE_NONE: case GOG_FILL_STYLE_NONE:
break; /* impossible */ break; /* impossible */
......
...@@ -250,6 +250,75 @@ init_gradient_page (GogObject *gobj, GladeXML *gui, GogStyle *style) ...@@ -250,6 +250,75 @@ init_gradient_page (GogObject *gobj, GladeXML *gui, GogStyle *style)
gtk_widget_show_all (table); gtk_widget_show_all (table);
} }
static gboolean
cb_image_filename_changed (GtkWidget *cc,
GdkEventFocus *ev,
GogObject *gobj)
{
GogStyle *style = NULL;
char const *filename;
g_object_get (G_OBJECT (gobj), "style", &style, NULL);
style = gog_style_dup (style);
g_return_val_if_fail (style != NULL, FALSE);
filename = gtk_entry_get_text (GTK_ENTRY (cc));
style->fill.u.image.image_file = (filename)? g_strdup (filename): NULL;
g_object_set (G_OBJECT (gobj), "style", style, NULL);
return FALSE;
}
static void
cb_image_file_select (GtkWidget *cc, GogObject *gobj)
{
GogStyle *style = NULL;
GtkWidget *fs, *w;
gint result;
const gchar* filename;
GladeXML *gui;
g_object_get (G_OBJECT (gobj), "style", &style, NULL);
style = gog_style_dup (style);
g_return_if_fail (style != NULL);
fs = gtk_file_selection_new (_("Select an image file"));
gtk_window_set_modal (GTK_WINDOW (fs), TRUE);
if (style->fill.u.image.image_file)
gtk_file_selection_set_filename (GTK_FILE_SELECTION (fs), style->fill.u.image.image_file);
result = gtk_dialog_run (GTK_DIALOG (fs));
if (result == GTK_RESPONSE_OK) {
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
if (filename && !*filename) filename = NULL;
if (style->fill.u.image.image_file)
g_free (style->fill.u.image.image_file);
style->fill.u.image.image_file = (filename)? g_strdup (filename): NULL;
gui = (GladeXML*) g_object_get_data (G_OBJECT (cc), "state");
w = glade_xml_get_widget (gui, "image_filename");
gtk_entry_set_text (GTK_ENTRY (w), (filename)? filename: "");
g_object_set (G_OBJECT (gobj), "style", style, NULL);
}
gtk_widget_destroy (fs);
g_return_if_fail (style != NULL);
}
static void
cb_image_style_changed (GtkWidget *cc,
GogObject *gobj)
{
GogStyle *style = NULL;
g_object_get (G_OBJECT (gobj), "style", &style, NULL);
style = gog_style_dup (style);
g_return_if_fail (style != NULL);
style->fill.u.image.type = gtk_option_menu_get_history (GTK_OPTION_MENU (cc));
g_object_set (G_OBJECT (gobj), "style", style, NULL);
}
static void static void
cb_type_changed (GtkWidget *cc, cb_type_changed (GtkWidget *cc,
GogObject *gobj) GogObject *gobj)
...@@ -259,10 +328,17 @@ cb_type_changed (GtkWidget *cc, ...@@ -259,10 +328,17 @@ cb_type_changed (GtkWidget *cc,
GladeXML *gui; GladeXML *gui;
GtkWidget *w, *table; GtkWidget *w, *table;
GogStyle *style = NULL; GogStyle *style = NULL;
const gchar* filename;
g_object_get (G_OBJECT (gobj), "style", &style, NULL); g_object_get (G_OBJECT (gobj), "style", &style, NULL);
style = gog_style_dup (style); style = gog_style_dup (style);
g_return_if_fail (style != NULL); g_return_if_fail (style != NULL);
if ((style->flags & GOG_STYLE_FILL) &&
GOG_FILL_STYLE_IMAGE == style->fill.type &&
style->fill.u.image.image_file) {
g_free (style->fill.u.image.image_file);
}
gui = (GladeXML*) g_object_get_data (G_OBJECT (cc), "state"); gui = (GladeXML*) g_object_get_data (G_OBJECT (cc), "state");
notebook = GTK_NOTEBOOK (glade_xml_get_widget (gui, "notebook")); notebook = GTK_NOTEBOOK (glade_xml_get_widget (gui, "notebook"));
...@@ -302,6 +378,11 @@ cb_type_changed (GtkWidget *cc, ...@@ -302,6 +378,11 @@ cb_type_changed (GtkWidget *cc,
break; break;
case 4: case 4:
style->fill.type = GOG_FILL_STYLE_IMAGE; style->fill.type = GOG_FILL_STYLE_IMAGE;
w = glade_xml_get_widget (gui, "image_filename");
filename = gtk_entry_get_text (GTK_ENTRY (w));
style->fill.u.image.image_file = (filename && *filename)? g_strdup (filename): NULL;
w = glade_xml_get_widget (gui, "image_option");
style->fill.u.image.type = gtk_option_menu_get_history (GTK_OPTION_MENU (w));
break; break;
} }
gtk_notebook_set_current_page (notebook, page); gtk_notebook_set_current_page (notebook, page);
...@@ -388,6 +469,21 @@ gog_style_editor (GogObject *gobj, CommandContext *cc, guint32 enable) ...@@ -388,6 +469,21 @@ gog_style_editor (GogObject *gobj, CommandContext *cc, guint32 enable)
"color_changed", "color_changed",
G_CALLBACK (cb_outline_color_changed), gobj); G_CALLBACK (cb_outline_color_changed), gobj);
/* initialization of the image related widgets */
w = glade_xml_get_widget (gui, "image_filename");
g_signal_connect (G_OBJECT (w),
"focus_out_event",
G_CALLBACK (cb_image_filename_changed), gobj);
w = glade_xml_get_widget (gui, "image_button");
g_signal_connect (G_OBJECT (w),
"clicked",
G_CALLBACK (cb_image_file_select), gobj);
g_object_set_data (G_OBJECT (w), "state", gui);
w = glade_xml_get_widget (gui, "image_option");
g_signal_connect (G_OBJECT (w),
"changed",
G_CALLBACK (cb_image_style_changed), gobj);
if (enable & GOG_STYLE_FILL) { if (enable & GOG_STYLE_FILL) {
switch (style->fill.type) { switch (style->fill.type) {
case GOG_FILL_STYLE_NONE: case GOG_FILL_STYLE_NONE:
...@@ -405,7 +501,15 @@ gog_style_editor (GogObject *gobj, CommandContext *cc, guint32 enable) ...@@ -405,7 +501,15 @@ gog_style_editor (GogObject *gobj, CommandContext *cc, guint32 enable)
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 2); gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 2);
break; break;
case GOG_FILL_STYLE_PATTERN: case GOG_FILL_STYLE_PATTERN:
break;
case GOG_FILL_STYLE_IMAGE: case GOG_FILL_STYLE_IMAGE:
gtk_option_menu_set_history (GTK_OPTION_MENU (menu), 4);
gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 4);
w = glade_xml_get_widget (gui, "image_filename");
gtk_entry_set_text (GTK_ENTRY (w), style->fill.u.image.image_file);
w = glade_xml_get_widget (gui, "image_style");
gtk_option_menu_set_history (GTK_OPTION_MENU (w), style->fill.u.image.type);
break;
default : default :
break; break;
} }
...@@ -424,7 +528,9 @@ gog_style_finalize (GObject *obj) ...@@ -424,7 +528,9 @@ gog_style_finalize (GObject *obj)
GogStyle *style = GOG_STYLE (obj); GogStyle *style = GOG_STYLE (obj);
if ((style->flags & GOG_STYLE_FILL) && if ((style->flags & GOG_STYLE_FILL) &&
GOG_FILL_STYLE_IMAGE == style->fill.type) { GOG_FILL_STYLE_IMAGE == style->fill.type &&
style->fill.u.image.image_file) {
g_free (style->fill.u.image.image_file);
} }
(parent_klass->finalize) (obj); (parent_klass->finalize) (obj);
...@@ -509,7 +615,7 @@ gog_series_element_style_list_free (GogSeriesElementStyleList *list) ...@@ -509,7 +615,7 @@ gog_series_element_style_list_free (GogSeriesElementStyleList *list)
GogSeriesElementStyleList * GogSeriesElementStyleList *
gog_series_element_style_list_copy (GogSeriesElementStyleList *list) gog_series_element_style_list_copy (GogSeriesElementStyleList *list)
{ {
GogSeriesElementStyle *pt; GogSeriesElementStyle *pt = NULL;
GSList *ptr, *res = NULL; GSList *ptr, *res = NULL;
for (ptr = list; ptr != NULL ; ptr = ptr->next) { for (ptr = list; ptr != NULL ; ptr = ptr->next) {
......
...@@ -52,6 +52,10 @@ typedef enum { ...@@ -52,6 +52,10 @@ typedef enum {
GOG_GRADIENT_NW_TO_SE, GOG_GRADIENT_NW_TO_SE,
GOG_GRADIENT_NE_TO_SW GOG_GRADIENT_NE_TO_SW
} GogGradientType; } GogGradientType;
typedef enum {
GOG_IMAGE_STRETCHED,
GOG_IMAGE_WALLPAPER,
} GogImageType;
typedef guint32 GOColor; typedef guint32 GOColor;
...@@ -86,6 +90,7 @@ struct _GogStyle { ...@@ -86,6 +90,7 @@ struct _GogStyle {
} gradient; } gradient;
struct { struct {
char *image_file; char *image_file;
GogImageType type;
/* ? */ /* ? */
} image; } image;
} u; } u;
......
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