[gnumeric] New contextual menu item: copy a graph to a new graph sheet.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] New contextual menu item: copy a graph to a new graph sheet.
- Date: Fri, 29 Oct 2010 09:54:05 +0000 (UTC)
commit a04b6367f8647e8a239b6a3c7e903574faca9733
Author: Jean Brefort <jean brefort normalesup org>
Date: Fri Oct 29 11:55:33 2010 +0200
New contextual menu item: copy a graph to a new graph sheet.
ChangeLog | 6 ++++++
NEWS | 1 +
src/sheet-object-graph.c | 28 +++++++++++++++++++++++++++-
3 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a3ab213..c1cea86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-29 Jean Brefort <jean brefort normalesup org>
+
+ * src/sheet-object-graph.c (sog_cb_copy_to_new_sheet),
+ (gnm_sog_populate_menu): New contextual menu item: copy a graph
+ to a new graph sheet.
+
2010-10-27 Morten Welinder <terra gnome org>
* src/parser.y (parser_simple_val_or_name): Check whether a name
diff --git a/NEWS b/NEWS
index c61e29c..0c1b80a 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,7 @@ Andreas:
Jean:
* Export/import tick label rotation angle. [#629675]
* Read and write cell comments from/to OpenXML. [#630627]
+ * New contextual menu item: copy a graph to a new graph sheet.
J.H.M. Dassen (Ray):
* Revised ssconvert man page.
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index 1c1e037..c29bd3d 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -36,6 +36,8 @@
#include "application.h"
#include "sheet.h"
#include "print-info.h"
+#include "workbook.h"
+#include "workbook-view.h"
#include <graph.h>
#include <goffice/goffice.h>
@@ -365,11 +367,35 @@ sog_cb_open_in_new_window (SheetObject *so, SheetControl *sc)
}
static void
+sog_cb_copy_to_new_sheet (SheetObject *so, SheetControl *sc)
+{
+ SheetObjectGraph *sog = SHEET_OBJECT_GRAPH (so);
+ SheetControlGUI *scg = SHEET_CONTROL_GUI (sc);
+ WorkbookControl *wbc = scg_wbc (scg);
+ Sheet *sheet = wb_control_cur_sheet (wbc);
+ GogGraph *graph = GOG_GRAPH (gog_object_dup (GOG_OBJECT (sog->graph), NULL, NULL));
+ WorkbookSheetState *old_state = workbook_sheet_state_new (wb_control_get_workbook (wbc));
+ Sheet *new_sheet = workbook_sheet_add_with_type (
+ wb_control_get_workbook (wbc),
+ GNM_SHEET_OBJECT, -1,
+ gnm_sheet_get_max_cols (sheet),
+ gnm_sheet_get_max_rows (sheet));
+ SheetObject *new_sog = sheet_object_graph_new (graph);
+ print_info_set_paper_orientation (new_sheet->print_info, GTK_PAGE_ORIENTATION_LANDSCAPE);
+ sheet_object_set_sheet (new_sog, new_sheet);
+ wb_view_sheet_focus (wb_control_view (wbc), new_sheet);
+ cmd_reorganize_sheets (wbc, old_state, sheet);
+ g_object_unref (graph);
+ g_object_unref (new_sog);
+}
+
+static void
gnm_sog_populate_menu (SheetObject *so, GPtrArray *actions)
{
static SheetObjectAction const sog_actions[] = {
{ GTK_STOCK_SAVE_AS, N_("_Save as Image"), NULL, 0, sog_cb_save_as },
- { NULL, N_("Open in _New Window"), NULL, 0, sog_cb_open_in_new_window }
+ { NULL, N_("Open in _New Window"), NULL, 0, sog_cb_open_in_new_window },
+ { NULL, N_("Copy to New Graph S_heet"), NULL, 0, sog_cb_copy_to_new_sheet }
};
unsigned int i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]