gnumeric r17287 - in trunk: . plugins/corba plugins/dif plugins/html plugins/lotus-123 plugins/mps plugins/python-loader src src/dialogs



Author: mortenw
Date: Thu Apr  2 17:42:07 2009
New Revision: 17287
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17287&view=rev

Log:
2009-04-02  Morten Welinder  <terra gnome org>

	* src/workbook.c (workbook_sheet_add): Require a size.  All
	callers changed.
	(workbook_sheet_add_size): Remove.  Map all callers to
	workbook_sheet_add.



Modified:
   trunk/ChangeLog
   trunk/plugins/corba/corba-workbook.c
   trunk/plugins/dif/dif.c
   trunk/plugins/html/html_read.c
   trunk/plugins/lotus-123/lotus.c
   trunk/plugins/mps/mps.c
   trunk/plugins/python-loader/py-gnumeric.c
   trunk/src/commands.c
   trunk/src/dialogs/dialog-sheet-order.c
   trunk/src/wbc-gtk.c
   trunk/src/workbook.c
   trunk/src/workbook.h

Modified: trunk/plugins/corba/corba-workbook.c
==============================================================================
--- trunk/plugins/corba/corba-workbook.c	(original)
+++ trunk/plugins/corba/corba-workbook.c	Thu Apr  2 17:42:07 2009
@@ -119,7 +119,7 @@
 {
         WorkbookControl *wbcc = (WorkbookControl *)wbcc_from_servant (servant);
 	Workbook *wb = wb_control_get_workbook (wbcc);
-	Sheet *sheet = workbook_sheet_add (wb, -1);
+	Sheet *sheet = workbook_sheet_add (wb, -1, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 
 	SHEET_FOREACH_CONTROL(sheet, sv, sc, {
 		if (wbcc == sc_wbc (sc))

Modified: trunk/plugins/dif/dif.c
==============================================================================
--- trunk/plugins/dif/dif.c	(original)
+++ trunk/plugins/dif/dif.c	Thu Apr  2 17:42:07 2009
@@ -65,7 +65,7 @@
 
 	ctxt->line_no        = 1;
 	ctxt->line           = NULL;
-	ctxt->sheet          = workbook_sheet_add (wb, -1);
+	ctxt->sheet          = workbook_sheet_add (wb, -1, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 	ctxt->converter      = g_iconv_open ("UTF-8", "ISO-8859-1");
 
 	io_progress_message (io_context, _("Reading file..."));

Modified: trunk/plugins/html/html_read.c
==============================================================================
--- trunk/plugins/html/html_read.c	(original)
+++ trunk/plugins/html/html_read.c	Thu Apr  2 17:42:07 2009
@@ -70,11 +70,11 @@
 	if (name) {
 		sheet = workbook_sheet_by_name (wb, name);
 		if (sheet == NULL) {
-		  sheet = sheet_new (wb, name, 256, 65536);
+			sheet = sheet_new (wb, name, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 			workbook_sheet_attach (wb, sheet);
 		}
 	} else
-		sheet = workbook_sheet_add (wb, -1);
+		sheet = workbook_sheet_add (wb, -1, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 	return sheet;
 }
 

Modified: trunk/plugins/lotus-123/lotus.c
==============================================================================
--- trunk/plugins/lotus-123/lotus.c	(original)
+++ trunk/plugins/lotus-123/lotus.c	Thu Apr  2 17:42:07 2009
@@ -1509,7 +1509,7 @@
 	 * Yes, I do mean col_name.  Use that as an easy proxy for
 	 * naming the sheets similarly to lotus.
 	 */
-	Sheet *sheet = sheet_new (wb, col_name (idx), 256, 65536);
+	Sheet *sheet = sheet_new (wb, col_name (idx), GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 
 	/*
 	 * In case nothing forces a spanning, do it here so that any new
@@ -1633,7 +1633,7 @@
 	g_return_val_if_fail (i >= 0 && i <= 255, NULL);
 
 	while (i >= workbook_sheet_count (wb))
-		workbook_sheet_add (wb, -1);
+		workbook_sheet_add (wb, -1, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 
 	return workbook_sheet_by_index (wb, i);
 }

Modified: trunk/plugins/mps/mps.c
==============================================================================
--- trunk/plugins/mps/mps.c	(original)
+++ trunk/plugins/mps/mps.c	Thu Apr  2 17:42:07 2009
@@ -523,7 +523,7 @@
 	ctxt->input	     = (GsfInputTextline *)gsf_input_textline_new (input);
 	ctxt->line_no        = 1;
 	ctxt->line           = NULL;
-	ctxt->sheet          = workbook_sheet_add (wb, -1);
+	ctxt->sheet          = workbook_sheet_add (wb, -1, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 
 	ctxt->name           = NULL;
 	ctxt->rows           = NULL;

Modified: trunk/plugins/python-loader/py-gnumeric.c
==============================================================================
--- trunk/plugins/python-loader/py-gnumeric.c	(original)
+++ trunk/plugins/python-loader/py-gnumeric.c	Thu Apr  2 17:42:07 2009
@@ -1716,7 +1716,7 @@
 	if (!PyArg_ParseTuple (args, (char *) "|zi:sheet_add"))
 		return NULL;
 
-	sheet = workbook_sheet_add (self->wb, insert_before);
+	sheet = workbook_sheet_add (self->wb, insert_before, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 	if (sheet != NULL && name != NULL)
 		g_object_set (sheet, "name", name, NULL);
 	return py_new_Sheet_object (sheet);
@@ -1732,7 +1732,7 @@
 		return NULL;
 
 	if (workbook_sheet_count (self->wb) == 0)
-		(void)workbook_sheet_add (self->wb, -1);
+		(void)workbook_sheet_add (self->wb, -1, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 
 	wbcg = wbc_gtk_new (NULL, self->wb, NULL, NULL);
 	result = py_new_Gui_object (wbcg);

Modified: trunk/src/commands.c
==============================================================================
--- trunk/src/commands.c	(original)
+++ trunk/src/commands.c	Thu Apr  2 17:42:07 2009
@@ -5219,7 +5219,9 @@
 	for (i = 0; i < me->n; i++) {
 		Sheet *new_sheet;
 
-		new_sheet = workbook_sheet_add (me->sheet->workbook, -1);
+		new_sheet = workbook_sheet_add (me->sheet->workbook, -1,
+						gnm_sheet_get_max_cols (me->sheet),
+						gnm_sheet_get_max_rows (me->sheet));
 		me->sheet_list = g_slist_prepend (me->sheet_list, new_sheet);
 
 		colrow_set_states (new_sheet, TRUE, target_range.start.col, state_col);

Modified: trunk/src/dialogs/dialog-sheet-order.c
==============================================================================
--- trunk/src/dialogs/dialog-sheet-order.c	(original)
+++ trunk/src/dialogs/dialog-sheet-order.c	Thu Apr  2 17:42:07 2009
@@ -864,21 +864,22 @@
 	WorkbookSheetState *old_state;
 	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
 	Workbook *wb = wb_control_get_workbook (wbc);
-	Sheet *sheet;
+	Sheet *sheet, *old_sheet = NULL;
 
 	if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter)) {
-		Sheet *this_sheet;
-
 		gtk_tree_model_get (GTK_TREE_MODEL (state->model), &sel_iter, 
-				    SHEET_POINTER, &this_sheet,
+				    SHEET_POINTER, &old_sheet,
 				    -1);
-		index = this_sheet->index_in_wb;
-	}
+		index = old_sheet->index_in_wb;
+	} else
+		old_sheet = workbook_sheet_by_index (wb, 0);
 
 	workbook_signals_block (state);
 
 	old_state = workbook_sheet_state_new (wb);
-	workbook_sheet_add (wb, index);
+	workbook_sheet_add (wb, index,
+			    gnm_sheet_get_max_cols (old_sheet),
+			    gnm_sheet_get_max_rows (old_sheet));
 	cmd_reorganize_sheets (wbc, old_state, NULL);
 	update_undo (state, wbc);
 
@@ -906,12 +907,15 @@
 	WorkbookControl *wbc = WORKBOOK_CONTROL (state->wbcg);
 	Workbook *wb = wb_control_get_workbook (wbc);
 	GtkTreeIter iter;
-	Sheet *sheet;
+	Sheet *sheet, *old_sheet;
 
 	workbook_signals_block (state);
 
 	old_state = workbook_sheet_state_new (wb);
-	workbook_sheet_add (wb, -1);
+	old_sheet = workbook_sheet_by_index (wb, 0);
+	workbook_sheet_add (wb, -1,
+			    gnm_sheet_get_max_cols (old_sheet),
+			    gnm_sheet_get_max_rows (old_sheet));
 	cmd_reorganize_sheets (wbc, old_state, NULL);
 	update_undo (state, wbc);
 

Modified: trunk/src/wbc-gtk.c
==============================================================================
--- trunk/src/wbc-gtk.c	(original)
+++ trunk/src/wbc-gtk.c	Thu Apr  2 17:42:07 2009
@@ -402,9 +402,9 @@
 	Workbook *wb = sheet->workbook;
 	WorkbookSheetState *old_state = workbook_sheet_state_new (wb);
 	/* Use same size as current sheet.  */
-	workbook_sheet_add_sized (wb, sheet->index_in_wb,
-				  gnm_sheet_get_max_cols (sheet),
-				  gnm_sheet_get_max_rows (sheet));
+	workbook_sheet_add (wb, sheet->index_in_wb,
+			    gnm_sheet_get_max_cols (sheet),
+			    gnm_sheet_get_max_rows (sheet));
 	cmd_reorganize_sheets (wbc, old_state, sheet);
 }
 
@@ -444,7 +444,7 @@
 			break;
 		}
 		old_state = workbook_sheet_state_new (wb);
-		new_sheet = workbook_sheet_add_sized (wb, index, state.columns, state.rows);
+		new_sheet = workbook_sheet_add (wb, index, state.columns, state.rows);
 		cmd_reorganize_sheets (wbc, old_state, sheet);
 		if (state.name && strlen (state.name))
 			g_object_set (new_sheet, "name", state.name, NULL);
@@ -462,9 +462,9 @@
 	Workbook *wb = sheet->workbook;
 	WorkbookSheetState *old_state = workbook_sheet_state_new (wb);
 	/* Use same size as current sheet.  */
-	workbook_sheet_add_sized (wb, -1,
-				  gnm_sheet_get_max_cols (sheet),
-				  gnm_sheet_get_max_rows (sheet));
+	workbook_sheet_add (wb, -1,
+			    gnm_sheet_get_max_cols (sheet),
+			    gnm_sheet_get_max_rows (sheet));
 	cmd_reorganize_sheets (wbc, old_state, sheet);
 }
 
@@ -477,7 +477,7 @@
 	WorkbookSheetState *old_state = workbook_sheet_state_new (wb);
 	Sheet *new_sheet = sheet_dup (sheet);
 	workbook_sheet_attach_at_pos (wb, new_sheet, sheet->index_in_wb + 1);
-	/* See workbook_sheet_add_sized:  */
+	/* See workbook_sheet_add:  */
 	g_signal_emit_by_name (G_OBJECT (wb), "sheet_added", 0);
 	cmd_reorganize_sheets (wbc, old_state, sheet);
 	g_object_unref (new_sheet);

Modified: trunk/src/workbook.c
==============================================================================
--- trunk/src/workbook.c	(original)
+++ trunk/src/workbook.c	Thu Apr  2 17:42:07 2009
@@ -359,7 +359,7 @@
 {
 	Workbook *wb = workbook_new ();
 	while (sheet_count-- > 0)
-		workbook_sheet_add (wb, -1);
+		workbook_sheet_add (wb, -1, GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
 	go_doc_set_dirty (GO_DOC (wb), FALSE);
 	GO_DOC (wb)->pristine = TRUE;
 	return wb;
@@ -866,14 +866,7 @@
  * returned is not ref'd.  (The ref belongs to the workbook.)
  */
 Sheet *
-workbook_sheet_add (Workbook *wb, int pos)
-{
-	return workbook_sheet_add_sized (wb, pos,
-					 GNM_DEFAULT_COLS, GNM_DEFAULT_ROWS);
-}
-
-Sheet *
-workbook_sheet_add_sized (Workbook *wb, int pos, int columns, int rows)
+workbook_sheet_add (Workbook *wb, int pos, int columns, int rows)
 {
 	char *name = workbook_sheet_get_free_name (wb, _("Sheet"), TRUE, FALSE);
 	Sheet *new_sheet = sheet_new (wb, name, columns, rows);

Modified: trunk/src/workbook.h
==============================================================================
--- trunk/src/workbook.h	(original)
+++ trunk/src/workbook.h	Thu Apr  2 17:42:07 2009
@@ -23,8 +23,7 @@
 Sheet      *workbook_sheet_by_name       (Workbook const *wb, char const *sheet_name);
 void        workbook_sheet_attach        (Workbook *wb, Sheet *new_sheet);
 void        workbook_sheet_attach_at_pos (Workbook *wb, Sheet *new_sheet, int pos);
-Sheet	   *workbook_sheet_add		 (Workbook *wb, int pos);
-Sheet	   *workbook_sheet_add_sized	 (Workbook *wb, int pos, int columns, int rows);
+Sheet	   *workbook_sheet_add		 (Workbook *wb, int pos, int columns, int rows);
 void        workbook_sheet_delete        (Sheet *sheet);
 void        workbook_sheet_move          (Sheet *sheet, int direction);
 char       *workbook_sheet_get_free_name (Workbook *wb,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]