Commit b459aaa7 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

All we need is a wbc. (sheet_object_anchor_set) : new routine to replace


2001-08-20  Jody Goldberg <jgoldberg@home.com>

	* src/sheet-object.c (sheet_object_remove_cb) : All we need is a wbc.
	(sheet_object_anchor_set) : new routine to replace range_set.
	(sheet_object_anchor_get) : new.
	(sheet_object_anchor_cpy) : new.
	(sheet_object_anchor_init) : new routine to bundle up object
	  positioning more neatly.

	* src/sheet-object-cell-comment.c (cell_set_comment) : Only use anchor
	  types that are implemented.  Use the new SheetObjectAnchor scheme.

	* src/sheet-control-gui.c (scg_object_move) : track whether the ctrl
	  point causes a move or a resize.
	(cb_control_point_event) : store the initial anchor rather than the
	  control specific position,  and assume that the changes are simple
	  movements until a resize occurs.
	(scg_object_calc_position) : adjust to using SheetObjectAnchor.
	(scg_colrow_distance_get_virtual) : new routine.
	(scg_class_init) : register it here.

	* src/sheet-control.c (sc_colrow_distance_get) : a new new virtual.

	* src/gnumeric-canvas.c (gnm_canvas_key_mode_object) : delete newly
	  created objects too.
	(gnm_canvas_filenames_dropped) : signature change
	  for sheet_object_container_new_file.

	* src/gnumeric.h : add GnmGraph.

	* src/Makefile.am : rename graph-vector -> gnumeric-graph

	* idl/gnumeric-graphs.idl : Add some versioning.
	  Move the header arg out of the value callback.
	  Replace VectorNotify::remove with Manger::clearVectors.
	  Merge freeze & thaw.
	  Renamed 'nameChange' to 'headerChanged'
	  Add an 'id' arg when registering vectors.

2001-08-19  Jody Goldberg <jgoldberg@home.com>

	* src/commands.c
	    s/insert_object/object_insert/
	    s/move_object/object_move/
	    s/delete_object/object/delete/
	(cmd_object_insert_redo) : The object knows its position based on its
	  anchor. No need to set the control specific coordinates for an
	  arbitrary control.  No need to tweak the reference count either.
	(cmd_object_insert) :  ditto.
	(cmd_object_insert_undo) : no need to tweak the ref count.
	(cmd_object_delete_redo) : keep it simple, just set the sheet.
	(cmd_object_delete_undo) : just clear the sheet.
	(cmd_object_delete_destroy) : very simple.
	(cmd_object_move_redo) : store the anchor, not the position for a
	  specific control.  Be careful not to move the object the firs time
	  through.  We've already done that.
	(cmd_move_object_undo) : just call redo.
	(cmd_object_move) : store the old anchor and take a flag indicating
	  move vs resize.

	* src/workbook-control-gui.c (wb_control_gui_toplevel) : Add some
	  protection.

	* src/sheet-object.c (sheet_object_update_bounds) : rename from
	  sheet_object_position to have a clearer name.

	* src/embeddable-grid.c (embeddable_grid_init_anon) : init the sheet.
	(grid_view_new) : use scg_toplevel.

	* src/sheet-control-gui.c (scg_toplevel) : new function.

2001-08-18  Jody Goldberg <jgoldberg@home.com>

	* src/gnumeric-graph.c : Major reorg to fix life cycle issues.
	(gnm_graph_new) : don't dangle the reference returned by oaf.
	(gnm_graph_destroy) : deactivate & _fini the corba obj.
	(gnm_graph_vector_destroy) : ditto.

	* src/expr.c (expr_to_graph_vector) : delete this function.
	  we have no need to disassemble the expression in graphs.

	* src/item-grid.c : revert switch from destroy -> finalize.
	* src/item-bar.c : ditto.

	* src/sheet-object-container.c : no need to include gnorba.
	  no need to include sheet-control-gui-priv anymore.
	(sheet_object_container_destroy) : delete unused.
	(sheet_object_container_new) : weaken requirements to take a workbook,
	  rather than a sheet as the container.
	(sheet_object_container_new_object) : ditto.
	(sheet_object_container_new_file) : ditto.

	* src/workbook-private.c : delete some unnecessary code.

	* src/workbook.c : include sheet-control vs sheet-control-gui.
	(workbook_expr_unrelocate) : it is ok to attempt to relocate to a
	  non-existent cell.

	* src/commands.c (cmd_paste_cut_undo) : restore the original content
	  AFTER unrelocating the expressions.

	* src/workbook-control-gui.c (workbook_control_gui_init) : Add the
	  magic to enable the bonobo toolbar config utility.
	(workbook_menu_edit) : Fix the accelerators and sync the text with the
	  bonobo version.
	(wbcg_menu_state_update) : Fix the capitalization for freeze/unfreeze.
	(change_menu_label) : Fix accelerator display, we still don't set
	  them, but at least we display them correctly.
	(insert_bonobo_object) : signature change to
	  sheet_object_container_new_object.

2001-08-17  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.c (sheet_freeze_panes) : set the initial top_left position
	  based on the frozen pane when unfreezing.

	* src/sheet-control-gui.c (scg_set_panes) : prepare for h/v only splits.
	  Reformat.  Remove code to set the topleft after the panes are
	  created or removed.  That is handled by sheet.

	* src/GNOME_Gnumeric.xml : enable the font accelerators in the bonobo
	  build by making them standalone rather than associating them with
	  toolbuttons.  It appears as if bonobo does not support accelerators
	  for toolbuttons as yet.
parent fed4ba83
2001-08-20 Jody Goldberg <jgoldberg@home.com>
* Makefile.am : Remove unused stubs for gnumeric-chart.
* ms-chart.c : s/ExcelChart/ExcelChartReadState/g
(BC_R(top_state)) : new function.
(map_excel_vec_type_to_gnm) : new function.
(BC_R(vector_details)) : new function.
(BC_R(series_impl)) : Use vector_details.
(BC_R(ai)) : actually handle the vector.
(BC_R(begin)) : keep a stack of the states.
(BC_R(series)) : keep track of the series.
* ms-excel-read.c (ms_sheet_obj_realize) : use the correct anchor specs.
and use the new SheetObjectAnchor mechanism.
(ms_sheet_obj_create) : signatue change for sheet_object_container_new.
2001-08-20 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_read_formula) : improve the debug info.
......
......@@ -14,8 +14,6 @@ excel_la_SOURCES = \
ms-biff.h \
biff-types.h \
escher-types.h \
gnumeric-chart.c \
gnumeric-chart.h \
ms-container.c \
ms-container.h \
ms-escher.c \
......
......@@ -4,7 +4,7 @@
* Author:
* Michael Meeks (michael@ximian.com)
*
* (C) 1998, 1999, 2000 Michael Meeks
* (C) 1998-2001 Michael Meeks
**/
#include <stdio.h>
#include <sys/stat.h>
......
/**
* gnumeric-chart.c: Gnumeric chart object
*
* I'll lurk it down here until it firms up a bit.
*
* Author:
* Jody Goldberg (jgoldberg@home.com)
*
* (C) 1999, 2000 Jody Goldberg
**/
#include <config.h>
#include "gnumeric-chart.h"
GnumericChart *
gnumeric_chart_new (void)
{
GnumericChart * res = (GnumericChart *) g_new (GnumericChart, 1);
res->series = NULL;
return res;
}
void
gnumeric_chart_destroy (GnumericChart * chart)
{
if (chart->series)
g_ptr_array_free (chart->series, FALSE);
chart->series = (GPtrArray *)0xdeadbeef; /* poison the pointer */
g_free (chart);
}
#ifndef GNUMERIC_CHART_H
#define GNUMERIC_CHART_H
#include <glib.h>
/**
* gnumeric-chart.h: Gnumeric Charts
*
* Author:
* Jody Goldberg (jgoldberg@home.com)
*
* (C) 1999, 2000 Jody Goldberg
**/
typedef struct _GnumericChartSeries
{
gint dummy;
} GnumericChartSeries;
typedef struct _GnumericChart
{
GPtrArray *series;
} GnumericChart;
extern GnumericChart * gnumeric_chart_new (void);
extern void gnumeric_chart_destroy (GnumericChart * chart);
#endif /* GNUMERIC_CHART_H */
This diff is collapsed.
......@@ -14,6 +14,7 @@ typedef struct
GtkObject * (*create_obj) (MSContainer *container, MSObj *obj);
ExprTree * (*parse_expr) (MSContainer *container,
guint8 const *data, int length);
Workbook * (*workbook) (MSContainer *container);
} MSContainerClass;
struct _MSContainer
......
......@@ -18,7 +18,6 @@
#include "ms-excel-read.h"
#include "ms-obj.h"
#include "ms-chart.h"
#include "gnumeric-chart.h"
#include "ms-escher.h"
#include "print-info.h"
#include "selection.h"
......@@ -2188,16 +2187,20 @@ ms_sheet_obj_realize (MSContainer *container, MSObj *obj)
return TRUE;
if (obj->gnum_obj != NULL) {
SheetObjectAnchor anchor_types[4] = {
SO_ANCHOR_PTS_FROM_COLROW_START,
SO_ANCHOR_PTS_FROM_COLROW_START,
SO_ANCHOR_PTS_FROM_COLROW_START,
SO_ANCHOR_PTS_FROM_COLROW_START
static SheetObjectAnchorType const anchor_types[4] = {
SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
SO_ANCHOR_PERCENTAGE_FROM_COLROW_START,
SO_ANCHOR_PERCENTAGE_FROM_COLROW_START
};
SheetObjectAnchor anchor;
sheet_object_anchor_init (&anchor, &range,
offsets, anchor_types,
SO_DIR_DOWN_RIGHT);
sheet_object_anchor_set (SHEET_OBJECT (obj->gnum_obj),
&anchor);
sheet_object_set_sheet (SHEET_OBJECT (obj->gnum_obj),
esheet->gnum_sheet);
sheet_object_range_set (SHEET_OBJECT (obj->gnum_obj), &range,
offsets, anchor_types);
}
return FALSE;
......@@ -2223,21 +2226,18 @@ ms_sheet_obj_create (MSContainer *container, MSObj *obj)
case 0x05: so = sheet_object_box_new (FALSE); break; /* Chart */
case 0x06: so = sheet_widget_label_new (sheet); break; /* TextBox */
case 0x07: so = sheet_widget_button_new (sheet); break; /* Button */
case 0x08:
/* Picture */
case 0x08: { /* Picture */
#ifdef ENABLE_BONOBO
so = sheet_object_container_new (sheet);
so = sheet_object_container_new (sheet->workbook);
#else
so = NULL;
{
static gboolean needs_warn = TRUE;
if (needs_warn) {
needs_warn = FALSE;
g_warning ("Images are not supported in non-bonobo version");
}
}
static gboolean needs_warn = TRUE;
if (needs_warn) {
needs_warn = FALSE;
g_warning ("Images are not supported in non-bonobo version");
}
#endif
break;
}
break;
case 0x0B: so = sheet_widget_checkbox_new (sheet); break; /* CheckBox*/
case 0x0C: so = sheet_widget_radio_button_new (sheet); break; /* OptionButton */
case 0x0E: so = sheet_widget_label_new (sheet); break; /* Label */
......@@ -2494,7 +2494,6 @@ ms_excel_workbook_new (MsBiffVersion ver)
ans->excel_sheets = g_ptr_array_new ();
ans->XF_cell_records = g_ptr_array_new ();
ans->name_data = g_ptr_array_new ();
ans->charts = g_ptr_array_new ();
ans->format_data = g_hash_table_new ((GHashFunc)biff_guint16_hash,
(GCompareFunc)biff_guint16_equal);
ans->palette = ms_excel_default_palette ();
......@@ -2533,11 +2532,6 @@ ms_excel_workbook_destroy (ExcelWorkbook *wb)
biff_name_data_destroy (g_ptr_array_index (wb->name_data, lp));
g_ptr_array_free (wb->name_data, TRUE);
for (lp = 0; lp < wb->charts->len; lp++)
gnumeric_chart_destroy (g_ptr_array_index (wb->charts, lp));
g_ptr_array_free (wb->charts, TRUE);
wb->charts = NULL;
g_hash_table_foreach_remove (wb->font_data,
(GHRFunc)biff_font_data_destroy,
wb);
......
......@@ -98,9 +98,6 @@ typedef struct _ExcelWorkbook
char **global_strings;
guint32 global_string_max;
/* Indexed in the order they are read */
GPtrArray *charts;
/**
* Gnumeric parallel workbook
**/
......
......@@ -247,8 +247,8 @@ GNUMERIC_BONOBO_SOURCES = \
bonobo-io.h \
embeddable-grid.c \
embeddable-grid.h \
graph-vector.c \
graph-vector.h \
gnumeric-graph.c \
gnumeric-graph.h \
sheet-object-bonobo.c \
sheet-object-bonobo.h \
sheet-object-container.c \
......
......@@ -3967,52 +3967,41 @@ cmd_zoom (WorkbookControl *wbc, GSList *sheets, double factor)
/******************************************************************/
#define CMD_INSERT_OBJECT_TYPE (cmd_insert_object_get_type ())
#define CMD_INSERT_OBJECT(o) (GTK_CHECK_CAST ((o), CMD_INSERT_OBJECT_TYPE, CmdInsertObject))
#define CMD_OBJECT_INSERT_TYPE (cmd_object_insert_get_type ())
#define CMD_OBJECT_INSERT(o) (GTK_CHECK_CAST ((o), CMD_OBJECT_INSERT_TYPE, CmdObjectInsert))
typedef struct
{
GnumericCommand parent;
SheetObject *so;
} CmdObjectInsert;
double coords [4];
} CmdInsertObject;
GNUMERIC_MAKE_COMMAND (CmdInsertObject, cmd_insert_object);
GNUMERIC_MAKE_COMMAND (CmdObjectInsert, cmd_object_insert);
static gboolean
cmd_insert_object_redo (GnumericCommand *cmd, WorkbookControl *wbc)
cmd_object_insert_redo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdInsertObject *me = CMD_INSERT_OBJECT (cmd);
SheetControlGUI *scg;
CmdObjectInsert *me = CMD_OBJECT_INSERT (cmd);
g_return_val_if_fail (IS_WORKBOOK_CONTROL_GUI (wbc), TRUE);
scg = wb_control_gui_cur_sheet (WORKBOOK_CONTROL_GUI (wbc));
if (!sheet_object_set_sheet (me->so, me->parent.sheet)) {
scg_object_calc_position (scg, me->so, me->coords);
gtk_object_ref (GTK_OBJECT (me->so));
}
sheet_object_set_sheet (me->so, me->parent.sheet);
return (FALSE);
}
static gboolean
cmd_insert_object_undo (GnumericCommand *cmd, WorkbookControl *wbc)
cmd_object_insert_undo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdInsertObject *me = CMD_INSERT_OBJECT (cmd);
CmdObjectInsert *me = CMD_OBJECT_INSERT (cmd);
sheet_object_clear_sheet (me->so);
gtk_object_unref (GTK_OBJECT (me->so));
return (FALSE);
}
static void
cmd_insert_object_destroy (GtkObject *cmd)
cmd_object_insert_destroy (GtkObject *cmd)
{
CmdInsertObject *me = CMD_INSERT_OBJECT (cmd);
CmdObjectInsert *me = CMD_OBJECT_INSERT (cmd);
gtk_object_unref (GTK_OBJECT (me->so));
......@@ -4020,23 +4009,21 @@ cmd_insert_object_destroy (GtkObject *cmd)
}
gboolean
cmd_insert_object (WorkbookControl *wbc, Sheet *sheet, SheetObject *so)
cmd_object_insert (WorkbookControl *wbc, SheetObject *so, Sheet *sheet)
{
GtkObject *object;
CmdInsertObject *me;
CmdObjectInsert *me;
g_return_val_if_fail (IS_WORKBOOK_CONTROL (wbc), TRUE);
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (IS_SHEET_OBJECT (so), TRUE);
object = gtk_type_new (CMD_INSERT_OBJECT_TYPE);
me = CMD_INSERT_OBJECT (object);
object = gtk_type_new (CMD_OBJECT_INSERT_TYPE);
me = CMD_OBJECT_INSERT (object);
me->so = so;
gtk_object_ref (GTK_OBJECT (so));
sheet_object_position_pts (so, me->coords);
me->parent.sheet = sheet;
me->parent.size = 1;
me->parent.cmd_descriptor = g_strdup (_("Insert object"));
......@@ -4046,103 +4033,66 @@ cmd_insert_object (WorkbookControl *wbc, Sheet *sheet, SheetObject *so)
/******************************************************************/
#define CMD_MOVE_OBJECT_TYPE (cmd_move_object_get_type ())
#define CMD_MOVE_OBJECT(o) (GTK_CHECK_CAST ((o), CMD_MOVE_OBJECT_TYPE, CmdMoveObject))
#define CMD_OBJECT_DELETE_TYPE (cmd_object_delete_get_type ())
#define CMD_OBJECT_DELETE(o) (GTK_CHECK_CAST ((o), CMD_OBJECT_DELETE_TYPE, CmdObjectDelete))
typedef struct
{
GnumericCommand parent;
SheetObject *so;
} CmdObjectDelete;
double old_coords [4];
double new_coords [4];
} CmdMoveObject;
GNUMERIC_MAKE_COMMAND (CmdMoveObject, cmd_move_object);
GNUMERIC_MAKE_COMMAND (CmdObjectDelete, cmd_object_delete);
static gboolean
cmd_move_object_redo (GnumericCommand *cmd, WorkbookControl *wbc)
cmd_object_delete_redo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdMoveObject *me = CMD_MOVE_OBJECT (cmd);
SheetControlGUI *scg;
g_return_val_if_fail (IS_WORKBOOK_CONTROL_GUI (wbc), TRUE);
scg = wb_control_gui_cur_sheet (WORKBOOK_CONTROL_GUI (wbc));
scg_object_calc_position (scg, me->so, me->new_coords);
return (FALSE);
CmdObjectDelete *me = CMD_OBJECT_DELETE (cmd);
sheet_object_clear_sheet (me->so);
return FALSE;
}
static gboolean
cmd_move_object_undo (GnumericCommand *cmd, WorkbookControl *wbc)
cmd_object_delete_undo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdMoveObject *me = CMD_MOVE_OBJECT (cmd);
SheetControlGUI *scg;
g_return_val_if_fail (IS_WORKBOOK_CONTROL_GUI (wbc), TRUE);
scg = wb_control_gui_cur_sheet (WORKBOOK_CONTROL_GUI (wbc));
scg_object_calc_position (scg, me->so, me->old_coords);
return (FALSE);
CmdObjectDelete *me = CMD_OBJECT_DELETE (cmd);
sheet_object_set_sheet (me->so, me->parent.sheet);
return FALSE;
}
static void
cmd_move_object_destroy (GtkObject *cmd)
cmd_object_delete_destroy (GtkObject *cmd)
{
CmdMoveObject *me = CMD_MOVE_OBJECT (cmd);
CmdObjectDelete *me = CMD_OBJECT_DELETE (cmd);
gtk_object_unref (GTK_OBJECT (me->so));
gnumeric_command_destroy (cmd);
}
gboolean
cmd_move_object (WorkbookControl *wbc, Sheet *sheet, SheetObject *so,
double old_coords [4], double new_coords [4])
cmd_object_delete (WorkbookControl *wbc, SheetObject *so)
{
GtkObject *object;
CmdMoveObject *me;
int i;
CmdObjectDelete *me;
g_return_val_if_fail (IS_WORKBOOK_CONTROL (wbc), TRUE);
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (IS_SHEET_OBJECT (so), TRUE);
/*
* There is no need to move the object around, because this has
* already happened.
*/
object = gtk_type_new (CMD_MOVE_OBJECT_TYPE);
me = CMD_MOVE_OBJECT (object);
object = gtk_type_new (CMD_OBJECT_DELETE_TYPE);
me = CMD_OBJECT_DELETE (object);
me->so = so;
gtk_object_ref (GTK_OBJECT (so));
for (i = 0; i < 4; i++) {
me->old_coords [i] = old_coords [i];
me->new_coords [i] = new_coords [i];
}
me->parent.sheet = sheet;
me->parent.sheet = sheet_object_get_sheet (so);
me->parent.size = 1;
if (new_coords[2] - new_coords[0] != old_coords[2] - old_coords[0] ||
new_coords[3] - new_coords[1] != old_coords[3] - old_coords[1]) {
me->parent.cmd_descriptor = g_strdup (_("Resize object"));
} else {
me->parent.cmd_descriptor = g_strdup (_("Move object"));
}
me->parent.cmd_descriptor = g_strdup (_("Delete object"));
return command_push_undo (wbc, object);
}
/******************************************************************/
#define CMD_DELETE_OBJECT_TYPE (cmd_delete_object_get_type ())
#define CMD_DELETE_OBJECT(o) (GTK_CHECK_CAST ((o), CMD_DELETE_OBJECT_TYPE, CmdDeleteObject))
#define CMD_OBJECT_MOVE_TYPE (cmd_object_move_get_type ())
#define CMD_OBJECT_MOVE(o) (GTK_CHECK_CAST ((o), CMD_OBJECT_MOVE_TYPE, CmdObjectMove))
typedef struct
{
......@@ -4150,69 +4100,69 @@ typedef struct
SheetObject *so;
double coords [4];
} CmdDeleteObject;
SheetObjectAnchor anchor;
gboolean first_time;
} CmdObjectMove;
GNUMERIC_MAKE_COMMAND (CmdDeleteObject, cmd_delete_object);
GNUMERIC_MAKE_COMMAND (CmdObjectMove, cmd_object_move);
static gboolean
cmd_delete_object_redo (GnumericCommand *cmd, WorkbookControl *wbc)
cmd_object_move_redo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdDeleteObject *me = CMD_DELETE_OBJECT (cmd);
CmdObjectMove *me = CMD_OBJECT_MOVE (cmd);
SheetObjectAnchor tmp;
sheet_object_anchor_cpy (&tmp, sheet_object_anchor_get (me->so));
if (me->first_time)
me->first_time = FALSE;
else
sheet_object_anchor_set (me->so, &me->anchor);
sheet_object_anchor_cpy (&me->anchor, &tmp);
sheet_object_clear_sheet (me->so);
return (FALSE);
}
static gboolean
cmd_delete_object_undo (GnumericCommand *cmd, WorkbookControl *wbc)
cmd_object_move_undo (GnumericCommand *cmd, WorkbookControl *wbc)
{
CmdDeleteObject *me = CMD_DELETE_OBJECT (cmd);
SheetControlGUI *scg;
g_return_val_if_fail (IS_WORKBOOK_CONTROL_GUI (wbc), TRUE);
scg = wb_control_gui_cur_sheet (WORKBOOK_CONTROL_GUI (wbc));
sheet_object_set_sheet (me->so, me->parent.sheet);
scg_object_calc_position (scg, me->so, me->coords);
return (FALSE);
return cmd_object_move_redo (cmd, wbc);
}
static void
cmd_delete_object_destroy (GtkObject *cmd)
cmd_object_move_destroy (GtkObject *cmd)
{
CmdDeleteObject *me = CMD_DELETE_OBJECT (cmd);
CmdObjectDelete *me = CMD_OBJECT_DELETE (cmd);
gtk_object_unref (GTK_OBJECT (me->so));
gnumeric_command_destroy (cmd);
}
gboolean
cmd_delete_object (WorkbookControl *wbc, Sheet *sheet, SheetObject *so)
cmd_object_move (WorkbookControl *wbc, SheetObject *so,
SheetObjectAnchor const *old_anchor, gboolean is_resize)
{
GtkObject *object;
CmdDeleteObject *me;
CmdObjectMove *me;
g_return_val_if_fail (IS_WORKBOOK_CONTROL (wbc), TRUE);
g_return_val_if_fail (IS_SHEET (sheet), TRUE);
g_return_val_if_fail (IS_SHEET_OBJECT (so), TRUE);
object = gtk_type_new (CMD_DELETE_OBJECT_TYPE);
me = CMD_DELETE_OBJECT (object);
/*
* There is no need to move the object around, because this has
* already happened.
*/
object = gtk_type_new (CMD_OBJECT_MOVE_TYPE);
me = CMD_OBJECT_MOVE (object);
me->so = so;
gtk_object_ref (GTK_OBJECT (so));
sheet_object_position_pts (so, me->coords);
sheet_object_anchor_cpy (&me->anchor, old_anchor);
me->parent.sheet = sheet;
me->parent.sheet = sheet_object_get_sheet (so);
me->parent.size = 1;
me->parent.cmd_descriptor = g_strdup (_("Delete object"));
sheet_object_clear_sheet (so);
me->parent.cmd_descriptor =
g_strdup ((is_resize) ? _("Resize object") : _("Move object"));
return command_push_undo (wbc, object);
}
......@@ -83,12 +83,11 @@ gboolean cmd_consolidate (WorkbookControl *wbc, Consolidate *cs);
gboolean cmd_zoom (WorkbookControl *wbc, GSList *sheets, double factor);
gboolean cmd_insert_object (WorkbookControl *wbc, Sheet *sheet,
SheetObject *so);
gboolean cmd_move_object (WorkbookControl *wbc, Sheet *sheet,
SheetObject *so,
double old_coords [4], double new_coords [4]);
gboolean cmd_delete_object (WorkbookControl *wbc, Sheet *sheet,
SheetObject *so);
gboolean cmd_object_insert (WorkbookControl *wbc, SheetObject *so,
Sheet *sheet);
gboolean cmd_object_delete (WorkbookControl *wbc, SheetObject *so);
gboolean cmd_object_move (WorkbookControl *wbc, SheetObject *so,
SheetObjectAnchor const *old_anchor,
gboolean resize);
#endif /* GNUMERIC_COMMANDS_H */
2001-08-18 Jody Goldberg <jgoldberg@home.com>
* dialog-graph-guru.c : Move the life cycle issues up into
gnumeric-graph.
2001-08-15 Jody Goldberg <jgoldberg@home.com>
* plugin-manager.glade : desensitize the install new plugin button
......
......@@ -21,31 +21,20 @@
* USA
*/
#include <config.h>
#include <gnome.h>
#include "gnumeric.h"
#include "dialogs.h"
#include "gnumeric-graph.h"
#include "gnumeric-util.h"
#include "workbook-control-gui-priv.h"
#include "workbook.h"
#include "sheet.h"
#include "workbook-edit.h"
#include "sheet-object.h"
#include "sheet-object-container.h"
#include "sheet-object-bonobo.h"
#include "sheet-control-gui.h"
#include "selection.h"
#include "ranges.h"
#include "selection.h"
#include "expr.h"
#include "value.h"
#include "cell.h"
#include "graph-vector.h"
#include "idl/gnumeric-graphs.h"
#include <liboaf/liboaf.h>
#include "workbook-edit.h"
#include "sheet-control-gui.h"
#include "sheet-object.h"
typedef struct
{
BonoboObjectClient *manager_client;
GNOME_Gnumeric_Graph_Manager manager;
Bonobo_Control control;
GnmGraph *graph;
Bonobo_Control control;
/* GUI accessors */
GladeXML *gui;
......@@ -76,7 +65,6 @@ typedef struct
gboolean valid;
gboolean is_columns;
GPtrArray *vectors;
GSList *ranges;
/* external state */
......@@ -86,24 +74,6 @@ typedef struct
Sheet *sheet;
} GraphGuruState;
static void
graph_guru_clear_vectors (GraphGuruState *state, gboolean explicit_remove)
{
/* Release the vectors objects */
if (state->vectors != NULL) {
int i = state->vectors->len;
while (i-- > 0) {
GraphVector *vectors = g_ptr_array_index (state->vectors, i);
if (explicit_remove)
graph_vector_unsubscribe (vectors);
gtk_object_unref (GTK_OBJECT (vectors));
}
g_ptr_array_free (state->vectors, TRUE);
state->vectors = NULL;
}
}
static void
graph_guru_state_destroy (GraphGuruState *state)
{
......@@ -111,13 +81,16 @@ graph_guru_state_destroy (GraphGuruState *state)
wbcg_edit_detach_guru (state->wbcg);
if (state->graph != NULL) {
gtk_object_unref (GTK_OBJECT (state->graph));
state->graph = NULL;
}
if (state->gui != NULL) {
gtk_object_unref (GTK_OBJECT (state->gui));
state->gui = NULL;
}
graph_guru_clear_vectors (state, FALSE);
if (state->ranges != NULL) {
GSList *ptr = state->ranges;
......@@ -127,23 +100,6 @@ graph_guru_state_destroy (GraphGuruState *state)
state->ranges = NULL;
}
if (state->control != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
CORBA_exception_init (&ev);
Bonobo_Control_unref (state->control, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("Problems releasing the graph selector control");
CORBA_exception_free (&ev);
state->control = CORBA_OBJECT_NIL;
}
if (state->manager_client != NULL) {
bonobo_object_unref (BONOBO_OBJECT(state->manager_client));
state->manager_client = NULL;
state->manager = CORBA_OBJECT_NIL;
}
/* Handle window manger closing the dialog.
* This will be ignored if we are being destroyed differently.
*/
......@@ -182,15 +138,12 @@ graph_guru_set_page (GraphGuruState *state, int page)
return;
switch (page) {
case 0:
name = _("Step 1 of 3: Select graphic type");
case 0: name = _("Step 1 of 3: Select graph type");
prev_ok = FALSE;
break;
case 1:
name = _("Step 2 of 3: Select data ranges");
case 1: name = _("Step 2 of 3: Select data ranges");
break;
case 2:
name = _("Step 3 of 3: Customize graphic");
case 2: name = _("Step 3 of 3: Customize graph");
next_ok = FALSE;
break;
......@@ -206,13 +159,6 @@ graph_guru_set_page (GraphGuruState *state, int page)
gtk_widget_set_sensitive (state->button_next, next_ok);
}
static gboolean
cb_graph_vector_destroy (GtkObject *w, gpointer vector)
{
printf ("vector destroy %p\n", vector);
return FALSE;
}
static void
cb_graph_guru_clicked (GtkWidget *button, GraphGuruState *state)
{
......@@ -232,31 +178,11 @@ cb_graph_guru_clicked (GtkWidget *button, GraphGuruState *state)
}
if (button == state->button_finish) {
SheetObject *so = sheet_object_container_new (state->sheet);
if (sheet_object_bonobo_set_server (SHEET_OBJECT_BONOBO (so),
state->manager_client)) {
scg_mode_create_object (state->scg,