Commit 23a9d0da authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Let the sort dialog guess whether there is a header

2009-06-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* dialog-cell-sort.c (dialog_load_selection): return info about
	  the selection
	(dialog_init): use sheet_range_has_heading
	* dialog-preferences.c (pref_sort_page_initializer): remove "Sort
	  Area Has a HEADER" button.

2009-06-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* schemas/gnumeric-general.schemas.in: remove sort header default
	* src/GNOME_Gnumeric-gtk.xml.in move preferences menu item
	* src/gnumeric-gconf.h: remove sort_default_has_header
	* src/gnumeric-gconf.c: remove sort_default_has_header
	(gnm_gconf_set_sort_has_header): deleted
	* src/wbc-gtk-actions.c: sort_by_rows, trust the automatic
	  detection and don't try to use the default too
	(actions): move preferences, goto and fill menus
parent d359d622
2009-06-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* schemas/gnumeric-general.schemas.in: remove sort header default
* src/GNOME_Gnumeric-gtk.xml.in move preferences menu item
* src/gnumeric-gconf.h: remove sort_default_has_header
* src/gnumeric-gconf.c: remove sort_default_has_header
(gnm_gconf_set_sort_has_header): deleted
* src/wbc-gtk-actions.c: sort_by_rows, trust the automatic
detection and don't try to use the default too
(actions): move preferences, goto and fill menus
2009-06-11 Morten Welinder <terra@gnome.org>
* src/stf-parse.c (stf_parse_fixed_line): Make sure we have the
......
......@@ -16,6 +16,8 @@ Andreas:
* Added Tests for Independence and Homogeneity
* Make imported manual page breaks work
* Improve print area handling and export to ODF
* Some minor menu rearrangement
* Let the sort dialog guess whether there is a header
Jody:
* GOString start of richtext and phonetic support.
......
......@@ -338,17 +338,6 @@ they are also processed at that time. If `lag' is negative, then recalculation h
<long>Before an existing file is being overwritten, gnumeric will present a warning dialog. Setting this option will make the overwrite button in that dialog the default button.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/sort/default/has-header</key>
<applyto>/apps/gnumeric/core/sort/default/has-header</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Sort Area Has Header</short>
<long>Setting this option will cause the sort buttons on the toolbar to assume that the area to be sorted has a header and determine the initial state of the has-header checkbox in the sort dialog.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/core/sort/default/by-case</key>
<applyto>/apps/gnumeric/core/sort/default/by-case</applyto>
......
......@@ -19,7 +19,6 @@
<separator name="file-sep3"/>
<menuitem action="FileSend"/>
<menuitem action="FileMetaData"/>
<menuitem action="FilePreferences"/>
<separator name="file-sep4"/>
<placeholder name="FileHistory" />
<menuitem action="FileHistoryFull"/>
......@@ -37,13 +36,6 @@
<menuitem action="EditPasteSpecial"/>
<!--TODO menuitem action="EditPasteLink" -->
<separator name="edit-sep2"/>
<menu name="Fill" action="MenuEditFill">
<menuitem action="EditFillAutofill"/>
<menuitem action="ToolsMerge"/>
<menuitem action="ToolsTabulate"/>
<menuitem action="EditFillSeries"/>
<menuitem action="RandomGenerator"/>
</menu>
<menu name="Clear" action="MenuEditClear">
<menuitem action="EditClearAll"/>
<menuitem action="EditClearFormats"/>
......@@ -58,7 +50,6 @@
<separator name="edit-sep3"/>
<menuitem action="EditFind"/>
<menuitem action="EditReplace"/>
<menuitem action="EditGoto"/>
<separator name="edit-sep4"/>
<menu name="EditSheet" action="MenuEditSheet">
<menuitem action="SheetReorder"/>
......@@ -77,9 +68,13 @@
<menuitem action="EditSelectArray"/>
<menuitem action="EditSelectDepends"/>
<menuitem action="EditSelectInputs"/>
<separator name="edit-sep5"/>
<menuitem action="EditGoto"/>
</menu>
<menuitem action="EditRecalc"/>
<placeholder name="ops"/>
<separator name="edit-sep6"/>
<menuitem action="EditPreferences"/>
</menu>
<menu name="View" action="MenuView">
<menuitem action="ViewNew"/>
......@@ -147,7 +142,6 @@
<menuitem action="SheetDirection"/>
</menu>
<menuitem action="FormatWorkbook"/>
<menuitem action="FilePreferences"/>
<menuitem action="FormatAuto"/>
</menu>
<menu name="Tools" action="MenuTools">
......@@ -199,6 +193,13 @@
</menu>
<menu name="Data" action="MenuData">
<menuitem action="DataSort"/>
<menu name="Fill" action="MenuEditFill">
<menuitem action="EditFillAutofill"/>
<menuitem action="ToolsMerge"/>
<menuitem action="ToolsTabulate"/>
<menuitem action="EditFillSeries"/>
<menuitem action="RandomGenerator"/>
</menu>
<menu name="Filter" action="MenuFilter">
<menuitem action="DataAutoFilter"/>
<menuitem action="DataFilterShowAll"/>
......
2009-06-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* dialog-cell-sort.c (dialog_load_selection): return info about
the selection
(dialog_init): use sheet_range_has_heading
* dialog-preferences.c (pref_sort_page_initializer): remove "Sort
Area Has a HEADER" button.
2009-06-09 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* dialog-printer-setup.c (load_print_area) adjust for changes in
......
......@@ -514,8 +514,8 @@ cb_dialog_cancel_clicked (G_GNUC_UNUSED GtkWidget *button,
gtk_widget_destroy (state->dialog);
}
static void
dialog_load_selection (SortFlowState *state)
static GnmRange const *
dialog_load_selection (SortFlowState *state, gboolean *col_rb)
{
GnmRange const *first;
......@@ -524,13 +524,14 @@ dialog_load_selection (SortFlowState *state)
if (first != NULL) {
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (state->cell_sort_col_rb),
first->end.row - first->start.row > first->end.col - first->start.col);
(*col_rb = (first->end.row - first->start.row > first->end.col - first->start.col)));
gnm_expr_entry_load_from_range (state->range_entry,
state->sheet, first);
} else
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (state->cell_sort_col_rb),
TRUE);
(*col_rb = TRUE));
return first;
}
/**
......@@ -874,6 +875,8 @@ dialog_init (SortFlowState *state)
GtkWidget *scrolled;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
gboolean col_rb;
GnmRange const *range;
table = GTK_TABLE (glade_xml_get_widget (state->gui, "cell_sort_options_table"));
/* setup range entry */
......@@ -994,8 +997,6 @@ dialog_init (SortFlowState *state)
state->cell_sort_header_check = glade_xml_get_widget (state->gui,
"cell_sort_header_check");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->cell_sort_header_check),
gnm_app_prefs->sort_default_has_header);
g_signal_connect_swapped (G_OBJECT (state->cell_sort_header_check),
"toggled",
G_CALLBACK (cb_sort_header_check), state);
......@@ -1059,9 +1060,12 @@ dialog_init (SortFlowState *state)
g_object_set_data_full (G_OBJECT (state->dialog),
"state", state, (GDestroyNotify) cb_dialog_destroy);
cb_sort_selection_changed (state);
dialog_load_selection (state);
cb_update_sensitivity (state);
range = dialog_load_selection (state, &col_rb);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->cell_sort_header_check),
sheet_range_has_heading (state->sheet, range, col_rb, FALSE));
cb_sort_header_check (state);
cb_update_sensitivity (state);
gnm_expr_entry_grab_focus(GNM_EXPR_ENTRY (state->add_entry), TRUE);
}
......
......@@ -582,10 +582,6 @@ pref_sort_page_initializer (PrefState *state,
page, row++,
gnm_gconf_set_sort_ascending,
_("Sort Ascending"));
bool_pref_create_widget (node, GNM_CONF_SORT_DEFAULT_HAS_HEADER,
page, row++,
gnm_gconf_set_sort_has_header,
_("Sort Area Has a HEADER"));
go_conf_free_node (node);
gtk_widget_show_all (page);
......
......@@ -345,8 +345,6 @@ gnm_conf_init_extras (void)
node = go_conf_get_node (root, GNM_CONF_SORT_DIR);
prefs.sort_default_by_case = go_conf_load_bool (
node, GNM_CONF_SORT_DEFAULT_BY_CASE, FALSE);
prefs.sort_default_has_header = go_conf_load_bool (
node, GNM_CONF_SORT_DEFAULT_HAS_HEADER, FALSE);
prefs.sort_default_retain_formats = go_conf_load_bool (
node, GNM_CONF_SORT_DEFAULT_RETAIN_FORM, TRUE);
prefs.sort_default_ascending = go_conf_load_bool (
......@@ -925,14 +923,6 @@ gnm_gconf_set_sort_by_case (gboolean val)
root, GNM_CONF_SORT_DIR "/" GNM_CONF_SORT_DEFAULT_BY_CASE, val != FALSE);
}
void
gnm_gconf_set_sort_has_header (gboolean val)
{
prefs.sort_default_has_header = val;
go_conf_set_bool (
root, GNM_CONF_SORT_DIR "/" GNM_CONF_SORT_DEFAULT_HAS_HEADER, val != FALSE);
}
void
gnm_gconf_set_sort_ascending (gboolean val)
{
......
......@@ -50,7 +50,6 @@ typedef struct {
gboolean file_overwrite_default_answer;
gboolean file_ask_single_sheet_save;
gboolean sort_default_has_header;
gboolean sort_default_by_case;
gboolean sort_default_retain_formats;
gboolean sort_default_ascending;
......@@ -185,7 +184,6 @@ void gnm_gconf_set_hf_font (GnmStyle const *mstyle);
/* sorting */
void gnm_gconf_set_sort_dialog_max_initial (gint value);
void gnm_gconf_set_sort_retain_form (gboolean value);
void gnm_gconf_set_sort_has_header (gboolean value);
void gnm_gconf_set_sort_by_case (gboolean value);
void gnm_gconf_set_sort_ascending (gboolean value);
......
......@@ -1132,12 +1132,6 @@ sort_by_rows (WBCGtk *wbcg, gboolean descending)
sel = gnm_range_dup (tmp);
range_clip_to_finite (sel, sv_sheet (sv));
if (gnm_app_prefs->sort_default_has_header) {
sel->start.row++;
if (sel->start.row > sel->end.row)
return;
}
numclause = range_width (sel);
clause = g_new0 (GnmSortClause, numclause);
for (i = 0; i < numclause; i++) {
......@@ -1792,9 +1786,6 @@ static GtkActionEntry const actions[] = {
{ "FileMetaData", GTK_STOCK_PROPERTIES, N_("Proper_ties..."),
NULL, N_("Edit descriptive information"),
G_CALLBACK (cb_doc_meta_data) },
{ "FilePreferences", GTK_STOCK_PREFERENCES, N_("Pre_ferences..."),
NULL, N_("Change Gnumeric Preferences"),
G_CALLBACK (cb_file_preferences) },
{ "FileHistoryFull", NULL, N_("Full _History..."),
NULL, N_("Access previously used file"),
G_CALLBACK (cb_file_history_full) },
......@@ -1846,46 +1837,32 @@ static GtkActionEntry const actions[] = {
* gnm-pane.c:gnm_pane_key_mode_sheet
* with the rest of the key movement and rangeselection.
* Otherwise input methods would steal them */
{ "EditSelectAll", NULL, N_("Select _All"),
{ "EditSelectAll", NULL, N_("_All"),
"<control><shift>space", N_("Select all cells in the spreadsheet"),
G_CALLBACK (cb_edit_select_all) },
/* A duplicate that should not go into the menus, used only for the accelerator */
{ "EditSelectAllXL", NULL, N_("Select _All"),
{ "EditSelectAllXL", NULL, N_("_All"),
"<control>a", N_("Select all cells in the spreadsheet"),
G_CALLBACK (cb_edit_select_all) },
{ "EditSelectColumn", NULL, N_("Select _Column"),
{ "EditSelectColumn", NULL, N_("_Column"),
"<control>space", N_("Select an entire column"),
G_CALLBACK (cb_edit_select_col) },
{ "EditSelectRow", NULL, N_("Select _Row"),
{ "EditSelectRow", NULL, N_("_Row"),
"<shift>space", N_("Select an entire row"),
G_CALLBACK (cb_edit_select_row) },
{ "EditSelectArray", NULL, N_("Select Arra_y"),
{ "EditSelectArray", NULL, N_("Arra_y"),
"<control>slash", N_("Select an array of cells"),
G_CALLBACK (cb_edit_select_array) },
{ "EditSelectDepends", NULL, N_("Select _Depends"),
{ "EditSelectDepends", NULL, N_("_Depends"),
"<control>bracketright", N_("Select all the cells that depend on the current edit cell"),
G_CALLBACK (cb_edit_select_depends) },
{ "EditSelectInputs", NULL, N_("Select _Inputs"),
{ "EditSelectInputs", NULL, N_("_Inputs"),
"<control>bracketleft", N_("Select all the cells are used by the current edit cell"),
G_CALLBACK (cb_edit_select_inputs) },
/* Edit -> Fill */
{ "EditFillAutofill", NULL, N_("Auto_fill"),
NULL, N_("Automatically fill the current selection"),
G_CALLBACK (cb_edit_fill_autofill) },
{ "ToolsMerge", NULL, N_("_Merge..."),
NULL, N_("Merges columnar data into a sheet creating duplicate sheets for each row"),
G_CALLBACK (cb_tools_merge) },
{ "ToolsTabulate", NULL, N_("_Tabulate Dependency..."),
NULL, N_("Make a table of a cell's value as a function of other cells"),
G_CALLBACK (cb_tools_tabulate) },
{ "EditFillSeries", NULL, N_("_Series..."),
NULL, N_("Fill according to a linear or exponential series"),
G_CALLBACK (cb_edit_fill_series) },
{ "RandomGenerator", NULL, N_("_Random Generator..."),
NULL, N_("Generate random numbers of a selection of distributions"),
G_CALLBACK (cb_tools_random_generator) },
{ "EditGoto", GTK_STOCK_JUMP_TO, N_("_Goto cell..."),
"<control>G", N_("Jump to a specified cell"),
G_CALLBACK (cb_edit_goto) },
/* Edit -> Sheet */
{ "SheetReorder", NULL, N_("_Manage Sheets..."),
......@@ -1932,14 +1909,15 @@ static GtkActionEntry const actions[] = {
{ "EditReplace", GTK_STOCK_FIND_AND_REPLACE, N_("R_eplace..."),
"<control>H", N_("Search for something and replace it with something else"),
G_CALLBACK (cb_edit_search_replace) },
{ "EditGoto", GTK_STOCK_JUMP_TO, N_("_Goto cell..."),
"<control>G", N_("Jump to a specified cell"),
G_CALLBACK (cb_edit_goto) },
{ "EditRecalc", NULL, N_("Recalculate"),
"F9", N_("Recalculate the spreadsheet"),
G_CALLBACK (cb_edit_recalc) },
{ "EditPreferences", GTK_STOCK_PREFERENCES, N_("Preferences..."),
NULL, N_("Change Gnumeric Preferences"),
G_CALLBACK (cb_file_preferences) },
/* View */
{ "ViewNew", GTK_STOCK_NEW, N_("_New View..."),
NULL, N_("Create a new view of the workbook"),
......@@ -2186,6 +2164,24 @@ static GtkActionEntry const actions[] = {
NULL, N_("Create a Data Table to evaluate a function with multiple inputs"),
G_CALLBACK (cb_data_table) },
/* Data -> Fill */
{ "EditFillAutofill", NULL, N_("Auto_fill"),
NULL, N_("Automatically fill the current selection"),
G_CALLBACK (cb_edit_fill_autofill) },
{ "ToolsMerge", NULL, N_("_Merge..."),
NULL, N_("Merges columnar data into a sheet creating duplicate sheets for each row"),
G_CALLBACK (cb_tools_merge) },
{ "ToolsTabulate", NULL, N_("_Tabulate Dependency..."),
NULL, N_("Make a table of a cell's value as a function of other cells"),
G_CALLBACK (cb_tools_tabulate) },
{ "EditFillSeries", NULL, N_("_Series..."),
NULL, N_("Fill according to a linear or exponential series"),
G_CALLBACK (cb_edit_fill_series) },
{ "RandomGenerator", NULL, N_("_Random Generator..."),
NULL, N_("Generate random numbers of a selection of distributions"),
G_CALLBACK (cb_tools_random_generator) },
/* Data -> Outline */
{ "DataOutlineHideDetail", "Gnumeric_HideDetail", N_("_Hide Detail"),
NULL, N_("Collapse an outline group"),
......
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