[gnumeric] Fix Data->Filter->ShowAll for Advanced Filter. [#611079]



commit 4a55ca45d79e29d6d044bfdadd4f329e2e953dfa
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue May 4 17:48:46 2010 -0600

    Fix Data->Filter->ShowAll for Advanced Filter. [#611079]
    
    2010-05-04 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/wbc-gtk-actions.c: change argument to filter_show_all
    	* src/wbc-gtk.c (wbcg_menu_state_update): use MS_FILTER_STATE_CHANGED
    	  rather than MS_CONSOLIDATE
    	* src/workbook-control.h (MS_FILTER_STATE_CHANGED): new
    
    2010-05-04 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* filter.h (filter_show_all): require WorkbookControl rather
    	  than Sheet.
    	* filter.c (filter_show_all): require WorkbookControl rather
    	  than Sheet; update menu
    	(filter): mark rows to belong to a filter
    	(advanced_filter): update menu

 ChangeLog              |    7 +++++++
 NEWS                   |    1 +
 src/tools/ChangeLog    |    9 +++++++++
 src/tools/filter.c     |   13 +++++++++++--
 src/tools/filter.h     |    2 +-
 src/wbc-gtk-actions.c  |    2 +-
 src/wbc-gtk.c          |    2 +-
 src/workbook-control.h |    5 +++--
 8 files changed, 34 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 984b810..0099c56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/wbc-gtk-actions.c: change argument to filter_show_all
+	* src/wbc-gtk.c (wbcg_menu_state_update): use MS_FILTER_STATE_CHANGED
+	  rather than MS_CONSOLIDATE
+	* src/workbook-control.h (MS_FILTER_STATE_CHANGED): new
+	
 2010-05-03  Morten Welinder  <terra gnome org>
 
 	* src/style.c (gnm_pango_context_get): Cache the context.  (Some
diff --git a/NEWS b/NEWS
index 7bcc372..c7e897d 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Andreas:
 	* Improve date & time import from and export to ODF. [#617208]
 	* Protect against accidentally pushing data off the sheet. [#98562]
 	* Make Advanced Filter (except filter-in-place) undoable.
+	* Fix Data->Filter->ShowAll for Advanced Filter. [#611079]
 
 Jean:
 	* Implement graph only sheets. [#158170]
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index d91236c..d4d510c 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,5 +1,14 @@
 2010-05-04 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* filter.h (filter_show_all): require WorkbookControl rather 
+	  than Sheet.
+	* filter.c (filter_show_all): require WorkbookControl rather 
+	  than Sheet; update menu
+	(filter): mark rows to belong to a filter
+	(advanced_filter): update menu
+
+2010-05-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* analysis-normality.c (analysis_tool_normality_engine_run):
 	  dao_autofit_columns is not needed
 	* analysis-tools.c (summary_statistics): ditto
diff --git a/src/tools/filter.c b/src/tools/filter.c
index 450e2ac..dadd3f1 100644
--- a/src/tools/filter.c
+++ b/src/tools/filter.c
@@ -48,6 +48,10 @@ filter (data_analysis_output_t *dao, Sheet *sheet, GSList *rows,
 		sheet->has_filtered_rows = TRUE;
 		colrow_set_visibility (sheet, FALSE,
 				       FALSE, input_row_b+1, input_row_e);
+		for (i=input_row_b; i<=input_row_e; i++) {
+			ColRowInfo *ri = sheet_row_fetch (sheet, i);
+			ri->in_filter = TRUE;
+		}
 		while (rows != NULL) {
 			gint *row = (gint *) rows->data;
 			colrow_set_visibility (sheet, FALSE, TRUE, *row, *row);
@@ -135,6 +139,8 @@ advanced_filter (WorkbookControl        *wbc,
 
 	go_slist_free_custom (rows, (GFreeFunc)g_free);
 
+	wb_control_menu_state_update (wbc, MS_FILTER_STATE_CHANGED);
+
 	return analysis_tools_noerr;
 }
 
@@ -143,13 +149,14 @@ cb_show_all (GnmColRowIter const *iter, Sheet *sheet)
 {
 	if (iter->cri->in_filter && !iter->cri->visible)
 		colrow_set_visibility (sheet, FALSE, TRUE,
-			iter->pos, iter->pos);
+				       iter->pos, iter->pos);
 	return FALSE;
 }
 
 void
-filter_show_all (Sheet *sheet)
+filter_show_all (WorkbookControl *wbc)
 {
+	Sheet *sheet = wb_control_cur_sheet (wbc);
 	GSList *ptr = sheet->filters;
 	GnmFilter *filter;
 	unsigned i;
@@ -166,6 +173,8 @@ filter_show_all (Sheet *sheet)
 			(ColRowHandler) cb_show_all, sheet);
 	sheet->has_filtered_rows = FALSE;
 	sheet_redraw_all (sheet, TRUE);
+
+	wb_control_menu_state_update (wbc, MS_FILTER_STATE_CHANGED);
 }
 
 static gboolean
diff --git a/src/tools/filter.h b/src/tools/filter.h
index 49b40b4..41c16e3 100644
--- a/src/tools/filter.h
+++ b/src/tools/filter.h
@@ -9,6 +9,6 @@ gint advanced_filter (WorkbookControl        *wbc,
 		      GnmValue               *database, GnmValue *criteria,
 		      gboolean                unique_only_flag);
 
-void filter_show_all (Sheet *sheet);
+void filter_show_all (WorkbookControl *wbc);
 
 #endif
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index ac5d2b3..67f7623 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -903,7 +903,7 @@ static GNM_ACTION_DEF (cb_data_shuffle)		{ dialog_shuffle (wbcg); }
 static GNM_ACTION_DEF (cb_data_import_text)	{ gui_file_open (wbcg, "Gnumeric_stf:stf_assistant"); }
 
 static GNM_ACTION_DEF (cb_auto_filter)          { cmd_autofilter_add_remove (WORKBOOK_CONTROL (wbcg)); }
-static GNM_ACTION_DEF (cb_show_all)		{ filter_show_all (wbcg_cur_sheet (wbcg)); }
+static GNM_ACTION_DEF (cb_show_all)		{ filter_show_all (WORKBOOK_CONTROL (wbcg)); }
 static GNM_ACTION_DEF (cb_data_filter)		{ dialog_advanced_filter (wbcg); }
 static GNM_ACTION_DEF (cb_data_validate)	{ dialog_cell_format (wbcg, FD_VALIDATION); }
 static GNM_ACTION_DEF (cb_data_text_to_columns) { stf_text_to_columns (WORKBOOK_CONTROL (wbcg), GO_CMD_CONTEXT (wbcg)); }
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 655e1d0..80220ea 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -1554,7 +1554,7 @@ wbcg_menu_state_update (WorkbookControl *wbc, int flags)
 		wbc_gtk_set_action_sensitivity (wbcg, "EditNames", !has_guru);
 	if (MS_CONSOLIDATE & flags)
 		wbc_gtk_set_action_sensitivity (wbcg, "DataConsolidate", !has_guru);
-	if (MS_CONSOLIDATE & flags)
+	if (MS_FILTER_STATE_CHANGED & flags)
 		wbc_gtk_set_action_sensitivity (wbcg, "DataFilterShowAll", has_filtered_rows);
 	if (MS_SHOW_PRINTAREA & flags) {
 		GnmRange *print_area = sheet_get_nominal_printarea (sheet);
diff --git a/src/workbook-control.h b/src/workbook-control.h
index 14d7164..908a672 100644
--- a/src/workbook-control.h
+++ b/src/workbook-control.h
@@ -55,7 +55,8 @@ enum {
 	MS_FREEZE_VS_THAW   = 1 << 9,
 	MS_ADD_VS_REMOVE_FILTER = 1 << 10,
 	MS_SHOW_PRINTAREA   = 1 << 11,
-	MS_SELECT_OBJECT    = 1 << 12
+	MS_SELECT_OBJECT    = 1 << 12,
+	MS_FILTER_STATE_CHANGED = 1 << 13
 };
 
 #define MS_ALL \
@@ -63,7 +64,7 @@ enum {
      MS_SHOWHIDE_DETAIL | MS_PASTE_SPECIAL |				    \
      MS_PRINT_SETUP | MS_SEARCH_REPLACE | MS_DEFINE_NAME | MS_CONSOLIDATE | \
      MS_FREEZE_VS_THAW | MS_ADD_VS_REMOVE_FILTER | MS_SHOW_PRINTAREA |      \
-     MS_SELECT_OBJECT)
+     MS_SELECT_OBJECT | MS_FILTER_STATE_CHANGED)
 #define MS_GURU_MENU_ITEMS \
     (MS_PRINT_SETUP | MS_SEARCH_REPLACE | MS_DEFINE_NAME | MS_CONSOLIDATE)
 



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