From: Andrea Zagli Date: Sun, 7 Oct 2007 08:37:59 +0000 (+0000) Subject: Continued ObjectProperties. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=d05157896a728621a9e1807d04886dec5a778b9b;p=reptool%2Fgreptool Continued ObjectProperties. Code adjustments and bugfixes. git-svn-id: svn+ssh://saetta.homelinux.org/svn/greptool/trunk@13 76169498-11ee-428b-941f-28d7a79d5cb2 --- diff --git a/data/greptool/glade/greptool.glade b/data/greptool/glade/greptool.glade index b8ef728..288c490 100644 --- a/data/greptool/glade/greptool.glade +++ b/data/greptool/glade/greptool.glade @@ -3312,7 +3312,7 @@ Custom - + True True True diff --git a/data/greptool/pixmaps/Makefile b/data/greptool/pixmaps/Makefile deleted file mode 100644 index 1189c03..0000000 --- a/data/greptool/pixmaps/Makefile +++ /dev/null @@ -1,336 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# data/greptool/pixmaps/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - -srcdir = . -top_srcdir = ../../.. - -pkgdatadir = $(datadir)/greptool -pkglibdir = $(libdir)/greptool -pkgincludedir = $(includedir)/greptool -top_builddir = ../../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = /usr/bin/install -c -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = x86_64-unknown-linux-gnu -host_triplet = x86_64-unknown-linux-gnu -target_triplet = x86_64-unknown-linux-gnu -subdir = data/greptool/pixmaps -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(iconsdir)" -iconsDATA_INSTALL = $(INSTALL_DATA) -DATA = $(icons_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/andreaz/files/c/reptool/greptool/missing --run aclocal-1.9 -AMDEP_FALSE = # -AMDEP_TRUE = -AMTAR = ${SHELL} /home/andreaz/files/c/reptool/greptool/missing --run tar -AUTOCONF = ${SHELL} /home/andreaz/files/c/reptool/greptool/missing --run autoconf -AUTOHEADER = ${SHELL} /home/andreaz/files/c/reptool/greptool/missing --run autoheader -AUTOMAKE = ${SHELL} /home/andreaz/files/c/reptool/greptool/missing --run automake-1.9 -AWK = mawk -CC = gcc -CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -CPPFLAGS = -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -EXEEXT = -GREPTOOL_CFLAGS = -DPNG_NO_MMX_CODE -I/usr/local/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -I/usr/include/libgda-1.2 -I/usr/include/libglade-2.0 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/goocanvas-1.0 -GREPTOOL_LIBS = -L/usr/local/lib -lreptool -lgda-2 -lxslt -lglade-2.0 -lxml2 -lgoocanvas -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s -LDFLAGS = -LIBOBJS = -LIBS = -LTLIBOBJS = -MAINT = # -MAINTAINER_MODE_FALSE = -MAINTAINER_MODE_TRUE = # -MAKEINFO = ${SHELL} /home/andreaz/files/c/reptool/greptool/missing --run makeinfo -OBJEXT = o -PACKAGE = greptool -PACKAGE_BUGREPORT = -PACKAGE_NAME = greptool -PACKAGE_STRING = greptool 0.0.1 -PACKAGE_TARNAME = greptool -PACKAGE_VERSION = 0.0.1 -PATH_SEPARATOR = : -PKG_CONFIG = /usr/bin/pkg-config -SET_MAKE = -SHELL = /bin/sh -STRIP = -VERSION = 0.0.1 -ac_ct_CC = gcc -am__fastdepCC_FALSE = # -am__fastdepCC_TRUE = -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -bindir = ${exec_prefix}/bin -build = x86_64-unknown-linux-gnu -build_alias = -build_cpu = x86_64 -build_os = linux-gnu -build_vendor = unknown -datadir = /home/andreaz/files/c/reptool/greptool/data/ -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} -dvidir = ${docdir} -exec_prefix = ${prefix} -host = x86_64-unknown-linux-gnu -host_alias = -host_cpu = x86_64 -host_os = linux-gnu -host_vendor = unknown -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = /home/andreaz/files/c/reptool/greptool/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = mkdir -p -- -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -sysconfdir = ${prefix}/etc -target = x86_64-unknown-linux-gnu -target_alias = -target_cpu = x86_64 -target_os = linux-gnu -target_vendor = unknown -iconsdir = $(datadir)/greptool/pixmaps -icons_DATA = \ - selector.png \ - text.png \ - line.png \ - rectangle.png \ - ellipse.png \ - image.png - -EXTRA_DIST = $(icons_DATA) -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/greptool/pixmaps/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu data/greptool/pixmaps/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: # $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): # $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: -install-iconsDATA: $(icons_DATA) - @$(NORMAL_INSTALL) - test -z "$(iconsdir)" || $(mkdir_p) "$(DESTDIR)$(iconsdir)" - @list='$(icons_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(iconsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(iconsdir)/$$f'"; \ - $(iconsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(iconsdir)/$$f"; \ - done - -uninstall-iconsDATA: - @$(NORMAL_UNINSTALL) - @list='$(icons_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(iconsdir)/$$f'"; \ - rm -f "$(DESTDIR)$(iconsdir)/$$f"; \ - done -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(DATA) -installdirs: - for dir in "$(DESTDIR)$(iconsdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-iconsDATA - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-iconsDATA uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-iconsDATA install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ - uninstall-am uninstall-iconsDATA uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/canvasimage.c b/src/canvasimage.c index 208915c..ac3942a 100644 --- a/src/canvasimage.c +++ b/src/canvasimage.c @@ -133,10 +133,18 @@ GRptCanvasItem static void grpt_canvas_image_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanvasBounds *bounds) { - RptPoint *from_p; - RptPoint *to_p = (RptPoint *)g_new (RptPoint, 1); + RptPoint *position; RptSize *size; RptRotation *rotation = NULL; + RptBorder *border = NULL; + gchar *filename = NULL; + gchar *adapt = NULL; + gint w; + gint h; + + cairo_surface_t *image; + cairo_pattern_t *pattern; + cairo_matrix_t matrix; GRptCanvasImage *grpt_canvas_image = (GRptCanvasImage *)simple; @@ -145,29 +153,75 @@ grpt_canvas_image_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanv GRptCanvasImagePrivate *priv = GRPT_CANVAS_IMAGE_GET_PRIVATE (grpt_canvas_image); g_object_get (G_OBJECT (priv->rpt_object_image), - "position", &from_p, + "position", &position, "size", &size, "rotation", &rotation, + "border", &border, + "source", &filename, + "adapt", &adapt, NULL); - to_p->x = from_p->x + size->width; - to_p->y = from_p->y + size->height; + if (filename == NULL || strcmp (g_strstrip (filename), "") == 0) + { + filename = g_strdup (ICONSDIR "/image.png"); + } - cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); + if (adapt == NULL) + { + adapt = "none"; + } + else + { + g_strstrip (adapt); + } - if (rotation != NULL) + image = cairo_image_surface_create_from_png (filename); + if (cairo_surface_status (image) != CAIRO_STATUS_SUCCESS) { - /*RptSize size; + image = cairo_image_surface_create_from_png (ICONSDIR "/image.png"); + if (cairo_surface_status (image) != CAIRO_STATUS_SUCCESS) + { + /* TO DO */ + g_warning ("No image.png found"); + } + } - size.width = to_p->x - from_p->x; - size.height = to_p->y - from_p->y; + pattern = cairo_pattern_create_for_surface (image); - rpt_print_rotate (rpt_print, from_p, &size, rotation->angle);*/ + if (rotation != NULL) + { + /* TO DO */ + } + + cairo_matrix_init_identity (&matrix); + if (strcmp (adapt, "none") != 0) + { + w = cairo_image_surface_get_width (image); + h = cairo_image_surface_get_height (image); + + if (strcmp (adapt, "to-box") == 0) + { + cairo_matrix_scale (&matrix, w / size->width, h / size->height); + } + else if (strcmp (adapt, "to-image") == 0) + { + size->width = (gdouble)w; + size->height = (gdouble)h; + } } + cairo_matrix_translate (&matrix, -position->x, -position->y); + + cairo_pattern_set_matrix (pattern, &matrix); + cairo_set_source (cr, pattern); + + cairo_rectangle (cr, position->x, position->y, size->width, size->height); + cairo_fill (cr); + + /* TO DO */ + /* border */ - cairo_move_to (cr, from_p->x, from_p->y); - cairo_line_to (cr, to_p->x, to_p->y); - cairo_stroke (cr); + /*cairo_pattern_destroy (pattern); + cairo_surface_destroy (image);*/ } static RptObject diff --git a/src/canvasitem.c b/src/canvasitem.c index 7270876..fc4ccb2 100644 --- a/src/canvasitem.c +++ b/src/canvasitem.c @@ -44,6 +44,7 @@ struct _GRptCanvasItemPrivate gdouble y; gdouble width; gdouble height; + RptRotation *rotation; RptReportSection section; @@ -100,6 +101,7 @@ grpt_canvas_item_init (GRptCanvasItem *grpt_canvas_item) priv->y = 0.0; priv->width = 0.0; priv->height = 0.0; + priv->rotation = NULL; priv->selected = FALSE; } @@ -218,6 +220,46 @@ grpt_canvas_item_set_size (GRptCanvasItem *grpt_canvas_item, RptSize size) goo_canvas_item_simple_changed (simple, TRUE); } +RptRotation +*grpt_canvas_item_get_rotation (GRptCanvasItem *grpt_canvas_item) +{ + RptRotation *rotation = NULL; + RptObject *rpto; + + rpto = grpt_canvas_item_get_rpt_object (grpt_canvas_item); + + g_object_get (G_OBJECT (rpto), + "rotation", &rotation, + NULL); + + return rotation; +} + +void +grpt_canvas_item_set_rotation (GRptCanvasItem *grpt_canvas_item, RptRotation *rotation) +{ + GRptCanvasItemPrivate *priv = GRPT_CANVAS_ITEM_GET_PRIVATE (grpt_canvas_item); + + RptObject *rpto; + + GooCanvasItemSimple *simple = (GooCanvasItemSimple *)grpt_canvas_item; + + priv->rotation = rotation; + + rpto = grpt_canvas_item_get_rpt_object (grpt_canvas_item); + + g_object_set (G_OBJECT (rpto), + "rotation", &rotation, + NULL); + + goo_canvas_item_set_transform ((GooCanvasItem *)simple, NULL); + goo_canvas_item_rotate ((GooCanvasItem *)simple, rotation->angle, + priv->x + (priv->width / 2), + priv->y + (priv->height / 2)); + + goo_canvas_item_simple_changed (simple, TRUE); +} + RptObject *grpt_canvas_item_get_rpt_object (GRptCanvasItem *grpt_canvas_item) { diff --git a/src/canvasitem.h b/src/canvasitem.h index 8fb0319..121b0c6 100644 --- a/src/canvasitem.h +++ b/src/canvasitem.h @@ -69,6 +69,9 @@ void grpt_canvas_item_set_position (GRptCanvasItem *grpt_canvas_item, RptPoint p RptSize *grpt_canvas_item_get_size (GRptCanvasItem *grpt_canvas_item); void grpt_canvas_item_set_size (GRptCanvasItem *grpt_canvas_item, RptSize size); +RptRotation *grpt_canvas_item_get_rotation (GRptCanvasItem *grpt_canvas_item); +void grpt_canvas_item_set_rotation (GRptCanvasItem *grpt_canvas_item, RptRotation *rotation); + RptObject *grpt_canvas_item_get_rpt_object (GRptCanvasItem *grpt_canvas_item); RptReportSection grpt_canvas_item_get_section (GRptCanvasItem *grpt_canvas_item); diff --git a/src/canvasline.c b/src/canvasline.c index e0106a5..f65894c 100644 --- a/src/canvasline.c +++ b/src/canvasline.c @@ -163,6 +163,10 @@ grpt_canvas_line_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanva { cairo_set_source_rgba (cr, stroke->color->r, stroke->color->g, stroke->color->b, stroke->color->a); } + else + { + cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); + } if (stroke->style != NULL) { gdouble *dash = rpt_common_style_to_array (stroke->style); diff --git a/src/canvasrect.c b/src/canvasrect.c index a0e4137..28b47a1 100644 --- a/src/canvasrect.c +++ b/src/canvasrect.c @@ -159,9 +159,9 @@ grpt_canvas_rect_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanva } if (stroke == NULL) { - stroke = (RptStroke *)g_malloc0 (sizeof (RptStroke)); + stroke = rpt_common_rptstroke_new (); stroke->width = 1.0; - stroke->color = (RptColor *)g_malloc0 (sizeof (RptColor)); + stroke->color = rpt_common_rptcolor_new (); stroke->color->a = 1.0; stroke->style = NULL; } diff --git a/src/canvastext.c b/src/canvastext.c index 5ce6384..74bac8e 100644 --- a/src/canvastext.c +++ b/src/canvastext.c @@ -268,11 +268,6 @@ grpt_canvas_text_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanva pango_layout_set_attributes (playout, lpattr); } - /*if (rotation != NULL) - { - rpt_print_rotate (rpt_print, position, size, rotation->angle); - }*/ - /* background */ if (position != NULL && size != NULL && color != NULL) { diff --git a/src/main.c b/src/main.c index 0f166f2..f7a6d1c 100644 --- a/src/main.c +++ b/src/main.c @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + #include #include #include @@ -242,6 +244,12 @@ report_open () static void report_save (const gchar *filename) { + gchar *locale_old; + gchar *locale_num; + + locale_old = setlocale (LC_ALL, NULL); + locale_num = setlocale (LC_NUMERIC, "C"); + xmlDoc *xdoc = rpt_report_get_xml (rpt_report); if (xdoc == NULL) { @@ -250,8 +258,12 @@ report_save (const gchar *filename) } report_filename = g_strdup (filename); + xmlSaveFormatFile (report_filename, xdoc, 2); + setlocale (LC_NUMERIC, locale_num); + setlocale (LC_ALL, locale_old); + gtk_window_set_title (GTK_WINDOW (w), g_strdup_printf ("GRepTool - %s", report_filename)); } diff --git a/src/object_properties.c b/src/object_properties.c index 3999f01..f3fafec 100644 --- a/src/object_properties.c +++ b/src/object_properties.c @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include + #include #include @@ -26,6 +28,86 @@ static void grpt_object_properties_class_init (GRptObjectPropertiesClass *klass); static void grpt_object_properties_init (GRptObjectProperties *grpt_object_properties); +static void on_txt_name_changed (GtkEditable *editable, + gpointer user_data); +static void on_spn_x_y_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_width_height_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_rotation_value_changed (GtkSpinButton *spin_button, + gpointer user_data); + +static void on_spn_text_border_width_top_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_text_border_width_right_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_text_border_width_bottom_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_text_border_width_left_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_cbtn_text_border_color_top_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_text_border_color_right_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_text_border_color_bottom_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_text_border_color_left_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_fbtn_text_font_font_set (GtkFontButton *widget, + gpointer user_data); +static void on_chk_text_font_strike (GtkToggleButton *widget, + gpointer user_data); +static void on_cbtn_text_font_color_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_text_back_color_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_spn_text_padd_top_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_text_padd_right_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_text_padd_bottom_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_text_padd_left_value_changed (GtkSpinButton *spin_button, + gpointer user_data); + +static void on_spn_line_stroke_width_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_cbtn_line_stroke_color_color_set (GtkColorButton *widget, + gpointer user_data); + +static void on_spn_rect_stroke_width_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_cbtn_rect_stroke_color_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_rect_fill_color_color_set (GtkColorButton *widget, + gpointer user_data); + +static void on_spn_ellipse_stroke_width_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_cbtn_ellipse_stroke_color_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_ellipse_fill_color_color_set (GtkColorButton *widget, + gpointer user_data); + +static void on_spn_image_border_width_top_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_image_border_width_right_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_image_border_width_bottom_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_spn_image_border_width_left_value_changed (GtkSpinButton *spin_button, + gpointer user_data); +static void on_cbtn_image_border_color_top_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_image_border_color_right_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_image_border_color_bottom_color_set (GtkColorButton *widget, + gpointer user_data); +static void on_cbtn_image_border_color_left_color_set (GtkColorButton *widget, + gpointer user_data); + +static void grpt_object_properties_set_vbox (GRptObjectProperties *grpt_object_properties, + GtkWidget *vbox); static void grpt_object_properties_load_common (GRptObjectProperties *grpt_object_properties); static void grpt_object_properties_load_text (GRptObjectProperties *grpt_object_properties); static void grpt_object_properties_load_line (GRptObjectProperties *grpt_object_properties); @@ -33,6 +115,9 @@ static void grpt_object_properties_load_rect (GRptObjectProperties *grpt_object_ static void grpt_object_properties_load_ellipse (GRptObjectProperties *grpt_object_properties); static void grpt_object_properties_load_image (GRptObjectProperties *grpt_object_properties); +static void grpt_object_properties_set_signal_active (GRptObjectProperties *grpt_object_properties, + gboolean active); + #define GRPT_OBJECT_PROPERTIES_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GRPT_TYPE_OBJECT_PROPERTIES, GRptObjectPropertiesPrivate)) @@ -42,7 +127,9 @@ struct _GRptObjectPropertiesPrivate { GtkWidget *w; GtkWidget *vbox; - + GtkWidget *cur_vbox; + + /* common */ GtkWidget *txt_name; GtkWidget *spn_x; GtkWidget *spn_y; @@ -50,7 +137,73 @@ struct _GRptObjectPropertiesPrivate GtkWidget *spn_height; GtkWidget *spn_rotation; + /* text */ + GtkWidget *vbox_text; + GtkWidget *spn_text_border_width_top; + GtkWidget *spn_text_border_width_right; + GtkWidget *spn_text_border_width_bottom; + GtkWidget *spn_text_border_width_left; + GtkWidget *cbtn_text_border_color_top; + GtkWidget *cbtn_text_border_color_right; + GtkWidget *cbtn_text_border_color_bottom; + GtkWidget *cbtn_text_border_color_left; + /* to do style */ + GtkWidget *fbtn_text_font; + /* to do underline */ + GtkWidget *chk_text_font_strike; + GtkWidget *cbtn_text_font_color; + GtkWidget *cb_text_alignment_h; + GtkWidget *cb_text_alignment_v; + GtkWidget *txtv_text_source; + GtkTextBuffer *buf_text_source; + GtkWidget *cbtn_text_back_color; + GtkWidget *spn_text_padd_top; + GtkWidget *spn_text_padd_right; + GtkWidget *spn_text_padd_bottom; + GtkWidget *spn_text_padd_left; + + /* line */ + GtkWidget *vbox_line; + GtkWidget *spn_line_stroke_width; + GtkWidget *cbtn_line_stroke_color; + /* to do style */ + + /* rectangle */ + GtkWidget *vbox_rect; + GtkWidget *spn_rect_stroke_width; + GtkWidget *cbtn_rect_stroke_color; + /* to do style */ + GtkWidget *cbtn_rect_fill_color; + + /* ellipse */ + GtkWidget *vbox_ellipse; + GtkWidget *spn_ellipse_stroke_width; + GtkWidget *cbtn_ellipse_stroke_color; + /* to do style */ + GtkWidget *cbtn_ellipse_fill_color; + + /* image */ + GtkWidget *vbox_image; + GtkWidget *spn_image_border_width_top; + GtkWidget *spn_image_border_width_right; + GtkWidget *spn_image_border_width_bottom; + GtkWidget *spn_image_border_width_left; + GtkWidget *cbtn_image_border_color_top; + GtkWidget *cbtn_image_border_color_right; + GtkWidget *cbtn_image_border_color_bottom; + GtkWidget *cbtn_image_border_color_left; + /* to do style */ + GtkWidget *cb_image_adapt; + + GRptCanvasItem *grpt_canvas_item; RptObject *rpt_obj; + + RptPoint *position; + RptSize *size; + RptBorder *border; + RptFont *font; + RptStroke *stroke; + RptColor *color; }; GType @@ -93,6 +246,10 @@ static void grpt_object_properties_init (GRptObjectProperties *grpt_object_properties) { GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + priv->border = NULL; + priv->font = NULL; + priv->stroke = NULL; } GRptObjectProperties @@ -103,10 +260,23 @@ GRptObjectProperties GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (obj_prop); GladeXML *gla = glade_xml_new (GLADEDIR "/greptool.glade", "w_obj_properties", NULL); + GladeXML *gla_text = glade_xml_new (GLADEDIR "/greptool.glade", "w_obj_text_properties", NULL); + GladeXML *gla_line = glade_xml_new (GLADEDIR "/greptool.glade", "w_obj_line_properties", NULL); + GladeXML *gla_rectangle = glade_xml_new (GLADEDIR "/greptool.glade", "w_obj_rect_properties", NULL); + GladeXML *gla_ellipse = glade_xml_new (GLADEDIR "/greptool.glade", "w_obj_ellipse_properties", NULL); + GladeXML *gla_image = glade_xml_new (GLADEDIR "/greptool.glade", "w_obj_image_properties", NULL); + + glade_xml_signal_autoconnect (gla); + glade_xml_signal_autoconnect (gla_text); + glade_xml_signal_autoconnect (gla_line); + glade_xml_signal_autoconnect (gla_rectangle); + glade_xml_signal_autoconnect (gla_ellipse); + glade_xml_signal_autoconnect (gla_image); priv->w = glade_xml_get_widget (gla, "w_obj_properties"); priv->vbox = glade_xml_get_widget (gla, "vbox"); + /* common */ priv->txt_name = glade_xml_get_widget (gla, "txt_name"); priv->spn_x = glade_xml_get_widget (gla, "spn_x"); priv->spn_y = glade_xml_get_widget (gla, "spn_y"); @@ -114,6 +284,153 @@ GRptObjectProperties priv->spn_height = glade_xml_get_widget (gla, "spn_height"); priv->spn_rotation = glade_xml_get_widget (gla, "spn_rotation"); + g_signal_connect (G_OBJECT (priv->txt_name), "changed", + G_CALLBACK (on_txt_name_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_x), "value-changed", + G_CALLBACK (on_spn_x_y_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_y), "value-changed", + G_CALLBACK (on_spn_x_y_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_width), "value-changed", + G_CALLBACK (on_spn_width_height_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_height), "value-changed", + G_CALLBACK (on_spn_width_height_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_rotation), "value-changed", + G_CALLBACK (on_spn_rotation_value_changed), (gpointer)obj_prop); + + /* text */ + priv->vbox_text = glade_xml_get_widget (gla_text, "vbox"); + g_object_ref (priv->vbox_text); + gtk_widget_unparent (priv->vbox_text); + priv->spn_text_border_width_top = glade_xml_get_widget (gla_text, "spn_text_border_width_top"); + priv->spn_text_border_width_right = glade_xml_get_widget (gla_text, "spn_text_border_width_right"); + priv->spn_text_border_width_bottom = glade_xml_get_widget (gla_text, "spn_text_border_width_bottom"); + priv->spn_text_border_width_left = glade_xml_get_widget (gla_text, "spn_text_border_width_left"); + priv->cbtn_text_border_color_top = glade_xml_get_widget (gla_text, "cbtn_text_border_color_top"); + priv->cbtn_text_border_color_right = glade_xml_get_widget (gla_text, "cbtn_text_border_color_right"); + priv->cbtn_text_border_color_bottom = glade_xml_get_widget (gla_text, "cbtn_text_border_color_bottom"); + priv->cbtn_text_border_color_left = glade_xml_get_widget (gla_text, "cbtn_text_border_color_left"); + priv->fbtn_text_font = glade_xml_get_widget (gla_text, "fbtn_text_font"); + priv->chk_text_font_strike = glade_xml_get_widget (gla_text, "chk_text_font_strike"); + priv->cbtn_text_font_color = glade_xml_get_widget (gla_text, "cbtn_text_font_color"); + priv->cb_text_alignment_h = glade_xml_get_widget (gla_text, "cb_text_alignment_h"); + priv->cb_text_alignment_v = glade_xml_get_widget (gla_text, "cb_text_alignment_v"); + priv->txtv_text_source = glade_xml_get_widget (gla_text, "txtv_text_source"); + priv->buf_text_source = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->txtv_text_source)); + priv->cbtn_text_back_color = glade_xml_get_widget (gla_text, "cbtn_text_back_color"); + priv->spn_text_padd_top = glade_xml_get_widget (gla_text, "spn_text_padd_top"); + priv->spn_text_padd_right = glade_xml_get_widget (gla_text, "spn_text_padd_right"); + priv->spn_text_padd_bottom = glade_xml_get_widget (gla_text, "spn_text_padd_bottom"); + priv->spn_text_padd_left = glade_xml_get_widget (gla_text, "spn_text_padd_left"); + + g_signal_connect (G_OBJECT (priv->spn_text_border_width_top), "value-changed", + G_CALLBACK (on_spn_text_border_width_top_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_text_border_width_right), "value-changed", + G_CALLBACK (on_spn_text_border_width_right_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_text_border_width_bottom), "value-changed", + G_CALLBACK (on_spn_text_border_width_bottom_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_text_border_width_left), "value-changed", + G_CALLBACK (on_spn_text_border_width_left_value_changed), (gpointer)obj_prop); + + g_signal_connect (G_OBJECT (priv->cbtn_text_border_color_top), "color-set", + G_CALLBACK (on_cbtn_text_border_color_top_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_text_border_color_right), "color-set", + G_CALLBACK (on_cbtn_text_border_color_right_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_text_border_color_bottom), "color-set", + G_CALLBACK (on_cbtn_text_border_color_bottom_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_text_border_color_left), "color-set", + G_CALLBACK (on_cbtn_text_border_color_left_color_set), (gpointer)obj_prop); + + g_signal_connect (G_OBJECT (priv->fbtn_text_font), "font-set", + G_CALLBACK (on_fbtn_text_font_font_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->chk_text_font_strike), "toggled", + G_CALLBACK (on_chk_text_font_strike), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_text_font_color), "color-set", + G_CALLBACK (on_cbtn_text_font_color_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_text_back_color), "color-set", + G_CALLBACK (on_cbtn_text_back_color_color_set), (gpointer)obj_prop); + + g_signal_connect (G_OBJECT (priv->spn_text_padd_top), "value-changed", + G_CALLBACK (on_spn_text_padd_top_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_text_padd_right), "value-changed", + G_CALLBACK (on_spn_text_padd_right_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_text_padd_bottom), "value-changed", + G_CALLBACK (on_spn_text_padd_bottom_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_text_padd_left), "value-changed", + G_CALLBACK (on_spn_text_padd_left_value_changed), (gpointer)obj_prop); + + /* line */ + priv->vbox_line = glade_xml_get_widget (gla_line, "vbox"); + g_object_ref (priv->vbox_line); + gtk_widget_unparent (priv->vbox_line); + priv->spn_line_stroke_width = glade_xml_get_widget (gla_line, "spn_line_stroke_width"); + priv->cbtn_line_stroke_color = glade_xml_get_widget (gla_line, "cbtn_line_stroke_color"); + + g_signal_connect (G_OBJECT (priv->spn_line_stroke_width), "value-changed", + G_CALLBACK (on_spn_line_stroke_width_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_line_stroke_color), "color-set", + G_CALLBACK (on_cbtn_line_stroke_color_color_set), (gpointer)obj_prop); + + /* rectangle */ + priv->vbox_rect = glade_xml_get_widget (gla_rectangle, "vbox"); + g_object_ref (priv->vbox_rect); + gtk_widget_unparent (priv->vbox_rect); + priv->spn_rect_stroke_width = glade_xml_get_widget (gla_rectangle, "spn_rect_stroke_width"); + priv->cbtn_rect_stroke_color = glade_xml_get_widget (gla_rectangle, "cbtn_rect_stroke_color"); + priv->cbtn_rect_fill_color = glade_xml_get_widget (gla_rectangle, "cbtn_rect_fill_color"); + + g_signal_connect (G_OBJECT (priv->spn_rect_stroke_width), "value-changed", + G_CALLBACK (on_spn_rect_stroke_width_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_rect_stroke_color), "color-set", + G_CALLBACK (on_cbtn_rect_stroke_color_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_rect_fill_color), "color-set", + G_CALLBACK (on_cbtn_rect_fill_color_color_set), (gpointer)obj_prop); + + /* ellipse */ + priv->vbox_ellipse = glade_xml_get_widget (gla_ellipse, "vbox"); + g_object_ref (priv->vbox_ellipse); + gtk_widget_unparent (priv->vbox_ellipse); + priv->spn_ellipse_stroke_width = glade_xml_get_widget (gla_ellipse, "spn_ellipse_stroke_width"); + priv->cbtn_ellipse_stroke_color = glade_xml_get_widget (gla_ellipse, "cbtn_ellipse_stroke_color"); + priv->cbtn_ellipse_fill_color = glade_xml_get_widget (gla_ellipse, "cbtn_ellipse_fill_color"); + + g_signal_connect (G_OBJECT (priv->spn_ellipse_stroke_width), "value-changed", + G_CALLBACK (on_spn_ellipse_stroke_width_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_ellipse_stroke_color), "color-set", + G_CALLBACK (on_cbtn_ellipse_stroke_color_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_ellipse_fill_color), "color-set", + G_CALLBACK (on_cbtn_ellipse_fill_color_color_set), (gpointer)obj_prop); + + /* image */ + priv->vbox_image = glade_xml_get_widget (gla_text, "vbox"); + g_object_ref (priv->vbox_image); + gtk_widget_unparent (priv->vbox_image); + priv->spn_image_border_width_top = glade_xml_get_widget (gla_image, "spn_image_border_width_top"); + priv->spn_image_border_width_right = glade_xml_get_widget (gla_image, "spn_image_border_width_right"); + priv->spn_image_border_width_bottom = glade_xml_get_widget (gla_image, "spn_image_border_width_bottom"); + priv->spn_image_border_width_left = glade_xml_get_widget (gla_image, "spn_image_border_width_left"); + priv->cbtn_image_border_color_top = glade_xml_get_widget (gla_image, "cbtn_image_border_color_top"); + priv->cbtn_image_border_color_right = glade_xml_get_widget (gla_image, "cbtn_image_border_color_right"); + priv->cbtn_image_border_color_bottom = glade_xml_get_widget (gla_image, "cbtn_image_border_color_bottom"); + priv->cbtn_image_border_color_left = glade_xml_get_widget (gla_image, "cbtn_image_border_color_left"); + + g_signal_connect (G_OBJECT (priv->spn_image_border_width_top), "value-changed", + G_CALLBACK (on_spn_image_border_width_top_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_image_border_width_right), "value-changed", + G_CALLBACK (on_spn_image_border_width_right_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_image_border_width_bottom), "value-changed", + G_CALLBACK (on_spn_image_border_width_bottom_value_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->spn_image_border_width_left), "value-changed", + G_CALLBACK (on_spn_image_border_width_left_value_changed), (gpointer)obj_prop); + + g_signal_connect (G_OBJECT (priv->cbtn_image_border_color_top), "color-set", + G_CALLBACK (on_cbtn_image_border_color_top_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_image_border_color_right), "color-set", + G_CALLBACK (on_cbtn_image_border_color_right_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_image_border_color_bottom), "color-set", + G_CALLBACK (on_cbtn_image_border_color_bottom_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cbtn_image_border_color_left), "color-set", + G_CALLBACK (on_cbtn_image_border_color_left_color_set), (gpointer)obj_prop); + gtk_widget_show_all (priv->w); return obj_prop; @@ -129,35 +446,48 @@ grpt_object_properties_set_canvas_item (GRptObjectProperties *grpt_object_proper if (GRPT_IS_CANVAS_ITEM (grpt_canvas_item)) { + priv->grpt_canvas_item = grpt_canvas_item; priv->rpt_obj = grpt_canvas_item_get_rpt_object (grpt_canvas_item); } else { + priv->grpt_canvas_item = NULL; priv->rpt_obj = NULL; } + grpt_object_properties_set_signal_active (grpt_object_properties, FALSE); grpt_object_properties_load_common (grpt_object_properties); if (IS_RPT_OBJ_TEXT (priv->rpt_obj)) { + grpt_object_properties_set_vbox (grpt_object_properties, priv->vbox_text); grpt_object_properties_load_text (grpt_object_properties); } else if (IS_RPT_OBJ_ELLIPSE (priv->rpt_obj)) { + grpt_object_properties_set_vbox (grpt_object_properties, priv->vbox_ellipse); grpt_object_properties_load_ellipse (grpt_object_properties); } else if (IS_RPT_OBJ_RECT (priv->rpt_obj)) { + grpt_object_properties_set_vbox (grpt_object_properties, priv->vbox_rect); grpt_object_properties_load_rect (grpt_object_properties); } else if (IS_RPT_OBJ_LINE (priv->rpt_obj)) { + grpt_object_properties_set_vbox (grpt_object_properties, priv->vbox_line); grpt_object_properties_load_line (grpt_object_properties); } else if (IS_RPT_OBJ_IMAGE (priv->rpt_obj)) { + grpt_object_properties_set_vbox (grpt_object_properties, priv->vbox_image); grpt_object_properties_load_image (grpt_object_properties); } + else + { + grpt_object_properties_set_vbox (grpt_object_properties, NULL); + } + grpt_object_properties_set_signal_active (grpt_object_properties, TRUE); } void @@ -168,17 +498,677 @@ grpt_object_properties_destroy (GRptObjectProperties *grpt_object_properties) gtk_widget_destroy (priv->w); } +static void +on_txt_name_changed (GtkEditable *editable, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + g_object_set (G_OBJECT (priv->rpt_obj), + "name", gtk_entry_get_text (GTK_ENTRY (priv->txt_name)), + NULL); + + if (IS_RPT_OBJ_TEXT (priv->rpt_obj)) + { + /* for other different type objects it doesn't matter a redraw */ + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); + } +} + +static void +on_spn_x_y_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + RptPoint position; + + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + position.x = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_x)); + position.y = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_y)); + + grpt_canvas_item_set_position (priv->grpt_canvas_item, position); +} + +static void +on_spn_width_height_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + RptSize size; + + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + size.width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_width)); + size.height = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_height)); + + grpt_canvas_item_set_size (priv->grpt_canvas_item, size); +} + +static void +on_spn_rotation_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + RptRotation rotation; + + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + rotation.angle = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_rotation)); + + grpt_canvas_item_set_rotation (priv->grpt_canvas_item, &rotation); +} + +static void +on_spn_text_border_width_top_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + } + priv->border->top_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_top)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_text_border_width_right_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + } + priv->border->right_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_right)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_text_border_width_bottom_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + } + priv->border->bottom_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_bottom)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_text_border_width_left_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + } + priv->border->left_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_left)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_text_border_color_top_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_top), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_top)); + + if (priv->border == NULL) + { + priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + } + priv->border->top_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_text_border_color_right_color_set (GtkColorButton *widget, + gpointer user_data) +{ +} + +static void +on_cbtn_text_border_color_bottom_color_set (GtkColorButton *widget, + gpointer user_data) +{ +} + +static void +on_cbtn_text_border_color_left_color_set (GtkColorButton *widget, + gpointer user_data) +{ +} + +static void +on_fbtn_text_font_font_set (GtkFontButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + const gchar *font_name; + PangoFontDescription *pango_desc; + + font_name = gtk_font_button_get_font_name (GTK_FONT_BUTTON (priv->fbtn_text_font)); + pango_desc = pango_font_description_from_string (font_name); + + priv->font = rpt_common_rptfont_from_pango_description ((const PangoFontDescription *)pango_desc); + + g_object_set (G_OBJECT (priv->rpt_obj), + "font", priv->font, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_chk_text_font_strike (GtkToggleButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + gboolean strike = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->chk_text_font_strike)); + + if (priv->font == NULL) + { + priv->font = (RptFont *)g_malloc0 (sizeof (RptFont)); + } + priv->font->strike = strike; + + g_object_set (G_OBJECT (priv->rpt_obj), + "font", priv->font, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_text_font_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_text_font_color), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_font_color)); + + if (priv->font == NULL) + { + priv->font = (RptFont *)g_malloc0 (sizeof (RptFont)); + } + priv->font->color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "font", priv->font, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_text_back_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_text_back_color), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_back_color)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "background-color", rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha), + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_text_padd_top_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + gdouble pad = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_padd_top)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "padding-top", pad, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_text_padd_right_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + gdouble pad = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_padd_right)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "padding-right", pad, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_text_padd_bottom_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + gdouble pad = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_padd_bottom)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "padding-bottom", pad, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_text_padd_left_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + gdouble pad = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_padd_left)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "padding-left", pad, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_line_stroke_width_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->stroke == NULL) + { + priv->stroke = rpt_common_rptstroke_new (); + } + priv->stroke->width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_line_stroke_width)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "stroke", priv->stroke, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_line_stroke_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_line_stroke_color), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_line_stroke_color)); + + if (priv->stroke == NULL) + { + priv->stroke = rpt_common_rptstroke_new (); + } + priv->stroke->color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "stroke", priv->stroke, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_rect_stroke_width_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->stroke == NULL) + { + priv->stroke = rpt_common_rptstroke_new (); + } + priv->stroke->width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_rect_stroke_width)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "stroke", priv->stroke, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_rect_stroke_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_rect_stroke_color), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_rect_stroke_color)); + + if (priv->stroke == NULL) + { + priv->stroke = rpt_common_rptstroke_new (); + } + priv->stroke->color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "stroke", priv->stroke, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_rect_fill_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_rect_fill_color), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_rect_fill_color)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "fill-color", rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha), + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_ellipse_stroke_width_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->stroke == NULL) + { + priv->stroke = rpt_common_rptstroke_new (); + } + priv->stroke->width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_ellipse_stroke_width)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "stroke", priv->stroke, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_ellipse_stroke_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_ellipse_stroke_color), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_ellipse_stroke_color)); + + if (priv->stroke == NULL) + { + priv->stroke = rpt_common_rptstroke_new (); + } + priv->stroke->color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "stroke", priv->stroke, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cbtn_ellipse_fill_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_ellipse_fill_color), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_ellipse_fill_color)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "fill-color", rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha), + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_spn_image_border_width_top_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ +} + +static void +on_spn_image_border_width_right_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ +} + +static void +on_spn_image_border_width_bottom_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ +} + +static void +on_spn_image_border_width_left_value_changed (GtkSpinButton *spin_button, + gpointer user_data) +{ +} + +static void +on_cbtn_image_border_color_top_color_set (GtkColorButton *widget, + gpointer user_data) +{ +} + +static void +on_cbtn_image_border_color_right_color_set (GtkColorButton *widget, + gpointer user_data) +{ +} + +static void +on_cbtn_image_border_color_bottom_color_set (GtkColorButton *widget, + gpointer user_data) +{ +} + +static void +on_cbtn_image_border_color_left_color_set (GtkColorButton *widget, + gpointer user_data) +{ +} + static void grpt_object_properties_empty_properties (GRptObjectProperties *grpt_object_properties) { + GdkColor gdk_color_black; + GdkColor gdk_color_white; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + gdk_color_black.red = 0; + gdk_color_black.green = 0; + gdk_color_black.blue = 0; + + gdk_color_white.red = 65535; + gdk_color_white.green = 65535; + gdk_color_white.blue = 65535; + + /* common */ gtk_entry_set_text (GTK_ENTRY (priv->txt_name), ""); gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_x), 0.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_y), 0.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_width), 0.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_height), 0.0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_rotation), 0.0); + + /* text */ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_top), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_right), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_bottom), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_left), 0.0); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_top), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_top), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_right), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_right), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_bottom), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_bottom), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_left), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_left), 65535); + + priv->fbtn_text_font; + /* to do underline */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->chk_text_font_strike), FALSE); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_font_color), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_font_color), 65535); + + priv->cb_text_alignment_h; + priv->cb_text_alignment_v; + + gtk_text_buffer_set_text (priv->buf_text_source, "", 0); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_back_color), &gdk_color_white); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_back_color), 65535); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_top), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_right), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_bottom), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_left), 0.0); + + /* line */ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_line_stroke_width), 1.0); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_line_stroke_color), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_line_stroke_color), 65535); + + /* rectangle */ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_rect_stroke_width), 1.0); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_rect_stroke_color), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_rect_stroke_color), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_rect_fill_color), &gdk_color_white); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_rect_fill_color), 65535); + + /* ellipse */ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_ellipse_stroke_width), 1.0); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_ellipse_stroke_color), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_ellipse_stroke_color), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_ellipse_fill_color), &gdk_color_white); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_ellipse_fill_color), 65535); + + /* image */ + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_top), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_right), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_bottom), 0.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_left), 0.0); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_top), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_top), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_right), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_right), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_bottom), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_bottom), 65535); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_left), &gdk_color_black); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_left), 65535); +} + +static void +grpt_object_properties_set_vbox (GRptObjectProperties *grpt_object_properties, + GtkWidget *vbox) +{ + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->cur_vbox != NULL) + { + g_object_ref (priv->cur_vbox); + gtk_container_remove (GTK_CONTAINER (priv->vbox), priv->cur_vbox); + } + if (vbox != NULL) + { + gtk_box_pack_end (GTK_BOX (priv->vbox), vbox, TRUE, TRUE, 0); + } + priv->cur_vbox = vbox; } static void @@ -223,21 +1213,27 @@ grpt_object_properties_load_common (GRptObjectProperties *grpt_object_properties static void grpt_object_properties_load_text (GRptObjectProperties *grpt_object_properties) { - RptBorder *border; - RptFont *font; - RptAlign *align; - gchar *source; - RptColor *background_color; + RptAlign *align = NULL; + gchar *source = NULL; + RptColor *background_color = NULL; gdouble padding_top; gdouble padding_right; gdouble padding_bottom; gdouble padding_left; + GdkColor *gdk_color; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + g_free (priv->border); + g_free (priv->font); + + priv->border = NULL; + priv->font = NULL; + g_object_get (G_OBJECT (priv->rpt_obj), - "border", &border, - "font", &font, + "border", &priv->border, + "font", &priv->font, "align", &align, "source", &source, "background-color", &background_color, @@ -246,60 +1242,369 @@ grpt_object_properties_load_text (GRptObjectProperties *grpt_object_properties) "padding-bottom", &padding_bottom, "padding-left", &padding_left, NULL); + + if (priv->border != NULL) + { + if (priv->border->top_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_top), priv->border->top_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->top_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_top), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_top), + priv->border->top_color->a * 65535); + } + if (priv->border->right_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_right), priv->border->right_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->right_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_right), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_right), + priv->border->right_color->a * 65535); + } + if (priv->border->bottom_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_bottom), priv->border->bottom_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->bottom_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_bottom), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_bottom), + priv->border->bottom_color->a * 65535); + } + if (priv->border->left_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_left), priv->border->left_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->left_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_left), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_left), + priv->border->left_color->a * 65535); + } + } + + if (priv->font != NULL) + { + gchar *font_name = g_strdup_printf ("%s %d", priv->font->name, (int)priv->font->size); + + if (priv->font->bold) + { + font_name = g_strconcat (font_name, " bold"); + } + if (priv->font->italic) + { + font_name = g_strconcat (font_name, " italic"); + } + gtk_font_button_set_font_name (GTK_FONT_BUTTON (priv->fbtn_text_font), + font_name); + + /* TO DO */ + /* underline */ + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->chk_text_font_strike), + priv->font->strike); + + if (priv->font->color != NULL) + { + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->font->color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_font_color), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_font_color), + priv->font->color->a * 65535); + } + } + + if (align!= NULL) + { + } + + if (source != NULL) + { + gtk_text_buffer_set_text (priv->buf_text_source, source, strlen (source)); + } + + if (background_color != NULL) + { + gdk_color = rpt_common_rptcolor_to_gdkcolor (background_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_text_back_color), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_back_color), + background_color->a * 65535); + } + + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_top), padding_top); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_right), padding_right); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_bottom), padding_bottom); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_text_padd_left), padding_left); } static void grpt_object_properties_load_line (GRptObjectProperties *grpt_object_properties) { - RptStroke *stroke; + GdkColor *gdk_color; GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + g_free (priv->stroke); + + priv->stroke = NULL; + g_object_get (G_OBJECT (priv->rpt_obj), - "stroke", &stroke, + "stroke", &priv->stroke, NULL); + + if (priv->stroke != NULL) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_line_stroke_width), + priv->stroke->width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->stroke->color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_line_stroke_color), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_line_stroke_color), + priv->stroke->color->a * 65535); + } } static void grpt_object_properties_load_rect (GRptObjectProperties *grpt_object_properties) { - RptStroke *stroke; - RptColor *fill_color; + GdkColor *gdk_color; GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + g_free (priv->stroke); + g_free (priv->color); + + priv->stroke = NULL; + priv->color = NULL; + g_object_get (G_OBJECT (priv->rpt_obj), - "stroke", &stroke, - "fill-color", &fill_color, + "stroke", &priv->stroke, + "fill-color", &priv->color, NULL); + + if (priv->stroke != NULL) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_rect_stroke_width), + priv->stroke->width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->stroke->color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_rect_stroke_color), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_rect_stroke_color), + priv->stroke->color->a * 65535); + } + + if (priv->color != NULL) + { + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_rect_fill_color), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_rect_fill_color), + priv->color->a * 65535); + } } static void grpt_object_properties_load_ellipse (GRptObjectProperties *grpt_object_properties) { - RptStroke *stroke; - RptColor *fill_color; + GdkColor *gdk_color; GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + g_free (priv->stroke); + g_free (priv->color); + + priv->stroke = NULL; + priv->color = NULL; + g_object_get (G_OBJECT (priv->rpt_obj), - "stroke", &stroke, - "fill-color", &fill_color, + "stroke", &priv->stroke, + "fill-color", &priv->color, NULL); + + if (priv->stroke != NULL) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_ellipse_stroke_width), + priv->stroke->width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->stroke->color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_ellipse_stroke_color), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_ellipse_stroke_color), + priv->stroke->color->a * 65535); + } + + if (priv->color != NULL) + { + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_ellipse_fill_color), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_ellipse_fill_color), + priv->color->a * 65535); + } } static void grpt_object_properties_load_image (GRptObjectProperties *grpt_object_properties) { - RptBorder *border; gchar *source; guint adapt; + GdkColor *gdk_color; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + g_free (priv->border); + + priv->border = NULL; + g_object_get (G_OBJECT (priv->rpt_obj), - "border", &border, + "border", &priv->border, "source", &source, "adapt", &adapt, NULL); + + if (priv->border != NULL) + { + if (priv->border->top_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_top), priv->border->top_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->top_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_top), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_top), + priv->border->top_color->a * 65535); + } + if (priv->border->right_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_right), priv->border->right_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->right_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_right), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_right), + priv->border->right_color->a * 65535); + } + if (priv->border->bottom_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_bottom), priv->border->bottom_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->bottom_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_bottom), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_bottom), + priv->border->bottom_color->a * 65535); + } + if (priv->border->left_width != 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_left), priv->border->left_width); + + gdk_color = rpt_common_rptcolor_to_gdkcolor (priv->border->left_color); + gtk_color_button_set_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_left), + gdk_color); + gtk_color_button_set_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_left), + priv->border->left_color->a * 65535); + } + } + + if (source != NULL) + { + } +} + +static void +grpt_object_properties_set_signal_active (GRptObjectProperties *grpt_object_properties, + gboolean active) +{ + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (active) + { + g_signal_handlers_unblock_by_func (priv->txt_name, G_CALLBACK (on_txt_name_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_x, G_CALLBACK (on_spn_x_y_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_y, G_CALLBACK (on_spn_x_y_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_width, G_CALLBACK (on_spn_width_height_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_height, G_CALLBACK (on_spn_width_height_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_rotation, G_CALLBACK (on_spn_rotation_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_border_width_top, G_CALLBACK (on_spn_text_border_width_top_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_border_width_right, G_CALLBACK (on_spn_text_border_width_right_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_border_width_bottom, G_CALLBACK (on_spn_text_border_width_bottom_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_border_width_left, G_CALLBACK (on_spn_text_border_width_left_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_text_border_color_top, G_CALLBACK (on_cbtn_text_border_color_top_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_text_border_color_right, G_CALLBACK (on_cbtn_text_border_color_right_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_text_border_color_bottom, G_CALLBACK (on_cbtn_text_border_color_bottom_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_text_border_color_left, G_CALLBACK (on_cbtn_text_border_color_left_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->fbtn_text_font, G_CALLBACK (on_fbtn_text_font_font_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->chk_text_font_strike, G_CALLBACK (on_chk_text_font_strike), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_text_font_color, G_CALLBACK (on_cbtn_text_font_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_text_back_color, G_CALLBACK (on_cbtn_text_back_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_padd_top, G_CALLBACK (on_spn_text_padd_top_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_padd_right, G_CALLBACK (on_spn_text_padd_right_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_padd_bottom, G_CALLBACK (on_spn_text_padd_bottom_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_text_padd_left, G_CALLBACK (on_spn_text_padd_left_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_line_stroke_width, G_CALLBACK (on_spn_line_stroke_width_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_line_stroke_color, G_CALLBACK (on_cbtn_line_stroke_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_rect_stroke_width, G_CALLBACK (on_spn_rect_stroke_width_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_rect_stroke_color, G_CALLBACK (on_cbtn_rect_stroke_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_rect_fill_color, G_CALLBACK (on_cbtn_rect_fill_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_ellipse_stroke_width, G_CALLBACK (on_spn_ellipse_stroke_width_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_ellipse_stroke_color, G_CALLBACK (on_cbtn_ellipse_stroke_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_ellipse_fill_color, G_CALLBACK (on_cbtn_ellipse_fill_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_image_border_width_top, G_CALLBACK (on_spn_image_border_width_top_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_image_border_width_right, G_CALLBACK (on_spn_image_border_width_right_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_image_border_width_bottom, G_CALLBACK (on_spn_image_border_width_bottom_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->spn_image_border_width_left, G_CALLBACK (on_spn_image_border_width_left_value_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_image_border_color_top, G_CALLBACK (on_cbtn_image_border_color_top_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_image_border_color_right, G_CALLBACK (on_cbtn_image_border_color_right_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_image_border_color_bottom, G_CALLBACK (on_cbtn_image_border_color_bottom_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cbtn_image_border_color_left, G_CALLBACK (on_cbtn_image_border_color_left_color_set), grpt_object_properties); + } + else + { + g_signal_handlers_block_by_func (priv->txt_name, G_CALLBACK (on_txt_name_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_x, G_CALLBACK (on_spn_x_y_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_y, G_CALLBACK (on_spn_x_y_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_width, G_CALLBACK (on_spn_width_height_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_height, G_CALLBACK (on_spn_width_height_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_rotation, G_CALLBACK (on_spn_rotation_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_border_width_top, G_CALLBACK (on_spn_text_border_width_top_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_border_width_right, G_CALLBACK (on_spn_text_border_width_right_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_border_width_bottom, G_CALLBACK (on_spn_text_border_width_bottom_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_border_width_left, G_CALLBACK (on_spn_text_border_width_left_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_text_border_color_top, G_CALLBACK (on_cbtn_text_border_color_top_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_text_border_color_right, G_CALLBACK (on_cbtn_text_border_color_right_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_text_border_color_bottom, G_CALLBACK (on_cbtn_text_border_color_bottom_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_text_border_color_left, G_CALLBACK (on_cbtn_text_border_color_left_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->fbtn_text_font, G_CALLBACK (on_fbtn_text_font_font_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->chk_text_font_strike, G_CALLBACK (on_chk_text_font_strike), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_text_font_color, G_CALLBACK (on_cbtn_text_font_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_text_back_color, G_CALLBACK (on_cbtn_text_back_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_padd_top, G_CALLBACK (on_spn_text_padd_top_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_padd_right, G_CALLBACK (on_spn_text_padd_right_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_padd_bottom, G_CALLBACK (on_spn_text_padd_bottom_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_text_padd_left, G_CALLBACK (on_spn_text_padd_left_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_line_stroke_width, G_CALLBACK (on_spn_line_stroke_width_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_line_stroke_color, G_CALLBACK (on_cbtn_line_stroke_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_rect_stroke_width, G_CALLBACK (on_spn_rect_stroke_width_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_rect_stroke_color, G_CALLBACK (on_cbtn_rect_stroke_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_rect_fill_color, G_CALLBACK (on_cbtn_rect_fill_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_ellipse_stroke_width, G_CALLBACK (on_spn_ellipse_stroke_width_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_ellipse_stroke_color, G_CALLBACK (on_cbtn_ellipse_stroke_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_ellipse_fill_color, G_CALLBACK (on_cbtn_ellipse_fill_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_image_border_width_top, G_CALLBACK (on_spn_image_border_width_top_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_image_border_width_right, G_CALLBACK (on_spn_image_border_width_right_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_image_border_width_bottom, G_CALLBACK (on_spn_image_border_width_bottom_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->spn_image_border_width_left, G_CALLBACK (on_spn_image_border_width_left_value_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_image_border_color_top, G_CALLBACK (on_cbtn_image_border_color_top_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_image_border_color_right, G_CALLBACK (on_cbtn_image_border_color_right_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_image_border_color_bottom, G_CALLBACK (on_cbtn_image_border_color_bottom_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cbtn_image_border_color_left, G_CALLBACK (on_cbtn_image_border_color_left_color_set), grpt_object_properties); + } } diff --git a/src/page_properties.c b/src/page_properties.c index c227f0f..a1f5e94 100644 --- a/src/page_properties.c +++ b/src/page_properties.c @@ -39,6 +39,27 @@ static GtkWidget *spn_footer_height; static GtkWidget *chk_footer_first_page; static GtkWidget *chk_footer_last_page; +static void +page_properties_find_cb_page_size () +{ + /* TO DO */ + + gdouble width; + gdouble height; + + width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_width)); + height = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_height)); + + if (width == 595.0 && height == 842.0) + { + gtk_combo_box_set_active (GTK_COMBO_BOX (cb_size_type), 0); + } + else + { + gtk_combo_box_set_active (GTK_COMBO_BOX (cb_size_type), 1); + } +} + static void page_properties_set_size_sensibility () { @@ -83,6 +104,8 @@ page_properties_load () gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_width), size->width); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_height), size->height); + page_properties_find_cb_page_size (); + rpt_report_get_page_margins (rpt_report_, &top, &right, @@ -121,7 +144,15 @@ void page_properties_on_cb_size_type_changed (GtkComboBox *widget, gpointer user_data) { + gchar *text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (cb_size_type)); + page_properties_set_size_sensibility (); + + if (strcmp (text, "A4") == 0) + { + gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_width), 595.0); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_height), 842.0); + } } void