Commit eff5af9d authored by Jon K Hellan's avatar Jon K Hellan Committed by Jon Kåre Hellan
Browse files

Put "cell_changed" signal back in.

2000-04-09  Jon K Hellan  <hellan@acm.org>

	* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
	signal back in.

	* src/sheet.c (sheet_load_cell_val): Ditto.

2000-04-09  Jon K Hellan  <hellan@acm.org>

	* gtk-combo-text.[ch]: Fix problem with mouseover: Mouseover from
	last time popup was up persists if popup was last dismissed with
	Escape.

	* gtk-combo-text.h (_GtkComboText): Add member to remember which
	entry widget we are caching.

	* gtk-combo-text.c (gtk_combo_text_destroy): Disconnect
	cb_pop_down.
	(cb_enter): Remember which entry widget we are caching.
	(cb_pop_down): New callback function. Forget cached entry widget.
	(gtk_combo_text_construct): Note that we're not yet caching any
	entry widget.
	(gtk_combo_text_new): Connect cb_pop_down to pop_down_done.

	* gtk-combo-box.c (gtk_combo_popup_tear_off): Add missing cast to
	kill warning.
	(gtk_combo_tearoff_bg_copy): It's not in use. #ifdef 0 it, and add
	comment about when it would be needed.
	(gtk_combo_popup_reparent): Add FIXME comment about code which
	isn't used, but will be needed.
parent 09613e12
2000-04-09 Jon K Hellan <hellan@acm.org>
* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
signal back in.
* src/sheet.c (sheet_load_cell_val): Ditto.
2000-04-06 Michael Meeks <michael@helixcode.com>
* src/sheet-style.c (sheet_style_relocate): use range_translate to
......
2000-04-09 Jon K Hellan <hellan@acm.org>
* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
signal back in.
* src/sheet.c (sheet_load_cell_val): Ditto.
2000-04-06 Michael Meeks <michael@helixcode.com>
* src/sheet-style.c (sheet_style_relocate): use range_translate to
......
2000-04-09 Jon K Hellan <hellan@acm.org>
* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
signal back in.
* src/sheet.c (sheet_load_cell_val): Ditto.
2000-04-06 Michael Meeks <michael@helixcode.com>
* src/sheet-style.c (sheet_style_relocate): use range_translate to
......
2000-04-09 Jon K Hellan <hellan@acm.org>
* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
signal back in.
* src/sheet.c (sheet_load_cell_val): Ditto.
2000-04-06 Michael Meeks <michael@helixcode.com>
* src/sheet-style.c (sheet_style_relocate): use range_translate to
......
2000-04-09 Jon K Hellan <hellan@acm.org>
* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
signal back in.
* src/sheet.c (sheet_load_cell_val): Ditto.
2000-04-06 Michael Meeks <michael@helixcode.com>
* src/sheet-style.c (sheet_style_relocate): use range_translate to
......
2000-04-09 Jon K Hellan <hellan@acm.org>
* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
signal back in.
* src/sheet.c (sheet_load_cell_val): Ditto.
2000-04-06 Michael Meeks <michael@helixcode.com>
* src/sheet-style.c (sheet_style_relocate): use range_translate to
......
2000-04-09 Jon K Hellan <hellan@acm.org>
* src/workbook.[ch] (workbook_class_init): Put "cell_changed"
signal back in.
* src/sheet.c (sheet_load_cell_val): Ditto.
2000-04-06 Michael Meeks <michael@helixcode.com>
* src/sheet-style.c (sheet_style_relocate): use range_translate to
......
......@@ -31,7 +31,9 @@ static void gtk_combo_popup_reparent (GtkWidget *popup, GtkWidget *new_parent,
gboolean unrealize);
static gboolean cb_popup_delete (GtkWidget *w, GdkEventAny *event,
GtkComboBox *combo);
#if 0
static void gtk_combo_tearoff_bg_copy (GtkComboBox *combo);
#endif
enum {
POP_DOWN_WIDGET,
......@@ -466,7 +468,8 @@ gtk_combo_popup_tear_off (GtkComboBox *combo)
FALSE, TRUE, FALSE);
gtk_window_set_transient_for
(GTK_WINDOW (tearoff),
GTK_WINDOW (gtk_widget_get_toplevel (combo)));
GTK_WINDOW (gtk_widget_get_toplevel
GTK_WIDGET (combo)));
}
if (GTK_WIDGET_VISIBLE (combo->priv->popup)) {
......@@ -524,7 +527,12 @@ gtk_combo_set_tearoff_state (GtkComboBox *combo,
* Copy popup background to the tearoff window.
*
* Compare with gtk_menu_tearoff_bg_copy in gtk/gtkmenu.c
*
* FIXME:
* This is not used, but will be necessary when we make behaviour more
* consistent with tearoff menus.
*/
#if 0
static void
gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
{
......@@ -558,6 +566,7 @@ gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
gdk_pixmap_unref (pixmap);
}
}
#endif
/**
* gtk_combo_popup_reparent
......@@ -568,6 +577,10 @@ gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
* Reparent the popup, taking care of the refcounting
*
* Compare with gtk_menu_reparent in gtk/gtkmenu.c
*
* FIXME:
* The 'unrealize = TRUE' branch is unnecessary unless we decide to make it
* possible to reattach the popup to the combo.
*/
static void
gtk_combo_popup_reparent (GtkWidget *popup,
......
......@@ -1040,6 +1040,7 @@ sheet_load_cell_val (Sheet const *sheet)
{
GtkEntry *entry;
Cell *cell;
char *text;
g_return_if_fail (sheet != NULL);
g_return_if_fail (IS_SHEET (sheet));
......@@ -1049,12 +1050,20 @@ sheet_load_cell_val (Sheet const *sheet)
sheet->cursor.edit_pos.col,
sheet->cursor.edit_pos.row);
if (cell) {
char *text = cell_get_text (cell);
gtk_entry_set_text (entry, text);
g_free (text);
} else
gtk_entry_set_text (entry, "");
if (cell)
text = cell_get_text (cell);
else
text = g_strdup ("");
gtk_entry_set_text (entry, text);
/* This is intended for screen reading software etc. */
gtk_signal_emit_by_name (GTK_OBJECT (sheet->workbook), "cell_changed",
sheet, text,
sheet->cursor.edit_pos.col,
sheet->cursor.edit_pos.row);
g_free (text);
}
/**
......
2000-04-09 Jon K Hellan <hellan@acm.org>
* gtk-combo-text.[ch]: Fix problem with mouseover: Mouseover from
last time popup was up persists if popup was last dismissed with
Escape.
* gtk-combo-text.h (_GtkComboText): Add member to remember which
entry widget we are caching.
* gtk-combo-text.c (gtk_combo_text_destroy): Disconnect
cb_pop_down.
(cb_enter): Remember which entry widget we are caching.
(cb_pop_down): New callback function. Forget cached entry widget.
(gtk_combo_text_construct): Note that we're not yet caching any
entry widget.
(gtk_combo_text_new): Connect cb_pop_down to pop_down_done.
* gtk-combo-box.c (gtk_combo_popup_tear_off): Add missing cast to
kill warning.
(gtk_combo_tearoff_bg_copy): It's not in use. #ifdef 0 it, and add
comment about when it would be needed.
(gtk_combo_popup_reparent): Add FIXME comment about code which
isn't used, but will be needed.
2000-04-07 Morten Welinder <terra@diku.dk>
* widget-pixmap-combo.c (pixmap_combo_destroy): Unref, not destroy.
......
......@@ -31,7 +31,9 @@ static void gtk_combo_popup_reparent (GtkWidget *popup, GtkWidget *new_parent,
gboolean unrealize);
static gboolean cb_popup_delete (GtkWidget *w, GdkEventAny *event,
GtkComboBox *combo);
#if 0
static void gtk_combo_tearoff_bg_copy (GtkComboBox *combo);
#endif
enum {
POP_DOWN_WIDGET,
......@@ -466,7 +468,8 @@ gtk_combo_popup_tear_off (GtkComboBox *combo)
FALSE, TRUE, FALSE);
gtk_window_set_transient_for
(GTK_WINDOW (tearoff),
GTK_WINDOW (gtk_widget_get_toplevel (combo)));
GTK_WINDOW (gtk_widget_get_toplevel
GTK_WIDGET (combo)));
}
if (GTK_WIDGET_VISIBLE (combo->priv->popup)) {
......@@ -524,7 +527,12 @@ gtk_combo_set_tearoff_state (GtkComboBox *combo,
* Copy popup background to the tearoff window.
*
* Compare with gtk_menu_tearoff_bg_copy in gtk/gtkmenu.c
*
* FIXME:
* This is not used, but will be necessary when we make behaviour more
* consistent with tearoff menus.
*/
#if 0
static void
gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
{
......@@ -558,6 +566,7 @@ gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
gdk_pixmap_unref (pixmap);
}
}
#endif
/**
* gtk_combo_popup_reparent
......@@ -568,6 +577,10 @@ gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
* Reparent the popup, taking care of the refcounting
*
* Compare with gtk_menu_reparent in gtk/gtkmenu.c
*
* FIXME:
* The 'unrealize = TRUE' branch is unnecessary unless we decide to make it
* possible to reattach the popup to the combo.
*/
static void
gtk_combo_popup_reparent (GtkWidget *popup,
......
......@@ -31,7 +31,9 @@ static void gtk_combo_popup_reparent (GtkWidget *popup, GtkWidget *new_parent,
gboolean unrealize);
static gboolean cb_popup_delete (GtkWidget *w, GdkEventAny *event,
GtkComboBox *combo);
#if 0
static void gtk_combo_tearoff_bg_copy (GtkComboBox *combo);
#endif
enum {
POP_DOWN_WIDGET,
......@@ -466,7 +468,8 @@ gtk_combo_popup_tear_off (GtkComboBox *combo)
FALSE, TRUE, FALSE);
gtk_window_set_transient_for
(GTK_WINDOW (tearoff),
GTK_WINDOW (gtk_widget_get_toplevel (combo)));
GTK_WINDOW (gtk_widget_get_toplevel
GTK_WIDGET (combo)));
}
if (GTK_WIDGET_VISIBLE (combo->priv->popup)) {
......@@ -524,7 +527,12 @@ gtk_combo_set_tearoff_state (GtkComboBox *combo,
* Copy popup background to the tearoff window.
*
* Compare with gtk_menu_tearoff_bg_copy in gtk/gtkmenu.c
*
* FIXME:
* This is not used, but will be necessary when we make behaviour more
* consistent with tearoff menus.
*/
#if 0
static void
gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
{
......@@ -558,6 +566,7 @@ gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
gdk_pixmap_unref (pixmap);
}
}
#endif
/**
* gtk_combo_popup_reparent
......@@ -568,6 +577,10 @@ gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
* Reparent the popup, taking care of the refcounting
*
* Compare with gtk_menu_reparent in gtk/gtkmenu.c
*
* FIXME:
* The 'unrealize = TRUE' branch is unnecessary unless we decide to make it
* possible to reattach the popup to the combo.
*/
static void
gtk_combo_popup_reparent (GtkWidget *popup,
......
......@@ -6,6 +6,9 @@
static GtkObjectClass *gtk_combo_text_parent_class;
static gboolean cb_pop_down (GtkWidget *w, GtkWidget *pop_down,
gpointer dummy);
static void
gtk_combo_text_destroy (GtkObject *object)
{
......@@ -15,7 +18,8 @@ gtk_combo_text_destroy (GtkObject *object)
g_hash_table_destroy (ct->elements);
ct->elements = NULL;
}
gtk_signal_disconnect_by_func (GTK_OBJECT (ct),
GTK_SIGNAL_FUNC (cb_pop_down), NULL);
(*gtk_combo_text_parent_class->destroy) (object);
}
......@@ -87,9 +91,11 @@ cb_enter (GtkWidget *w, GdkEventCrossing *event,
gpointer user)
{
GtkComboText *ct = user;
ct->cached_entry = w;
ct->cache_mouse_state = GTK_WIDGET_STATE(w);
if (GTK_STATE_SELECTED != ct->cache_mouse_state)
gtk_widget_set_state (w, GTK_STATE_ACTIVE);
return TRUE;
}
static gboolean
......@@ -101,6 +107,18 @@ cb_exit (GtkWidget *w, GdkEventCrossing *event,
return TRUE;
}
static gboolean
cb_pop_down (GtkWidget *w, GtkWidget *pop_down, gpointer dummy)
{
GtkComboText *ct = GTK_COMBO_TEXT (w);
if (ct->cached_entry)
gtk_widget_set_state (ct->cached_entry, ct->cache_mouse_state);
ct->cached_entry = NULL;
return FALSE;
}
void
gtk_combo_text_add_item (GtkComboText *ct,
const gchar *item,
......@@ -147,6 +165,7 @@ gtk_combo_text_construct (GtkComboText *ct, gboolean const is_scrolled)
/* Probably irrelevant, but lets be careful */
ct->cache_mouse_state = GTK_STATE_NORMAL;
ct->cached_entry = NULL;
entry = ct->entry = gtk_entry_new ();
list = ct->list = gtk_list_new ();
......@@ -173,5 +192,8 @@ gtk_combo_text_new (gboolean const is_scrolled)
ct = gtk_type_new (gtk_combo_text_get_type ());
gtk_combo_text_construct (ct, is_scrolled);
gtk_signal_connect (GTK_OBJECT (ct), "pop_down_done",
GTK_SIGNAL_FUNC (cb_pop_down), NULL);
return GTK_WIDGET (ct);
}
......@@ -18,6 +18,7 @@ struct _GtkComboText {
GtkWidget *list;
GtkWidget *scrolled_window;
GtkStateType cache_mouse_state;
GtkWidget *cached_entry;
GHashTable*elements;
};
......
......@@ -139,6 +139,8 @@ typedef struct {
/* Signals */
void (*sheet_entered) (Sheet *sheet);
void (*cell_changed) (Sheet *sheet, char *contents,
int col, int row);
} WorkbookClass;
GtkType workbook_get_type (void);
......
......@@ -71,11 +71,12 @@ static WORKBOOK_PARENT_CLASS *workbook_parent_class;
/* Workbook signals */
enum {
SHEET_ENTERED,
CELL_CHANGED,
LAST_SIGNAL
};
static gint workbook_signals [LAST_SIGNAL] = {
0, /* SHEET_ENTERED */
0, /* SHEET_ENTERED, CELL_CHANGED */
};
static void workbook_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
......@@ -2243,6 +2244,23 @@ workbook_class_init (GtkObjectClass *object_class)
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
/*
* WARNING :
* This is a preliminary hook used by screen reading software,
* etc. The signal does NOT trigger for all cell changes and
* should be used with care.
*/
workbook_signals [CELL_CHANGED] =
gtk_signal_new (
"cell_changed",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (WorkbookClass,
cell_changed),
gtk_marshal_NONE__POINTER_POINTER_INT_INT,
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, workbook_signals, LAST_SIGNAL);
object_class->destroy = workbook_destroy;
......
......@@ -139,6 +139,8 @@ typedef struct {
/* Signals */
void (*sheet_entered) (Sheet *sheet);
void (*cell_changed) (Sheet *sheet, char *contents,
int col, int row);
} WorkbookClass;
GtkType workbook_get_type (void);
......
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