gnumeric r17298 - in trunk: plugins/excel plugins/python-loader src



Author: mortenw
Date: Sat Apr  4 16:55:24 2009
New Revision: 17298
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17298&view=rev

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

	* src/libgnumeric.c (gnm_sheet_max_cols, gnm_sheet_max_rows):
	Remove.  All uses were wrong anyway.
	(libspreadsheet_options): Remove --columns and --rows.




Modified:
   trunk/plugins/excel/ms-excel-write.c
   trunk/plugins/python-loader/py-command-line.c
   trunk/src/gnumeric-gconf.c
   trunk/src/libgnumeric.c
   trunk/src/libgnumeric.h
   trunk/src/main-application.c
   trunk/src/sheet.c

Modified: trunk/plugins/excel/ms-excel-write.c
==============================================================================
--- trunk/plugins/excel/ms-excel-write.c	(original)
+++ trunk/plugins/excel/ms-excel-write.c	Sat Apr  4 16:55:24 2009
@@ -252,7 +252,7 @@
 			break;
 		}
 	/* include collapsed or hidden rows */
-	for (i = XLS_MaxCol ; i-- > extent->end.col ; )
+	for (i = maxcols ; i-- > extent->end.col ; )
 		if (!colrow_is_empty (sheet_col_get (sheet, i))) {
 			extent->end.col = i;
 			break;
@@ -4990,6 +4990,8 @@
 {
 	int const maxrows = MIN (biff7 ? XLS_MaxRow_V7 : XLS_MaxRow_V8,
 				 gnm_sheet_get_max_rows (sheet));
+	int const maxcols = MIN (XLS_MaxCol,
+				 gnm_sheet_get_max_cols (sheet));
 	ExcelWriteSheet *esheet = g_new0 (ExcelWriteSheet, 1);
 	GnmRange extent;
 	GSList *objs, *img;
@@ -4997,10 +4999,10 @@
 	g_return_val_if_fail (sheet, NULL);
 	g_return_val_if_fail (ewb, NULL);
 
-	esheet->col_xf = g_new (guint16, gnm_sheet_max_cols);
-	esheet->col_style = g_new (GnmStyle*, gnm_sheet_max_cols);
+	esheet->col_xf = g_new (guint16, gnm_sheet_get_max_cols (sheet));
+	esheet->col_style = g_new (GnmStyle*, gnm_sheet_get_max_cols (sheet));
 	excel_sheet_extent (sheet, &extent, esheet->col_style,
-		XLS_MaxCol, maxrows, ewb->io_context);
+			    maxcols, maxrows, ewb->io_context);
 
 	esheet->gnum_sheet = sheet;
 	esheet->streamPos  = 0x0deadbee;

Modified: trunk/plugins/python-loader/py-command-line.c
==============================================================================
--- trunk/plugins/python-loader/py-command-line.c	(original)
+++ trunk/plugins/python-loader/py-command-line.c	Sat Apr  4 16:55:24 2009
@@ -60,8 +60,9 @@
 			cline->history = g_list_append (NULL, g_strdup (text));
 			cline->history_tail = cline->history;
 		} else if (text[0] != '\0' && strcmp (text, cline->history_tail->data) != 0) {
-			g_list_append (cline->history_tail, g_strdup (text));
-			cline->history_tail = cline->history_tail->next;
+			cline->history_tail =
+				g_list_append (cline->history_tail,
+					       g_strdup (text))->next;
 		}
 		if (cline->history_size == MAX_HISTORY_SIZE) {
 			g_free (cline->history->data);

Modified: trunk/src/gnumeric-gconf.c
==============================================================================
--- trunk/src/gnumeric-gconf.c	(original)
+++ trunk/src/gnumeric-gconf.c	Sat Apr  4 16:55:24 2009
@@ -185,15 +185,11 @@
 	prefs.initial_sheet_number = go_conf_load_int (
 		root, GNM_CONF_WORKBOOK_NSHEETS, 1, 64, 3);
 	prefs.row_number = go_conf_load_int (
-		root, GNM_CONF_WORKBOOK_NROWS, GNM_DEFAULT_ROWS, GNM_MAX_ROWS, GNM_DEFAULT_ROWS);
-	while (gnm_sheet_max_rows < prefs.row_number && gnm_sheet_max_rows < GNM_MAX_ROWS)
-		gnm_sheet_max_rows <<= 1;
-	prefs.row_number = gnm_sheet_max_rows;
+		root, GNM_CONF_WORKBOOK_NROWS, GNM_MIN_ROWS, GNM_MAX_ROWS, GNM_DEFAULT_ROWS);
 	prefs.col_number = go_conf_load_int (
-		root, GNM_CONF_WORKBOOK_NCOLS, GNM_DEFAULT_COLS, GNM_MAX_COLS, GNM_DEFAULT_COLS);
-	while (gnm_sheet_max_cols < prefs.col_number && gnm_sheet_max_cols < GNM_MAX_COLS)
-		gnm_sheet_max_cols <<= 1;
-	prefs.col_number = gnm_sheet_max_cols;
+		root, GNM_CONF_WORKBOOK_NCOLS, GNM_MIN_COLS, GNM_MAX_COLS, GNM_DEFAULT_COLS);
+	gnm_sheet_suggest_size (&prefs.col_number,
+				&prefs.row_number);
 	prefs.horizontal_window_fraction = go_conf_load_double (
 		  node, GNM_CONF_GUI_WINDOW_X, .1, 1., .6);
 	prefs.vertical_window_fraction = go_conf_load_double (

Modified: trunk/src/libgnumeric.c
==============================================================================
--- trunk/src/libgnumeric.c	(original)
+++ trunk/src/libgnumeric.c	Sat Apr  4 16:55:24 2009
@@ -71,9 +71,6 @@
 /* TODO : get rid of this monstrosity */
 gboolean initial_workbook_open_complete = FALSE;
 
-int gnm_sheet_max_rows = GNM_DEFAULT_ROWS;
-int gnm_sheet_max_cols = GNM_DEFAULT_COLS;
-
 static gboolean param_show_version = FALSE;
 static char *param_lib_dir  = NULL;
 static char *param_data_dir = NULL;

Modified: trunk/src/libgnumeric.h
==============================================================================
--- trunk/src/libgnumeric.h	(original)
+++ trunk/src/libgnumeric.h	Sat Apr  4 16:55:24 2009
@@ -30,8 +30,6 @@
 /* Internal */
 int gnm_dump_func_defs (char const* filename, int dump_type); /* changes as needed */
 
-GNM_VAR_DECL int gnm_sheet_max_rows, gnm_sheet_max_cols;
-
 G_END_DECLS
 
 #endif /* _GNM_LIBGNUMERIC_H_ */

Modified: trunk/src/main-application.c
==============================================================================
--- trunk/src/main-application.c	(original)
+++ trunk/src/main-application.c	Sat Apr  4 16:55:24 2009
@@ -68,8 +68,6 @@
 static gchar  *func_state_file = NULL;
 static gchar  *geometry = NULL;
 static gchar **startup_files;
-static int rows = 0;
-static int cols = 0;
 
 static const GOptionEntry gnumeric_options [] = {
 	/*********************************
@@ -84,14 +82,6 @@
 		N_("Don't display warning dialogs when importing"),
 		NULL
 	},
-	{ "rows", 'r', 0, G_OPTION_ARG_INT, &rows,
-		N_("Minimum number of rows"),
-		NULL
-	},
-	{ "columns", 'c', 0, G_OPTION_ARG_INT, &cols,
-		N_("Minimum number of columns"),
-		NULL
-	},
 
 	/*********************************
 	 * Hidden Actions */
@@ -395,23 +385,6 @@
 	if (split_funcdocs)
 		return gnm_dump_func_defs (NULL, 2);
 
-	if (g_getenv ("GNUMERIC_SHEET_SIZE") == NULL &&
-	    (cols || rows)) {
-		g_printerr ("The \"columns\" and \"rows\" options are not enabled yet.\n");
-		cols = rows = 0;
-	}
-
-	/*
-	 * Increase gnm_sheet_max_(cols|rows) by factors of two until they are
-	 *  big enough to hold the requested number of rows.
-	 */
-	while (gnm_sheet_max_cols < cols &&
-	       gnm_sheet_max_cols <= GNM_MAX_COLS / 2)
-		gnm_sheet_max_cols <<= 1;
-	while (gnm_sheet_max_rows < rows &&
-	       gnm_sheet_max_rows <= GNM_MAX_ROWS / 2)
-		gnm_sheet_max_rows <<= 1;
-
 	/* Keep in sync with .desktop file */
 	g_set_application_name (_("Gnumeric Spreadsheet"));
 	gnm_plugins_init (GO_CMD_CONTEXT (ioc));

Modified: trunk/src/sheet.c
==============================================================================
--- trunk/src/sheet.c	(original)
+++ trunk/src/sheet.c	Sat Apr  4 16:55:24 2009
@@ -5495,7 +5495,7 @@
 {
 	if (G_UNLIKELY (!sheet)) {
 		/* FIXME: This needs to go.  */
-		return gnm_sheet_max_rows;
+		return GNM_DEFAULT_ROWS;
 	}
 
 	if (G_UNLIKELY (sheet->being_constructed))
@@ -5509,7 +5509,7 @@
 {
 	if (G_UNLIKELY (!sheet)) {
 		/* FIXME: This needs to go.  */
-		return gnm_sheet_max_cols;
+		return GNM_DEFAULT_COLS;
 	}
 
 	if (G_UNLIKELY (sheet->being_constructed))



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