static void e_minicard_label_realize (GnomeCanvasItem *item) { EMinicardLabel *e_minicard_label; GnomeCanvasGroup *group; e_minicard_label = E_MINICARD_LABEL (item); group = GNOME_CANVAS_GROUP ( item ); if (GNOME_CANVAS_ITEM_CLASS ( parent_class )->realize) (* GNOME_CANVAS_ITEM_CLASS ( parent_class )->realize) (item); e_canvas_item_request_reflow (item); e_minicard_label->rect = gnome_canvas_item_new ( group, gnome_canvas_rect_get_type (), "x1", (double) 0, "y1", (double) 0, "x2", (double) e_minicard_label->width - 1, "y2", (double) e_minicard_label->height - 1, "outline_color", NULL, NULL ); e_minicard_label->fieldname = gnome_canvas_item_new ( group, e_text_get_type (), "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), "clip", TRUE, "use_ellipsis", TRUE, "fill_color", "black", "draw_background", FALSE, "im_context", E_CANVAS (item->canvas)->im_context, NULL ); e_canvas_item_move_absolute (e_minicard_label->fieldname, 2, 1); e_minicard_label->field = gnome_canvas_item_new ( group, e_text_get_type (), "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), "clip", TRUE, "use_ellipsis", TRUE, "fill_color", "black", "editable", FALSE, /* e_minicard_label->editable, */ "draw_background", FALSE, "im_context", E_CANVAS (item->canvas)->im_context, NULL ); e_canvas_item_move_absolute (e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); set_colors (e_minicard_label); e_canvas_item_request_reflow (item); }
/* Virtual functions */ static void e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { GnomeCanvasItem *item; EReflow *reflow; item = GNOME_CANVAS_ITEM (object); reflow = E_REFLOW (object); switch (prop_id){ case PROP_HEIGHT: reflow->height = g_value_get_double (value); reflow->need_reflow_columns = TRUE; e_canvas_item_request_reflow(item); break; case PROP_MINIMUM_WIDTH: reflow->minimum_width = g_value_get_double (value); if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object)) set_empty(reflow); e_canvas_item_request_reflow(item); break; case PROP_EMPTY_MESSAGE: g_free(reflow->empty_message); reflow->empty_message = g_strdup(g_value_get_string (value)); if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object)) set_empty(reflow); break; case PROP_MODEL: connect_model (reflow, (EReflowModel *) g_value_get_object (value)); break; case PROP_COLUMN_WIDTH: if (reflow->column_width != g_value_get_double (value)) { GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); double old_width = reflow->column_width; reflow->column_width = g_value_get_double (value); adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; adjustment->page_increment = adjustment->page_size - adjustment->step_increment; gtk_adjustment_changed(adjustment); e_reflow_resize_children(item); e_canvas_item_request_reflow(item); reflow->need_column_resize = TRUE; gnome_canvas_item_request_update(item); if (old_width != reflow->column_width) column_width_changed (reflow); } break; } }
static void table_header_dimension_changed (ETableHeader *header, gint col, ETableFieldChooserItem *etfci) { e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etfci)); }
void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item) { g_return_if_fail(item != NULL); g_return_if_fail(GNOME_IS_CANVAS_ITEM(item)); e_canvas_item_request_reflow(item->parent); }
static gboolean etgc_remove (ETableGroup *etg, gint row) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); GList *list; for (list = etgc->children ; list; list = g_list_next (list)) { ETableGroupContainerChildNode *child_node = list->data; ETableGroup *child = child_node->child; if (e_table_group_remove (child, row)) { child_node->count --; if (child_node->count == 0) { e_table_group_container_child_node_free (etgc, child_node); etgc->children = g_list_remove (etgc->children, child_node); g_free (child_node); } else compute_text (etgc, child_node); e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); return TRUE; } } return FALSE; }
static void comparison_changed (EReflowModel *model, EReflow *reflow) { e_sorter_array_clean (reflow->sorter); reflow->reflow_from_column = -1; reflow->need_reflow_columns = TRUE; e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); }
static void etgl_realize (GnomeCanvasItem *item) { ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (item); if (GNOME_CANVAS_ITEM_CLASS (e_table_group_leaf_parent_class)->realize) GNOME_CANVAS_ITEM_CLASS (e_table_group_leaf_parent_class)->realize (item); etgl->item = E_TABLE_ITEM (gnome_canvas_item_new ( GNOME_CANVAS_GROUP (etgl), e_table_item_get_type (), "ETableHeader", E_TABLE_GROUP (etgl)->header, "ETableModel", etgl->ets, "alternating_row_colors", etgl->alternating_row_colors, "horizontal_draw_grid", etgl->horizontal_draw_grid, "vertical_draw_grid", etgl->vertical_draw_grid, "drawfocus", etgl->draw_focus, "cursor_mode", etgl->cursor_mode, "minimum_width", etgl->minimum_width, "length_threshold", etgl->length_threshold, "selection_model", etgl->selection_model, "uniform_row_height", etgl->uniform_row_height, NULL)); etgl->etgl_cursor_change_id = g_signal_connect ( etgl->item, "cursor_change", G_CALLBACK (etgl_cursor_change), etgl); etgl->etgl_cursor_activated_id = g_signal_connect ( etgl->item, "cursor_activated", G_CALLBACK (etgl_cursor_activated), etgl); etgl->etgl_double_click_id = g_signal_connect ( etgl->item, "double_click", G_CALLBACK (etgl_double_click), etgl); etgl->etgl_right_click_id = g_signal_connect ( etgl->item, "right_click", G_CALLBACK (etgl_right_click), etgl); etgl->etgl_click_id = g_signal_connect ( etgl->item, "click", G_CALLBACK (etgl_click), etgl); etgl->etgl_key_press_id = g_signal_connect ( etgl->item, "key_press", G_CALLBACK (etgl_key_press), etgl); etgl->etgl_start_drag_id = g_signal_connect ( etgl->item, "start_drag", G_CALLBACK (etgl_start_drag), etgl); etgl->notify_is_editing_id = e_signal_connect_notify ( etgl->item, "notify::is-editing", G_CALLBACK (etgl_item_is_editing_changed_cb), etgl); e_canvas_item_request_reflow (item); }
/* Realize handler for the text item */ static void etgc_realize (GnomeCanvasItem *item) { ETableGroupContainer *etgc; if (GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize) (* GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize) (item); etgc = E_TABLE_GROUP_CONTAINER (item); e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); }
static void items_inserted (EReflowModel *model, int position, int count, EReflow *reflow) { int i, oldcount; if (position < 0 || position > reflow->count) return; oldcount = reflow->count; reflow->count += count; if (reflow->count > reflow->allocated_count) { while (reflow->count > reflow->allocated_count) reflow->allocated_count += 256; reflow->heights = g_renew (int, reflow->heights, reflow->allocated_count); reflow->items = g_renew (GnomeCanvasItem *, reflow->items, reflow->allocated_count); } memmove (reflow->heights + position + count, reflow->heights + position, (reflow->count - position - count) * sizeof (int)); memmove (reflow->items + position + count, reflow->items + position, (reflow->count - position - count) * sizeof (GnomeCanvasItem *)); for (i = position; i < position + count; i++) { reflow->items[i] = NULL; reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow)); } e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), reflow->count); if (position == oldcount) e_sorter_array_append (reflow->sorter, count); else e_sorter_array_set_count (reflow->sorter, reflow->count); for (i = position; i < position + count; i ++) { int sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i); int c; for (c = reflow->column_count - 1; c >= 0; c--) { int start_of_column = reflow->columns[c]; if (start_of_column <= sorted) { if (reflow->reflow_from_column == -1 || reflow->reflow_from_column > c) { reflow->reflow_from_column = c; } break; } } } reflow->need_reflow_columns = TRUE; set_empty (reflow); e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); }
static void etcta_realize (GnomeCanvasItem *item) { ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); create_rect_and_text (etcta); e_canvas_item_move_absolute (etcta->text, 2, 2); if (GNOME_CANVAS_ITEM_CLASS (e_table_click_to_add_parent_class)->realize) (*GNOME_CANVAS_ITEM_CLASS (e_table_click_to_add_parent_class)->realize)(item); e_canvas_item_request_reflow (item); }
static void item_changed (EReflowModel *model, int i, EReflow *reflow) { if (i < 0 || i >= reflow->count) return; reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow)); if (reflow->items[i] != NULL) e_reflow_model_reincarnate (model, i, reflow->items[i]); e_sorter_array_clean (reflow->sorter); reflow->reflow_from_column = -1; reflow->need_reflow_columns = TRUE; e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); }
static void etgc_add_array (ETableGroup *etg, const int *array, int count) { int i; ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); void *lastval = NULL; int laststart = 0; GCompareFunc comp = etgc->ecol->compare; ETableGroupContainerChildNode *child_node; ETableGroup *child; if (count <= 0) return; e_table_group_container_list_free (etgc); etgc->children = NULL; lastval = e_table_model_value_at (etg->model, etgc->ecol->col_idx, array[0]); for (i = 1; i < count; i++) { void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, array[i]); int comp_val; comp_val = (*comp)(lastval, val); if (comp_val != 0) { child_node = create_child_node(etgc, lastval); child = child_node->child; e_table_group_add_array(child, array + laststart, i - laststart); child_node->count = i - laststart; etgc->children = g_list_append (etgc->children, child_node); compute_text (etgc, child_node); laststart = i; lastval = val; } } child_node = create_child_node(etgc, lastval); child = child_node->child; e_table_group_add_array(child, array + laststart, i - laststart); child_node->count = i - laststart; etgc->children = g_list_append (etgc->children, child_node); compute_text (etgc, child_node); e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); }
static void etfci_add_table_header (ETableFieldChooserItem *etfci, ETableHeader *header) { etfci->header = header; g_object_ref (etfci->header); etfci->table_header_structure_change_id = g_signal_connect ( header, "structure_change", G_CALLBACK (table_header_structure_changed), etfci); etfci->table_header_dimension_change_id = g_signal_connect ( header, "dimension_change", G_CALLBACK (table_header_dimension_changed), etfci); e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etfci)); }
static void e_reflow_realize (GnomeCanvasItem *item) { EReflow *reflow; GtkAdjustment *adjustment; int count; int i; reflow = E_REFLOW (item); if (GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->realize) (* GNOME_CANVAS_ITEM_CLASS(e_reflow_parent_class)->realize) (item); reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); count = reflow->count; for(i = 0; i < count; i++) { if (reflow->items[i]) gnome_canvas_item_set(reflow->items[i], "width", reflow->column_width, NULL); } set_empty(reflow); reflow->need_reflow_columns = TRUE; e_canvas_item_request_reflow(item); adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); #if 0 connect_set_adjustment (reflow); #endif connect_adjustment (reflow, adjustment); adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; adjustment->page_increment = adjustment->page_size - adjustment->step_increment; gtk_adjustment_changed(adjustment); if (!item->canvas->aa) { } }
static void e_minicard_label_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { EMinicardLabel *e_minicard_label; GnomeCanvasItem *item; e_minicard_label = E_MINICARD_LABEL (object); item = GNOME_CANVAS_ITEM (object); switch (property_id) { case PROP_WIDTH: e_minicard_label->width = g_value_get_double (value); e_minicard_label_resize_children (e_minicard_label); e_canvas_item_request_reflow (item); break; case PROP_HAS_FOCUS: if (e_minicard_label->field && (g_value_get_boolean (value) != E_FOCUS_NONE)) e_canvas_item_grab_focus (e_minicard_label->field, FALSE); break; case PROP_FIELD: gnome_canvas_item_set( e_minicard_label->field, "text", g_value_get_string (value), NULL ); break; case PROP_FIELDNAME: gnome_canvas_item_set( e_minicard_label->fieldname, "text", g_value_get_string (value), NULL ); break; case PROP_TEXT_MODEL: gnome_canvas_item_set( e_minicard_label->field, "model", g_value_get_object (value), NULL); break; case PROP_MAX_FIELD_NAME_WIDTH: e_minicard_label->max_field_name_length = g_value_get_double (value); break; case PROP_EDITABLE: e_minicard_label->editable = g_value_get_boolean (value); g_object_set (e_minicard_label->field, "editable", FALSE /* e_minicard_label->editable */, NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void etfci_realize (GnomeCanvasItem *item) { ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); if (GNOME_CANVAS_ITEM_CLASS (e_table_field_chooser_item_parent_class)-> realize) (*GNOME_CANVAS_ITEM_CLASS (e_table_field_chooser_item_parent_class)->realize)(item); if (!etfci->font_desc) etfci_font_load (etfci); etfci->drag_end_id = g_signal_connect ( item->canvas, "drag_end", G_CALLBACK (etfci_drag_end), etfci); etfci->drag_data_get_id = g_signal_connect ( item->canvas, "drag_data_get", G_CALLBACK (etfci_drag_data_get), etfci); e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etfci)); }
static void item_removed (EReflowModel *model, int i, EReflow *reflow) { int c; int sorted; if (i < 0 || i >= reflow->count) return; sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i); for (c = reflow->column_count - 1; c >= 0; c--) { int start_of_column = reflow->columns[c]; if (start_of_column <= sorted) { if (reflow->reflow_from_column == -1 || reflow->reflow_from_column > c) { reflow->reflow_from_column = c; } break; } } if (reflow->items[i]) gtk_object_destroy (GTK_OBJECT (reflow->items[i])); memmove (reflow->heights + i, reflow->heights + i + 1, (reflow->count - i - 1) * sizeof (int)); memmove (reflow->items + i, reflow->items + i + 1, (reflow->count - i - 1) * sizeof (GnomeCanvasItem *)); reflow->count --; reflow->heights [reflow->count] = 0; reflow->items [reflow->count] = NULL; reflow->need_reflow_columns = TRUE; set_empty (reflow); e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); e_sorter_array_set_count (reflow->sorter, reflow->count); e_selection_model_simple_delete_rows (E_SELECTION_MODEL_SIMPLE (reflow->selection), i, 1); }
static void etgc_add (ETableGroup *etg, gint row) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, row); GCompareFunc comp = etgc->ecol->compare; GList *list = etgc->children; ETableGroup *child; ETableGroupContainerChildNode *child_node; int i = 0; for (; list; list = g_list_next (list), i++){ int comp_val; child_node = list->data; comp_val = (*comp)(child_node->key, val); if (comp_val == 0) { child = child_node->child; child_node->count ++; e_table_group_add (child, row); compute_text (etgc, child_node); return; } if ((comp_val > 0 && etgc->ascending) || (comp_val < 0 && (!etgc->ascending))) break; } child_node = create_child_node (etgc, val); child = child_node->child; child_node->count = 1; e_table_group_add (child, row); if (list) etgc->children = g_list_insert (etgc->children, child_node, i); else etgc->children = g_list_append (etgc->children, child_node); compute_text (etgc, child_node); e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc)); }
static void model_changed (EReflowModel *model, EReflow *reflow) { int i; int count; int oldcount; count = reflow->count; oldcount = count; for (i = 0; i < count; i++) { if (reflow->items[i]) gtk_object_destroy (GTK_OBJECT (reflow->items[i])); } g_free (reflow->items); g_free (reflow->heights); reflow->count = e_reflow_model_count (model); reflow->allocated_count = reflow->count; reflow->items = g_new (GnomeCanvasItem *, reflow->count); reflow->heights = g_new (int, reflow->count); count = reflow->count; for (i = 0; i < count; i++) { reflow->items[i] = NULL; reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow)); } e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), count); e_sorter_array_set_count (reflow->sorter, reflow->count); reflow->need_reflow_columns = TRUE; if (oldcount > reflow->count) reflow_columns (reflow); set_empty (reflow); e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow)); }
static void etfci_drop_table_header (ETableFieldChooserItem *etfci) { GObject *header; if (!etfci->header) return; header = G_OBJECT (etfci->header); if (etfci->table_header_structure_change_id) g_signal_handler_disconnect ( header, etfci->table_header_structure_change_id); if (etfci->table_header_dimension_change_id) g_signal_handler_disconnect ( header, etfci->table_header_dimension_change_id); etfci->table_header_structure_change_id = 0; etfci->table_header_dimension_change_id = 0; if (header) g_object_unref (header); etfci->header = NULL; etfci->height = 0; e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etfci)); }
static void etgc_thaw (ETableGroup *etg) { e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(etg)); }
static void table_header_structure_changed (ETableHeader *header, ETableFieldChooserItem *etfci) { e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etfci)); }
static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) { EReflow *reflow; int return_val = FALSE; reflow = E_REFLOW (item); switch( event->type ) { case GDK_KEY_PRESS: return_val = e_selection_model_key_press(reflow->selection, (GdkEventKey *) event); break; #if 0 if (event->key.keyval == GDK_Tab || event->key.keyval == GDK_KP_Tab || event->key.keyval == GDK_ISO_Left_Tab) { int i; int count; count = reflow->count; for (i = 0; i < count; i++) { int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); GnomeCanvasItem *item = reflow->items[unsorted]; EFocus has_focus; if (item) { g_object_get(item, "has_focus", &has_focus, NULL); if (has_focus) { if (event->key.state & GDK_SHIFT_MASK) { if (i == 0) return FALSE; i--; } else { if (i == count - 1) return FALSE; i++; } unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i); if (reflow->items[unsorted] == NULL) { reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow)); } item = reflow->items[unsorted]; gnome_canvas_item_set(item, "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, NULL); return TRUE; } } } } #endif case GDK_BUTTON_PRESS: switch(event->button.button) { case 1: { GdkEventButton *button = (GdkEventButton *) event; double n_x, max_x; n_x = button->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); max_x = E_REFLOW_BORDER_WIDTH; max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) { /* don't allow to drag the first line*/ if (e_reflow_pick_line(reflow, button->x) == 0) return TRUE; reflow->which_column_dragged = e_reflow_pick_line(reflow, button->x); reflow->start_x = reflow->which_column_dragged * (reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; reflow->temp_column_width = reflow->column_width; reflow->column_drag = TRUE; gnome_canvas_item_grab (item, GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, reflow->arrow_cursor, button->time); reflow->previous_temp_column_width = -1; reflow->need_column_resize = TRUE; gnome_canvas_item_request_update(item); return TRUE; } } break; case 4: { GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); gdouble new_value = adjustment->value; new_value -= adjustment->step_increment; gtk_adjustment_set_value(adjustment, new_value); } break; case 5: { GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); gdouble new_value = adjustment->value; new_value += adjustment->step_increment; if ( new_value > adjustment->upper - adjustment->page_size ) new_value = adjustment->upper - adjustment->page_size; gtk_adjustment_set_value(adjustment, new_value); } break; } break; case GDK_BUTTON_RELEASE: if (reflow->column_drag) { gdouble old_width = reflow->column_width; GdkEventButton *button = (GdkEventButton *) event; GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); reflow->temp_column_width = reflow->column_width + (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value)); if ( reflow->temp_column_width < 50 ) reflow->temp_column_width = 50; reflow->column_drag = FALSE; if ( old_width != reflow->temp_column_width ) { gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(reflow, adjustment->value) * (reflow->temp_column_width - reflow->column_width)); reflow->column_width = reflow->temp_column_width; adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; adjustment->page_increment = adjustment->page_size - adjustment->step_increment; gtk_adjustment_changed(adjustment); e_reflow_resize_children(item); e_canvas_item_request_reflow(item); gnome_canvas_request_redraw(item->canvas, 0, 0, reflow->width, reflow->height); column_width_changed (reflow); } reflow->need_column_resize = TRUE; gnome_canvas_item_request_update(item); gnome_canvas_item_ungrab (item, button->time); return TRUE; } break; case GDK_MOTION_NOTIFY: if (reflow->column_drag) { double old_width = reflow->temp_column_width; GdkEventMotion *motion = (GdkEventMotion *) event; GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); reflow->temp_column_width = reflow->column_width + (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value)); if (reflow->temp_column_width < 50) reflow->temp_column_width = 50; if (old_width != reflow->temp_column_width) { reflow->need_column_resize = TRUE; gnome_canvas_item_request_update(item); } return TRUE; } else { GdkEventMotion *motion = (GdkEventMotion *) event; double n_x, max_x; n_x = motion->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); max_x = E_REFLOW_BORDER_WIDTH; max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) { if ( reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor); reflow->default_cursor_shown = FALSE; } } else if ( ! reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor); reflow->default_cursor_shown = TRUE; } } break; case GDK_ENTER_NOTIFY: if (!reflow->column_drag) { GdkEventCrossing *crossing = (GdkEventCrossing *) event; double n_x, max_x; n_x = crossing->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); max_x = E_REFLOW_BORDER_WIDTH; max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count; if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) { if ( reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor); reflow->default_cursor_shown = FALSE; } } } break; case GDK_LEAVE_NOTIFY: if (!reflow->column_drag) { GdkEventCrossing *crossing = (GdkEventCrossing *) event; double n_x; n_x = crossing->x; n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER)); if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) { if ( ! reflow->default_cursor_shown ) { gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor); reflow->default_cursor_shown = TRUE; } } } break; default: break; } if (return_val) return return_val; else if (GNOME_CANVAS_ITEM_CLASS( e_reflow_parent_class )->event) return (* GNOME_CANVAS_ITEM_CLASS( e_reflow_parent_class )->event) (item, event); else return FALSE; }