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

Dump in some pending changes so that I can sync things to the laptop

2004-10-08  Jody Goldberg <jody@gnome.org>

	* ms-obj.c (ms_obj_read_biff8_obj) : some simple mapping from Forms
	  objects to things we understand.  No properties imported yet.

	http://bugzilla.gnome.org/show_bug.cgi?id=154734
	* ms-chart.c (BC_R(end)) : cheesy swapping of the formatting
	  associated with X and Y axes for bar plots.

2004-10-08  Jody Goldberg <jody@gnome.org>

	* graph/gog-object.c (gog_object_dup) : copy the position.

2004-10-06  Jody Goldberg <jody@gnome.org>

	* graph/gog-control-foocanvas.c (gog_control_foocanvas_update) : Fix
	  redraw.  There were two bugs.
	  1) foocanvas_group_update was wiping tbe bounds (things always look
	     like they move)
	  2) We were not requesting a redraw for the old position before
	     moving.

2004-10-08  Jody Goldberg <jody@gnome.org>

	* src/gnumeric-canvas.c (gnm_canvas_key_mode_object) : throw in
	  support for tabbing fwd/back through the list of objects.

	* src/sheet-object-widget.c (sheet_widget_checkbox_create_widget) :
	  Tweak to support toggle buttons too

2004-10-08  Jody Goldberg <jody@gnome.org>

	* src/sheet-object.c : Add a SheetObjectView interface and use it to
	  give us more control over things.

	* src/workbook-control-gui.c (wbcg_zoom_feedback) : no need to
	  reposition objects manually here.

	* src/print.c (print_sheet_objects) : Use sheet_object_can_print.

	* src/gutils.c : Clean up the name spacing

	* src/sheet-filter.c : Support the new SheetObjectView interface
	* src/sheet-object-cell-comment.c : ditto
	* src/sheet-object-graph.c : ditto
	* src/sheet-object-image.c : ditto
	* src/sheet-object-widget.c : ditto

	* src/gnumeric-canvas.c (gnm_canvas_key_mode_object) :
	  - arrow moves the objects
	  - ctrl arrow expands an edge
	  - shift ctrl arrow shrinks an edge

	* src/commands.c (CmdObjectInsert) : delete
	(CmdObjectDelete) : Rename to CmdObjectsDelete and handle multiples
	(CmdObjectMove) : Rename to CmdObjectsMove and handle multiples

	* src/application.c (gnm_app_clipboard_cut_copy_obj) : handle multiple
	  objects.
	* src/gnumeric-pane.c : ditto.
	* src/sheet-control-gui.c : ditto.
	* src/item-grid.c : ditto.  Also there is no need to handle object
	  creation here as a special case just use the object editing
	  directly.

	* src/sheet-object.c (sheet_object_anchor_init) : pick a default that
	  we've actually implemented.
parent 488c90b9
...@@ -10,12 +10,16 @@ Release Critical ...@@ -10,12 +10,16 @@ Release Critical
debian 272697 debian 272697
: Don't leak dropped objects from sheet_objects_relocate http://bugzilla.gnome.org/show_bug.cgi?id=152434
: Don't leak dropped objects from sheet_objects_clear : file save gremlins
: provide undo for dropped objects from sheet_objects_relocate
: provide undo for dropped objects from sheet_objects_clear
: undo of pasting copy/cut of objects : undo of pasting copy/cut of objects
: kasal's popt patch : kasal's popt patch
: editing text boxes : editing text boxes (do a derived FooCanvasEditableTextItem)
we can steal some of the xim support from item-edit.
http://bugzilla.gnome.org/show_bug.cgi?id=152528 http://bugzilla.gnome.org/show_bug.cgi?id=152528
: No crash when reading broken xls : No crash when reading broken xls
...@@ -163,7 +167,8 @@ Target Features ...@@ -163,7 +167,8 @@ Target Features
- ssconvert for non-gnome (DONE) - ssconvert for non-gnome (DONE)
Excel i/o Excel i/o
- 'Forms' import. - 'Forms' import (DONE)
- Properties of 'Forms'
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Short Term Goals Short Term Goals
...@@ -269,7 +274,7 @@ Short Term Goals ...@@ -269,7 +274,7 @@ Short Term Goals
1.12.2) Take marker sizes into account at bounds (DONE) 1.12.2) Take marker sizes into account at bounds (DONE)
1.12.3) Bounds on 1 axis explicitly clip the other 1.12.3) Bounds on 1 axis explicitly clip the other
1.12.4) Splined interpolation 1.12.4) Splined interpolation
1.12.5) Bubbles {Jean has patch} (DONE) 1.12.5) Bubbles (DONE)
1.13) Decide on recalc strategy (DONE) 1.13) Decide on recalc strategy (DONE)
1.13.1) Getting data from sheet -> graphs (DONE) 1.13.1) Getting data from sheet -> graphs (DONE)
1.13.2) linking unlinking (DONE) 1.13.2) linking unlinking (DONE)
...@@ -396,7 +401,9 @@ Short Term Goals ...@@ -396,7 +401,9 @@ Short Term Goals
1.30.2) Theme it (DONE) 1.30.2) Theme it (DONE)
1.30.3) Add or remove it depending on chart axis set (DONE) 1.30.3) Add or remove it depending on chart axis set (DONE)
1.30.4) Render background (DONE) 1.30.4) Render background (DONE)
1.30.5) Draw grid lines when appropriate 1.30.5) Support grid lines (added to axis) (DONE)
1.30.6) XLS import of grid lines
1.30.7) XLS export of grid lines
1.31) SVG Render 1.31) SVG Render
1.31.1) Paths (DONE) 1.31.1) Paths (DONE)
1.31.2) Solid Fills (DONE) 1.31.2) Solid Fills (DONE)
...@@ -410,8 +417,14 @@ Short Term Goals ...@@ -410,8 +417,14 @@ Short Term Goals
1.32) Radar plots 1.32) Radar plots
1.32.1) line (DONE) 1.32.1) line (DONE)
1.32.2) area (DONE) 1.32.2) area (DONE)
1.32.3) axis labels 1.32.3) axis labels {partial}
1.32.4) fix xls import of marker vs no marker 1.32.4) fix xls import of marker vs no marker
1.33) Contour plots {Jean}
1.33.1) Initial implementation
1.33.2) GOMatrix
1.33.3) Axis changes
1.33.4) XLS import
1.33.4) XLS export
2) stf {Andreas/Morten} 2) stf {Andreas/Morten}
2.1) UTF-8 cleanliness (DONE) 2.1) UTF-8 cleanliness (DONE)
...@@ -672,15 +685,37 @@ Short Term Goals ...@@ -672,15 +685,37 @@ Short Term Goals
31) sylk 31) sylk
31.1) importer 31.1) importer
31.1.1) constants (DONE) 31.1.1) constants (DONE)
31.1.2) expressions (needs r1c1 parser) 31.1.2) expressions (needs r1c1 parser)
31.1.3) array expressions 31.1.3) array expressions
31.1.4) column widths (DONE) 31.1.4) column widths (DONE)
31.1.5) formats (DONE) 31.1.5) formats (DONE)
31.1.6) fonts {partial} 31.1.6) fonts {partial}
31.1.7) styles (DONE) 31.1.7) styles (DONE)
31.2) exporter 31.2) exporter
32) SheetObjects
32.1) SheetView specific objects {partial}
32.2) Add acetate_create virtual to handle shaped objects.
32.3) Other anchor types for sheet objects
32.4) Add keyboard controls for the control points (DONE)
32.4.1) Arrows move (DONE)
32.4.2) Ctrl Arrows expand (DONE)
32.4.3) Shift Ctrl Arrows shrink (DONE)
32.5) Use delta from start of drag rather than previous movement
32.6) Add 'is_printable' flag (DONE)
32.7) Add 'move_with_cells' flag (DONE)
32.8) Add ability to fix aspect ratio of drag resize
32.9) Honour rubber_band_directly during resize too (DONE)
32.10) research the other xl object flags.
32.11) remove update_view_bounds and have the model emit a (DONE)
bound_changed signal
32.12) double click to bring up prefs dialog
32.13) selecting object with other objects on top of it should
hide them while editing
32.14) ngettext for insert/delete objects undo message
32.15) Check the stacking of ctrl pts when moving multiple selections
Misc stuff that should be fixed Misc stuff that should be fixed
------------------------------- -------------------------------
...@@ -700,7 +735,7 @@ Misc stuff that should be fixed ...@@ -700,7 +735,7 @@ Misc stuff that should be fixed
- Freeze panes (tricky this is a view attribute) - Freeze panes (tricky this is a view attribute)
- Remove sheet. (Done except that references are not linked back.) - Remove sheet. (Done except that references are not linked back.)
- `Add Scenario' Portion of Solver - `Add Scenario' Portion of Solver
- Sheet object configuration changes. (Done for graphs.) - Sheet object configuration changes. (Done for graphs, lines, and fills)
- Workbook attr changes - Workbook attr changes
- cols/rows - cols/rows
...@@ -772,23 +807,6 @@ Misc stuff that should be fixed ...@@ -772,23 +807,6 @@ Misc stuff that should be fixed
: Borders : Borders
* use new border code for cell format dialog (possibly preview-grid) * use new border code for cell format dialog (possibly preview-grid)
- SheetObjects
: SheetView specific objects
: Add acetate_create virtual to handle shaped objects.
: Other anchor types for sheet objects
: Add keyboard controls for the control points
: Add object control for resize to disable invalid sizes.
: Add 'is_printable' flag and import
: Add 'move_with_cells' flag (DONE)
: Add ability to fix aspect ratio of drag resize
: Honour rubber_band_directly during resize too
: research the other xl object flags.
: remove update_view_bounds and have the model emit a (DONE)
bound_changed signal
: double click to bring up prefs dialog
: selecting object with other objects on top of it should hide them while
editing
Dialogs Dialogs
------- -------
- Formula Guru - Formula Guru
......
2004-10-08 Jody Goldberg <jody@gnome.org>
* src/gnumeric-canvas.c (gnm_canvas_key_mode_object) : throw in
support for tabbing fwd/back through the list of objects.
* src/sheet-object-widget.c (sheet_widget_checkbox_create_widget) :
Tweak to support toggle buttons too
2004-10-08 Jody Goldberg <jody@gnome.org>
* src/sheet-object.c : Add a SheetObjectView interface and use it to
give us more control over things.
* src/workbook-control-gui.c (wbcg_zoom_feedback) : no need to
reposition objects manually here.
* src/print.c (print_sheet_objects) : Use sheet_object_can_print.
* src/gutils.c : Clean up the name spacing
* src/sheet-filter.c : Support the new SheetObjectView interface
* src/sheet-object-cell-comment.c : ditto
* src/sheet-object-graph.c : ditto
* src/sheet-object-image.c : ditto
* src/sheet-object-widget.c : ditto
* src/gnumeric-canvas.c (gnm_canvas_key_mode_object) :
- arrow moves the objects
- ctrl arrow expands an edge
- shift ctrl arrow shrinks an edge
* src/commands.c (CmdObjectInsert) : delete
(CmdObjectDelete) : Rename to CmdObjectsDelete and handle multiples
(CmdObjectMove) : Rename to CmdObjectsMove and handle multiples
* src/application.c (gnm_app_clipboard_cut_copy_obj) : handle multiple
objects.
* src/gnumeric-pane.c : ditto.
* src/sheet-control-gui.c : ditto.
* src/item-grid.c : ditto. Also there is no need to handle object
creation here as a special case just use the object editing
directly.
* src/sheet-object.c (sheet_object_anchor_init) : pick a default that
we've actually implemented.
2004-10-08 Morten Welinder <terra@gnome.org> 2004-10-08 Morten Welinder <terra@gnome.org>
* src/rangefunc.c (range_hypot): New function. * src/rangefunc.c (range_hypot): New function.
......
Gnumeric 1.3.92 Gnumeric 1.3.92
Jody:
* Enable selecting and moving multiple drawing objects
http://bugzilla.gnome.org/show_bug.cgi?id=154734
* Swap X & Y axis content when importing xls bar plots
* Basic handling for XL 'Forms' Objects
Morten: Morten:
* Implement Edit->Select->Input. [#154735] * Implement Edit->Select->Input. [#154735]
* Fix sample datasource's recalc. [#154857] * Fix sample datasource's recalc. [#154857]
......
2004-10-08 Jody Goldberg <jody@gnome.org>
* src/gnumeric-canvas.c (gnm_canvas_key_mode_object) : throw in
support for tabbing fwd/back through the list of objects.
* src/sheet-object-widget.c (sheet_widget_checkbox_create_widget) :
Tweak to support toggle buttons too
2004-10-08 Jody Goldberg <jody@gnome.org>
* src/sheet-object.c : Add a SheetObjectView interface and use it to
give us more control over things.
* src/workbook-control-gui.c (wbcg_zoom_feedback) : no need to
reposition objects manually here.
* src/print.c (print_sheet_objects) : Use sheet_object_can_print.
* src/gutils.c : Clean up the name spacing
* src/sheet-filter.c : Support the new SheetObjectView interface
* src/sheet-object-cell-comment.c : ditto
* src/sheet-object-graph.c : ditto
* src/sheet-object-image.c : ditto
* src/sheet-object-widget.c : ditto
* src/gnumeric-canvas.c (gnm_canvas_key_mode_object) :
- arrow moves the objects
- ctrl arrow expands an edge
- shift ctrl arrow shrinks an edge
* src/commands.c (CmdObjectInsert) : delete
(CmdObjectDelete) : Rename to CmdObjectsDelete and handle multiples
(CmdObjectMove) : Rename to CmdObjectsMove and handle multiples
* src/application.c (gnm_app_clipboard_cut_copy_obj) : handle multiple
objects.
* src/gnumeric-pane.c : ditto.
* src/sheet-control-gui.c : ditto.
* src/item-grid.c : ditto. Also there is no need to handle object
creation here as a special case just use the object editing
directly.
* src/sheet-object.c (sheet_object_anchor_init) : pick a default that
we've actually implemented.
2004-10-08 Morten Welinder <terra@gnome.org> 2004-10-08 Morten Welinder <terra@gnome.org>
* src/rangefunc.c (range_hypot): New function. * src/rangefunc.c (range_hypot): New function.
......
2004-10-08 Jody Goldberg <jody@gnome.org>
* ms-obj.c (ms_obj_read_biff8_obj) : some simple mapping from Forms
objects to things we understand. No properties imported yet.
http://bugzilla.gnome.org/show_bug.cgi?id=154734
* ms-chart.c (BC_R(end)) : cheesy swapping of the formatting
associated with X and Y axes for bar plots.
2004-10-05 Jody Goldberg <jody@gnome.org> 2004-10-05 Jody Goldberg <jody@gnome.org>
* Release 1.3.91 * Release 1.3.91
......
...@@ -1864,6 +1864,18 @@ cb_store_singletons (gpointer indx, GogStyle *style, GogObject *series) ...@@ -1864,6 +1864,18 @@ cb_store_singletons (gpointer indx, GogStyle *style, GogObject *series)
} }
} }
static void
xl_axis_swap_elem (GogAxis *a, GogAxis *b, unsigned dim)
{
GOData *a_dat = gog_dataset_get_dim (GOG_DATASET (a), dim);
GOData *b_dat = gog_dataset_get_dim (GOG_DATASET (b), dim);
if (a_dat != NULL) g_object_ref (a_dat);
if (b_dat != NULL) g_object_ref (b_dat);
gog_dataset_set_dim (GOG_DATASET (a), dim, b_dat, NULL);
gog_dataset_set_dim (GOG_DATASET (b), dim, a_dat, NULL);
}
static gboolean static gboolean
BC_R(end)(XLChartHandler const *handle, BC_R(end)(XLChartHandler const *handle,
XLChartReadState *s, BiffQuery *q) XLChartReadState *s, BiffQuery *q)
...@@ -1971,14 +1983,26 @@ BC_R(end)(XLChartHandler const *handle, ...@@ -1971,14 +1983,26 @@ BC_R(end)(XLChartHandler const *handle,
(GHFunc) cb_store_singletons, series); (GHFunc) cb_store_singletons, series);
} }
/* Vile cheesy hack.
* XL stores axis as 'value' and 'category' whereas we use X and Y.
* When importing bar plots things are transposed, but we do
* not know it until we import the plot. Swap the contents of the axes */
if (0 == strcmp (G_OBJECT_TYPE_NAME (s->plot), "GogBarColPlot")) { if (0 == strcmp (G_OBJECT_TYPE_NAME (s->plot), "GogBarColPlot")) {
gboolean horizontal; gboolean horizontal;
g_object_get (s->plot, "horizontal", &horizontal, NULL); g_object_get (s->plot, "horizontal", &horizontal, NULL);
if (horizontal) { if (horizontal) {
g_warning ("the axes will be reversed. fix this"); GogAxis *x = gog_plot_get_axis (s->plot, GOG_AXIS_X);
#if 0 GogAxis *y = gog_plot_get_axis (s->plot, GOG_AXIS_Y);
gog_chart_swap_xy_axes (s->chart); GogStyle *x_style, *y_style;
#endif int i;
for (i = 0 ; i < AXIS_ELEM_MAX_ENTRY ; i++)
xl_axis_swap_elem (x, y, i);
g_object_get (G_OBJECT (x), "style", &x_style, NULL);
g_object_get (G_OBJECT (y), "style", &y_style, NULL);
g_object_set (G_OBJECT (y), "style", x_style, NULL);
g_object_set (G_OBJECT (x), "style", y_style, NULL);
g_object_unref (x_style);
g_object_unref (y_style);
} }
} }
s->plot = NULL; s->plot = NULL;
......
...@@ -734,7 +734,23 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *c, MSObj *obj) ...@@ -734,7 +734,23 @@ ms_obj_read_pre_biff8_obj (BiffQuery *q, MSContainer *c, MSObj *obj)
return FALSE; return FALSE;
} }
/* S59DAD.HTM */ static struct {
char const *name;
unsigned excel_type;
} const map_forms [] = {
{ "ScrollBar", 0x11 },
{ "CheckBox", 0x0B },
{ "TextBox", 0x06 },
{ "CommandButton", 0x07 },
{ "OptionButton", 0x0C },
{ "ListBox", 0x12 },
{ "ComboBox", 0x14 },
{ "ToggleButton", 0x0 }, /* TODO */
{ "SpinButton", 0x10 },
{ "Label", 0x0E },
{ "Image", 0x08 }
};
static gboolean static gboolean
ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj) ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
{ {
...@@ -814,6 +830,21 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj) ...@@ -814,6 +830,21 @@ ms_obj_read_biff8_obj (BiffQuery *q, MSContainer *container, MSObj *obj)
case GR_PICTURE_FORMULA : case GR_PICTURE_FORMULA :
ms_obj_dump (data, len, data_len_left, "PictFormula"); ms_obj_dump (data, len, data_len_left, "PictFormula");
/* Forms are stored as pictures */
if (obj->excel_type == 8 &&
len > 26 && 0 == strncmp (data+21, "Forms.", 6)) {
unsigned i = G_N_ELEMENTS (map_forms);
while (i-- > 0) {
char const *key = map_forms[i].name;
unsigned key_len = strlen (key);
if (0 == strncmp (data+27, key, key_len)) {
gsf_mem_dump (data, len+4);
if (map_forms [i].excel_type > 0)
obj->excel_type = map_forms [i].excel_type;
break;
}
}
}
break; break;
case GR_CHECKBOX_LINK : case GR_CHECKBOX_LINK :
......
...@@ -242,7 +242,6 @@ gnm_app_clipboard_cut_copy (WorkbookControl *wbc, gboolean is_cut, ...@@ -242,7 +242,6 @@ gnm_app_clipboard_cut_copy (WorkbookControl *wbc, gboolean is_cut,
g_return_if_fail (app != NULL); g_return_if_fail (app != NULL);
gnm_app_clipboard_clear (FALSE); gnm_app_clipboard_clear (FALSE);
if (wb_control_claim_selection (wbc)) { if (wb_control_claim_selection (wbc)) {
Sheet *sheet = sv_sheet (sv); Sheet *sheet = sv_sheet (sv);
g_free (app->clipboard_cut_range); g_free (app->clipboard_cut_range);
...@@ -264,47 +263,51 @@ gnm_app_clipboard_cut_copy (WorkbookControl *wbc, gboolean is_cut, ...@@ -264,47 +263,51 @@ gnm_app_clipboard_cut_copy (WorkbookControl *wbc, gboolean is_cut,
g_warning ("Unable to set selection ?"); g_warning ("Unable to set selection ?");
} }
} }
/** gnm_app_clipboard_cut_copy_obj : /** gnm_app_clipboard_cut_copy_obj :
* @wbc : #WorkbookControl * @wbc : #WorkbookControl
* @is_cut : * @is_cut :
* @sv : #SheetView * @sv : #SheetView
* @so : #SheetObject * @objects : a list of #SheetObject which is freed
* *
* Different than copying/cutting a region, this can actually cut an object * Different than copying/cutting a region, this can actually cuts an object
**/ **/
void void
gnm_app_clipboard_cut_copy_obj (WorkbookControl *wbc, gboolean is_cut, gnm_app_clipboard_cut_copy_obj (WorkbookControl *wbc, gboolean is_cut,
SheetView *sv, SheetObject *so) SheetView *sv, GSList *objects)
{ {
SheetObject *so;
GnmRange *r;
GSList *ptr;
g_return_if_fail (IS_SHEET_VIEW (sv)); g_return_if_fail (IS_SHEET_VIEW (sv));
g_return_if_fail (IS_SHEET_OBJECT (so)); g_return_if_fail (objects != NULL);
g_return_if_fail (app != NULL); g_return_if_fail (app != NULL);
gnm_app_clipboard_clear (FALSE); gnm_app_clipboard_clear (FALSE);
if (wb_control_claim_selection (wbc)) { if (wb_control_claim_selection (wbc)) {
GnmRange *r;
Sheet *sheet = sv_sheet (sv);
app->clipboard_cut_range = NULL; app->clipboard_cut_range = NULL;
sv_weak_ref (sv, &(app->clipboard_sheet_view)); sv_weak_ref (sv, &(app->clipboard_sheet_view));
app->clipboard_copied_contents = cellregion_new (sv_sheet (sv));
for (ptr = objects ; ptr != NULL ; ptr = ptr->next) {
so = sheet_object_dup (ptr->data);
r = (GnmRange *) sheet_object_get_range (so);
range_translate (r,
-MIN (r->start.col, r->end.col),
-MIN (r->start.row, r->end.row));
app->clipboard_copied_contents->objects = g_slist_prepend (
app->clipboard_copied_contents->objects, so);
}
app->clipboard_copied_contents = cellregion_new (sheet); if (is_cut) {
if (is_cut) cmd_objects_delete (wbc, objects, _("Cut Object"));
cmd_object_delete (wbc, so, _("Cut Object")); objects = NULL;
so = sheet_object_dup (so); }
r = (GnmRange *) sheet_object_get_range (so);
range_translate (r,
-MIN (r->start.col, r->end.col),
-MIN (r->start.row, r->end.row));
app->clipboard_copied_contents->objects = g_slist_prepend (
app->clipboard_copied_contents->objects, so);
g_signal_emit (G_OBJECT (app), signals [CLIPBOARD_MODIFIED], 0); g_signal_emit (G_OBJECT (app), signals [CLIPBOARD_MODIFIED], 0);
} else { } else {
g_warning ("Unable to set selection ?"); g_warning ("Unable to set selection ?");
} }
g_slist_free (objects);
} }
gboolean gboolean
......
...@@ -44,7 +44,7 @@ void gnm_app_clipboard_cut_copy (WorkbookControl *wbc, gboolean is_cut, ...@@ -44,7 +44,7 @@ void gnm_app_clipboard_cut_copy (WorkbookControl *wbc, gboolean is_cut,
SheetView *sv, GnmRange const *area, SheetView *sv, GnmRange const *area,
gboolean animate_range); gboolean animate_range);
void gnm_app_clipboard_cut_copy_obj (WorkbookControl *wbc, gboolean is_cut, void gnm_app_clipboard_cut_copy_obj (WorkbookControl *wbc, gboolean is_cut,
SheetView *sv, SheetObject *so); SheetView *sv, GSList *objects);
void gnm_app_clipboard_unant (void); void gnm_app_clipboard_unant (void);
gboolean gnm_app_clipboard_is_empty (void); gboolean gnm_app_clipboard_is_empty (void);
gboolean gnm_app_clipboard_is_cut (void); gboolean gnm_app_clipboard_is_cut (void);
......
...@@ -4349,126 +4349,62 @@ cmd_zoom (WorkbookControl *wbc, GSList *sheets, double factor) ...@@ -4349,126 +4349,62 @@ cmd_zoom (WorkbookControl *wbc, GSList *sheets, double factor)
/******************************************************************/ /******************************************************************/
#define CMD_OBJECT_INSERT_TYPE (cmd_object_insert_get_type ()) #define CMD_OBJECTS_DELETE_TYPE (cmd_objects_delete_get_type ())
#define CMD_OBJECT_INSERT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CMD_OBJECT_INSERT_TYPE, CmdObjectInsert)) #define CMD_OBJECTS_DELETE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CMD_OBJECTS_DELETE_TYPE, CmdObjectsDelete))
typedef struct { typedef struct {
GnmCommand cmd; GnmCommand cmd;
SheetObject *so; GSList *objects;
} CmdObjectInsert; } CmdObjectsDelete;
MAKE_GNM_COMMAND (CmdObjectInsert, cmd_object_insert, NULL); MAKE_GNM_COMMAND (CmdObjectsDelete, cmd_objects_delete, NULL);
static gboolean static gboolean
cmd_object_insert_redo (GnmCommand *cmd, G_GNUC_UNUSED WorkbookControl *wbc) cmd_objects_delete_redo (GnmCommand *cmd,
{
CmdObjectInsert *me = CMD_OBJECT_INSERT (cmd);
sheet_object_set_sheet (me->so, me->cmd.sheet);
return FALSE;
}
static gboolean
cmd_object_insert_undo (GnmCommand *cmd, G_GNUC_UNUSED WorkbookControl *wbc)
{
CmdObjectInsert *me = CMD_OBJECT_INSERT (cmd);
sheet_object_clear_sheet (me->so);
return FALSE;
}
static void
cmd_object_insert_finalize (GObject *cmd)
{
CmdObjectInsert *me = CMD_OBJECT_INSERT (cmd);
g_object_unref (G_OBJECT (me->so));
gnm_command_finalize (cmd);
}
/**
* cmd_object_insert :
* @wbc :
* @so :
* @sheet
*
* Adds a ref to @so and inserts it into @sheet
**/
gboolean
cmd_object_insert (WorkbookControl *wbc, SheetObject *so, Sheet *sheet,
char const *name)
{
GObject *object;
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 = g_object_new (CMD_OBJECT_INSERT_TYPE, NULL);
me = CMD_OBJECT_INSERT (object);
me->so = so;
g_object_ref (G_OBJECT (so));
me->cmd.sheet = sheet;
me->cmd.size = 1;
me->cmd.cmd_descriptor = g_strdup (name ? name : _("Insert Object"));
return command_push_undo (wbc, object);
}
/******************************************************************/
#define CMD_OBJECT_DELETE_TYPE (cmd_object_delete_get_type ())
#define CMD_OBJECT_DELETE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CMD_OBJECT_DELETE_TYPE, CmdObjectDelete))
typedef struct {
GnmCommand cmd;
SheetObject *so;
} CmdObjectDelete;
MAKE_GNM_COMMAND (CmdObjectDelete, cmd_object_delete, NULL);
static gboolean
cmd_object_delete_redo (GnmCommand *cmd,
G_GNUC_UNUSED WorkbookControl *wbc) G_GNUC_UNUSED WorkbookControl *wbc)
{ {
CmdObjectDelete *me = CMD_OBJECT_DELETE (cmd); CmdObjectsDelete *me = CMD_OBJECTS_DELETE (cmd);
sheet_object_clear_sheet (me->so); g_slist_foreach (me->objects, (GFunc) sheet_object_clear_sheet, NULL);
return FALSE; return FALSE;
} }
static gboolean static gboolean
cmd_object_delete_undo (GnmCommand *cmd, cmd_objects_delete_undo (GnmCommand *cmd,
G_GNUC_UNUSED WorkbookControl *wbc) G_GNUC_UNUSED WorkbookControl *wbc)
{ {
CmdObjectDelete *me = CMD_OBJECT_DELETE (cmd); CmdObjectsDelete *me = CMD_OBJECTS_DELETE (cmd);
sheet_object_set_sheet (me->so, me->cmd.sheet); g_slist_foreach (me->objects,
(GFunc) sheet_object_set_sheet, me->cmd.sheet);
return FALSE; return FALSE;
} }
static void static void
cmd_object_delete_finalize (GObject *cmd) cmd_objects_delete_finalize (GObject *cmd)
{ {
CmdObjectDelete *me = CMD_OBJECT_DELETE (cmd); CmdObjectsDelete *me = CMD_OBJECTS_DELETE (cmd);
g_object_unref (G_OBJECT (me->so)); g_slist_foreach (me->objects, (GFunc) g_object_unref, NULL);
g_slist_free (me->objects);
gnm_command_finalize (cmd); gnm_command_finalize (cmd);
} }
/* Absorbs the list, adding references to the content */
gboolean gboolean
cmd_object_delete (WorkbookControl *wbc, SheetObject *so, cmd_objects_delete (WorkbookControl *wbc, GSList *objects,
char const *name) char const *name)
{ {
GObject *object; GObject *object;
CmdObjectDelete *me; CmdObjectsDelete *me;
g_return_val_if_fail (IS_SHEET_OBJECT (so), TRUE); g_return_val_if_fail (IS_WORKBOOK_CONTROL (wbc), TRUE);
g_return_val_if_fail (objects != NULL, TRUE);
object = g_object_new (CMD_OBJECT_DELETE_TYPE, NULL); object = g_object_new (CMD_OBJECTS_DELETE_TYPE, NULL);
me = CMD_OBJECT_DELETE (object); me = CMD_OBJECTS_DELETE (object);
me->so = so; me->objects = objects;
g_object_ref (G_OBJECT (so)); g_slist_foreach (me->objects, (GFunc) g_object_ref, NULL);
me->cmd.sheet = sheet_object_get_sheet (so); me->cmd.sheet = sheet_object_get_sheet (objects->data);
me->cmd.size = 1; me->cmd.size = 1;
me->cmd.cmd_descriptor = g_strdup (name ? name : _("Delete Object")); me->cmd.cmd_descriptor = g_strdup (name ? name : _("Delete Object"));
...@@ -4477,92 +4413,90 @@ cmd_object_delete (WorkbookControl *wbc, SheetObject *so, ...@@ -4477,92 +4413,90 @@ cmd_object_delete (WorkbookControl *wbc, SheetObject *so,
/******************************************************************/ /******************************************************************/
#define CMD_OBJECT_MOVE_TYPE (cmd_object_move_get_type ()) #define CMD_OBJECTS_MOVE_TYPE (cmd_objects_move_get_type ())
#define CMD_OBJECT_MOVE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CMD_OBJECT_MOVE_TYPE, CmdObjectMove)) #define CMD_OBJECTS_MOVE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CMD_OBJECTS_MOVE_TYPE, CmdObjectsMove))
typedef struct { typedef struct {
GnmCommand cmd; GnmCommand cmd;
GSList *objects;