diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-14 22:31:22 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-14 22:31:22 +0800 |
commit | 32471accadcf2099f9d3567f51add9fab197ec24 (patch) | |
tree | 8b070bcbdbcd962de9016b0fceaa15ec45848310 /widgets/e-table/e-table-header-item.c | |
parent | 623ba9a279db035339ac8ae5030683c1e79b8618 (diff) | |
download | gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.gz gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.bz2 gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.lz gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.xz gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.tar.zst gsoc2013-evolution-32471accadcf2099f9d3567f51add9fab197ec24.zip |
From widgets/e-table/ChangeLog
2000-05-14 Christopher James Lahey <clahey@helixcode.com>
* Implemented the feature where the ETable columns automatically
fill the given space.
* e-cell-text.c, e-cell-text.h: Moved #include
e-text-event-processor.h from the .h to the .c.
* e-table-col.c, e-table-col.h: Added an expansion variable, and
made it so that width isn't set by the programmer but instead by
the e-table-header.
* e-table-example-1.c, e-table-example-2.c, e-table-size-test.c,
test-check.c, test-cols.c, test-table.c: Fixed to handle new
ETable column resizing.
* e-table-group-container.c, e-table-group-container.h,
e-table-group-leaf.c, e-table-group-leaf.h, e-table-group.c,
e-table-group.h, e-table-item.c, e-table-item.h: Fixed these to do
a proper canvas reflow/update loop. Changed them to take a
minimum width and return a width and a height.
* e-table-header-item.c, e-table-header-item.h: Made this so that
it depends on e-table-header.c for deciding the actual size of
columns during resize (it was making incorrect decisions on its
own.)
* e-table-header.c, e-table-header.h: Changed this to make sure
that the sum of the widths of the columns was always as close as
possible to the width of the window. This is done by taking a
full width and having each of the columns have an "expansion"
field. This field is what makes each column have approximately
the same portion of its part of the screen that it used to.
* e-table.c: Changed this to set the width on the ETableHeader as
well as set the proper minimum width on the ETableGroup and get
the width and height it reports.
From addressbook/ChangeLog
2000-05-14 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/Makefile.am: Added libeutil for e-card's support
for categories.
* backend/ebook/e-card-list.c, backend/ebook/e-card-list.h: Added
a function to get the length.
* backend/ebook/e-card.c, backend/ebook/e-card.h: Added categories
support (accessible either as "categories" or "category_list".)
* contact-editor/Makefile.am: Added e-table and all of the
categories files.
* contact-editor/categories.glade,
contact-editor/categories-strings.h,
contact-editor/e-contact-editor-categories.c,
contact-editor/e-contact-editor-categories.h:
* contact-editor/contact-editor.glade,
contact-editor/e-contact-editor-strings.h: Rearranged this dialog.
* contact-editor/e-contact-editor.c: Rearranged dialog a bit.
Added opening of categories dialog.
* gui/component/Makefile.am: Rearranged libraries so that
libetable would be available for the contact editor categories
dialog.
* gui/component/addressbook.c: Fix for new ETable resizing. Make
contact editor dialog resizable.
* gui/minicard/Makefile.am: Added libetable contact editor
categories dialog.
* gui/minicard/e-minicard.c: Make contact editor dialog resizable.
From mail/ChangeLog
2000-05-14 Christopher James Lahey <clahey@helixcode.com>
* message-list.c: Updated to work with new ETable resizing.
svn path=/trunk/; revision=3027
Diffstat (limited to 'widgets/e-table/e-table-header-item.c')
-rw-r--r-- | widgets/e-table/e-table-header-item.c | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c index 6923fffd0a..89d901b4be 100644 --- a/widgets/e-table/e-table-header-item.c +++ b/widgets/e-table/e-table-header-item.c @@ -21,6 +21,7 @@ #include "e-table-header.h" #include "e-table-header-item.h" #include "e-table-col-dnd.h" +#include "e-table-defines.h" #include "add-col.xpm" #include "remove-col.xpm" @@ -42,10 +43,8 @@ static guint ethi_signals [LAST_SIGNAL] = { 0, }; #define MIN_ARROW_SIZE 10 -#define GROUP_INDENT 10 - /* Defines the tolerance for proximity of the column division to the cursor position */ -#define TOLERANCE 3 +#define TOLERANCE 4 #define ETHI_RESIZING(x) ((x)->resize_col != -1) @@ -114,6 +113,13 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update) (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags); + if (ethi->sort_info) + ethi->group_indent_width = e_table_sort_info_grouping_get_count(ethi->sort_info) * GROUP_INDENT; + else + ethi->group_indent_width = 0; + + ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width; + if (item->x1 != ethi->x1 || item->y1 != ethi->y1 || item->x2 != ethi->x1 + ethi->width || @@ -165,17 +171,13 @@ ethi_drop_table_header (ETableHeaderItem *ethi) static void structure_changed (ETableHeader *header, ETableHeaderItem *ethi) { - ethi->width = e_table_header_total_width (header) + ethi->group_indent_width; - - ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0); + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi)); } static void dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi) { - ethi->width = e_table_header_total_width (header) + ethi->group_indent_width; - - ethi_update (GNOME_CANVAS_ITEM (ethi), NULL, NULL, 0); + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi)); } static void @@ -183,7 +185,6 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header) { ethi->eth = header; gtk_object_ref (GTK_OBJECT (ethi->eth)); - ethi->width = e_table_header_total_width (header) + ethi->group_indent_width; ethi->structure_change_id = gtk_signal_connect ( GTK_OBJECT (header), "structure_change", @@ -191,6 +192,7 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header) ethi->dimension_change_id = gtk_signal_connect ( GTK_OBJECT (header), "dimension_change", GTK_SIGNAL_FUNC(dimension_changed), ethi); + gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi)); } static void @@ -706,7 +708,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width int x1, x2; int col; GHashTable *arrows = g_hash_table_new (NULL, NULL); - gint group_indent = 0; if (ethi->sort_info) { @@ -714,7 +715,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width int i; for (i = 0; i < length; i++) { ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i); - group_indent ++; g_hash_table_insert (arrows, (gpointer) column.column, (gpointer) (column.ascending ? @@ -732,7 +732,6 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width } } - ethi->group_indent_width = group_indent * GROUP_INDENT; ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width; x1 = x2 = ethi->x1; x2 += ethi->group_indent_width; @@ -740,10 +739,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width ETableCol *ecol = e_table_header_get_column (ethi->eth, col); int col_width; - if (col == ethi->resize_col) - col_width = ethi->resize_width; - else - col_width = ecol->width; + col_width = ecol->width; x2 += col_width; @@ -839,14 +835,12 @@ ethi_request_redraw (ETableHeaderItem *ethi) } static void -ethi_end_resize (ETableHeaderItem *ethi, int new_size) +ethi_end_resize (ETableHeaderItem *ethi) { - e_table_header_set_size (ethi->eth, ethi->resize_col, new_size); - ethi->resize_col = -1; ethi->resize_guide = GINT_TO_POINTER (0); - - ethi_request_redraw (ethi); + + gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); } static gboolean @@ -910,10 +904,7 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event) context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event); ecol = e_table_header_get_column (ethi->eth, ethi->drag_col); - if (ethi->drag_col == ethi->resize_col) - col_width = ethi->resize_width; - else - col_width = ecol->width; + col_width = ecol->width; pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1); gc = widget->style->bg_gc [GTK_STATE_ACTIVE]; draw_button (ethi, ecol, pixmap, gc, @@ -998,17 +989,9 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) new_width = x - ethi->resize_start_pos; - if (new_width <= 0) - new_width = 1; + e_table_header_set_size (ethi->eth, ethi->resize_col, new_width); - if (new_width < ethi->resize_min_width) - new_width = ethi->resize_min_width; - ethi_request_redraw (ethi); - - ethi->resize_width = new_width; - e_table_header_set_size (ethi->eth, ethi->resize_col, ethi->resize_width); - - ethi_request_redraw (ethi); + gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi)); } else if (ethi_maybe_start_drag (ethi, &e->motion)){ ethi_start_drag (ethi, e); } else @@ -1033,7 +1016,6 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) if (!ecol->resizeable) break; ethi->resize_col = col; - ethi->resize_width = ecol->width; ethi->resize_start_pos = start - ecol->width; ethi->resize_min_width = ecol->min_width; } else { @@ -1065,7 +1047,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) if (ethi->resize_col != -1){ needs_ungrab = (ethi->resize_guide != NULL); - ethi_end_resize (ethi, ethi->resize_width); + ethi_end_resize (ethi); } else if (was_maybe_drag && ethi->sort_info) { ETableCol *col; int model_col; |