Fixed a reference.

2000-07-26  Christopher James Lahey  <clahey@helixcode.com>

	* e-table-click-to-add.c: Fixed a reference.

	* e-table-selection-model.c, e-table-selection-model.h: Added a
	clear function.

	* e-table.c, e-table.h: Made going from click to add to the main
	table and back work better.

svn path=/trunk/; revision=4373
This commit is contained in:
Christopher James Lahey
2000-07-27 01:36:20 +00:00
committed by Chris Lahey
parent d1cc23165d
commit 5e3f91d87b
11 changed files with 82 additions and 12 deletions

View File

@ -1,3 +1,13 @@
2000-07-26 Christopher James Lahey <clahey@helixcode.com>
* e-table-click-to-add.c: Fixed a reference.
* e-table-selection-model.c, e-table-selection-model.h: Added a
clear function.
* e-table.c, e-table.h: Made going from click to add to the main
table and back work better.
2000-07-26 Christopher James Lahey <clahey@helixcode.com>
* e-table-click-to-add.c, e-table-click-to-add.h: Added an

View File

@ -400,7 +400,7 @@ etcta_init (GnomeCanvasItem *item)
etcta->rect = NULL;
etcta->selection = e_table_selection_model_new();
gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_change",
gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_changed",
GTK_SIGNAL_FUNC(etcta_cursor_change), etcta);
e_canvas_item_set_reflow_callback(item, etcta_reflow);

View File

@ -44,11 +44,7 @@ enum {
static void
model_changed(ETableModel *etm, ETableSelectionModel *etsm)
{
g_free(etsm->selection);
etsm->selection = NULL;
etsm->row_count = -1;
gtk_signal_emit(GTK_OBJECT(etsm),
e_table_selection_model_signals [SELECTION_CHANGED]);
e_table_selection_model_clear(etsm);
}
#if 1
@ -386,3 +382,13 @@ void e_table_selection_model_do_something (ETableSelectionModel
}
}
}
void
e_table_selection_model_clear(ETableSelectionModel *selection)
{
g_free(selection->selection);
selection->selection = NULL;
selection->row_count = -1;
gtk_signal_emit(GTK_OBJECT(selection),
e_table_selection_model_signals [SELECTION_CHANGED]);
}

View File

@ -57,6 +57,7 @@ void e_table_selection_model_do_something (ETableSelectionModel *
guint col,
gboolean shift_p,
gboolean ctrl_p);
void e_table_selection_model_clear (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);

View File

@ -184,6 +184,7 @@ e_table_init (GtkObject *object)
e_table->drop_col = -1;
e_table->selection = e_table_selection_model_new();
e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE;
}
static void
@ -270,9 +271,22 @@ table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
e_table->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) table_canvas_reflow_idle, e_table, NULL);
}
static void
click_to_add_cursor_change (ETableClickToAdd *etcta, int row, int col, ETable *et)
{
if (et->cursor_loc == E_TABLE_CURSOR_LOC_TABLE) {
e_table_selection_model_clear(et->selection);
}
et->cursor_loc = E_TABLE_CURSOR_LOC_ETCTA;
}
static void
group_cursor_change (ETableGroup *etg, int row, ETable *et)
{
if (et->cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add) {
e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(et->click_to_add));
}
et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE;
gtk_signal_emit (GTK_OBJECT (et),
et_signals [CURSOR_CHANGE],
row);
@ -441,6 +455,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
NULL);
e_canvas_vbox_add_item(E_CANVAS_VBOX(e_table->canvas_vbox), e_table->click_to_add);
gtk_signal_connect(GTK_OBJECT (e_table->click_to_add), "cursor_change",
GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table);
}
e_table->group = e_table_group_new (

View File

@ -21,6 +21,12 @@ BEGIN_GNOME_DECLS
#define E_IS_TABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_TYPE))
#define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE))
typedef enum {
E_TABLE_CURSOR_LOC_NONE = 0,
E_TABLE_CURSOR_LOC_ETCTA = 1 << 0,
E_TABLE_CURSOR_LOC_TABLE = 1 << 1,
} ETableCursorLoc;
typedef struct {
GtkTable parent;
@ -34,6 +40,7 @@ typedef struct {
ETableSortInfo *sort_info;
ETableSelectionModel *selection;
ETableCursorLoc cursor_loc;
int table_model_change_id;
int table_row_change_id;

View File

@ -400,7 +400,7 @@ etcta_init (GnomeCanvasItem *item)
etcta->rect = NULL;
etcta->selection = e_table_selection_model_new();
gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_change",
gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_changed",
GTK_SIGNAL_FUNC(etcta_cursor_change), etcta);
e_canvas_item_set_reflow_callback(item, etcta_reflow);

View File

@ -44,11 +44,7 @@ enum {
static void
model_changed(ETableModel *etm, ETableSelectionModel *etsm)
{
g_free(etsm->selection);
etsm->selection = NULL;
etsm->row_count = -1;
gtk_signal_emit(GTK_OBJECT(etsm),
e_table_selection_model_signals [SELECTION_CHANGED]);
e_table_selection_model_clear(etsm);
}
#if 1
@ -386,3 +382,13 @@ void e_table_selection_model_do_something (ETableSelectionModel
}
}
}
void
e_table_selection_model_clear(ETableSelectionModel *selection)
{
g_free(selection->selection);
selection->selection = NULL;
selection->row_count = -1;
gtk_signal_emit(GTK_OBJECT(selection),
e_table_selection_model_signals [SELECTION_CHANGED]);
}

View File

@ -57,6 +57,7 @@ void e_table_selection_model_do_something (ETableSelectionModel *
guint col,
gboolean shift_p,
gboolean ctrl_p);
void e_table_selection_model_clear (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);

View File

@ -184,6 +184,7 @@ e_table_init (GtkObject *object)
e_table->drop_col = -1;
e_table->selection = e_table_selection_model_new();
e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE;
}
static void
@ -270,9 +271,22 @@ table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
e_table->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) table_canvas_reflow_idle, e_table, NULL);
}
static void
click_to_add_cursor_change (ETableClickToAdd *etcta, int row, int col, ETable *et)
{
if (et->cursor_loc == E_TABLE_CURSOR_LOC_TABLE) {
e_table_selection_model_clear(et->selection);
}
et->cursor_loc = E_TABLE_CURSOR_LOC_ETCTA;
}
static void
group_cursor_change (ETableGroup *etg, int row, ETable *et)
{
if (et->cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add) {
e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(et->click_to_add));
}
et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE;
gtk_signal_emit (GTK_OBJECT (et),
et_signals [CURSOR_CHANGE],
row);
@ -441,6 +455,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
NULL);
e_canvas_vbox_add_item(E_CANVAS_VBOX(e_table->canvas_vbox), e_table->click_to_add);
gtk_signal_connect(GTK_OBJECT (e_table->click_to_add), "cursor_change",
GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table);
}
e_table->group = e_table_group_new (

View File

@ -21,6 +21,12 @@ BEGIN_GNOME_DECLS
#define E_IS_TABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_TYPE))
#define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE))
typedef enum {
E_TABLE_CURSOR_LOC_NONE = 0,
E_TABLE_CURSOR_LOC_ETCTA = 1 << 0,
E_TABLE_CURSOR_LOC_TABLE = 1 << 1,
} ETableCursorLoc;
typedef struct {
GtkTable parent;
@ -34,6 +40,7 @@ typedef struct {
ETableSortInfo *sort_info;
ETableSelectionModel *selection;
ETableCursorLoc cursor_loc;
int table_model_change_id;
int table_row_change_id;