Commit ba9839f5 authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow
Browse files

when deleting text to add new text don't emit a signal partially through

2002-02-05  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* gnumeric-expr-entry.c (update_rangesel_text) : when deleting
	  text to add new text don't emit a signal partially through
	  the process.

2002-02-05  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* goalseek.glade : remove hbox from active-area
	* cell-sort.glade : add add and delete buttons (currently
	  inactive)
	* dialog-cell-sort.c :  add add and delete buttons (currently
	  inactive), set initial top-bottom vs left-right depending on
	  shape of initial selection, add only MAX_INITIAL_CLAUSES to the
	  list of available clauses (to avoid adding 65000+ if a complete
	  column is selected).
parent cb580c18
......@@ -8,7 +8,7 @@
<property name="type">GTK_WINDOW_DIALOG</property>
<property name="modal">no</property>
<property name="allow_shrink">no</property>
<property name="allow_grow">no</property>
<property name="allow_grow">yes</property>
<property name="window-position">GTK_WIN_POS_CENTER</property>
<child internal-child="vbox">
......@@ -115,7 +115,7 @@
<child>
<widget class="GtkScrolledWindow" id="scrolled_cell_sort_list">
<property name="width_request">400</property>
<property name="width_request">300</property>
<property name="height_request">200</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
......@@ -188,6 +188,58 @@
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">1</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkButton" id="add_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-add</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<widget class="GtkButton" id="delete_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-delete</property>
<property name="use_stock">True</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
......@@ -38,6 +38,9 @@
#define CELL_SORT_KEY "cell-sort-dialog"
#define MAX_INITIAL_CLAUSES 32
#warning we need to add a way to add clauses
typedef struct {
Sheet *sheet;
WorkbookControlGUI *wbcg;
......@@ -51,11 +54,14 @@ typedef struct {
GtkWidget *help_button;
GtkWidget *up_button;
GtkWidget *down_button;
GtkWidget *add_button;
GtkWidget *delete_button;
GnumericExprEntry *range_entry;
GtkListStore *model;
GtkTreeView *treeview;
GtkTreeSelection *selection;
GtkWidget *cell_sort_row_rb;
GtkWidget *cell_sort_col_rb;
GtkWidget *cell_sort_header_check;
Value *sel;
......@@ -135,19 +141,15 @@ translate_range (Value *range, SortFlowState *state)
gboolean old_is_cols = state->is_cols;
state->header = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (state->cell_sort_header_check));;
GTK_TOGGLE_BUTTON (state->cell_sort_header_check));
state->is_cols = !gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (state->cell_sort_row_rb));;
GTK_TOGGLE_BUTTON (state->cell_sort_row_rb));
if (state->sel == NULL) {
state->sel = range;
return TRUE;
}
#warning FIXME:
#warning the next check is completely useless since the expr entry widget always
#warning first set the widget to empty and then to the right content, causing 2 signals!
if (old_header != state->header || old_is_cols != state->is_cols ||
state->sel->v_range.cell.a.sheet != range->v_range.cell.a.sheet ||
state->sel->v_range.cell.a.col != range->v_range.cell.a.col ||
......@@ -189,6 +191,9 @@ load_model_data (SortFlowState *state)
gtk_list_store_clear (state->model);
state->sort_items = 0;
if (end >= start + MAX_INITIAL_CLAUSES)
end = start + MAX_INITIAL_CLAUSES - 1;
for (i = start; i <= end; i++) {
str = state->is_cols
? col_row_name (sheet, i, index, state->header, TRUE)
......@@ -234,7 +239,6 @@ cb_update_sensitivity (GtkWidget *dummy, SortFlowState *state)
state->sort_items = 0;
}
gtk_widget_set_sensitive (state->ok_button, FALSE);
fprintf (stderr, "Range is NULL\n");
} else {
if (translate_range (range, state))
load_model_data (state);
......@@ -364,10 +368,22 @@ dialog_load_selection (SortFlowState *state)
first = selection_first_range (state->sheet, NULL, NULL);
if (first != NULL) {
/* gtk_toggle_button_set_active ( */
/* GTK_TOGGLE_BUTTON (state->cell_sort_row_rb), */
/* FALSE); */
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);
name = global_range_name (state->sheet, first);
gtk_entry_set_text (GTK_ENTRY (state->range_entry), name);
g_free (name);
}
} else
/* gtk_toggle_button_set_active ( */
/* GTK_TOGGLE_BUTTON (state->cell_sort_row_rb), */
/* FALSE); */
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (state->cell_sort_col_rb),
TRUE);
}
static gint
......@@ -416,6 +432,7 @@ cb_sort_selection_changed (GtkTreeSelection *ignored, SortFlowState *state)
gtk_widget_set_sensitive (state->down_button,
gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (state->model),
&this_iter, NULL, row+1));
gtk_widget_set_sensitive (state->delete_button, FALSE);
}
static void
......@@ -616,6 +633,7 @@ dialog_init (SortFlowState *state)
/* Set-up other widgets */
state->cell_sort_row_rb = glade_xml_get_widget (state->gui, "cell_sort_row_rb");
state->cell_sort_col_rb = glade_xml_get_widget (state->gui, "cell_sort_col_rb");
gtk_signal_connect (GTK_OBJECT (state->cell_sort_row_rb), "toggled",
GTK_SIGNAL_FUNC (cb_update_sensitivity), state);
......@@ -634,6 +652,11 @@ dialog_init (SortFlowState *state)
gtk_signal_connect (GTK_OBJECT (state->down_button),
"clicked",
GTK_SIGNAL_FUNC (cb_down), state);
state->add_button = glade_xml_get_widget (state->gui, "add_button");
gtk_widget_set_sensitive (state->add_button, FALSE);
state->delete_button = glade_xml_get_widget (state->gui, "delete_button");
gtk_widget_set_sensitive (state->delete_button, FALSE);
state->help_button = glade_xml_get_widget (state->gui, "help_button");
gtk_signal_connect (GTK_OBJECT (state->help_button), "clicked",
GTK_SIGNAL_FUNC (cb_dialog_help), "cell-sort.html");
......
......@@ -25,12 +25,6 @@
<property name="spacing">5</property>
<property name="visible">yes</property>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox3">
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">8</property>
<property name="visible">yes</property>
<child>
<widget class="GtkButton" id="applybutton">
<property name="can_default">yes</property>
......@@ -79,13 +73,6 @@
<property name="use_underline">yes</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">yes</property>
<property name="fill">yes</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
2002-02-05 Andreas J. Guelzow <aguelzow@taliesin.ca>
* gnumeric-expr-entry.c (update_rangesel_text) : when deleting
text to add new text don't emit a signal partially through
the process.
2002-01-30 Jody Goldberg <jody@gnome.org>
* widget-editable-label.c (el_init) : delete to work around a change
......
......@@ -142,10 +142,18 @@ update_rangesel_text (GnumericExprEntry *expr_entry)
int len;
char *text = make_rangesel_text (expr_entry);
if (rs->text_end > rs->text_start) {
gtk_editable_delete_text (editable,
rs->text_start,
rs->text_end);
if (text == NULL)
gtk_editable_delete_text (editable,
rs->text_start,
rs->text_end);
else
/* We don't call gtk_editable_delete_text since we don't want */
/* to emit a signal yet */
GTK_EDITABLE_GET_CLASS (expr_entry)->delete_text (editable,
rs->text_start,
rs->text_end);
rs->text_end = rs->text_start;
gtk_editable_set_position (GTK_EDITABLE (expr_entry), rs->text_end);
} else
......
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