Commit a534d94d authored by Morten Welinder's avatar Morten Welinder

clipboard: simplify interface for undo

With this change, a single call to clipboard_copy_ranges_undo will create
an undo object for the selection.
parent 0662f3f6
2014-05-23 Morten Welinder <terra@gnome.org>
* src/clipboard.c (clipboard_copy_ranges_undo): New function. We
need better building blocks for commands; this is one such.
2014-05-22 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/commands.c (cmd_hyperlink_undo): use posiitons rather than cells
......
......@@ -755,6 +755,29 @@ clipboard_copy_range_undo (Sheet *sheet, GnmRange const *r)
(GFreeFunc)g_free);
}
/**
* clipboard_copy_ranges_undo:
* @sheet: #Sheet
* @ranges: (element-type GnmRange) (transfer none): list of ranges
*
* Returns: (transfer full): A #GOUndo object that will restore the contents
* of the given range.
**/
GOUndo *
clipboard_copy_ranges_undo (Sheet *sheet, GSList *ranges)
{
GSList *l;
GOUndo *undo = NULL;
for (l = ranges; l != NULL; l = l->next) {
GnmRange *r = l->data;
GOUndo *undo1 = clipboard_copy_range_undo (sheet, r);
undo = go_undo_combine (undo, undo1);
}
return undo;
}
/**
* clipboard_copy_obj:
......
......@@ -85,6 +85,7 @@ GType gnm_paste_target_get_type (void);
GnmCellRegion *clipboard_copy_range (Sheet *sheet, GnmRange const *r);
GOUndo *clipboard_copy_range_undo (Sheet *sheet, GnmRange const *r);
GOUndo *clipboard_copy_ranges_undo (Sheet *sheet, GSList *ranges);
GnmCellRegion *clipboard_copy_obj (Sheet *sheet, GSList *objects);
gboolean clipboard_paste_region (GnmCellRegion const *cr,
GnmPasteTarget const *pt,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment