Commit 619a5d91 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Some cut-n-paste for the without_gnome case


2004-02-21  Jody Goldberg <jody@gnome.org>

	* utils/go-locale.c : Some cut-n-paste for the without_gnome case

	* gui-utils/go-action-combo-text.c : some initial implementation

	* graph/plugins/plot_pie/gog-pie.c (gog_pie_plot_foreach_elem) :
	  handle mismatched numbers of elements and labels.
	(gog_pie_view_render) : take the outline into account when sizing.

	* graph/gog-style.h : add weak notion of centered image.  This needs
	  to be stronger to specify alignement.

	* graph/gog-style.c (gog_style_set_fill_image_filename) : new.
	(cb_image_file_select) : Use it.

	* graph/gog-renderer-pixbuf.c (gog_renderer_pixbuf_draw_polygon) :
	supported centered images.

	* graph/gog-renderer-gnome-print.c
	(gog_renderer_gnome_print_draw_polygon) : support centered images.

	* graph/gog-object.c (gog_object_get_children) : add a filter parm.
	(gog_object_get_child_by_role) : new utility routine.

	* graph/gog-legend.c (gog_legend_update) : set up the editor properly
	  for fonts.

	* graph/gog-graph.c (gog_graph_view_size_allocate) : typo.  Only
	  effected manually created plots

	* graph/gog-control-foocanvas.c (gog_control_foocanvas_draw) : make
	  more resistent to out of memory situations.

	* graph/go-data-simple.c : Add some quick and dirty constant vectors
	  for double [], and char const *[].  These could certainly be more
	  robust.

	From Michael Devine <mdevine@cs.stanford.edu> :
	* graph/goffice-graph.h : Add a first pass at 'radar' plots
	* graph/gog-axis.c : ditto.
	* goffice/graph/gog-chart.c : ditto

2004-02-21  Jody Goldberg <jody@gnome.org>

	* ms-excel-util.c (two_way_table_new) : store the destroy func.
	(two_way_table_put) : patch leak and use the destroy func on things
	  that are already in the table.

	* ms-chart.c (BC_R(radar)) : connect the new engine
	(BC_R(radararea)) : ditto.

2004-02-21  Jody Goldberg <jody@gnome.org>

	* dialog-stf-export.c : Major reorg to remove the gnomedruid, and
	  GtkCLists

	* dialog-about.c : rewrite.  Not so pretty, but getting better.  It's
	  a decent test case for the an api to create a plot.


2004-02-21  Jody Goldberg <jody@gnome.org>

	http://bugzilla.gnome.org/show_bug.cgi?id=134627
	* src/workbook-view.c (wb_view_selection_desc) : Display name of edit
	  position after releasing Shift key, not the top left

	* src/workbook-control-gui.c (cb_wbcg_drag_data_received) : disable
	  the gnome-vfs portions.  They did not work anyway.  We can probably
	  just #ifdef it in the future, I can't see an easy way to put that into
	  a plugin.

	* src/wbc-gtk.c (cb_font_name_changed) : quick and dirty enabling.
	(cb_font_size_changed) : ditto.

	* src/stf.c (stf_write_workbook) : remove the pointless wrapping of a
	  pointer and just return the result directly.

	http://bugzilla.gnome.org/show_bug.cgi?id=97216
	* src/sheet-control-gui.c (scg_mode_create_object) : Go back to the
	  primary sheet when creating an object

	http://bugzilla.gnome.org/show_bug.cgi?id=131588
	* src/rangefunc.c (range_sum) : use long double if it is available

	* src/mstyle.c (mstyle_new_default) : remove the gconf usage it did
	  not belong here.
	* src/style.c (font_init) : ditto.

	* src/normal-args.c : deleted. content moved

	* src/main-application.c : Move the arg handling into here, and #ifdef
	  it rather than using external files.  It makes it easier to read.
	  For the non gnome case we need to manually add gtk deps.  Now that
	  we're not so dependent on gnome we can do more magic and move to a
	  more abi-style approach with --convert and abi-commands in place of
	  ssconvert

	* src/libgnumeric.h : drop the arg handler stubs

	* src/libgnumeric.c (gnm_shutdown) : gconf shutdown is handled
	  internally now.

	* src/hlink.c (gnm_hlink_url_activate) : conditionalize gnome depend.

	* src/gutils.c (gnumeric_sys_data_dir) : Use g_build_path, just to be
	  pedantic.
	(gnumeric_sys_lib_dir) : ditto.

	* src/gui-util.c (gnumeric_dialog_run) : Don't destroy the dialog
	  until a stock response comes in (useful for druids)
	(gnumeric_help_display) : conditionalize gnome.
	(gnumeric_icondir) : new.
	(gnumeric_load_image) : use it.
	(gnumeric_load_pixbuf) : use it.

	* src/gnumeric-gconf.c (gnm_app_get_gconf_client) : moved to here.
	(gnm_conf_init_essential) : handle the font stuff here.

	* src/gnumeric-gconf-priv.h : Clean up the default font keys and move
	  them here.

	* src/application.c : remove the gconf_client
	(gnm_app_get_gconf_client) : move for now.
	(gnm_app_release_gconf_client) : delete.

	* src/Makefile.am : Further down the path of making gnome optional

	* icons/Makefile.am : Add the new about box image, dunno where/how to
	  use it yet.

	* configure.in : corba is dependent on gnome for now.
	  Move libgnome* into the gnome specific libs
	  Add the new radar plot engine

	* src/wbc-gtk.c (cb_show_menu_tip) : fix leak.
parent 39dfa2e5
......@@ -56,7 +56,7 @@ plot_icon_DATA = \
radar.xpm \
scatter.xpm \
stock.xpm \
surface.xpm
surface.xpm \
gnumeric-about.png
EXTRA_DIST = $(icons_DATA) $(plot_icon_DATA)
2004-02-21 Jody Goldberg <jody@gnome.org>
* ms-excel-util.c (two_way_table_new) : store the destroy func.
(two_way_table_put) : patch leak and use the destroy func on things
that are already in the table.
* ms-chart.c (BC_R(radar)) : connect the new engine
(BC_R(radararea)) : ditto.
2004-02-09 Morten Welinder <terra@gnome.org>
* ms-biff.c (ms_biff_query_next): Change to return gboolean and
......
......@@ -1238,7 +1238,7 @@ BC_R(radar)(XLChartHandler const *handle,
XLChartReadState *s, BiffQuery *q)
{
g_return_val_if_fail (s->plot == NULL, TRUE);
s->plot = gog_plot_new_by_name ("GogRadialPlot UNIMPLEMENTED");
s->plot = gog_plot_new_by_name ("GogRadarPlot");
return FALSE;
}
......@@ -1250,7 +1250,8 @@ BC_R(radararea)(XLChartHandler const *handle,
XLChartReadState *s, BiffQuery *q)
{
g_return_val_if_fail (s->plot == NULL, TRUE);
s->plot = gog_plot_new_by_name ("GogFilledRadialPlot UNIMPLEMENTED");
s->plot = gog_plot_new_by_name ("GogRadarPlot");
#warning filled
return FALSE;
}
......
......@@ -71,6 +71,7 @@ two_way_table_new (GHashFunc hash_func,
table->unique_keys = g_hash_table_new (hash_func, key_compare_func);
table->idx_to_key = g_ptr_array_new ();
table->base = base;
table->key_destroy_func = key_destroy_func;
return table;
}
......@@ -125,7 +126,8 @@ two_way_table_put (const TwoWayTable *table, gpointer key,
GINT_TO_POINTER (index + 1));
g_hash_table_insert (table->unique_keys, key,
GINT_TO_POINTER (index + 1));
}
} else if (table->key_destroy_func)
(table->key_destroy_func) (key);
g_ptr_array_add (table->idx_to_key, key);
}
......
......@@ -20,6 +20,7 @@ struct _TwoWayTable {
GHashTable *unique_keys;
GPtrArray *idx_to_key;
gint base; /* Indices assigned consecutively from base */
GDestroyNotify key_destroy_func;
};
typedef void (*AfterPutFunc) (gconstpointer key,
......
2004-02-21 Jody Goldberg <jody@gnome.org>
* POTFILES.in : remove some deleted files
2004-02-17 Yukihiro Nakai <nakai@gnome.gr.jp>
* ja.po: Update Japanese translation.
......
......@@ -212,8 +212,6 @@ src/dialogs/dialog-shuffle.c
src/dialogs/dialog-simulation.c
src/dialogs/dialog-solver.c
src/dialogs/dialog-stf-csv-page.c
src/dialogs/dialog-stf-export-format-page.c
src/dialogs/dialog-stf-export-sheet-page.c
src/dialogs/dialog-stf-export.c
src/dialogs/dialog-stf-export.glade
src/dialogs/dialog-stf-fixed-page.c
......@@ -350,7 +348,6 @@ src/widgets/gnumeric-cell-renderer-text.c
src/widgets/gnumeric-cell-renderer-toggle.c
src/widgets/gnumeric-expr-entry.c
src/widgets/gnumeric-optionmenu.c
src/widgets/preview-file-selection.c
src/widgets/widget-charmap-selector.c
src/widgets/widget-font-selector.c
src/widgets/widget-format-selector.c
......
......@@ -97,9 +97,6 @@ GNUMERIC_BASE = \
gnumeric-simple-canvas.h \
gnumeric-canvas.c \
gnumeric-canvas.h \
gnumeric-gconf.c \
gnumeric-gconf.h \
gnumeric-gconf-priv.h \
gnumeric-pane.c \
gnumeric-pane.h \
gnumeric.h \
......@@ -269,9 +266,12 @@ GNUMERIC_BASE = \
xml-io.h \
xml-io-version.h \
xml-io-autoft.c \
xml-io-autoft.h
xml-io-autoft.h \
gnumeric-gconf.c \
gnumeric-gconf.h \
gnumeric-gconf-priv.h
GNUMERIC_BONOBO = \
GNUMERIC_GNOME = \
bonobo-io.c \
bonobo-io.h \
sheet-object-bonobo.c \
......@@ -291,8 +291,7 @@ gnumeric_SOURCES = \
$(GNUMERIC_SOURCE) \
io-context-gtk.c \
io-context-gtk.h \
main-application.c \
normal-args.c
main-application.c
gnumeric_LDADD = \
$(gnumeric_app_libs) \
......@@ -369,7 +368,7 @@ EXTRA_DIST = GNOME_Gnumeric-gtk.xml \
gnm-marshalers.list \
main-application.c normal-args.c \
main-component.c \
$(GNUMERIC_BONOBO) README.gnm_float \
$(GNUMERIC_GNOME) README.gnm_float \
gnumeric-paths.sh.in ssconvert.c
#number_match_SOURCES = number-match.c formats.c dates.c number-match-test.c
......
......@@ -59,7 +59,6 @@ struct _GnmApp {
GSList *history_list;
/* Others */
GConfClient *gconf_client;
GtkWidget *pref_dialog;
GList *workbook_list;
......@@ -487,31 +486,6 @@ void gnm_app_set_transition_keys (gboolean state)
((GnmAppPrefs *)gnm_app_prefs)->transition_keys = state;
}
GConfClient *
gnm_app_get_gconf_client (void)
{
g_return_val_if_fail (app != NULL, NULL);
if (!app->gconf_client) {
app->gconf_client = gconf_client_get_default ();
gconf_client_add_dir (app->gconf_client, "/apps/gnumeric",
GCONF_CLIENT_PRELOAD_RECURSIVE,
NULL);
}
return app->gconf_client;
}
void
gnm_app_release_gconf_client (void)
{
g_return_if_fail (app != NULL);
if (app->gconf_client) {
gconf_client_remove_dir (app->gconf_client,
"/apps/gnumeric", NULL);
g_object_unref (G_OBJECT (app->gconf_client));
}
app->gconf_client = NULL;
}
/*
* Get a named pixbuf.
*/
......@@ -791,8 +765,6 @@ gnm_app_init (GObject *obj)
gnm_app->clipboard_copied_contents = NULL;
gnm_app->clipboard_sheet_view = NULL;
gnm_app->gconf_client = NULL;
gnm_app->workbook_list = NULL;
gnm_app->named_pixbufs = g_hash_table_new_full (g_str_hash, g_str_equal,
......
......@@ -2,7 +2,6 @@
#define GNUMERIC_APPLICATION_H
#include "gnumeric.h"
#include <gconf/gconf-client.h>
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
......@@ -32,8 +31,6 @@ gboolean gnm_app_live_scrolling (void);
int gnm_app_auto_expr_recalc_lag (void);
/* stuff that should move */
void gnm_app_release_gconf_client (void);
GConfClient *gnm_app_get_gconf_client (void);
GdkPixbuf *gnm_app_get_pixbuf (char const *name);
void gnm_app_release_pref_dialog (void);
gpointer gnm_app_get_pref_dialog (void);
......
2004-02-21 Jody Goldberg <jody@gnome.org>
* utils/go-locale.c : Some cut-n-paste for the without_gnome case
* gui-utils/go-action-combo-text.c : some initial implementation
* graph/plugins/plot_pie/gog-pie.c (gog_pie_plot_foreach_elem) :
handle mismatched numbers of elements and labels.
(gog_pie_view_render) : take the outline into account when sizing.
* graph/gog-style.h : add weak notion of centered image. This needs
to be stronger to specify alignement.
* graph/gog-style.c (gog_style_set_fill_image_filename) : new.
(cb_image_file_select) : Use it.
* graph/gog-renderer-pixbuf.c (gog_renderer_pixbuf_draw_polygon) :
supported centered images.
* graph/gog-renderer-gnome-print.c
(gog_renderer_gnome_print_draw_polygon) : support centered images.
* graph/gog-object.c (gog_object_get_children) : add a filter parm.
(gog_object_get_child_by_role) : new utility routine.
* graph/gog-legend.c (gog_legend_update) : set up the editor properly
for fonts.
* graph/gog-graph.c (gog_graph_view_size_allocate) : typo. Only
effected manually created plots
* graph/gog-control-foocanvas.c (gog_control_foocanvas_draw) : make
more resistent to out of memory situations.
* graph/go-data-simple.c : Add some quick and dirty constant vectors
for double [], and char const *[]. These could certainly be more
robust.
From Michael Devine <mdevine@cs.stanford.edu> :
* graph/goffice-graph.h : Add a first pass at 'radar' plots
* graph/gog-axis.c : ditto.
* goffice/graph/gog-chart.c : ditto
2004-02-13 Morten Welinder <terra@gnome.org>
* graph/gog-style.c (gog_style_extension_editor): Fix declaration
......
......@@ -51,9 +51,6 @@ typedef struct {
void (*changed) (GOData *dat);
} GODataClass;
/* protected */
void go_data_emit_changed (GOData *dat);
struct _GODataScalar {
GOData base;
};
......
......@@ -3,7 +3,7 @@
/*
* go-data-simple.c :
*
* Copyright (C) 2003 Jody Goldberg (jody@gnome.org)
* Copyright (C) 2003-2004 Jody Goldberg (jody@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
......@@ -69,7 +69,7 @@ go_data_scalar_val_eq (GOData const *a, GOData const *b)
GODataScalarVal const *sval_a = (GODataScalarVal const *)a;
GODataScalarVal const *sval_b = (GODataScalarVal const *)b;
/* GOData::eq is used for identity, not arithamtic */
/* GOData::eq is used for identity, not arithmetic */
return sval_a->val == sval_b->val;
}
......@@ -201,6 +201,7 @@ go_data_scalar_str_from_str (GOData *dat, char const *string)
if (str->needs_free)
g_free ((char *)str->str);
str->str = g_strdup (string);
str->needs_free = TRUE;
return TRUE;
}
......@@ -253,3 +254,223 @@ go_data_scalar_str_new (char const *str, gboolean needs_free)
res->needs_free = needs_free;
return GO_DATA (res);
}
void
go_data_scalar_str_set_str (GODataScalarStr *str,
char const *text, gboolean needs_free)
{
if (str->str == text)
return;
if (str->needs_free)
g_free ((char *)str->str);
str->str = text;
str->needs_free = needs_free;
go_data_emit_changed (GO_DATA (str));
}
/*****************************************************************************/
struct _GODataVectorVal {
GODataVector base;
unsigned n;
double const *val;
};
typedef GODataVectorClass GODataVectorValClass;
static GObjectClass *vector_val_parent_klass;
static void
go_data_vector_val_finalize (GObject *obj)
{
/* GODataVectorVal *val = (GODataVectorVal *)obj; */
if (vector_val_parent_klass->finalize)
(*vector_val_parent_klass->finalize) (obj);
}
static GOData *
go_data_vector_val_dup (GOData const *src)
{
GODataVectorVal *dst = g_object_new (G_OBJECT_TYPE (src), NULL);
GODataVectorVal const *src_val = (GODataVectorVal const *)src;
dst->val = src_val->val;
dst->n = src_val->n;
return GO_DATA (dst);
}
static gboolean
go_data_vector_val_eq (GOData const *a, GOData const *b)
{
GODataVectorVal const *val_a = (GODataVectorVal const *)a;
GODataVectorVal const *val_b = (GODataVectorVal const *)b;
/* GOData::eq is used for identity, not arithmetic */
return val_a->val == val_b->val && val_a->n == val_b->n;
}
static void
go_data_vector_val_load_len (GODataVector *vec)
{
vec->base.flags |= GO_DATA_VECTOR_LEN_CACHED;
vec->len = ((GODataVectorVal *)vec)->n;
}
static void
go_data_vector_val_load_values (GODataVector *vec)
{
GODataVectorVal const *val = (GODataVectorVal const *)vec;
double minimum = DBL_MAX, maximum = -DBL_MAX;
int i = val->n;
vec->values = (double *)val->val;
while (i-- > 0) {
if (minimum > val->val[i])
minimum = val->val[i];
if (maximum < val->val[i])
maximum = val->val[i];
}
vec->minimum = minimum;
vec->maximum = maximum;
vec->base.flags |= GO_DATA_CACHE_IS_VALID;
}
static double
go_data_vector_val_get_value (GODataVector *vec, unsigned i)
{
return vec->values[i];
}
static char *
go_data_vector_val_get_str (GODataVector *vec, unsigned i)
{
return g_strdup_printf ("%g", vec->values[i]);
}
static void
go_data_vector_val_class_init (GObjectClass *gobject_klass)
{
GODataClass *godata_klass = (GODataClass *) gobject_klass;
GODataVectorClass *vector_klass = (GODataVectorClass *) gobject_klass;
vector_val_parent_klass = g_type_class_peek_parent (gobject_klass);
gobject_klass->finalize = go_data_vector_val_finalize;
godata_klass->dup = go_data_vector_val_dup;
godata_klass->eq = go_data_vector_val_eq;
godata_klass->as_str = NULL;
godata_klass->from_str = NULL;
vector_klass->load_len = go_data_vector_val_load_len;
vector_klass->load_values = go_data_vector_val_load_values;
vector_klass->get_value = go_data_vector_val_get_value;
vector_klass->get_str = go_data_vector_val_get_str;
}
GSF_CLASS (GODataVectorVal, go_data_vector_val,
go_data_vector_val_class_init, NULL,
GO_DATA_VECTOR_TYPE)
GOData *
go_data_vector_val_new (double const *val, unsigned n)
{
GODataVectorVal *res = g_object_new (GO_DATA_VECTOR_VAL_TYPE, NULL);
res->val = val;
res->n = n;
return GO_DATA (res);
}
/*****************************************************************************/
struct _GODataVectorStr {
GODataVector base;
char const * const *str;
unsigned n;
};
typedef GODataVectorClass GODataVectorStrClass;
static GObjectClass *vector_str_parent_klass;
static void
go_data_vector_str_finalize (GObject *obj)
{
/* GODataVectorStr *str = (GODataVectorStr *)obj; */
if (vector_str_parent_klass->finalize)
(*vector_str_parent_klass->finalize) (obj);
}
static GOData *
go_data_vector_str_dup (GOData const *src)
{
GODataVectorStr *dst = g_object_new (G_OBJECT_TYPE (src), NULL);
GODataVectorStr const *src_val = (GODataVectorStr const *)src;
dst->n = src_val->n;
dst->str = src_val->str;
return GO_DATA (dst);
}
static gboolean
go_data_vector_str_eq (GOData const *a, GOData const *b)
{
GODataVectorStr const *str_a = (GODataVectorStr const *)a;
GODataVectorStr const *str_b = (GODataVectorStr const *)b;
return str_a->str == str_b->str && str_a->n == str_b->n;
}
static void
go_data_vector_str_load_len (GODataVector *vec)
{
vec->base.flags |= GO_DATA_VECTOR_LEN_CACHED;
vec->len = ((GODataVectorStr *)vec)->n;
}
static void
go_data_vector_str_load_values (GODataVector *vec)
{
}
static double
go_data_vector_str_get_value (GODataVector *vec, unsigned i)
{
return gnm_nan;
}
static char *
go_data_vector_str_get_str (GODataVector *vec, unsigned i)
{
GODataVectorStr *strs = (GODataVectorStr *)vec;
return g_strdup (strs->str[i]);
}
static void
go_data_vector_str_class_init (GObjectClass *gobject_klass)
{
GODataClass *godata_klass = (GODataClass *) gobject_klass;
GODataVectorClass *vector_klass = (GODataVectorClass *) gobject_klass;
vector_str_parent_klass = g_type_class_peek_parent (gobject_klass);
gobject_klass->finalize = go_data_vector_str_finalize;
godata_klass->dup = go_data_vector_str_dup;
godata_klass->eq = go_data_vector_str_eq;
godata_klass->as_str = NULL;
godata_klass->from_str = NULL;
vector_klass->load_len = go_data_vector_str_load_len;
vector_klass->load_values = go_data_vector_str_load_values;
vector_klass->get_value = go_data_vector_str_get_value;
vector_klass->get_str = go_data_vector_str_get_str;
}
static void
go_data_vector_str_init (GObject *obj)
{
GODataVectorStr *str = (GODataVectorStr *)obj;
str->str = NULL;
str->n = 0;
}
GSF_CLASS (GODataVectorStr, go_data_vector_str,
go_data_vector_str_class_init, go_data_vector_str_init,
GO_DATA_VECTOR_TYPE)
GOData *
go_data_vector_str_new (char const * const *str, unsigned n)
{
GODataVectorStr *res = g_object_new (GO_DATA_VECTOR_STR_TYPE, NULL);
res->str = str;
res->n = n;
return GO_DATA (res);
}
......@@ -38,6 +38,24 @@ GOData *go_data_scalar_val_new (double val);
typedef struct _GODataScalarStr GODataScalarStr;
GType go_data_scalar_str_get_type (void);
GOData *go_data_scalar_str_new (char const *str, gboolean needs_free);
GOData *go_data_scalar_str_new (char const *text, gboolean needs_free);
void go_data_scalar_str_set_str (GODataScalarStr *str,
char const *text, gboolean needs_free);
#define GO_DATA_VECTOR_VAL_TYPE (go_data_vector_val_get_type ())
#define GO_DATA_VECTOR_VAL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_DATA_VECTOR_VAL_TYPE, GODataVectorVal))
#define IS_GO_DATA_VECTOR_VAL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_DATA_VECTOR_VAL_TYPE))
typedef struct _GODataVectorVal GODataVectorVal;
GType go_data_vector_val_get_type (void);
GOData *go_data_vector_val_new (double const *val, unsigned n);
#define GO_DATA_VECTOR_STR_TYPE (go_data_vector_str_get_type ())
#define GO_DATA_VECTOR_STR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_DATA_VECTOR_STR_TYPE, GODataVectorStr))
#define IS_GO_DATA_VECTOR_STR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_DATA_VECTOR_STR_TYPE))
typedef struct _GODataVectorStr GODataVectorStr;
GType go_data_vector_str_get_type (void);
GOData *go_data_vector_str_new (char const * const *str, unsigned n);
#endif /* GO_DATA_SIMPLE_H */
......@@ -38,6 +38,7 @@ gboolean go_data_eq (GOData const *a, GOData const *b);
GOFormat *go_data_preferred_fmt (GOData const *dat);
char *go_data_as_str (GOData const *dat);
gboolean go_data_from_str (GOData *dat, char const *str);
void go_data_emit_changed (GOData *dat);
/*************************************************************************/
......
......@@ -78,6 +78,8 @@ typedef enum {
GOG_AXIS_X = 0,
GOG_AXIS_Y,
GOG_AXIS_Z,
GOG_AXIS_CIRCULAR,
GOG_AXIS_RADIAL,
GOG_AXIS_TYPES,
GOG_AXIS_PSEUDO_3D
} GogAxisType;
......@@ -87,6 +89,7 @@ typedef enum {
GOG_AXIS_SET_XY = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y),
GOG_AXIS_SET_XY_pseudo_3d = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y) | (1 << GOG_AXIS_PSEUDO_3D),
GOG_AXIS_SET_XYZ = (1 << GOG_AXIS_X) | (1 << GOG_AXIS_Y) | (1 << GOG_AXIS_Z),
GOG_AXIS_SET_RADAR = (1 << GOG_AXIS_CIRCULAR) | (1 << GOG_AXIS_RADIAL),
GOG_AXIS_SET_ALL = ((1 << GOG_AXIS_TYPES) -1)
} GogAxisSet;
......
......@@ -1321,6 +1321,8 @@ gog_axis_view_render (GogView *v, GogViewAllocation const *bbox)
bound = label_pos.x + label_result.w;
}
}
if (line_width > 0)
gog_renderer_draw_path (v->renderer, axis_path, NULL);
break;
case GOG_AXIS_Y:
......@@ -1409,13 +1411,41 @@ gog_axis_view_render (GogView *v, GogViewAllocation const *bbox)
bound = label_pos.y - label_result.h;
}
}
if (line_width > 0)
gog_renderer_draw_path (v->renderer, axis_path, NULL);
break;
case GOG_AXIS_CIRCULAR:
{
ArtVpath path[3];
double center_x, center_y, radius;
unsigned i;
path[0].code = ART_MOVETO;
path[1].code = ART_LINETO;
path[2].code = ART_END;
center_x = area->x + (area->w/2);
center_y = area->y + (area->h/2);
radius = v->allocation.h > v->allocation.w
? v->allocation.w / 2.0
: v->allocation.h / 2.0;
path[0].x = center_x;
path[0].y = center_y;
for (i = 0; i < n-1; i++) {
double angle_rad = i * 2.0 * M_PI/(n-1);
path[1].x = center_x + radius * sin(angle_rad);
path[1].y = center_y - radius * cos(angle_rad);
gog_renderer_draw_path (v->renderer, path,
NULL);
}
}
break;
default :
break;
}
if (line_width > 0)
gog_renderer_draw_path (v->renderer, axis_path, NULL);
gog_renderer_pop_style (v->renderer);
}
......
......@@ -178,6 +178,10 @@ static gboolean y_axis_can_add (GogObject const *parent) { return axis_can_add (
static void y_axis_post_add (GogObject *parent, GogObject *child) { axis_post_add (child, GOG_AXIS_Y); }
static gboolean z_axis_can_add (GogObject const *parent) { return axis_can_add (parent, GOG_AXIS_Z); }
static void z_axis_post_add (GogObject *parent, GogObject *child) { axis_post_add (child, GOG_AXIS_Z); }
static gboolean circular_axis_can_add (GogObject const *parent) { return axis_can_add (parent, GOG_AXIS_CIRCULAR); }
static void circular_axis_post_add (GogObject *parent, GogObject *child) { axis_post_add (child, GOG_AXIS_CIRCULAR); }
static gboolean radial_axis_can_add (GogObject const *parent) { return axis_can_add (parent, GOG_AXIS_RADIAL); }
static void radial_axis_post_add (GogObject *parent, GogObject *child) { axis_post_add (child, GOG_AXIS_RADIAL); }
static GogObjectRole const roles[] = {
{ N_("Legend"), "GogLegend", 0,
......@@ -201,6 +205,14 @@ static GogObjectRole const roles[] = {
GOG_POSITION_SPECIAL, GOG_POSITION_SPECIAL, GOG_OBJECT_NAME_BY_ROLE,
z_axis_can_add, axis_can_remove, NULL, z_axis_post_add, axis_pre_remove, NULL,
{ GOG_AXIS_Z } },
{ N_("Circular-Axis"), "GogAxis", 1,
GOG_POSITION_SPECIAL, GOG_POSITION_SPECIAL, GOG_OBJECT_NAME_BY_ROLE,
circular_axis_can_add, axis_can_remove, NULL, circular_axis_post_add, axis_pre_remove, NULL,
{ GOG_AXIS_CIRCULAR } },
{ N_("Radial-Axis"), "GogAxis", 2,
GOG_POSITION_SPECIAL, GOG_POSITION_SPECIAL, GOG_OBJECT_NAME_BY_ROLE,
radial_axis_can_add, axis_can_remove, NULL, radial_axis_post_add, axis_pre_remove, NULL,
{ GOG_AXIS_RADIAL } },
{ N_("Plot"), "GogPlot", 4, /* keep the axis before the plots */
GOG_POSITION_SPECIAL, GOG_POSITION_SPECIAL, GOG_OBJECT_NAME_BY_TYPE,
NULL, NULL, NULL, role_plot_post_add, role_plot_pre_remove, NULL, { -1 } }
......@@ -497,34 +509,36 @@ gog_chart_view_size_allocate (GogView *view, GogViewAllocation const *allocation
(cview_parent_klass->size_allocate) (view, &res);
res = view->residual;
if (chart->axis_set == GOG_AXIS_SET_XY) {
/* position the X & Y axes */
double pre_x = 0., post_x = 0., pre_y = 0, post_y = 0.;
double old_pre_x, old_post_x, old_pre_y, old_post_y;
do {
old_pre_x = pre_x; old_post_x = post_x;
old_pre_y = pre_y; old_post_y = post_y;
pre_x = post_x = pre_y = post_y = 0.;
for (ptr = view->children; ptr != NULL ; ptr = ptr->next) {
child = ptr->data;
if (child->model->position != GOG_POSITION_SPECIAL ||
!IS_GOG_AXIS (child->model))
continue;
axis = GOG_AXIS (child->model);
req.w = res.w - pre_x - post_x;
req.h = res.h - pre_y - post_y;
gog_view_size_request (child, &req);
switch (gog_axis_get_atype (axis)) {
case GOG_AXIS_X:
/* X axis fill the bottom and top */
tmp.x = res.x;
tmp.w = res.w;
tmp.h = req.h;
switch (gog_axis_get_pos (axis)) {
switch (chart->axis_set) {
case GOG_AXIS_SET_XY:
{
/* position the X & Y axes */
double pre_x = 0., post_x = 0., pre_y = 0, post_y = 0.;
double old_pre_x, old_post_x, old_pre_y, old_post_y;
do {
old_pre_x = pre_x; old_post_x = post_x;