goffice r2348 - in trunk: . goffice/graph goffice/gtk pixmaps plugins/plot_radar plugins/plot_xy po
- From: jbrefort svn gnome org
- To: svn-commits-list gnome org
- Subject: goffice r2348 - in trunk: . goffice/graph goffice/gtk pixmaps plugins/plot_radar plugins/plot_xy po
- Date: Fri, 27 Mar 2009 13:53:37 +0000 (UTC)
Author: jbrefort
Date: Fri Mar 27 13:53:37 2009
New Revision: 2348
URL: http://svn.gnome.org/viewvc/goffice?rev=2348&view=rev
Log:
2009-03-27 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-plot.c: (gog_plot_guru_helper_add_grid_line): fixed
axis type test.
* goffice/gtk/goffice-gtk.c: (go_xml_builder_new): new GtkBuilder
support function.
* goffice/gtk/goffice-gtk.h: ditto.
* pixmaps/Makefile.am: added new pixmaps.
* pixmaps/chart_color_polar_1_1.png: new pixmap.
* pixmaps/chart_color_polar_1_1.svg: ditto.
* plugins/plot_radar/Makefile.am: added ui file.
* plugins/plot_radar/gog-color-polar-prefs.glade: new glade file.
* plugins/plot_radar/gog-color-polar-prefs.xml: the same as a ui file.
* plugins/plot_radar/gog-radar.c: (hide_outliers_toggled_cb),
(gog_color_polar_plot_populate_editor),
(gog_color_polar_plot_set_property),
(gog_color_polar_plot_get_property),
(gog_color_polar_plot_type_name), (gog_color_polar_plot_update),
(gog_color_polar_plot_axis_get_bounds),
(gog_color_polar_plot_class_init), (gog_color_polar_plot_init),
(get_map_color), (gog_rt_view_render),
(gog_color_polar_series_init_style),
(gog_color_polar_series_update),
(gog_color_polar_series_class_init), (go_plugin_init): add support for
the new GogColorPolarPlot plot type.
* plugins/plot_radar/gog-radar.h: ditto.
* plugins/plot_radar/plot-types.xml.in: ditto.
* plugins/plot_radar/plugin.xml.in: ditto.
* plugins/plot_xy/gog-xy.c: (gog_xy_color_plot_populate_editor): fixed a
memory leak.
Added:
trunk/pixmaps/chart_color_polar_1_1.png (contents, props changed)
trunk/pixmaps/chart_color_polar_1_1.svg
trunk/plugins/plot_radar/gog-color-polar-prefs.glade
trunk/plugins/plot_radar/gog-color-polar-prefs.xml
Modified:
trunk/ChangeLog
trunk/goffice/graph/gog-plot.c
trunk/goffice/gtk/goffice-gtk.c
trunk/goffice/gtk/goffice-gtk.h
trunk/pixmaps/Makefile.am
trunk/plugins/plot_radar/Makefile.am
trunk/plugins/plot_radar/gog-radar.c
trunk/plugins/plot_radar/gog-radar.h
trunk/plugins/plot_radar/plot-types.xml.in
trunk/plugins/plot_radar/plugin.xml.in
trunk/plugins/plot_xy/gog-xy.c
trunk/po/ChangeLog
trunk/po/POTFILES.in
Modified: trunk/goffice/graph/gog-plot.c
==============================================================================
--- trunk/goffice/graph/gog-plot.c (original)
+++ trunk/goffice/graph/gog-plot.c Fri Mar 27 13:53:37 2009
@@ -1002,10 +1002,10 @@
GogAxisType type;
for (type = 0; type < GOG_AXIS_TYPES; type++) {
- if (((type & (GOG_AXIS_X |
- GOG_AXIS_Y |
- GOG_AXIS_CIRCULAR |
- GOG_AXIS_RADIAL)) != 0) &&
+ if ((((type == GOG_AXIS_X) |
+ (type == GOG_AXIS_Y) |
+ (type == GOG_AXIS_CIRCULAR) |
+ (type == GOG_AXIS_RADIAL))) &&
plot->axis[type] != NULL &&
gog_axis_get_grid_line (plot->axis[type], major) == NULL)
{
Modified: trunk/goffice/gtk/goffice-gtk.c
==============================================================================
--- trunk/goffice/gtk/goffice-gtk.c (original)
+++ trunk/goffice/gtk/goffice-gtk.c Fri Mar 27 13:53:37 2009
@@ -189,6 +189,48 @@
return g_signal_connect_swapped (w, detailed_signal, c_handler, data);
}
+/**
+ * go_xml_builder_new :
+ * @gcc : #GOCmdContext
+ * @gladefile : the name of the file load
+ *
+ * Simple utility to open ui files
+ *
+ * Returns: a new #GtkBuilder or NULL
+ **/
+GtkBuilder *
+go_xml_builder_new (char const *uifile,
+ char const *domain, GOCmdContext *gcc)
+{
+ GtkBuilder *gui;
+ char *f;
+ GError *error = NULL;
+
+ g_return_val_if_fail (uifile != NULL, NULL);
+
+ if (!g_path_is_absolute (uifile))
+ f = g_build_filename (go_sys_data_dir (), "glade", uifile, NULL);
+ else
+ f = g_strdup (uifile);
+
+ gui = gtk_builder_new ();
+ gtk_builder_set_translation_domain (gui, domain);
+ gtk_builder_add_from_file (gui, f, &error);
+ if (gui == NULL && gcc != NULL) {
+ char *msg;
+ if (error) {
+ msg = g_strdup (error->message);
+ g_error_free (error);
+ } else
+ msg = g_strdup_printf (_("Unable to open file '%s'"), f);
+ go_cmd_context_error_system (gcc, msg);
+ g_free (msg);
+ }
+ g_free (f);
+
+ return gui;
+}
+
/*
* A variant of gtk_window_activate_default that does not end up reactivating
* the widget that [Enter] was pressed in.
Modified: trunk/goffice/gtk/goffice-gtk.h
==============================================================================
--- trunk/goffice/gtk/goffice-gtk.h (original)
+++ trunk/goffice/gtk/goffice-gtk.h Fri Mar 27 13:53:37 2009
@@ -43,6 +43,10 @@
GCallback c_handler,
gpointer data);
+GtkBuilder *go_xml_builder_new (char const *uifile,
+ char const *domain, GOCmdContext *gcc);
+
+
int go_pango_measure_string (PangoContext *context,
PangoFontDescription const *font_desc,
char const *str);
Modified: trunk/pixmaps/Makefile.am
==============================================================================
--- trunk/pixmaps/Makefile.am (original)
+++ trunk/pixmaps/Makefile.am Fri Mar 27 13:53:37 2009
@@ -17,6 +17,7 @@
chart_pyramid_3_1.png \
chart_radar_1_1.png chart_radar_1_2.png chart_radar_1_3.png \
chart_polar_1_1.png \
+ chart_color_polar_1_1.png \
chart_stock_1_1.png chart_stock_1_2.png \
chart_stock_2_1.png chart_stock_2_2.png \
chart_line_1_1.png chart_line_1_2.png chart_line_1_3.png \
Added: trunk/pixmaps/chart_color_polar_1_1.png
==============================================================================
Binary file. No diff available.
Added: trunk/pixmaps/chart_color_polar_1_1.svg
==============================================================================
--- (empty file)
+++ trunk/pixmaps/chart_color_polar_1_1.svg Fri Mar 27 13:53:37 2009
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ inkscape:export-ydpi="25.400000"
+ inkscape:export-xdpi="25.400000"
+ inkscape:export-filename="/home/manu/Desktop/radar.png"
+ sodipodi:docname="chart_color_polar_1_1.svg"
+ sodipodi:docbase="/home/manu/Desktop"
+ height="60.000000mm"
+ width="64.000000mm"
+ inkscape:version="0.46"
+ sodipodi:version="0.32"
+ id="svg1"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 106.29921 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="226.77165 : 106.29921 : 1"
+ inkscape:persp3d-origin="113.38583 : 70.86614 : 1"
+ id="perspective2543" />
+ <linearGradient
+ id="linearGradient6655">
+ <stop
+ id="stop6656"
+ offset="0.0000000"
+ style="stop-color:#ffda86;stop-opacity:1.0000000;" />
+ <stop
+ id="stop6657"
+ offset="0.81471545"
+ style="stop-color:#c68c0b;stop-opacity:1.0000000;" />
+ <stop
+ id="stop6658"
+ offset="1.0000000"
+ style="stop-color:#664805;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient6649">
+ <stop
+ id="stop6650"
+ offset="0.0000000"
+ style="stop-color:#b5e6b0;stop-opacity:1.0000000;" />
+ <stop
+ id="stop6652"
+ offset="0.81471545"
+ style="stop-color:#6c8969;stop-opacity:1.0000000;" />
+ <stop
+ id="stop6651"
+ offset="1.0000000"
+ style="stop-color:#3b4b39;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient4044">
+ <stop
+ id="stop4045"
+ offset="0.0000000"
+ style="stop-color:#ffffff;stop-opacity:0.0000000;" />
+ <stop
+ id="stop4046"
+ offset="1.0000000"
+ style="stop-color:#363636;stop-opacity:0.18750000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3418">
+ <stop
+ id="stop3419"
+ offset="0.0000000"
+ style="stop-color:#f7f7f7;stop-opacity:1.0000000;" />
+ <stop
+ id="stop3420"
+ offset="1.0000000"
+ style="stop-color:#dedede;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2791">
+ <stop
+ id="stop2792"
+ offset="0.0000000"
+ style="stop-color:#fbfbfb;stop-opacity:1.0000000;" />
+ <stop
+ id="stop2793"
+ offset="1.0000000"
+ style="stop-color:#e9e9e9;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ y2="0.96103895"
+ x2="0.49079755"
+ y1="0.058441557"
+ x1="0.49693251"
+ id="linearGradient2794"
+ xlink:href="#linearGradient2791"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="0.98051947"
+ x2="0.53254437"
+ y1="0.012987013"
+ x1="0.53846157"
+ id="linearGradient3417"
+ xlink:href="#linearGradient3418"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="0.99350649"
+ x2="0.49689442"
+ y1="0.012987013"
+ x1="0.49689442"
+ id="linearGradient4043"
+ xlink:href="#linearGradient4044"
+ inkscape:collect="always" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:current-layer="svg1"
+ showguides="true"
+ inkscape:window-y="25"
+ inkscape:window-x="0"
+ guidetolerance="1.0000000mm"
+ inkscape:guide-points="true"
+ inkscape:guide-bbox="true"
+ gridtolerance="1.0000000px"
+ inkscape:grid-bbox="true"
+ inkscape:grid-points="true"
+ showgrid="true"
+ showborder="true"
+ inkscape:window-height="885"
+ inkscape:window-width="1270"
+ inkscape:cy="99.611423"
+ inkscape:cx="85.039367"
+ inkscape:zoom="4.4593316"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0000000"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base">
+ <sodipodi:guide
+ id="guide5924"
+ position="23.994627"
+ orientation="vertical" />
+ <sodipodi:guide
+ id="guide5925"
+ position="58.080453"
+ orientation="vertical" />
+ <sodipodi:guide
+ id="guide5926"
+ position="92.166278"
+ orientation="vertical" />
+ <sodipodi:guide
+ id="guide5927"
+ position="126.25210"
+ orientation="vertical" />
+ <inkscape:grid
+ id="GridFromPre046Settings"
+ type="xygrid"
+ originx="0px"
+ originy="0.50000000mm"
+ spacingx="1.0000000mm"
+ spacingy="1.0000000mm"
+ color="#0000ff"
+ empcolor="#0000ff"
+ opacity="0.2"
+ empopacity="0.4"
+ empspacing="5" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <rect
+ ry="14.164467"
+ rx="17.594519"
+ y="23.040251"
+ x="23.031496"
+ height="177.15660"
+ width="184.25197"
+ id="rect4047"
+ style="fill:url(#linearGradient4043);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" />
+ <rect
+ ry="14.164467"
+ rx="17.594519"
+ y="23.031490"
+ x="26.574802"
+ height="173.62204"
+ width="177.16536"
+ id="rect3421"
+ style="fill:url(#linearGradient4043);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" />
+ <rect
+ ry="14.164467"
+ rx="17.594519"
+ y="26.554472"
+ x="30.118111"
+ height="159.80026"
+ width="170.38249"
+ id="rect2169"
+ style="fill:url(#linearGradient2794);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;" />
+ <rect
+ ry="14.164467"
+ rx="17.594519"
+ y="31.699234"
+ x="31.955462"
+ height="149.19994"
+ width="163.39728"
+ id="rect3416"
+ style="fill:url(#linearGradient3417);fill-opacity:0.74901998;fill-rule:evenodd;stroke:none;stroke-width:3.0000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;" />
+ <rect
+ ry="14.164467"
+ rx="17.594519"
+ y="26.574797"
+ x="29.993284"
+ height="159.80026"
+ width="170.38249"
+ id="rect5928"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5262673;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path571"
+ d="M 115.15748,40.748025 L 115.15748,174.22427"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5433068;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path1334"
+ d="M 47.834646,108.07086 L 182.48031,108.07086"
+ style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5433068;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000" />
+ <path
+ d="M 182.48032 108.07086 A 67.322838 67.322838 0 1 1 47.834641,108.07086 A 67.322838 67.322838 0 1 1 182.48032 108.07086 z"
+ sodipodi:ry="67.322838"
+ sodipodi:rx="67.322838"
+ sodipodi:cy="108.07086"
+ sodipodi:cx="115.15748"
+ id="path1330"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3.5433068;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.605618e-2,0.999871,-0.999871,1.605618e-2,221.3654,-8.806980)"
+ d="M 116.45919,106.28101 C 119.67497,105.57880 121.23944,109.71124 120.83829,112.20236 C 119.85473,118.31025 112.58653,120.47444 107.36411,118.78675 C 98.005258,115.76232 95.036216,104.40330 98.519828,95.970752 C 103.88910,82.973718 120.06152,79.098746 132.10775,84.764241 C 149.09705,92.754525 153.95599,114.33219 145.78937,130.34860 C 134.92700,151.65192 107.43081,157.56342 87.122382,146.61912 C 67.776636,136.19362 58.049402,113.58378 61.656535,92.218629"
+ sodipodi:t0="0.10798493"
+ sodipodi:argument="-8.5150309"
+ sodipodi:radius="55.800037"
+ sodipodi:revolution="1.9010550"
+ sodipodi:expansion="1.4500000"
+ sodipodi:cy="108.07086"
+ sodipodi:cx="115.15748"
+ id="path1332"
+ style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#83a67f;stroke-width:8.8582678;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="spiral" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#0000fc;fill-opacity:1"
+ id="path1978"
+ sodipodi:cx="30.15074"
+ sodipodi:cy="104.51048"
+ sodipodi:rx="10.662551"
+ sodipodi:ry="10.763945"
+ d="M 40.813291,104.51048 A 10.662551,10.763945 0 1 1 19.488189,104.51048 A 10.662551,10.763945 0 1 1 40.813291,104.51048 z"
+ transform="matrix(0.8465218,0,0,0.8657569,94.949183,22.444458)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#00ffff;fill-opacity:1"
+ id="path1980"
+ sodipodi:cx="30.15074"
+ sodipodi:cy="104.51048"
+ sodipodi:rx="10.662551"
+ sodipodi:ry="10.763945"
+ d="M 40.813291,104.51048 A 10.662551,10.763945 0 1 1 19.488189,104.51048 A 10.662551,10.763945 0 1 1 40.813291,104.51048 z"
+ transform="matrix(0.8465218,0,0,0.8657569,103.63964,0.8738367)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#ff6200;fill-opacity:1"
+ id="path1984"
+ sodipodi:cx="30.15074"
+ sodipodi:cy="104.51048"
+ sodipodi:rx="10.662551"
+ sodipodi:ry="10.763945"
+ d="M 40.813291,104.51048 A 10.662551,10.763945 0 1 1 19.488189,104.51048 A 10.662551,10.763945 0 1 1 40.813291,104.51048 z"
+ transform="matrix(0.8465218,0,0,0.8657569,102.5187,-38.352427)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#00ff00;fill-opacity:1"
+ id="path1986"
+ sodipodi:cx="30.15074"
+ sodipodi:cy="104.51048"
+ sodipodi:rx="10.662551"
+ sodipodi:ry="10.763945"
+ d="M 40.813291,104.51048 A 10.662551,10.763945 0 1 1 19.488189,104.51048 A 10.662551,10.763945 0 1 1 40.813291,104.51048 z"
+ transform="matrix(0.8465218,0,0,0.8657569,85.196519,50.430795)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#ffff00;fill-opacity:1"
+ id="path1988"
+ sodipodi:cx="30.15074"
+ sodipodi:cy="104.51048"
+ sodipodi:rx="10.662551"
+ sodipodi:ry="10.763945"
+ d="M 40.813291,104.51048 A 10.662551,10.763945 0 1 1 19.488189,104.51048 A 10.662551,10.763945 0 1 1 40.813291,104.51048 z"
+ transform="matrix(0.8465218,0,0,0.8657569,49.761426,-8.1612704)" />
+</svg>
Modified: trunk/plugins/plot_radar/Makefile.am
==============================================================================
--- trunk/plugins/plot_radar/Makefile.am (original)
+++ trunk/plugins/plot_radar/Makefile.am Fri Mar 27 13:53:37 2009
@@ -1,6 +1,6 @@
goffice_graph_radardir = $(goffice_plugindir)/plot_radar
xmldir = $(goffice_graph_radardir)
-gladedir = $(goffice_graph_radardir)
+uidir = $(goffice_graph_radardir)
goffice_graph_radar_LTLIBRARIES = radar.la
radar_la_LDFLAGS = -module $(GOFFICE_PLUGIN_FLAGS)
@@ -13,6 +13,8 @@
xml_in_files = plugin.xml.in plot-types.xml.in
xml_DATA = $(xml_in_files:.xml.in=.xml)
+ui_DATA = gog-color-polar-prefs.xml
+
@INTLTOOL_XML_RULE@
# do not use the intl-tool stuff to merge the text back
Added: trunk/plugins/plot_radar/gog-color-polar-prefs.glade
==============================================================================
--- (empty file)
+++ trunk/plugins/plot_radar/gog-color-polar-prefs.glade Fri Mar 27 13:53:37 2009
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.4.5 on Fri Mar 27 12:29:54 2009 -->
+<glade-interface>
+ <widget class="GtkWindow" id="window1">
+ <child>
+ <widget class="GtkTable" id="gog-color-polar-prefs">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="hide-outliers">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Hide data outside of color axis bounds</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
Added: trunk/plugins/plot_radar/gog-color-polar-prefs.xml
==============================================================================
--- (empty file)
+++ trunk/plugins/plot_radar/gog-color-polar-prefs.xml Fri Mar 27 13:53:37 2009
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--Generated with glade3 3.4.5 on Fri Mar 27 12:29:54 2009 -->
+<interface>
+ <object class="GtkWindow" id="window1">
+ <child>
+ <object class="GtkTable" id="gog-color-polar-prefs">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="hide-outliers">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Hide data outside of color axis bounds</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
Modified: trunk/plugins/plot_radar/gog-radar.c
==============================================================================
--- trunk/plugins/plot_radar/gog-radar.c (original)
+++ trunk/plugins/plot_radar/gog-radar.c Fri Mar 27 13:53:37 2009
@@ -34,6 +34,7 @@
#include <goffice/math/go-math.h>
#include <goffice/utils/go-color.h>
#include <goffice/utils/go-marker.h>
+#include <goffice/utils/go-line.h>
#include <goffice/utils/go-persist.h>
#include <goffice/app/module-plugin-defs.h>
@@ -64,9 +65,11 @@
} GogRTSeries;
typedef GogRTSeries GogPolarSeries;
+typedef GogRTSeries GogColorPolarSeries;
typedef GogSeriesClass GogRTSeriesClass;
typedef GogRTSeriesClass GogPolarSeriesClass;
+typedef GogRTSeriesClass GogColorPolarSeriesClass;
enum {
SERIES_PROP_0,
@@ -79,6 +82,7 @@
static GType gog_rt_series_get_type (void);
static GType gog_polar_series_get_type (void);
+static GType gog_color_polar_series_get_type (void);
static GType gog_rt_view_get_type (void);
/*-----------------------------------------------------------------------------
@@ -422,16 +426,245 @@
/*****************************************************************************/
+typedef GogPolarPlotClass GogColorPolarPlotClass;
+
+static GogObjectClass *color_parent_klass;
+
+enum {
+ GOG_COLOR_POLAR_PROP_0,
+ GOG_COLOR_POLAR_PROP_HIDE_OUTLIERS,
+};
+
+#ifdef GOFFICE_WITH_GTK
+static void
+hide_outliers_toggled_cb (GtkToggleButton *btn, GObject *obj)
+{
+ g_object_set (obj, "hide-outliers", gtk_toggle_button_get_active (btn), NULL);
+}
+#endif
+
+static void
+gog_color_polar_plot_populate_editor (GogObject *obj,
+ GogEditor *editor,
+ GogDataAllocator *dalloc,
+ GOCmdContext *cc)
+{
+#ifdef GOFFICE_WITH_GTK
+ GtkBuilder *gui;
+ char const *dir;
+ char *path;
+
+ dir = go_plugin_get_dir_name (go_plugins_get_plugin_by_id ("GOffice_plot_radar"));
+ path = g_build_filename (dir, "gog-color-polar-prefs.xml", NULL);
+ gui = go_xml_builder_new (path, GETTEXT_PACKAGE, cc);
+ g_free (path);
+
+ if (gui != NULL) {
+ GtkWidget *w = GTK_WIDGET (gtk_builder_get_object (gui, "hide-outliers"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
+ (GOG_COLOR_POLAR_PLOT (obj))->hide_outliers);
+ g_signal_connect (G_OBJECT (w),
+ "toggled",
+ G_CALLBACK (hide_outliers_toggled_cb), obj);
+ w = GTK_WIDGET (gtk_builder_get_object (gui, "gog-color-polar-prefs"));
+ gtk_widget_unparent (w);
+ g_object_ref (w);
+ gog_editor_add_page (editor, w, _("Properties"));
+ g_object_unref (gui);
+ }
+
+#endif
+ (GOG_OBJECT_CLASS (color_parent_klass)->populate_editor) (obj, editor, dalloc, cc);
+}
+
+static void
+gog_color_polar_plot_set_property (GObject *obj, guint param_id,
+ GValue const *value, GParamSpec *pspec)
+{
+ GogColorPolarPlot *plot = GOG_COLOR_POLAR_PLOT (obj);
+ switch (param_id) {
+ case GOG_COLOR_POLAR_PROP_HIDE_OUTLIERS:
+ plot->hide_outliers = g_value_get_boolean (value);
+ break;
+ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+ break;
+ }
+
+ /* none of the attributes triggers a size change yet.
+ * When we add data labels we'll need it */
+ gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
+}
+
+static void
+gog_color_polar_plot_get_property (GObject *obj, guint param_id,
+ GValue *value, GParamSpec *pspec)
+{
+ GogColorPolarPlot *plot = GOG_COLOR_POLAR_PLOT (obj);
+ switch (param_id) {
+ case GOG_COLOR_POLAR_PROP_HIDE_OUTLIERS:
+ g_value_set_boolean (value, plot->hide_outliers);
+ break;
+ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+ break;
+ }
+}
+
+static char const *
+gog_color_polar_plot_type_name (G_GNUC_UNUSED GogObject const *item)
+{
+ /* xgettext : the base for how to name rt plot objects
+ * eg The 2nd rt plot in a chart will be called
+ * PlotColoredPolar2 */
+ return N_("PlotColorPolar");
+}
+
+static void
+gog_color_polar_plot_update (GogObject *obj)
+{
+ GogColorPolarPlot *model = GOG_COLOR_POLAR_PLOT (obj);
+ GogSeries const *series = NULL;
+ double z_min, z_max, tmp_min, tmp_max;
+ GSList *ptr;
+
+ z_min = DBL_MAX;
+ z_max = -DBL_MAX;
+ for (ptr = model->base.base.series ; ptr != NULL ; ptr = ptr->next) {
+ series = ptr->data;
+ if (!gog_series_is_valid (GOG_SERIES (series)))
+ continue;
+
+ go_data_vector_get_minmax (GO_DATA_VECTOR (
+ series->values[2].data), &tmp_min, &tmp_max);
+ if (z_min > tmp_min) z_min = tmp_min;
+ if (z_max < tmp_max) z_max = tmp_max;
+ }
+ if (model->z.minima != z_min || model->z.maxima != z_max) {
+ model->z.minima = z_min;
+ model->z.maxima = z_max;
+ gog_axis_bound_changed (model->base.base.axis[GOG_AXIS_COLOR], GOG_OBJECT (model));
+ }
+ color_parent_klass->update (obj);
+}
+
+static GOData *
+gog_color_polar_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
+ GogPlotBoundInfo * bounds)
+{
+ GogRTPlot *rt = GOG_RT_PLOT (plot);
+
+ switch (axis) {
+ case GOG_AXIS_CIRCULAR:
+ bounds->val.minima = bounds->logical.minima= -G_MAXDOUBLE;
+ bounds->val.maxima = bounds->logical.maxima= G_MAXDOUBLE;
+ bounds->is_discrete = FALSE;
+ break;
+ case GOG_AXIS_RADIAL:
+ bounds->val.minima = bounds->logical.minima = 0.;
+ bounds->val.maxima = rt->r.maxima;
+ bounds->logical.maxima = go_nan;
+ bounds->is_discrete = FALSE;
+ break;
+ case GOG_AXIS_COLOR: {
+ GogColorPolarPlot *model = GOG_COLOR_POLAR_PLOT (plot);
+
+ bounds->val.minima = model->z.minima;
+ bounds->val.maxima = model->z.maxima;
+ bounds->is_discrete = model->z.minima > model->z.maxima ||
+ !go_finite (model->z.minima) ||
+ !go_finite (model->z.maxima);
+ return NULL;
+ }
+ default:
+ g_warning("[GogColorPolarPlot::axis_set_bounds] bad axis (%i)", axis);
+ break;
+ }
+
+ return NULL;
+}
+
+static void
+gog_color_polar_plot_class_init (GogPlotClass *gog_plot_klass)
+{
+ GogObjectClass *gog_object_klass = (GogObjectClass *) gog_plot_klass;
+ GObjectClass *gobject_klass = (GObjectClass *) gog_plot_klass;
+
+ color_parent_klass = g_type_class_peek_parent (gog_plot_klass);
+ gog_object_klass->update = gog_color_polar_plot_update;
+ gog_object_klass->populate_editor = gog_color_polar_plot_populate_editor;
+
+ gobject_klass->set_property = gog_color_polar_plot_set_property;
+ gobject_klass->get_property = gog_color_polar_plot_get_property;
+ g_object_class_install_property (gobject_klass, GOG_COLOR_POLAR_PROP_HIDE_OUTLIERS,
+ g_param_spec_boolean ("hide-outliers",
+ _("hide-outliers"),
+ _("Hide data outside of the color axis bounds"),
+ TRUE,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+ /* Fill in GOGObject superclass values */
+ gog_object_klass->type_name = gog_color_polar_plot_type_name;
+
+ {
+ static GogSeriesDimDesc dimensions[] = {
+ { N_("Angle"), GOG_SERIES_SUGGESTED, FALSE,
+ GOG_DIM_INDEX, GOG_MS_DIM_CATEGORIES },
+ { N_("Magnitude"), GOG_SERIES_REQUIRED, FALSE,
+ GOG_DIM_VALUE, GOG_MS_DIM_VALUES },
+ { N_("Z"), GOG_SERIES_REQUIRED, FALSE,
+ GOG_DIM_VALUE, GOG_MS_DIM_EXTRA1 }
+ };
+ gog_plot_klass->desc.series.dim = dimensions;
+ gog_plot_klass->desc.series.num_dim = G_N_ELEMENTS (dimensions);
+ gog_plot_klass->desc.series.style_fields = GOG_STYLE_LINE
+ | GOG_STYLE_MARKER
+ | GOG_STYLE_INTERPOLATION
+ | GOG_STYLE_MARKER_NO_COLOR;
+ }
+
+ gog_plot_klass->series_type = gog_color_polar_series_get_type();
+ gog_plot_klass->axis_get_bounds = gog_color_polar_plot_axis_get_bounds;
+ gog_plot_klass->axis_set = GOG_AXIS_SET_RADAR | (1 << GOG_AXIS_COLOR);
+}
+
+static void
+gog_color_polar_plot_init (GogColorPolarPlot *plot)
+{
+ plot->hide_outliers = TRUE;
+}
+
+GSF_DYNAMIC_CLASS (GogColorPolarPlot, gog_color_polar_plot,
+ gog_color_polar_plot_class_init, gog_color_polar_plot_init,
+ GOG_POLAR_PLOT_TYPE)
+
+/*****************************************************************************/
+
typedef GogPlotView GogRTView;
typedef GogPlotViewClass GogRTViewClass;
+static GOColor
+get_map_color (double z, gboolean hide_outliers)
+{
+ if (hide_outliers && (z < 0. || z > 6.))
+ return 0;
+ if (z <= 0.)
+ return RGBA_BLUE;
+ if (z <= 1.)
+ return RGBA_BLUE + ((int) (z * 255.) << 16);
+ if (z <= 2.)
+ return RGBA_GREEN + ((int) ((2. - z) * 255) << 8);
+ if (z <= 4.)
+ return RGBA_GREEN + ((int) ((z / 2. - 1.) * 255) << 24);
+ if (z <= 6.)
+ return RGBA_RED + ((int) ((3. - z / 2.) * 255) << 16);
+ return RGBA_RED;
+}
+
static void
gog_rt_view_render (GogView *view, GogViewAllocation const *bbox)
{
GogRTPlot const *model = GOG_RT_PLOT (view->model);
GogAxis *r_axis, *c_axis;
GogChart *chart = GOG_CHART (view->model->parent);
- GogAxisMap *r_map, *c_map;
+ GogAxisMap *r_map, *c_map, *z_map = NULL;
GogChartMap *chart_map;
GogChartMapPolarData *parms;
GogViewAllocation const *area;
@@ -440,6 +673,7 @@
double th0, theta_min, theta_max, theta = 0;
double rho_min, rho_max, rho;
gboolean const is_polar = GOG_IS_PLOT_POLAR (model);
+ gboolean is_map = GOG_IS_PLOT_COLOR_POLAR (model), hide_outliers = TRUE;
r_axis = GOG_PLOT (model)->axis[GOG_AXIS_RADIAL];
c_axis = GOG_PLOT (model)->axis[GOG_AXIS_CIRCULAR];
@@ -455,6 +689,11 @@
r_map = gog_chart_map_get_axis_map (chart_map, 1);
parms = gog_chart_map_get_polar_parms (chart_map);
+ if (is_map) {
+ z_map = gog_axis_map_new (GOG_PLOT (model)->axis[GOG_AXIS_COLOR], 0, 6);
+ hide_outliers = GOG_COLOR_POLAR_PLOT (model)->hide_outliers;
+ }
+
gog_axis_map_get_bounds (c_map, &theta_min, &theta_max);
th0 = theta_min;
gog_axis_map_get_bounds (r_map, &rho_min, &rho_max);
@@ -471,11 +710,11 @@
for (ptr = model->base.series; ptr != NULL; ptr = ptr->next) {
GogRTSeries *series = GOG_RT_SERIES (ptr->data);
- GogStyle *style;
+ GogStyle *style, *color_style = NULL;
GOPath *path;
unsigned count;
- double *r_vals, *c_vals;
- double x, y;
+ double *r_vals, *c_vals, *z_vals = NULL;
+ double x, y, z = 0;
if (!gog_series_is_valid (GOG_SERIES (series)))
continue;
@@ -486,6 +725,10 @@
r_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[1].data));
c_vals = is_polar ? go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[0].data)) : NULL;
+ if (is_map) {
+ z_vals = go_data_vector_get_values (GO_DATA_VECTOR (series->base.values[2].data));
+ color_style = gog_style_dup (style);
+ }
if (is_polar) {
GOPath *clip_path;
@@ -585,6 +828,11 @@
for (count = 0; count < series->base.num_elements; count++) {
rho = (!is_polar || (go_add_epsilon (r_vals[count] - rho_min) >= 0.0)) ?
r_vals[count] : rho_min;
+ if (is_map) {
+ z = *z_vals++;
+ if (isnan (z) || !go_finite (z))
+ continue;
+ }
gog_chart_map_2D_to_view (chart_map,
is_polar ? c_vals[count] : count + 1, rho,
&x, &y);
@@ -597,14 +845,29 @@
go_add_epsilon ((theta_max - theta_min)
- fmod (theta_max - theta, 2 * M_PI)) >= 0.0 &&
go_add_epsilon ((theta_max - theta_min)
- - fmod (theta - theta_min, 2 * M_PI)) >= 0.0))
- gog_renderer_draw_marker (view->renderer, x, y);
+ - fmod (theta - theta_min, 2 * M_PI)) >= 0.0)) {
+ if (is_map) {
+ GOColor color = (gog_axis_map_finite (z_map, z))?
+ get_map_color (gog_axis_map_to_view (z_map, z), hide_outliers):
+ 0;
+ go_marker_set_fill_color (color_style->marker.mark, color);
+ go_marker_set_outline_color (color_style->marker.mark, color);
+ gog_renderer_push_style (view->renderer, color_style);
+ gog_renderer_draw_marker (view->renderer, x, y);
+ gog_renderer_pop_style (view->renderer);
+ } else
+ gog_renderer_draw_marker (view->renderer, x, y);
+ }
}
}
gog_renderer_pop_style (view->renderer);
+ if (is_map)
+ g_object_unref (color_style);
}
gog_chart_map_free (chart_map);
+ if (is_map)
+ gog_axis_map_free (z_map);
if (next_path != NULL)
go_path_free (next_path);
@@ -736,6 +999,8 @@
gog_rt_series_class_init, gog_rt_series_init,
GOG_SERIES_TYPE)
+/*****************************************************************************/
+
static void
gog_polar_series_class_init (GogObjectClass *gog_klass)
{
@@ -758,6 +1023,49 @@
gog_polar_series_class_init, NULL,
GOG_RT_SERIES_TYPE)
+/*****************************************************************************/
+
+static void
+gog_color_polar_series_init_style (GogStyledObject *gso, GogStyle *style)
+{
+ series_parent_klass->init_style (gso, style);
+ style->fill.type = GOG_FILL_STYLE_NONE;
+ if (style->line.auto_dash)
+ style->line.dash_type = GO_LINE_NONE;
+}
+
+static void
+gog_color_polar_series_update (GogObject *obj)
+{
+ const double *a_vals, *r_vals, *z_vals = NULL;
+ GogRTSeries *series = GOG_RT_SERIES (obj);
+ unsigned old_num = series->base.num_elements;
+
+ series->base.num_elements = gog_series_get_xyz_data (GOG_SERIES (series),
+ &a_vals, &r_vals, &z_vals);
+
+ /* queue plot for redraw */
+ gog_object_request_update (GOG_OBJECT (series->base.plot));
+ if (old_num != series->base.num_elements)
+ gog_plot_request_cardinality_update (series->base.plot);
+
+ if (series_parent_klass->base.update)
+ series_parent_klass->base.update (obj); /* do not call gog_rt_series_update */
+}
+
+static void
+gog_color_polar_series_class_init (GogObjectClass *gog_klass)
+{
+ GogStyledObjectClass *gso_klass = (GogStyledObjectClass *) gog_klass;
+
+ gog_klass->update = gog_color_polar_series_update;
+ gso_klass->init_style = gog_color_polar_series_init_style;
+}
+
+GSF_DYNAMIC_CLASS (GogColorPolarSeries, gog_color_polar_series,
+ gog_color_polar_series_class_init, NULL,
+ GOG_RT_SERIES_TYPE)
+
G_MODULE_EXPORT void
go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
{
@@ -766,9 +1074,11 @@
gog_radar_plot_register_type (module);
gog_radar_area_plot_register_type (module);
gog_polar_plot_register_type (module);
+ gog_color_polar_plot_register_type (module);
gog_rt_view_register_type (module);
gog_rt_series_register_type (module);
gog_polar_series_register_type (module);
+ gog_color_polar_series_register_type (module);
}
G_MODULE_EXPORT void
Modified: trunk/plugins/plot_radar/gog-radar.h
==============================================================================
--- trunk/plugins/plot_radar/gog-radar.h (original)
+++ trunk/plugins/plot_radar/gog-radar.h Fri Mar 27 13:53:37 2009
@@ -40,6 +40,14 @@
typedef GogRTPlot GogPolarPlot;
+typedef struct {
+ GogPolarPlot base;
+ struct {
+ double minima, maxima;
+ } z;
+ gboolean hide_outliers;
+} GogColorPolarPlot;
+
#define GOG_RT_PLOT_TYPE (gog_rt_plot_get_type ())
#define GOG_RT_PLOT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_RT_PLOT_TYPE, GogRTPlot))
#define GOG_IS_PLOT_RT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_RT_PLOT_TYPE))
@@ -58,6 +66,12 @@
GType gog_polar_plot_get_type (void);
+#define GOG_COLOR_POLAR_PLOT_TYPE (gog_color_polar_plot_get_type ())
+#define GOG_COLOR_POLAR_PLOT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_COLOR_POLAR_PLOT_TYPE, GogColorPolarPlot))
+#define GOG_IS_PLOT_COLOR_POLAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_COLOR_POLAR_PLOT_TYPE))
+
+GType gog_color_polar_plot_get_type (void);
+
G_END_DECLS
#endif /* GOG_RADAR_H */
Modified: trunk/plugins/plot_radar/plot-types.xml.in
==============================================================================
--- trunk/plugins/plot_radar/plot-types.xml.in (original)
+++ trunk/plugins/plot_radar/plot-types.xml.in Fri Mar 27 13:53:37 2009
@@ -29,4 +29,10 @@
sample_image_file="chart_polar_1_1.png">
<property name="guru-hints">major-grid;backplane</property>
</Type>
+ <Type _name="Colored Polar" row="2" col="1"
+ engine="GogColorPolarPlot" family="Polar"
+ _description="Polar plot with colored marks."
+ sample_image_file="chart_color_polar_1_1.png">
+ <property name="guru-hints">major-grid;backplane</property>
+ </Type>
</Types>
Modified: trunk/plugins/plot_radar/plugin.xml.in
==============================================================================
--- trunk/plugins/plot_radar/plugin.xml.in (original)
+++ trunk/plugins/plot_radar/plugin.xml.in Fri Mar 27 13:53:37 2009
@@ -23,6 +23,11 @@
<_description>Polar plotting engine</_description>
</information>
</service>
+ <service type="plot_engine" id="GogColorPolarPlot">
+ <information>
+ <_description>Polar plotting engine with coloured marks</_description>
+ </information>
+ </service>
<service type="plot_type" id="radar">
<file>plot-types.xml</file>
<information>
Modified: trunk/plugins/plot_xy/gog-xy.c
==============================================================================
--- trunk/plugins/plot_xy/gog-xy.c (original)
+++ trunk/plugins/plot_xy/gog-xy.c Fri Mar 27 13:53:37 2009
@@ -698,6 +698,7 @@
G_CALLBACK (hide_outliers_toggled_cb), obj);
w = glade_xml_get_widget (gui, "gog-xy-color-prefs");
gog_editor_add_page (editor, w, _("Properties"));
+ g_object_unref (gui);
}
#endif
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Fri Mar 27 13:53:37 2009
@@ -200,7 +200,7 @@
goffice/ms-compat/go-ms-parser.h
goffice/ms-compat/god-drawing-ms-client-handler.c
goffice/ms-compat/god-drawing-ms-client-handler.h
-goffice/ms-compat/god-drawing-ms.c
+goffice/ms-compat/god-drawing-chart_color_polar_1_1.*ms.c
goffice/ms-compat/god-drawing-ms.h
goffice/ms-compat/god-image-ms.c
goffice/ms-compat/god-image-ms.h
@@ -229,7 +229,7 @@
goffice/utils/go-locale.h
goffice/utils/go-marker.c
goffice/utils/go-marker.h
-goffice/utils/go-pattern.c
+goffice/utils/go-pattern.cchart_color_polar_1_1.*
goffice/utils/go-pattern.h
goffice/utils/go-units.h
goffice/utils/goffice-utils.h
@@ -266,6 +266,7 @@
plugins/plot_pie/plugin.xml.in
plugins/plot_radar/gog-radar.c
plugins/plot_radar/gog-radar.h
+plugins/plot_xy/gog-color-polar-prefs.xml
plugins/plot_radar/plot-types.xml.in
plugins/plot_radar/plugin.xml.in
plugins/plot_surface/gog-contour.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]